fixed bug where behavior would not continue after cutscene

This commit is contained in:
Felix Baumgärtner 2024-08-05 18:14:13 +02:00
parent d4a7de346d
commit b42eb143f0
3 changed files with 7 additions and 1 deletions

View File

@ -31,7 +31,7 @@ class GameObject {
async doBehaviorEvent(map) { async doBehaviorEvent(map) {
// stop if cutscene is playing // stop if cutscene is playing
if (map.isCutscenePlaying || this.behaviorLoop.length === 0) { if (map.isCutscenePlaying || this.behaviorLoop.length === 0 || this.isStanding) {
return; return;
} }

View File

@ -47,6 +47,9 @@ class OverworldMap {
} }
this.isCutscenePlaying = false; this.isCutscenePlaying = false;
// reset npcs
Object.values(this.gameObjects).forEach(object => object.doBehaviorEvent(this))
} }
addWall(x, y) { addWall(x, y) {

View File

@ -2,6 +2,7 @@ class Person extends GameObject {
constructor(config) { constructor(config) {
super(config); super(config);
this.movementProgressRemaining = 0; this.movementProgressRemaining = 0;
this.isStanding = false;
this.isPlayerControlled = config.isPlayerControlled || false; this.isPlayerControlled = config.isPlayerControlled || false;
@ -50,10 +51,12 @@ class Person extends GameObject {
} }
if (behavior.type = "stand") { if (behavior.type = "stand") {
this.isStanding = true;
setTimeout(() => { setTimeout(() => {
utils.emitEvent("PersonStandComplete", { utils.emitEvent("PersonStandComplete", {
whoId: this.id whoId: this.id
}) })
this.isStanding = false;
}, behavior.time); }, behavior.time);
} }
} }