fixed bug where behavior would not continue after cutscene
This commit is contained in:
		
							parent
							
								
									d4a7de346d
								
							
						
					
					
						commit
						b42eb143f0
					
				| @ -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; | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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) { | ||||||
|  | |||||||
| @ -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); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user