diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-03-09 17:15:25 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2021-03-09 17:15:25 -0500 |
commit | 842a4340e2e1c9c3fa357cab016af624a3ea33fb (patch) | |
tree | b11ef4aafa3460c1bdfbb29d06a909ba61b659e3 /res | |
parent | aac3b1bc1ba48b6e50f661b97326ef191cce3e6c (diff) | |
download | tanetane-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.lua | 8 |
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 | |||
230 | function hallucination_interior.switch_claus_attention() | 230 | function 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 | ||
261 | end | 269 | end |
262 | 270 | ||
263 | function hallucination_interior.switch_claus_lose_interest() | 271 | function hallucination_interior.switch_claus_lose_interest() |