add unoptimized pathfinding
This commit is contained in:
+11
-2
@@ -3,8 +3,8 @@ import { EventEmitter } from 'node:events'
|
||||
export default class Game {
|
||||
tickRate = 30
|
||||
currentTick = 0
|
||||
width = 4000
|
||||
height = 4000
|
||||
width = 2000
|
||||
height = 2000
|
||||
|
||||
#entities = []
|
||||
#eventEmitter = new EventEmitter()
|
||||
@@ -16,11 +16,20 @@ export default class Game {
|
||||
get terrains() { return this.#terrains }
|
||||
get tickBudget() { return this.#tickBudget }
|
||||
|
||||
get unadjustedWaypoints() {
|
||||
return this.terrains.map((t) => t.unadjustedWaypoints).concat(this.entities.map((e) => e.unadjustedWaypoints)).flat()
|
||||
}
|
||||
|
||||
spawn_entity(entity) {
|
||||
this.#entities.push(entity)
|
||||
entity.game = this
|
||||
}
|
||||
|
||||
despawn(entity) {
|
||||
this.#entities = this.#entities.filter((e) => e.id != entity.id)
|
||||
entity.game = null
|
||||
}
|
||||
|
||||
add_terrain(terrain) {
|
||||
this.#terrains.push(terrain)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user