diff --git a/js/game.js b/js/game.js index c27141b..64d15f9 100644 --- a/js/game.js +++ b/js/game.js @@ -355,8 +355,6 @@ export class Level extends LevelInterface { this.bonus_points = 0; this.aid = 0; - this.yellow_tank_decision = null; - // Time if (this.stored_level.time_limit === 0) { this.time_remaining = null; @@ -847,11 +845,6 @@ export class Level extends LevelInterface { this.make_actor_decision(actor, forced_only); } } - - // This only persists for a single decision phase - if (! forced_only) { - this.yellow_tank_decision = null; - } } // Lynx's combined action phase: each actor attempts to move, then cools down, in order diff --git a/js/tiletypes.js b/js/tiletypes.js index 8454ebb..a522e11 100644 --- a/js/tiletypes.js +++ b/js/tiletypes.js @@ -1448,7 +1448,11 @@ const TILE_TYPES = { draw_layer: DRAW_LAYERS.terrain, on_arrive(me, level, other) { level.sfx.play_once('button-press', me.cell); - level.yellow_tank_decision = other.direction; + for (let actor of level.actors) { + if (actor.type.name === 'tank_yellow') { + level._set_tile_prop(actor, 'pending_decision', other.direction); + } + } }, on_depart(me, level, other) { level.sfx.play_once('button-release', me.cell); @@ -1916,7 +1920,15 @@ const TILE_TYPES = { }, movement_speed: 4, decide_movement(me, level) { - return [level.yellow_tank_decision, null]; + if (me.pending_decision) { + let decision = me.pending_decision; + level._set_tile_prop(me, 'pending_decision', null); + // Yellow tanks don't keep trying to move if blocked + return [decision, null]; + } + else { + return null; + } } }, blob: {