From b57aa99e101c7cf59fd59d2f8df9fe3547d91acc Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 5 Jul 2021 12:05:47 -0400 Subject: Made the "everyone looks at mirror" behaviour into a background script This simplifies it a bit, because it no longer needs to constantly check that we are on the right map. It is linked to the mirror's edge. --- res/maps/hallucination_mirror.tmx | 1 + res/scripts/hallucination_mirror.lua | 11 +++++------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/res/maps/hallucination_mirror.tmx b/res/maps/hallucination_mirror.tmx index eeeb718..2f2c580 100644 --- a/res/maps/hallucination_mirror.tmx +++ b/res/maps/hallucination_mirror.tmx @@ -117,6 +117,7 @@ + diff --git a/res/scripts/hallucination_mirror.lua b/res/scripts/hallucination_mirror.lua index afacd59..18a3e28 100644 --- a/res/scripts/hallucination_mirror.lua +++ b/res/scripts/hallucination_mirror.lua @@ -1,19 +1,18 @@ hallucination_mirror = {} -function hallucination_mirror.init() +function hallucination_mirror.look_at_mirror() coroutine.yield() -- This routine makes the player's party face the mirror if they are standing -- in front of it for a few (5) seconds. The fact that this has to run - -- continuously makes it a bit complicated, and is why we keep checking that - -- we're on the same map. - while getMap():getName() == "hallucination_mirror" do + -- continuously makes it a bit complicated. + while true do if IsSpriteInZone("lucas", "mirror_sight") and IsSpriteInZone("kuma", "mirror_sight") and IsSpriteInZone("duster", "mirror_sight") and IsSpriteInZone("boney", "mirror_sight") then timer = 5000 -- milliseconds - while timer > 0 and getSprite(getPlayerSprite()).characterState == CharacterState.STILL and getMap():getName() == "hallucination_mirror" and not message().isMessageActive do + while timer > 0 and getSprite(getPlayerSprite()).characterState == CharacterState.STILL and not message().isMessageActive do timer = timer - coroutine.yield() end - if timer <= 0 and getSprite(getPlayerSprite()).characterState == CharacterState.STILL and getMap():getName() == "hallucination_mirror" and not message().isMessageActive then + if timer <= 0 and getSprite(getPlayerSprite()).characterState == CharacterState.STILL and not message().isMessageActive then SetPartyDirection(getPlayerSprite(), Direction.UP) end end -- cgit 1.4.1