Make yellow tanks remember a yellow button press made while they were sliding
This commit is contained in:
parent
934a2ec1fa
commit
4e5b2f02d9
@ -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
|
||||
|
||||
@ -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: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user