// If any monsters somehow spawned on an unwalkable tile, we move the monster to a new position on the spawnarea
// This could happen if we change some tile to non-walkable in a future version.
for (PredefinedMap map : world.maps.predefinedMaps) {
+ Coord playerPosition = null;
+ if (map == model.currentMap) playerPosition = model.player.position;
for (MonsterSpawnArea a : map.spawnAreas) {
for (Monster m : a.monsters) {
if (!map.isWalkable(m.rectPosition)) {
- Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, model.player.position);
+ Coord p = map.getRandomFreePosition(a.area, m.actorTraits.tileSize, playerPosition);
if (p == null) continue;
m.position.set(p);
}