From b42eb143f001084ba0c41a175627d91331185c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Baumg=C3=A4rtner?= Date: Mon, 5 Aug 2024 18:14:13 +0200 Subject: [PATCH] fixed bug where behavior would not continue after cutscene --- GameObject.js | 2 +- OverworldMap.js | 3 +++ Person.js | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/GameObject.js b/GameObject.js index e3d7d87..83ff46d 100644 --- a/GameObject.js +++ b/GameObject.js @@ -31,7 +31,7 @@ class GameObject { async doBehaviorEvent(map) { // stop if cutscene is playing - if (map.isCutscenePlaying || this.behaviorLoop.length === 0) { + if (map.isCutscenePlaying || this.behaviorLoop.length === 0 || this.isStanding) { return; } diff --git a/OverworldMap.js b/OverworldMap.js index 21a873b..1b7a84a 100644 --- a/OverworldMap.js +++ b/OverworldMap.js @@ -47,6 +47,9 @@ class OverworldMap { } this.isCutscenePlaying = false; + + // reset npcs + Object.values(this.gameObjects).forEach(object => object.doBehaviorEvent(this)) } addWall(x, y) { diff --git a/Person.js b/Person.js index de86efd..7c55351 100644 --- a/Person.js +++ b/Person.js @@ -2,6 +2,7 @@ class Person extends GameObject { constructor(config) { super(config); this.movementProgressRemaining = 0; + this.isStanding = false; this.isPlayerControlled = config.isPlayerControlled || false; @@ -50,10 +51,12 @@ class Person extends GameObject { } if (behavior.type = "stand") { + this.isStanding = true; setTimeout(() => { utils.emitEvent("PersonStandComplete", { whoId: this.id }) + this.isStanding = false; }, behavior.time); } }