using System.Collections; using System.Collections.Generic; using System.ComponentModel; using Godot; using Godot.Bridge; using Godot.NativeInterop; [ScriptPath("res://Scripts/Events/LWDay2Events.cs")] public partial class LWDay2Events : Node { [Export(PropertyHint.None, "")] private Entity[] entities; [Export(PropertyHint.None, "")] private Node2D[] nodes; [Export(PropertyHint.None, "")] private Node[] objects; public static LWDay2Events instance; public override void _EnterTree() { instance = this; } public void MartEventDay2() { Main.inEvent = Coroutine.Start(MartEventD2()); } private IEnumerator MartEventD2() { Player.instance.LookAt(Vector2.Right); entities[0].DoAutoMove(nodes[0].GlobalPosition); while (entities[0].moving != null) { yield return null; } TextSystem.GetText("MartDay2"); while (TextSystem.instance.Visible) { yield return null; } entities[0].DoAutoAlign(nodes[1].GlobalPosition); while (entities[0].moving != null) { if (entities[0].GlobalPosition.Y > Player.instance.GlobalPosition.Y) { Player.instance.LookAt(entities[0].GlobalPosition); } yield return null; } Coroutine c = Coroutine.Start(LWDay1Events.DoorSound()); for (float a = 0f; a < 30f; a += Main.deltaTime) { yield return null; } entities[0].QueueFree(); while (!c.done) { yield return null; } AudioStreamPlayer au = Audio.PlaySound("snd_martlet_takeoff.wav"); yield return null; while (au.Playing) { yield return null; } } public void MailWhale() { Main.inEvent = Coroutine.Start(MailWhaleEvent()); } private IEnumerator MailWhaleEvent() { Audio.ChangeMusic((Audio.AudioBlock)null, 2f); Audio.PlaySound("snd_mail_jingle_steamworks.wav"); TextSystem.GetText("MailWhaleIntro"); while (TextSystem.instance.Visible) { yield return null; } Player.instance.DoAutoAlign(nodes[0].GlobalPosition, 0.85f); Player.instance.moving.dirAtEnd = Entity.Direction.East; while (Player.instance.moving != null) { yield return null; } Audio.PlaySound("delivery_intro.ogg"); Vector2 p = Player.instance.GlobalPosition + new Vector2(-40f, 5f); Vector2 t = p + Vector2.Up * 200f; float a = 0f; float b; for (b = 230f; a <= b; a += Main.deltaTime) { entities[0].GlobalPosition = t.Lerp(p, Mathf.SmoothStep(0f, 1f, a / b)); yield return null; } Room.current.DoMusic(3); TextSystem.GetText("MailWhaleDelivery"); while (TextSystem.instance.Visible) { yield return null; } if (SaveFile.current.values[9] == 0) { SaveFile.current.letters.Add(SaveFile.Letters.MoAd); SaveFile.current.letters.Add(SaveFile.Letters.KanakoDay2); if (SaveFile.HasFlag(SaveFile.Flags.AnnoyedDecibat)) { SaveFile.current.letters.Add(SaveFile.Letters.NoiseComplaint); } if (SaveFile.HasFlag(SaveFile.Flags.VirgilDay1Weird)) { SaveFile.current.letters.Add(SaveFile.Letters.VirgilDay2); } } Audio.ChangeMusic((Audio.AudioBlock)null, 4f); b = 0f; for (a = 230f; b <= a; b += Main.deltaTime) { entities[0].GlobalPosition = p.Lerp(t, Mathf.SmoothStep(0f, 1f, b / a)); yield return null; } entities[0].QueueFree(); Room.current.DoMusic(); Player.instance.LookAt(Vector2.Down); } public void KanakoEventStartD2() { Main.inEvent = Coroutine.Start(KanakoDragToSchool()); } private IEnumerator KanakoDragToSchool() { Player.instance.Emoticon(Entity.Emoticons.Exclaim, sound: true); Player.instance.LookAt(Vector2.Right); while (GodotObject.IsInstanceValid(Player.instance.emoticonObj)) { yield return null; } entities[1].GlobalPosition = new Vector2(entities[1].GlobalPosition.X, Player.instance.GlobalPosition.Y); entities[1].DoAutoMove(Player.instance.GlobalPosition + Vector2.Right * 40f, 1.1f); while (entities[1].moving != null) { yield return null; } TextSystem.GetText(SaveFile.HasFlag(SaveFile.Flags.WeirdStart) ? "KanakoEventMornDay2Weird" : "KanakoEventMornDay2"); while (TextSystem.instance.Visible) { yield return null; } CameraController.Transition(Main.colorBlack, 120f, 100); Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Right * 1000f, 0.75f); entities[1].DoAutoMove(entities[1].GlobalPosition + Vector2.Right * 1000f, 0.85f); Audio.ChangeMusic((Audio.AudioBlock)null, 3f); CameraController.instance.follow = null; while (!CameraController.transitionRoutine.done) { yield return null; } float a; for (a = 0f; a < 60f; a += Main.deltaTime) { yield return null; } Coroutine c = Coroutine.Start(CommonEvents.DayAnim(2)); while (!c.done || Player.instance.moving != null) { yield return null; } Room.LoadRoom(Room.IDs.SchoolMain, reparent: true); yield return null; AudioStreamPlayer sound = Audio.PlaySound("snd_wild_east_bell.wav"); yield return null; while (sound.Playing) { yield return null; } Room.current.tileMap.SetLayerEnabled(Room.current.shadowLayer, enabled: false); c = Coroutine.Start(LWDay1Events.DoorSound()); while (!c.done) { yield return null; } Player.instance.GlobalPosition = new Vector2(-9f, -4f); CameraController.instance.GlobalPosition = Player.instance.GlobalPosition + Vector2.Up * 75f; Player.instance.LookAt(Vector2.Up); TextSystem.GetText("SchoolEventDay2-1"); while (TextSystem.instance.Visible) { yield return null; } CameraController.Transition(Main.colorClearB, 80f, 100); while (!CameraController.transitionRoutine.done) { yield return null; } Room.current.DoMusic(3); TextSystem.GetText("SchoolEventDay2-2"); while (TextSystem.instance.Visible) { yield return null; } Audio.music.StreamPaused = true; for (a = 0f; a < 120f; a += Main.deltaTime) { yield return null; } TextSystem.GetText("SchoolEventDay2-4"); while (TextSystem.instance.Visible) { yield return null; } for (a = 0f; a < 100f; a += Main.deltaTime) { yield return null; } Audio.music.StreamPaused = false; TextSystem.GetText("SchoolEventDay2-5"); while (TextSystem.instance.Visible) { yield return null; } Audio.music.StreamPaused = true; for (a = 0f; a < 120f; a += Main.deltaTime) { yield return null; } TextSystem.GetText("SchoolEventDay2-6"); while (TextSystem.instance.Visible) { yield return null; } Audio.music.StreamPaused = false; TextSystem.GetText("SchoolEventDay2-7"); while (TextSystem.instance.Visible) { yield return null; } instance.entities[0].collider.Disabled = true; instance.entities[0].DoAutoMove(new Vector2[3] { instance.nodes[0].GlobalPosition, instance.nodes[1].GlobalPosition, instance.nodes[2].GlobalPosition }); instance.entities[0].moving.dirAtEnd = Entity.Direction.North; while (instance.entities[0].moving != null) { yield return null; } c = Coroutine.Start(CameraController.Pan(CameraController.instance.GlobalPosition + Vector2.Down * 30f, 0.25f)); while (!c.done) { yield return null; } instance.entities[1].anim.Play("Note"); for (a = 0f; a < 45f; a += Main.deltaTime) { yield return null; } instance.entities[1].anim.Play("NoteToss"); Room current = Room.current; Sprite2D node; Sprite2D note = (node = new Sprite2D { Texture = GD.Load("res://Sprites/Bullets/Trash.tres"), Scale = Vector2.One * 0.65f, ZIndex = 1 }); current.AddChild(node, forceReadableName: false, InternalMode.Disabled); Vector2 start = instance.entities[1].GlobalPosition + new Vector2(-15f, -20f); Vector2 end = Player.instance.GlobalPosition + Vector2.Up * 16f; Vector2 mid = start.Lerp(end, 0.5f) + Vector2.Up * 30f; a = 0f; for (float b = 60f; a < b; a += Main.deltaTime) { note.GlobalPosition = Common.Beizier(start, mid, end, a / b); note.RotationDegrees -= Main.deltaTime; yield return null; } note.QueueFree(); Audio.PlaySound("snd_item_ch1.wav"); for (float b = 0f; b < 30f; b += Main.deltaTime) { yield return null; } TextSystem.GetText("SchoolEventDay2-8"); while (TextSystem.instance.Visible) { yield return null; } if (TextSystem.lastPrompt == 0) { SaveFile.current.letters.Add(SaveFile.Letters.CrumpledNoteD2); TextSystem.GetText("SchoolEventDay2-Note"); while (TextSystem.instance.Visible) { yield return null; } if (TextSystem.lastPrompt == 0) { SaveFile.current.values[0]++; Audio.PlaySound("snd_bell_ch1.wav"); Player.instance.Shake(10f, 1f); Player.instance.anim.Play((Player.instance.animMod == Entity.AnimMods.Hat) ? "ThumbsUpBackHat" : "ThumbsUpBack"); for (float b = 0f; b < 30f; b += Main.deltaTime) { yield return null; } } } for (float b = 0f; b < 100f; b += Main.deltaTime) { yield return null; } Player.instance.direction = Entity.Direction.North; instance.entities[1].LookAt(Vector2.Up, forceAnimUpdate: true); instance.entities[0].LookAt(Vector2.Down); yield return null; TextSystem.GetText("SchoolEventDay2-9"); while (TextSystem.instance.Visible) { Player.instance.anim.Play((Player.instance.animMod == Entity.AnimMods.Hat) ? "NorthIdleHat" : "NorthIdle"); yield return null; } Audio.ChangeMusic((Audio.AudioBlock)null, 3f); CameraController.Transition(Main.colorBlack, 120f, 10); for (float b = 0f; b < 80f; b += Main.deltaTime) { yield return null; } TextSystem.GetText("SchoolEventDay2-10"); while (TextSystem.instance.Visible || !CameraController.transitionRoutine.done) { yield return null; } sound = Audio.PlaySound("snd_wild_east_bell.wav"); yield return null; Vector2 kp = instance.entities[1].GlobalPosition; while (sound.Playing) { yield return null; } SaveFile.AddFlag(SaveFile.Flags.KanakoEventDay2); Room.LoadRoom(Room.IDs.SchoolMain, reparent: true); yield return null; CameraController.instance.follow = Player.instance; Party.AddFollower(Party.IDs.Kanako); yield return null; TextSystem.GetText("SchoolEventDay2-11"); while (TextSystem.instance.Visible) { yield return null; } Player.instance.followers[0].GlobalPosition = kp; Player.instance.followers[0].LookAt(Vector2.Up); yield return null; instance.entities[2].DoAutoMove(new Vector2(instance.entities[2].GlobalPosition.X, Player.instance.followers[0].GlobalPosition.Y), 0.35f); instance.entities[2].moving.dirAtEnd = Entity.Direction.East; Room.current.DoMusic(); CameraController.Transition(Main.colorClearB, 80f); while (!CameraController.transitionRoutine.done || instance.entities[2].moving != null) { yield return null; } Player.instance.followers[0].LookAt(Vector2.Right); for (float b = 0f; b < 30f; b += Main.deltaTime) { yield return null; } TextSystem.GetText("SchoolEventDay2-12"); while (TextSystem.instance.Visible) { yield return null; } instance.entities[2].DoAutoMove(new Vector2[3] { instance.nodes[3].GlobalPosition, instance.nodes[4].GlobalPosition, instance.nodes[5].GlobalPosition }, 0.85f); while (instance.entities[2].moving != null) { yield return null; } Coroutine.Start(LWDay1Events.DoorSound()); for (float b = 0f; b < 30f; b += Main.deltaTime) { yield return null; } instance.entities[2].QueueFree(); for (float b = 0f; b < 30f; b += Main.deltaTime) { yield return null; } Player.instance.followers[0].DoAutoMove(Player.instance.GlobalPosition + Vector2.Right * 30f, 0.5f); while (Player.instance.followers[0].moving != null) { yield return null; } Player.instance.LookAt(Vector2.Right); TextSystem.GetText("SchoolEventDay2-13"); while (TextSystem.instance.Visible) { yield return null; } Player.instance.ResetFollowStep(); SaveFile.AddFlag(SaveFile.Flags.JuneRecessDay2); Player.instance.LookAt(Vector2.Down); } public void MelodySchoolEvent() { Main.inEvent = Coroutine.Start(MelodyEvent()); } public IEnumerator MelodyEvent() { Party.LookAt(Entity.Direction.South); Coroutine c = Coroutine.Start(CameraController.Pan(entities[3].GlobalPosition, 0.5f)); while (!c.done) { yield return null; } Room.current.GetNode("GizmoMeloEvent").QueueFree(); TextSystem.GetText("MelodyDay2-1"); while (TextSystem.instance.Visible) { yield return null; } entities[4].collider.Disabled = true; entities[4].DoAutoMove(new Vector2(entities[4].GlobalPosition.X, entities[3].GlobalPosition.Y)); TextSystem.GetText("MelodyDay2-2"); while (entities[4].moving != null) { yield return null; } if (TextSystem.instance.Visible) { TextSystem.End(); } Audio.music.Stop(); Audio.PlaySound("snd_bump_ch1.wav"); entities[4].Shake(10f, 1f); entities[3].Shake(10f, 1f); float a; for (a = 0f; a < 60f; a += Main.deltaTime) { yield return null; } entities[3].LookAt(Vector2.Left); TextSystem.GetText("MelodyDay2-3"); while (TextSystem.instance.Visible) { yield return null; } Audio.PlaySound("snd_noise.wav"); entities[4].LookAt(Vector2.Right); for (a = 0f; a < 10f; a += Main.deltaTime) { yield return null; } entities[4].anim.Play("Push"); entities[3].anim.Play("Push1"); entities[5].anim.Play("Surprise"); entities[6].anim.Play("Surprise"); Audio.PlaySound("snd_grab.wav"); CameraController.Shake(10f); a = 0f; for (float b = 15f; a <= b; a += Main.deltaTime) { entities[3].GlobalPosition = entities[3].startPos.Lerp(entities[3].startPos + Vector2.Right * 30f, a / b); entities[5].GlobalPosition = entities[5].startPos.Lerp(entities[5].startPos + new Vector2(8f, 10f), a / b); entities[6].GlobalPosition = entities[6].startPos.Lerp(entities[6].startPos + new Vector2(8f, -8f), a / b); yield return null; } Audio.PlaySound("snd_hurt1.wav"); entities[3].anim.Play("Push2"); for (float b = 0f; b < 80f; b += Main.deltaTime) { yield return null; } entities[3].anim.Play("Push3"); entities[4].UpdateAnim(force: true); Room.current.DoMusic(4); TextSystem.GetText("MelodyDay2-4"); while (TextSystem.instance.Visible) { yield return null; } Coroutine.Start(CameraController.Pan(CameraController.instance.GlobalPosition + Vector2.Up * 30f, 0.25f)); Player.instance.DoAutoMove(new Vector2[2] { new Vector2(nodes[7].GlobalPosition.X, Player.instance.GlobalPosition.Y), nodes[7].GlobalPosition }, 1.2f); Player.instance.followers[0].DoAutoMove(new Vector2[2] { new Vector2(nodes[6].GlobalPosition.X, Player.instance.followers[0].GlobalPosition.Y), nodes[6].GlobalPosition }, 1.2f); while (!Party.IsStopped()) { yield return null; } entities[4].LookAt(Vector2.Up); TextSystem.GetText("MelodyDay2-5"); while (TextSystem.instance.Visible) { yield return null; } if (TextSystem.lastPrompt == 0) { Player.instance.DoAutoAlign(Player.instance.followers[0].GlobalPosition + Vector2.Down * 15f); Player.instance.moving.dirAtEnd = Entity.Direction.South; while (Player.instance.moving != null) { yield return null; } for (float b = 0f; b < 30f; b += Main.deltaTime) { yield return null; } TextSystem.GetText("MelodyDay2-5A"); while (TextSystem.instance.Visible) { yield return null; } if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart)) { SaveFile.current.values[0] -= 2; } else { SaveFile.current.values[0]++; } } else { TextSystem.GetText("MelodyDay2-5B"); while (TextSystem.instance.Visible) { yield return null; } if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart)) { SaveFile.current.values[0] += 3; } } entities[4].ShakeAnimChange("ReadyJump"); for (float b = 0f; b < 50f; b += Main.deltaTime) { yield return null; } Audio.music.Stop(); CameraController.Transition(Main.colorBlack, 0f, 20); Sprite2D[] souls = new Sprite2D[3]; for (int i = 0; i < 3; i++) { CameraController.instance.AddChild(souls[i] = new Sprite2D { Texture = GD.Load("res://Sprites/Menus/Menu Sprites/Soul.tres"), Visible = false, ZIndex = 4000 }, forceReadableName: false, InternalMode.Disabled); switch (i) { case 0: souls[i].Modulate = Main.colorYellow; souls[i].GlobalPosition = Vector2.Up * 16f + Player.instance.GlobalPosition; break; case 1: souls[i].FlipV = true; souls[i].GlobalPosition = Vector2.Up * 16f + Player.instance.followers[0].GlobalPosition; break; case 2: souls[i].Modulate = Main.colorBlue; souls[i].GlobalPosition = Vector2.Up * 16f + entities[4].GlobalPosition; break; } } for (int j = 0; j < 5; j++) { Audio.PlaySound("snd_noise.wav"); for (int k = 0; k < 3; k++) { souls[k].Visible = !souls[k].Visible; } for (float b = 0f; b < 10f; b += Main.deltaTime) { yield return null; } } AudioStreamPlayer sound = Audio.PlaySound("snd_wild_east_bell.wav"); yield return null; while (sound.Playing) { yield return null; } for (int l = 0; l < 3; l++) { souls[l].QueueFree(); } Audio.PlaySound("snd_noise.wav"); entities[4].anim.Play("NorthIdle"); CameraController.Transition(Main.colorClearB); for (float b = 0f; b < 80f; b += Main.deltaTime) { yield return null; } TextSystem.GetText("MelodyDay2-6"); while (TextSystem.instance.Visible) { yield return null; } entities[4].DoAutoMove(new Vector2[3] { new Vector2(-865f, entities[4].GlobalPosition.Y), new Vector2(-865f, -48f), new Vector2(-700f, -48f) }); while (entities[4].moving != null) { Party.LookAt(entities[4].GlobalPosition); yield return null; } Party.LookAt(Entity.Direction.West); Player.instance.followers[0].DoAutoAlign(entities[3].GlobalPosition + Vector2.Left * 32f, 0.5f); while (Player.instance.followers[0].moving != null) { yield return null; } Party.LookAt(entities[3].GlobalPosition); entities[3].currentAnim = Entity.Animations.Idle; entities[5].currentAnim = Entity.Animations.Idle; entities[6].currentAnim = Entity.Animations.Idle; TextSystem.GetText("MelodyDay2-7"); while (TextSystem.instance.Visible) { yield return null; } CameraController.Transition(Main.colorBlack, 60f, 10); while (!CameraController.transitionRoutine.done) { yield return null; } c = Coroutine.Start(LWDay1Events.DoorSound()); while (!c.done) { yield return null; } for (float b = 0f; b < 80f; b += Main.deltaTime) { yield return null; } SaveFile.current.flags.Remove(SaveFile.Flags.KanakoEventDay2); Room.LoadRoom(Room.IDs.SchoolMain, reparent: true); yield return null; Room.current.GetNode("JuneD2").QueueFree(); Player.instance.GlobalPosition = new Vector2(-9f, -4f); CameraController.instance.GlobalPosition = Player.instance.GlobalPosition + Vector2.Up * 75f; Player.instance.LookAt(Vector2.Up); yield return null; Room.current.DoMusic(3); CameraController.Transition(Main.colorClearB, 30f, 10); while (!CameraController.transitionRoutine.done) { yield return null; } TextSystem.GetText("SchoolAfterRecessD2-1"); for (float b = 0f; b < 30f; b += Main.deltaTime) { yield return null; } while (TextSystem.instance.Visible) { yield return null; } CameraController.Transition(Main.colorBlack, 100f, 10); Audio.ChangeMusic((Audio.AudioBlock)null, 3f); for (float b = 0f; b < 80f; b += Main.deltaTime) { yield return null; } TextSystem.GetText("SchoolAfterRecessD2-2"); while (!CameraController.transitionRoutine.done) { yield return null; } while (TextSystem.instance.Visible) { yield return null; } sound = Audio.PlaySound("snd_wild_east_bell.wav"); yield return null; while (GodotObject.IsInstanceValid(sound) && sound.Playing) { yield return null; } TextSystem.GetText("SchoolAfterRecessD2-3"); while (TextSystem.instance.Visible) { yield return null; } SaveFile.AddFlag(SaveFile.Flags.KanakoEventDay2); Room.LoadRoom(Room.IDs.WildEastMain, reparent: true); yield return null; CameraController.instance.follow = Player.instance; Party.SetPosition(instance.nodes[0].GlobalPosition + Vector2.Down * 20f); Party.LookAt(Vector2.Down); Room.current.DoMusic(); yield return null; Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Down * 70f, 0.35f); CameraController.Transition(Main.colorClearB, 150f, 10); for (float b = 0f; b < 40f; b += Main.deltaTime) { yield return null; } Player.instance.followers[0].DoAutoMove(Player.instance.followers[0].GlobalPosition + Vector2.Down * 40f, 0.35f); while (!CameraController.transitionRoutine.done || !Party.IsStopped()) { yield return null; } for (float b = 0f; b < 30f; b += Main.deltaTime) { yield return null; } TextSystem.GetText("SchoolAfterRecessD2-4"); while (TextSystem.instance.Visible) { yield return null; } Player.instance.ResetFollowStep(); SaveFile.AddFlag(SaveFile.Flags.SchoolRecessDay2); } public void EnterDarkJail() { Main.inEvent = Coroutine.Start(EnterJail()); } private IEnumerator EnterJail() { if (!SaveFile.HasFlag(SaveFile.Flags.EnterDarkJailDay2)) { Party.MoveTo(new Vector2[2] { Room.current.eventPointers[4].GetChild(0).GlobalPosition, Room.current.eventPointers[4].GetChild(1).GlobalPosition }, 0.75f, align: true, Entity.Direction.North); while (!Party.IsStopped()) { yield return null; } TextSystem.GetText("EnterDarkJailDay2-1"); while (TextSystem.instance.Visible) { yield return null; } for (float a = 0f; a < 60f; a += Main.deltaTime) { yield return null; } TextSystem.GetText("EnterDarkJailDay2-2"); while (TextSystem.instance.Visible) { yield return null; } } ((Sprite2D)Room.current.eventPointers[3]).Frame = 1; Coroutine c = Coroutine.Start(DarkWorldTransition.DarkWorldTransitionRoutine(new Vector2[2] { Room.current.eventPointers[4].GetChild(0).GlobalPosition, Room.current.eventPointers[4].GetChild(1).GlobalPosition }, Room.IDs.DarkPrisonSouth, new Vector2[2] { new Vector2(-23f, 212f), new Vector2(23f, 212f) }, new Vector2(0f, -115f), SaveFile.HasFlag(SaveFile.Flags.EnterDarkJailDay2), setCamAtEnd: false)); while (Room.current.id == Room.IDs.SchoolSupplyCave) { yield return null; } yield return null; Main.SetActive(Room.current.eventPointers[0], state: false); while (!c.done) { yield return null; } if (!SaveFile.HasFlag(SaveFile.Flags.EnterDarkJailDay2)) { for (float a = 0f; a < 60f; a += Main.deltaTime) { yield return null; } TextSystem.GetText("EnterDarkJailDay2-3"); while (TextSystem.instance.Visible) { yield return null; } } c = Coroutine.Start(CameraController.Pan(new Vector2(CameraController.instance.GlobalPosition.X, Player.instance.GlobalPosition.Y + CameraController.instance.offset.Y), 0.5f)); while (!c.done) { yield return null; } CameraController.instance.follow = Player.instance; SaveFile.AddFlag(SaveFile.Flags.EnterDarkJailDay2); } public void SchoolJokeDuo() { Main.inEvent = Coroutine.Start(JokeDuoEvent()); } private IEnumerator JokeDuoEvent() { TextSystem.GetText("BugKoalaDuoD2"); while (TextSystem.instance.Visible) { yield return null; } Room.current.DoMusic(3); for (float a = 0f; a < 60f; a += Main.deltaTime) { yield return null; } TextSystem.GetText("BugKoalaDuoD2-2"); while (TextSystem.instance.Visible) { yield return null; } Audio.ChangeMusic(null); for (float a = 0f; a < 300f; a += Main.deltaTime) { yield return null; } TextSystem.GetText("BugKoalaDuoD2-3"); while (TextSystem.instance.Visible) { yield return null; } SaveFile.AddFlag(SaveFile.Flags.SchoolJokeDuoD2); Room.current.DoMusic(0); } public void CerobaEvent() { Main.inEvent = Coroutine.Start(CerobaEventDay2()); } private IEnumerator CerobaEventDay2() { Party.MoveTo(new Vector2[2] { nodes[1].GlobalPosition, nodes[1].GetChild(0).GlobalPosition }, 0.65f, align: true, Entity.Direction.South); while (!Party.IsStopped()) { yield return null; } Coroutine c = Coroutine.Start(CameraController.Pan(entities[0].GlobalPosition + new Vector2(30f, -40f), 0.25f)); while (!c.done) { yield return null; } for (float a = 0f; a < 40f; a += Main.deltaTime) { yield return null; } entities[0].Emoticon(Entity.Emoticons.Exclaim, sound: true); while (GodotObject.IsInstanceValid(entities[0].emoticonObj)) { yield return null; } entities[0].LookAt(Vector2.Up); entities[1].LookAt(Vector2.Up); TextSystem.GetText("CerobaEventDay2"); while (TextSystem.instance.Visible) { yield return null; } entities[0].DoAutoMove(entities[0].GlobalPosition + Vector2.Left * 200f); while (entities[0].moving != null) { yield return null; } entities[0].QueueFree(); TextSystem.GetText("CerobaEventDay2-2"); while (TextSystem.instance.Visible) { yield return null; } entities[1].DoAutoMove(entities[1].GlobalPosition + Vector2.Right * 200f); while (entities[1].moving != null) { yield return null; } entities[1].QueueFree(); c = Coroutine.Start(CameraController.PanToObj(Player.instance, 0.25f)); while (!c.done) { yield return null; } TextSystem.GetText("CerobaEventDay2-3"); while (TextSystem.instance.Visible) { yield return null; } Player.instance.ResetFollowStep(); } public void GetRedLetter() { Main.inEvent = Coroutine.Start(RedLetterD2()); } private IEnumerator RedLetterD2() { TextSystem.GetText("RedLetterDay2"); while (TextSystem.instance.Visible) { yield return null; } if (TextSystem.lastPrompt == 0) { if (SaveFile.HasFlag(SaveFile.Flags.FullLInv)) { TextSystem.GetText("InvFull"); } else { Audio.PlaySound("snd_item_ch1.wav"); objects[0].QueueFree(); SaveFile.current.lwItems.Add(Items.IDs.RedLetter); TextSystem.GetText("MartletEventDay1-2"); SaveFile.AddFlag(SaveFile.Flags.RedLetterDay2); } while (TextSystem.instance.Visible) { yield return null; } } } public void MartletFridge() { Main.inEvent = Coroutine.Start(FridgeEvent()); } private IEnumerator FridgeEvent() { if (SaveFile.HasFlag(SaveFile.Flags.Day1End) && !SaveFile.HasFlag(SaveFile.Flags.FridgeDay2)) { TextSystem.GetText("FridgeDay2"); while (TextSystem.instance.Visible) { yield return null; } if (TextSystem.lastPrompt == 0) { if (SaveFile.HasFlag(SaveFile.Flags.FullLInv)) { TextSystem.GetText("InvFull"); } else { SaveFile.AddFlag(SaveFile.Flags.FridgeDay2); Audio.PlaySound("snd_item_ch1.wav"); SaveFile.current.lwItems.Add(Items.IDs.HomemadeLunch); TextSystem.GetText("FridgeDay2Get"); } } } else { TextSystem.GetText("MartFridge"); } while (TextSystem.instance.Visible) { yield return null; } } public void ChujinDoor() { Main.inEvent = Coroutine.Start(ChujinDoorEvents()); } private IEnumerator ChujinDoorEvents() { if (!SaveFile.HasFlag(SaveFile.Flags.Day2KanakoRoomCheck)) { TextSystem.GetText("ChujinWorkshopCheck"); while (TextSystem.instance.Visible) { yield return null; } yield break; } Vector2[] p = new Vector2[2] { nodes[1].GlobalPosition, nodes[1].GetChild(0).GlobalPosition }; Party.MoveTo(p, 1.1f, align: true, Entity.Direction.North); while (!Party.IsStopped()) { yield return null; } TextSystem.GetText("DWD2StartEvent4"); while (TextSystem.instance.Visible) { yield return null; } Audio.music.Stop(); Color dim = new Color(0.5f, 0.5f, 1f); Audio.PlaySound("snd_impact_ch1.wav").Bus = "Reverb"; ((Sprite2D)nodes[0]).Visible = true; Node2D effect = nodes[0].GetChild(0); float a; for (a = 0f; a < 60f; a += Main.deltaTime) { yield return null; } Room.current.DoMusic(2); Node2D t = Room.current.GetChild(0); a = 0f; for (float b = 200f; a <= b; a += Main.deltaTime) { effect.Modulate = Main.colorClearB.Lerp(Main.colorWhite, a / b); t.Modulate = Main.colorWhite.Lerp(dim, a / b); yield return null; } TextSystem.GetText("DWD2StartEvent5"); while (TextSystem.instance.Visible) { yield return null; } for (float b = 0f; b < 60f; b += Main.deltaTime) { yield return null; } TextSystem.GetText("DWD2StartEvent6"); while (TextSystem.instance.Visible) { yield return null; } Coroutine c = Coroutine.Start(DarkWorldTransition.DarkWorldTransitionRoutine(p, Room.IDs.ChujinDWEntrance, new Vector2[2] { new Vector2(-30f, 0f), new Vector2(30f, 0f) }, nodes[0].GlobalPosition, fast: false, setCamAtEnd: true, SaveFile.current.lwItems.Contains(Items.IDs.RedLetter) ? 1 : 0)); while (!c.done) { yield return null; } Room.current.DoMusic(); for (float b = 0f; b < 30f; b += Main.deltaTime) { yield return null; } TextSystem.GetText("DWD2StartEvent7"); while (TextSystem.instance.Visible) { yield return null; } Player.instance.ResetFollowStep(); SaveFile.current.flags.Remove(SaveFile.Flags.Day2KanakoRoomCheck); SaveFile.current.values[10] = 3; if (SaveFile.current.lwItems.Contains(Items.IDs.RedLetter)) { SaveFile.current.lwItems.Remove(Items.IDs.RedLetter); } else { SaveFile.AddFlag(SaveFile.Flags.KanakoRedLetterDWEntTalk); } } public void KanakoDoor() { Main.inEvent = Coroutine.Start(KanakoDoorEvent()); } private IEnumerator KanakoDoorEvent() { if (!SaveFile.HasFlag(SaveFile.Flags.Day2KanakoRoomCheck)) { Audio.PlaySound("snd_locked_door.wav"); Audio.ChangeMusic((Audio.AudioBlock)null, 3f); for (float a = 0f; a < 60f; a += Main.deltaTime) { yield return null; } TextSystem.GetText("DWD2StartEvent1"); while (TextSystem.instance.Visible) { yield return null; } Party.MoveTo(new Vector2[2] { nodes[2].GetChild(0).GlobalPosition, nodes[2].GlobalPosition }, 0.5f, align: true, Entity.Direction.North); while (!Party.IsStopped()) { yield return null; } for (int i = 0; i < 9; i++) { Audio.PlaySound("snd_locked_door.wav"); switch (i) { case 0: { for (float a = 0f; a < 30f; a += Main.deltaTime) { yield return null; } break; } case 1: { for (float a = 0f; a < 60f; a += Main.deltaTime) { yield return null; } break; } default: { for (float a = 0f; a < 7f; a += Main.deltaTime) { yield return null; } break; } } } TextSystem.GetText("DWD2StartEvent2"); while (TextSystem.instance.Visible) { yield return null; } ((CpuParticles2D)nodes[3]).Emitting = true; for (float a = 0f; a < 30f; a += Main.deltaTime) { yield return null; } Player.instance.followers[0].Emoticon(Entity.Emoticons.Exclaim, sound: true); for (float a = 0f; a < 60f; a += Main.deltaTime) { yield return null; } Room.current.DoMusic(1); TextSystem.GetText("DWD2StartEvent3"); while (TextSystem.instance.Visible) { yield return null; } SaveFile.AddFlag(SaveFile.Flags.Day2KanakoRoomCheck); Player.instance.ResetFollowStep(); } else { TextSystem.GetText("DWD2StartEventPanic"); while (TextSystem.instance.Visible) { yield return null; } } } }