stefanweck/dungeongeneration — pull request #4 by ruscoe (2014-06-14 19:10:51+00:00)
Title: Fixed browser crash on player death. Game now restarts with fresh map.

The issue where a JS process would lock up the browser seemed to be a result of the scheduler no longer being locked between enemy pathfinding events, which was a result of the player entity being removed. You'd end up with an enemy stuck in a loop of finding a path to the player, [somewhere in here](https://github.com/ruscoe/dungeongeneration/blob/master/lib/gameobjects/systems/pathfinding.js#L54).

I modified the combat code to lock the scheduler and set the game to an inactive state when the player is removed [here](https://github.com/ruscoe/dungeongeneration/blob/master/lib/gameobjects/systems/combat.js#L62).

I set up the game so it will automatically restart with a fresh map when it [finds itself in an inactive state](https://github.com/ruscoe/dungeongeneration/blob/master/lib/core/game.js#L221).

Seems to be working from the testing I did. Let me know what you think.