Fix sokoban buttons to count being pressed at level start

This commit is contained in:
Eevee (Evelyn Woods) 2021-05-26 22:49:29 -06:00
parent 3752902663
commit ca1a48c0fe

View File

@ -1387,6 +1387,20 @@ const TILE_TYPES = {
populate_defaults(me) {
me.color = 'red';
},
on_ready(me, level) {
if (me.cell.get_actor()) {
// Already held down, make sure the level knows
level.sokoban_buttons_unpressed[me.color] -= 1;
if (level.sokoban_buttons_unpressed[me.color] === 0) {
for (let cell of level.linear_cells) {
let terrain = cell.get_terrain();
if (terrain.type.name === 'sokoban_wall' && terrain.color === me.color) {
terrain.type = TILE_TYPES['sokoban_floor'];
}
}
}
}
},
on_arrive(me, level, other) {
if (other.type.name === 'sokoban_block' && me.color !== other.color)
return;