1246 lines
30 KiB
C#
1246 lines
30 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/Events/LWDay1Events.cs")]
|
|
public partial class LWDay1Events : Node2D
|
|
{
|
|
[Export(PropertyHint.None, "")]
|
|
private Entity[] entities;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Node2D[] nodes;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Node[] other;
|
|
|
|
[Export(PropertyHint.None, "")]
|
|
private Texture2D[] texture;
|
|
|
|
private static LWDay1Events instance;
|
|
|
|
public override void _EnterTree()
|
|
{
|
|
instance = this;
|
|
}
|
|
|
|
public static IEnumerator ClosetPostDWEvent()
|
|
{
|
|
SaveFile.current.values[5] = 10;
|
|
SaveFile.AddFlag(SaveFile.Flags.NightTime);
|
|
Vector2[] pos = new Vector2[2]
|
|
{
|
|
instance.nodes[0].GlobalPosition,
|
|
instance.nodes[1].GlobalPosition
|
|
};
|
|
Party.SetPosition(in pos);
|
|
CameraController.instance.cover.ZIndex = 100;
|
|
TextSystem.GetText("ReturnToLW1-1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
AnimationPlayer p = (AnimationPlayer)instance.other[0];
|
|
p.Play("Sounds");
|
|
yield return null;
|
|
while (p.IsPlaying())
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("ReturnToLW1-2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 20f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_noise.wav");
|
|
CameraController.Transition(Main.colorClear);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("ReturnToLW1-3");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
Player.instance.followers[0].anim.Play("Kneel5");
|
|
Player.instance.followers[0].Shake(10f, 1f);
|
|
Player.instance.LookAt(Player.instance.followers[0].GlobalPosition);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("ReturnToLW1-4");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.followers[0].Shake(10f, 1f);
|
|
Player.instance.followers[0].anim.Play("SouthIdle");
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (SaveFile.HasFlag(SaveFile.Flags.KanakoPhoneEvent))
|
|
{
|
|
TextSystem.GetText("ReturnToLW1-Phone");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
Audio.PlaySound("snd_noise.wav");
|
|
Player.instance.followers[0].anim.Play("PhoneCheck");
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.followers[0].anim.Play("SurpriseLW");
|
|
Player.instance.followers[0].Shake(10f, 1f);
|
|
TextSystem.GetText("ReturnToLW1-5");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.LookAt(Vector2.Down);
|
|
Player.instance.ResetFollowStep();
|
|
}
|
|
|
|
public void TrapdoorCheck()
|
|
{
|
|
Main.inEvent = Coroutine.Start(TrapdoorEvent());
|
|
}
|
|
|
|
private IEnumerator TrapdoorEvent()
|
|
{
|
|
SaveFile.current.flags.Remove(SaveFile.Flags.MagicDoorActive);
|
|
TextSystem.GetText("LWD1Trapdoor1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (TextSystem.lastPrompt == 0)
|
|
{
|
|
(nodes[2] as Sprite2D).Texture = texture[0];
|
|
Coroutine c = Coroutine.Start(DarkWorldTransition.DarkWorldTransitionRoutine(new Vector2[2]
|
|
{
|
|
nodes[3].GlobalPosition,
|
|
nodes[4].GlobalPosition
|
|
}, Room.IDs.DarkPrisonRight, new Vector2[2]
|
|
{
|
|
new Vector2(248f, -184f),
|
|
new Vector2(312f, -184f)
|
|
}, new Vector2(-72f, -40f)));
|
|
while (!c.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("LWD1Trapdoor2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.current.values[5] = 11;
|
|
}
|
|
}
|
|
|
|
public void MainSchoolDoor()
|
|
{
|
|
Main.inEvent = Coroutine.Start(MainSDoor());
|
|
}
|
|
|
|
private IEnumerator MainSDoor()
|
|
{
|
|
if (!SaveFile.HasFlag(SaveFile.Flags.SchoolCheckedLock))
|
|
{
|
|
Audio.PlaySound("snd_locked_door.wav");
|
|
for (float a = 0f; a < 40f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("SchoolLocked");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.SchoolCheckedLock);
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("SchoolLocked2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void MartHouse()
|
|
{
|
|
Main.inEvent = Coroutine.Start(MartletHouseCheck());
|
|
}
|
|
|
|
private IEnumerator MartletHouseCheck()
|
|
{
|
|
if (SaveFile.HasFlag(SaveFile.Flags.MartletHouseCheckD1))
|
|
{
|
|
TextSystem.GetText("MartHouseCheckD1-3");
|
|
}
|
|
else
|
|
{
|
|
Party.MoveTo(new Vector2[2]
|
|
{
|
|
nodes[0].GlobalPosition,
|
|
nodes[1].GlobalPosition
|
|
}, 0.75f, align: true, Entity.Direction.North);
|
|
yield return null;
|
|
while (!Party.IsStopped())
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("MartHouseCheckD1-1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 40f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.followers[0].Emoticon(Entity.Emoticons.Exclaim);
|
|
Player.instance.LookAt(Vector2.Right);
|
|
AudioStreamPlayer p = (AudioStreamPlayer)other[0];
|
|
AudioStreamWav v = GD.Load<AudioStreamWav>("res://Audio/Sounds/snd_phone.wav");
|
|
v.LoopMode = AudioStreamWav.LoopModeEnum.Forward;
|
|
v.LoopEnd = 42500;
|
|
p.Stream = v;
|
|
p.Play();
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_noise.wav");
|
|
Player.instance.followers[0].anim.Play("PhoneCheck");
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.followers[0].anim.Play("SurpriseLW");
|
|
Player.instance.followers[0].Shake(10f, 1f);
|
|
TextSystem.GetText("MartHouseCheckD1-2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (TextSystem.lastPrompt == 0)
|
|
{
|
|
for (float a = 0f; a < 20f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
p.Stop();
|
|
Player.instance.followers[0].anim.Play("PhoneAnswer");
|
|
SaveFile.current.values[0]++;
|
|
TextSystem.GetText("MartHouseCheckD1-2A");
|
|
}
|
|
else
|
|
{
|
|
SaveFile.AddFlag(SaveFile.Flags.IgnoredCerobaCallD1);
|
|
v.LoopMode = AudioStreamWav.LoopModeEnum.Disabled;
|
|
while (p.Playing)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.followers[0].anim.Play("SouthIdle");
|
|
TextSystem.GetText("MartHouseCheckD1-2B");
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.MartletHouseCheckD1);
|
|
}
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public void CerobaFirstEvent()
|
|
{
|
|
Main.inEvent = Coroutine.Start(CerobaFirstShop());
|
|
}
|
|
|
|
private IEnumerator CerobaFirstShop()
|
|
{
|
|
Coroutine.Start(CameraController.Pan(new Vector2(-40f, -90f), 0.25f));
|
|
Player.instance.DoAutoAlign(nodes[2].GlobalPosition, 0.7f);
|
|
Player.instance.moving.dirAtEnd = Entity.Direction.North;
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.followers[0].DoAutoMove(new Vector2[3]
|
|
{
|
|
nodes[3].GlobalPosition,
|
|
nodes[4].GlobalPosition,
|
|
nodes[5].GlobalPosition
|
|
}, 0.7f);
|
|
Player.instance.followers[0].moving.dirAtEnd = Entity.Direction.North;
|
|
while (!Party.IsStopped())
|
|
{
|
|
yield return null;
|
|
}
|
|
if (SaveFile.HasFlag(SaveFile.Flags.IgnoredCerobaCallD1))
|
|
{
|
|
TextSystem.GetText("IgnoredRobaCallD1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
TextSystem.GetText("CerobaBeforeDinner");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
entities[0].DoAutoMove(new Vector2[2]
|
|
{
|
|
nodes[0].GlobalPosition,
|
|
nodes[1].GlobalPosition
|
|
}, 1.2f);
|
|
while (entities[0].moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].QueueFree();
|
|
TextSystem.GetText("CerobaBeforeDinner2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.FirstKetsuShopEvent);
|
|
Coroutine c = Coroutine.Start(CameraController.Pan(new Vector2(-40f, -40f), 0.5f));
|
|
while (!c.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
CameraController.instance.follow = Player.instance;
|
|
Player.instance.ResetFollowStep();
|
|
}
|
|
|
|
public void KanakoRoomDiscussion()
|
|
{
|
|
Main.inEvent = Coroutine.Start(KanakoRoomTalk());
|
|
}
|
|
|
|
private IEnumerator KanakoRoomTalk()
|
|
{
|
|
Audio.ChangeMusic((Audio.AudioBlock)null, 5f);
|
|
Player.instance.DoAutoAlign(nodes[16].GlobalPosition, 0.7f);
|
|
Player.instance.moving.dirAtEnd = Entity.Direction.East;
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.followers[0].DoAutoMove(new Vector2[3]
|
|
{
|
|
nodes[13].GlobalPosition,
|
|
nodes[14].GlobalPosition,
|
|
nodes[15].GlobalPosition
|
|
}, 0.7f);
|
|
Player.instance.followers[0].moving.dirAtEnd = Entity.Direction.West;
|
|
while (!Party.IsStopped())
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("KanakoDiscussDay1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (SaveFile.HasFlag(SaveFile.Flags.WeirdStart) && TextSystem.lastPrompt == 0)
|
|
{
|
|
SaveFile.current.flags.Remove(SaveFile.Flags.WeirdStart);
|
|
}
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Party.LookAt(Vector2.Down);
|
|
TextSystem.GetText("KanakoDiscussDay1-3");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.ResetFollowStep();
|
|
Room.current.DoMusic();
|
|
}
|
|
|
|
public void KetsukaneDinner()
|
|
{
|
|
Main.inEvent = Coroutine.Start(KetsuDinner());
|
|
}
|
|
|
|
private IEnumerator KetsuDinner()
|
|
{
|
|
Entity[] en = new Entity[4]
|
|
{
|
|
Player.instance,
|
|
Player.instance.followers[0],
|
|
entities[1],
|
|
entities[2]
|
|
};
|
|
entities[1].LookAt(Vector2.Right);
|
|
TextSystem.GetText("KetsuDinnerDay1-1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[1].DoAutoAlign(nodes[12].GlobalPosition);
|
|
entities[1].moving.dirAtEnd = Entity.Direction.East;
|
|
entities[1].collider.Disabled = true;
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.DoAutoAlign(nodes[10].GlobalPosition, 0.75f);
|
|
Player.instance.moving.dirAtEnd = Entity.Direction.South;
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.followers[0].DoAutoAlign(nodes[11].GlobalPosition, 0.75f);
|
|
Player.instance.followers[0].moving.dirAtEnd = Entity.Direction.South;
|
|
while (!Party.IsStopped())
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
if (i == 0 && en[i].animMod == Entity.AnimMods.Hat)
|
|
{
|
|
en[i].anim.Play("SouthSitHat");
|
|
}
|
|
else
|
|
{
|
|
en[i].currentAnim = Entity.Animations.Sit;
|
|
}
|
|
en[i].Shake(10f, 1f);
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (int j = 1; j < 4; j++)
|
|
{
|
|
en[j].anim.Play("SitEat");
|
|
}
|
|
for (float a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.overridePlayer = false;
|
|
TextSystem.GetText("KetsuDinnerDay1-2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
en[1].anim.Play("SitEat");
|
|
for (float a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.overridePlayer = false;
|
|
TextSystem.GetText("KetsuDinnerDay1-3");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (int k = 1; k < 4; k++)
|
|
{
|
|
en[k].anim.Play("SitEat");
|
|
}
|
|
for (float a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (SaveFile.current.lwItems.Contains(Items.IDs.KetsukaneHeirloom))
|
|
{
|
|
TextSystem.overridePlayer = false;
|
|
TextSystem.GetText("KetsuDinnerDay1-Necklace");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.ReturnedNecklace);
|
|
SaveFile.current.lwItems.Remove(Items.IDs.KetsukaneHeirloom);
|
|
SaveFile.current.dwArmor.Remove(Items.IDs.FoxNecklace);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
en[3].anim.Play("SideSit");
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
en[3].currentAnim = Entity.Animations.Idle;
|
|
en[3].LookAt(Vector2.Right, forceAnimUpdate: true);
|
|
en[3].Shake(10f, 1f);
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
en[1].anim.Play("SitLook");
|
|
en[2].anim.Play("SideSit");
|
|
for (float a = 0f; a < 50f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.overridePlayer = false;
|
|
TextSystem.GetText("KetsuDinnerDay1-4");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
en[3].DoAutoMove(new Vector2[2]
|
|
{
|
|
nodes[8].GlobalPosition,
|
|
nodes[9].GlobalPosition
|
|
});
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
en[2].Shake(10f, 1f);
|
|
en[2].currentAnim = Entity.Animations.Idle;
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
en[3].collider.Disabled = true;
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
en[2].DoAutoMove(new Vector2[2]
|
|
{
|
|
new Vector2(en[2].GlobalPosition.X, nodes[8].GlobalPosition.Y),
|
|
nodes[8].GlobalPosition
|
|
});
|
|
while (en[2].moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
en[2].LookAt(Vector2.Right);
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.overridePlayer = false;
|
|
TextSystem.GetText("KetsuDinnerDay1-5");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
en[2].DoAutoMove(nodes[9].GlobalPosition);
|
|
while (en[2].moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_dooropen_ch1.wav");
|
|
for (float a = 0f; a < 40f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_doorclose_ch1.wav");
|
|
en[2].QueueFree();
|
|
en[3].QueueFree();
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
en[i].currentAnim = Entity.Animations.Idle;
|
|
en[i].UpdateAnim(force: true);
|
|
en[i].Shake(10f, 1f);
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.overridePlayer = false;
|
|
TextSystem.GetText("KetsuDinnerDay1-6");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.ResetFollowStep();
|
|
Main.SetActive(nodes[6], state: true);
|
|
Main.SetActive(nodes[7], state: false);
|
|
}
|
|
|
|
public void LeftKetsukane()
|
|
{
|
|
Main.inEvent = Coroutine.Start(LeftKetsuDinner());
|
|
}
|
|
|
|
private IEnumerator LeftKetsuDinner()
|
|
{
|
|
Party.LookAt(Vector2.Down);
|
|
Player.instance.DoAutoMove(Player.instance.GlobalPosition + Vector2.Down * 30f, 0.5f);
|
|
while (Player.instance.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.LookAt(Vector2.Up);
|
|
TextSystem.GetText("PostKetsuDinnerD1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.followers[0].LookAt(Vector2.Up);
|
|
Audio.PlaySound("snd_dooropen_ch1.wav");
|
|
for (float a = 0f; a < 40f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_doorclose_ch1.wav");
|
|
Party.Remove(1);
|
|
for (float a = 0f; a < 40f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.LookAt(Vector2.Down);
|
|
}
|
|
|
|
public void MartLetter()
|
|
{
|
|
Main.inEvent = Coroutine.Start(LetterEvent());
|
|
}
|
|
|
|
private IEnumerator LetterEvent()
|
|
{
|
|
TextSystem.GetText("MartletEventDay1-1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (TextSystem.lastPrompt != 1)
|
|
{
|
|
SaveFile.current.lwItems.Add(Items.IDs.RedLetter);
|
|
Audio.ChangeMusic((Audio.AudioBlock)null, 3f);
|
|
Main.SetActive(nodes[3], state: false);
|
|
Audio.PlaySound("snd_item_ch1.wav");
|
|
TextSystem.GetText("MartletEventDay1-2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
float a;
|
|
for (a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("MartletEventDay1-3");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.DoAutoAlign(nodes[2].GlobalPosition, 0.8f);
|
|
Player.instance.moving.dirAtEnd = Entity.Direction.North;
|
|
while (Player.instance.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.GlobalPosition = nodes[2].GlobalPosition;
|
|
entities[0].collider.Disabled = true;
|
|
Coroutine.Start(CameraController.Pan(nodes[3].GlobalPosition, 0.5f));
|
|
Audio.PlaySound("snd_martlet_lands.wav");
|
|
entities[0].anim.Play("FlyDown");
|
|
Vector2 s = nodes[3].GlobalPosition + Vector2.Up * 150f;
|
|
a = 0f;
|
|
float b;
|
|
for (b = 85f; a <= b + 1f; a += Main.deltaTime)
|
|
{
|
|
entities[0].GlobalPosition = s.Lerp(nodes[3].GlobalPosition, Mathf.Min(a / b, 1f));
|
|
yield return null;
|
|
}
|
|
entities[0].anim.Play("Land");
|
|
for (b = 0f; b < 50f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].anim.Play("SouthIdle");
|
|
while (!Audio.routine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
Room.current.DoMusic(2);
|
|
for (b = 0f; b < 60f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("MartletEventDay1-4");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].DoAutoMove(Player.instance.GlobalPosition + Vector2.Up * 8f, 0.8f);
|
|
while (entities[0].moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.Visible = false;
|
|
entities[0].anim.Play("Hug");
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
for (b = 0f; b < 50f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("MartletEventDay1-5");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (b = 0f; b < 50f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].anim.Play();
|
|
for (b = 0f; b < 15f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.Visible = true;
|
|
entities[0].GlobalPosition += Vector2.Up * 8f;
|
|
entities[0].UpdateAnim(force: true);
|
|
entities[0].DoAutoMove(entities[0].GlobalPosition + Vector2.Up * 8f, 0.35f);
|
|
entities[0].moving.doFacing = false;
|
|
while (entities[0].moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("MartletEventDay1-6");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].DoAutoMove(nodes[3].GlobalPosition, 0.25f);
|
|
Player.instance.DoAutoMove(nodes[3].GlobalPosition, 0.15f);
|
|
Coroutine c = Coroutine.Start(CameraController.Pan(nodes[3].GlobalPosition + Vector2.Up * 150f, 0.25f, fixedRate: true, 10000f));
|
|
while (entities[0].moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Coroutine.Start(DoorSound());
|
|
for (b = 0f; b < 20f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].Visible = false;
|
|
while (Player.instance.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Coroutine.Start(DoorSound());
|
|
for (b = 0f; b < 20f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.Visible = false;
|
|
Room.current.eventPointers[1].Modulate = Main.colorClear;
|
|
Room.current.eventPointers[1].Visible = true;
|
|
b = 0f;
|
|
for (a = 200f; b < a; b += Main.deltaTime)
|
|
{
|
|
Room.current.eventPointers[1].Modulate = Main.colorClear.Lerp(Main.colorWhite, b / a);
|
|
yield return null;
|
|
}
|
|
CameraController.Transition(Main.colorBlack, 200f);
|
|
while (!CameraController.transitionRoutine.done || !c.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
yield return null;
|
|
Room.LoadRoom(Room.IDs.MartletHouse, reparent: true);
|
|
yield return null;
|
|
Player.instance.Visible = true;
|
|
Player.instance.GlobalPosition = new Vector2(-50f, 71f);
|
|
Entity m = (Entity)Room.current.eventPointers[0];
|
|
m.GlobalPosition = Player.instance.GlobalPosition + Vector2.Up * 40f;
|
|
CameraController.instance.follow = Player.instance;
|
|
for (a = 0f; a < 20f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
CameraController.Transition(Main.colorClearB, 200f);
|
|
while (!CameraController.transitionRoutine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("MartletEventDay1-7");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
m.DoAutoAlign(m.startPos);
|
|
m.collider.Disabled = true;
|
|
m.moving.dirAtEnd = Entity.Direction.South;
|
|
while (m.moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
m.Shake(10f, 1f);
|
|
for (a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("MartletEventDay1-8");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static IEnumerator DoorSound()
|
|
{
|
|
Audio.PlaySound("snd_dooropen_ch1.wav");
|
|
for (float a = 0f; a < 40f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_doorclose_ch1.wav");
|
|
}
|
|
|
|
public void MartletTalkHouse()
|
|
{
|
|
Main.inEvent = Coroutine.Start(MartTalk());
|
|
}
|
|
|
|
private IEnumerator MartTalk()
|
|
{
|
|
if (SaveFile.HasFlag(SaveFile.Flags.GaveLetterMartlet))
|
|
{
|
|
TextSystem.GetText("MartletTalkDay1-PostLetter");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
yield break;
|
|
}
|
|
Texts.TextBlock[] diagClone = Texts.GetDiagClone("MartletTalkDay1");
|
|
bool hasLetter = SaveFile.current.lwItems.Contains(Items.IDs.RedLetter);
|
|
if (!hasLetter)
|
|
{
|
|
diagClone[^1].prompts = new string[2]
|
|
{
|
|
diagClone[^1].prompts[1],
|
|
diagClone[^1].prompts[2]
|
|
};
|
|
}
|
|
TextSystem.SingleText(diagClone);
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (!hasLetter)
|
|
{
|
|
TextSystem.lastPrompt++;
|
|
}
|
|
switch (TextSystem.lastPrompt)
|
|
{
|
|
case 0:
|
|
TextSystem.GetText("MartletTalkDay1-Letter");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.current.lwItems.Remove(Items.IDs.RedLetter);
|
|
SaveFile.AddFlag(SaveFile.Flags.GaveLetterMartlet);
|
|
break;
|
|
case 1:
|
|
TextSystem.GetText("MartletTalkDay1-Okay");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
break;
|
|
case 2:
|
|
TextSystem.GetText("MartletTalkDay1-Nothing");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
|
|
public void EndDay()
|
|
{
|
|
Main.inEvent = Coroutine.Start(DayEnd());
|
|
}
|
|
|
|
private IEnumerator DayEnd()
|
|
{
|
|
if (!SaveFile.HasFlag(SaveFile.Flags.NightTime))
|
|
{
|
|
TextSystem.GetText("ColeBedCheck");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
yield break;
|
|
}
|
|
TextSystem.GetText("SleepConfirm");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (TextSystem.lastPrompt == 0)
|
|
{
|
|
Audio.ChangeMusic((Audio.AudioBlock)null, 5f);
|
|
CameraController.Transition(Main.colorBlack, 200f, 50);
|
|
while (!CameraController.transitionRoutine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
float a;
|
|
for (a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.ChangeMusic(GD.Load<AudioStream>("res://Audio/Music/ocean.ogg"));
|
|
for (a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("Day2StartFlashback1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("Day2StartFlashback2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
for (a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("Day2StartFlashback3");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_groundbreak.wav", 1f, 0.8f).Bus = "Reverb";
|
|
for (a = 0f; a < 100f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("Day2StartFlashback4");
|
|
Audio.ChangeMusic((Audio.AudioBlock)null, 3f);
|
|
CameraController.Transition(Main.colorWhite, 200f, 50);
|
|
AudioStreamPlayer v = Audio.PlaySound("mus_cymbal.ogg");
|
|
while (!CameraController.transitionRoutine.done || v.Playing)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (TextSystem.instance.Visible)
|
|
{
|
|
TextSystem.End();
|
|
}
|
|
Main.SetActive(Room.current.eventPointers[1], state: true);
|
|
Vector2 p = new Vector2(860f, -433f);
|
|
Vector2 t = p + Vector2.Left * 40f;
|
|
Player.instance.collider.Disabled = true;
|
|
Player.instance.GlobalPosition = p;
|
|
Player.instance.anim.Play("Jumped");
|
|
Room.current.Modulate = Main.colorWhite;
|
|
Player.instance.ZIndex = 10;
|
|
yield return null;
|
|
Player.instance.anim.Stop();
|
|
CameraController.Transition(Main.colorClear);
|
|
Player.instance.Emoticon(Entity.Emoticons.Exclaim, sound: true);
|
|
while (GodotObject.IsInstanceValid(Player.instance.emoticonObj))
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.Shake(30f, 1f);
|
|
for (a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_fall2.wav");
|
|
Coroutine s = Coroutine.Start(CommonEvents.SpinEntity(Player.instance));
|
|
a = 0f;
|
|
for (float b = 90f; a <= b; a += Main.deltaTime)
|
|
{
|
|
Player.instance.GlobalPosition = p.Lerp(t, a / b);
|
|
yield return null;
|
|
}
|
|
Coroutine.Stop(s);
|
|
yield return null;
|
|
Player.instance.anim.Play("Jumped");
|
|
Player.instance.Shake(10f, 1f);
|
|
Audio.PlaySound("snd_grab.wav");
|
|
yield return null;
|
|
Player.instance.anim.Stop();
|
|
for (float b = 0f; b < 100f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.Shake(30f, 1f);
|
|
for (float b = 0f; b < 30f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.LookAt(Vector2.Up, forceAnimUpdate: true);
|
|
Audio.PlaySound("snd_wing_ch1.wav");
|
|
for (float b = 0f; b < 60f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
Player.instance.ZIndex = 0;
|
|
Player.instance.collider.Disabled = false;
|
|
Player.instance.LookAt(Vector2.Down);
|
|
SaveFile.AddFlag(SaveFile.Flags.Day1End);
|
|
SaveFile.current.flags.Remove(SaveFile.Flags.NightTime);
|
|
for (float b = 0f; b < 60f; b += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
CameraController cameraController = CameraController.instance;
|
|
SavePrompt node;
|
|
SavePrompt savePrompt = (node = GD.Load<PackedScene>("res://Objects/UI/SavePrompt.tscn").Instantiate<SavePrompt>(PackedScene.GenEditState.Disabled));
|
|
cameraController.AddChild(node, forceReadableName: false, InternalMode.Disabled);
|
|
while (GodotObject.IsInstanceValid(savePrompt))
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public void ColesLamp()
|
|
{
|
|
if (!SaveFile.HasFlag(SaveFile.Flags.NightTime))
|
|
{
|
|
TextSystem.GetText("ColeLampCheck");
|
|
return;
|
|
}
|
|
Audio.PlaySound("snd_noise.wav");
|
|
if (Room.current.tempFlags.Contains("Light"))
|
|
{
|
|
Room.current.Modulate = Main.colorWhite;
|
|
Room.current.tempFlags.Remove("Light");
|
|
}
|
|
else
|
|
{
|
|
Room.current.Modulate = new Color(0.5f, 0.4f, 0.6f);
|
|
Room.current.tempFlags.Add("Light");
|
|
}
|
|
Player.instance.canInput = true;
|
|
}
|
|
|
|
public void MartletRoof()
|
|
{
|
|
Main.inEvent = Coroutine.Start(MoveMartletRoof());
|
|
}
|
|
|
|
private IEnumerator MoveMartletRoof()
|
|
{
|
|
Audio.PlaySound("snd_escaped.wav");
|
|
CameraController.Transition(Main.colorBlack, 15f);
|
|
while (!CameraController.transitionRoutine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
yield return null;
|
|
Room.LoadRoom(Room.IDs.WildEastWest, reparent: true);
|
|
yield return null;
|
|
Party.SetPosition(Room.current.eventPointers[2].GlobalPosition);
|
|
Player.instance.ResetFollowStep();
|
|
Party.LookAt(Vector2.Right);
|
|
(Room.current.eventPointers[0] as Parallax2D).ScrollOffset = new Vector2(0f, -340f);
|
|
Room.current.eventPointers[3].ZIndex = -1;
|
|
if (SaveFile.HasFlag(SaveFile.Flags.NightTime))
|
|
{
|
|
Room.current.eventPointers[1].Visible = true;
|
|
}
|
|
for (float i = 0f; i < 30f; i += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
CameraController.Transition(Main.colorClearB, 15f);
|
|
while (!CameraController.transitionRoutine.done)
|
|
{
|
|
yield return null;
|
|
}
|
|
}
|
|
|
|
public void StarloEvent()
|
|
{
|
|
Main.inEvent = Coroutine.Start(Starlo());
|
|
}
|
|
|
|
private IEnumerator Starlo()
|
|
{
|
|
Party.MoveTo(new Vector2[2]
|
|
{
|
|
nodes[0].GlobalPosition,
|
|
nodes[1].GlobalPosition
|
|
}, 0.75f, align: true);
|
|
while (!Party.IsStopped())
|
|
{
|
|
yield return null;
|
|
}
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].Emoticon(Entity.Emoticons.Exclaim, sound: true);
|
|
for (float a = 0f; a < 60f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].LookAt(Vector2.Down);
|
|
entities[0].collider.Disabled = true;
|
|
TextSystem.GetText("Day1StarloEvent");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].DoAutoAlign(nodes[2].GlobalPosition);
|
|
while (entities[0].moving != null)
|
|
{
|
|
yield return null;
|
|
}
|
|
Coroutine.Start(DoorSound());
|
|
for (float a = 0f; a < 30f; a += Main.deltaTime)
|
|
{
|
|
yield return null;
|
|
}
|
|
entities[0].QueueFree();
|
|
SaveFile.AddFlag(SaveFile.Flags.StarloDay1);
|
|
Player.instance.ResetFollowStep();
|
|
}
|
|
|
|
public void BellEvent()
|
|
{
|
|
Main.inEvent = Coroutine.Start(RingBell());
|
|
}
|
|
|
|
private IEnumerator RingBell()
|
|
{
|
|
TextSystem.GetText("BellEvent1");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (TextSystem.lastPrompt != 0)
|
|
{
|
|
yield break;
|
|
}
|
|
((AnimatedSprite2D)nodes[0]).Play("default");
|
|
AudioStreamPlayer v = Audio.PlaySound("snd_wild_east_bell.wav");
|
|
yield return null;
|
|
while (v.Playing)
|
|
{
|
|
yield return null;
|
|
}
|
|
if (SaveFile.HasFlag(SaveFile.Flags.AnnoyedDecibat))
|
|
{
|
|
yield break;
|
|
}
|
|
if (!Room.current.tempFlags.Contains("Bell"))
|
|
{
|
|
Room.current.tempFlags.Add("Bell");
|
|
nodes[1].QueueFree();
|
|
yield break;
|
|
}
|
|
Player.instance.LookAt(Vector2.Left);
|
|
Audio.PlaySound("snd_martlet_takeoff.wav");
|
|
Vector2 p = nodes[2].GlobalPosition + Vector2.Up * 200f;
|
|
float a = 0f;
|
|
float b;
|
|
for (b = 180f; a < b; a += Main.deltaTime)
|
|
{
|
|
entities[0].GlobalPosition = p.Lerp(nodes[2].GlobalPosition, Mathf.SmoothStep(0f, 1f, a / b));
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("BellEvent2");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
Audio.PlaySound("snd_martlet_takeoff.wav");
|
|
b = 0f;
|
|
for (a = 180f; b < a; b += Main.deltaTime)
|
|
{
|
|
entities[0].GlobalPosition = p.Lerp(nodes[2].GlobalPosition, Mathf.SmoothStep(0f, 1f, 1f - b / a));
|
|
yield return null;
|
|
}
|
|
TextSystem.GetText("BellEvent3");
|
|
while (TextSystem.instance.Visible)
|
|
{
|
|
yield return null;
|
|
}
|
|
SaveFile.AddFlag(SaveFile.Flags.AnnoyedDecibat);
|
|
entities[0].QueueFree();
|
|
}
|
|
|
|
}
|