cygni / paintbot

An alternative to Snakebot, inspired by Bomberman's paint mode
MIT License
0 stars 4 forks source link

Preserve collision and explosion info long enough for players receive them #55

Closed 89netraM closed 3 years ago

89netraM commented 3 years ago

Currently when updating the WorldState, the collisions and the explosions are reset before being transmitted to the players. This is because DecrementStun returns a new modified, and unfortunately incomplete, copy of the world.

This PR fixes that problem and adds a test to detect the same problem in the future. To prevent similar problems in the future, this is done by introducing a set of "with" methods (withTiles, withCollisions, and withExplosions). These methods return an updated copy of the world, and are easier to maintain than when adding new properties in the future.