update static_on_tic_tiles when we transmute

This commit is contained in:
Timothy Stiles 2021-02-14 19:00:58 +11:00
parent 42560626bf
commit e699172b85

View File

@ -2455,6 +2455,28 @@ export class Level extends LevelInterface {
} }
this._do_extra_cooldown(tile); this._do_extra_cooldown(tile);
} }
//update static_on_tic_tiles
//TODO: if which on_tic happens first ever matters, this will introduce a time travel bug where the order is changed by changing tiles then undoing that. hmm
if (old_type.on_tic && !new_type.on_tic)
{
//search array and remove
for (let i = 0; i < this.static_on_tic_tiles.length; ++i)
{
if (this.static_on_tic_tiles[i] == tile)
{
this.static_on_tic_tiles.splice(i, 1);
break;
}
}
}
else if (!old_type.on_tic && new_type.on_tic)
{
//add to end of array
this.static_on_tic_tiles.push(tile);
}
//TODO: update circuit networks?
} }
// Have an actor try to pick up a particular tile; it's prevented if there's a no sign, and the // Have an actor try to pick up a particular tile; it's prevented if there's a no sign, and the