mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-01-21 19:08:30 +01:00
Bugfix: more fixes to movement of blocked monsters when loading savegames.
This commit is contained in:
@@ -255,10 +255,12 @@ public final class MovementController implements TimedMessageTask.Callback {
|
||||
// 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user