From 842a4340e2e1c9c3fa357cab016af624a3ea33fb Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 9 Mar 2021 17:15:25 -0500 Subject: Fixed race condition with getting Claus's attention It was possible to cause a crash by having two overlapping "switch_claus_attention" triggers, which then both try to remove his surprised expression. Now, there's essentially a lock on the function. --- res/scripts/hallucination_interior.lua | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'res') diff --git a/res/scripts/hallucination_interior.lua b/res/scripts/hallucination_interior.lua index c265a46..caad4b0 100644 --- a/res/scripts/hallucination_interior.lua +++ b/res/scripts/hallucination_interior.lua @@ -230,6 +230,12 @@ end function hallucination_interior.switch_claus_attention() gamestate.switch_claus_lost_interest = false + if gamestate.switch_claus_gaining_attention then + return + end + + gamestate.switch_claus_gaining_attention = true + Halt("switch_claus") DisableBehaviour("switch_claus") ShowExpression("switch_claus", "surprise") @@ -258,6 +264,8 @@ function hallucination_interior.switch_claus_attention() FollowSprite("switch_claus", "lucas") end end + + gamestate.switch_claus_gaining_attention = false end function hallucination_interior.switch_claus_lose_interest() -- cgit 1.4.1