summary refs log tree commit diff stats
path: root/res
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-03-09 17:15:25 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-03-09 17:15:25 -0500
commit842a4340e2e1c9c3fa357cab016af624a3ea33fb (patch)
treeb11ef4aafa3460c1bdfbb29d06a909ba61b659e3 /res
parentaac3b1bc1ba48b6e50f661b97326ef191cce3e6c (diff)
downloadtanetane-842a4340e2e1c9c3fa357cab016af624a3ea33fb.tar.gz
tanetane-842a4340e2e1c9c3fa357cab016af624a3ea33fb.tar.bz2
tanetane-842a4340e2e1c9c3fa357cab016af624a3ea33fb.zip
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.
Diffstat (limited to 'res')
-rw-r--r--res/scripts/hallucination_interior.lua8
1 files changed, 8 insertions, 0 deletions
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
230function hallucination_interior.switch_claus_attention() 230function hallucination_interior.switch_claus_attention()
231 gamestate.switch_claus_lost_interest = false 231 gamestate.switch_claus_lost_interest = false
232 232
233 if gamestate.switch_claus_gaining_attention then
234 return
235 end
236
237 gamestate.switch_claus_gaining_attention = true
238
233 Halt("switch_claus") 239 Halt("switch_claus")
234 DisableBehaviour("switch_claus") 240 DisableBehaviour("switch_claus")
235 ShowExpression("switch_claus", "surprise") 241 ShowExpression("switch_claus", "surprise")
@@ -258,6 +264,8 @@ function hallucination_interior.switch_claus_attention()
258 FollowSprite("switch_claus", "lucas") 264 FollowSprite("switch_claus", "lucas")
259 end 265 end
260 end 266 end
267
268 gamestate.switch_claus_gaining_attention = false
261end 269end
262 270
263function hallucination_interior.switch_claus_lose_interest() 271function hallucination_interior.switch_claus_lose_interest()