Merge branch 'fix-pets' into 'fix-pets-finally'

Fix pets and bots invalid tiles

See merge request morningstar/Arcturus-Community!519
This commit is contained in:
Harmonic 2022-04-08 00:52:00 +00:00
commit 0795a9f6ad

View File

@ -475,7 +475,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
b.setRoomUnit(new RoomUnit()); b.setRoomUnit(new RoomUnit());
b.getRoomUnit().setPathFinderRoom(this); b.getRoomUnit().setPathFinderRoom(this);
b.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y"))); b.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y")));
if (b.getRoomUnit().getCurrentLocation() == null) { if (b.getRoomUnit().getCurrentLocation() == null || b.getRoomUnit().getCurrentLocation().state == RoomTileState.INVALID) {
b.getRoomUnit().setZ(this.getLayout().getDoorTile().getStackHeight());
b.getRoomUnit().setLocation(this.getLayout().getDoorTile()); b.getRoomUnit().setLocation(this.getLayout().getDoorTile());
b.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection())); b.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection()));
} else { } else {
@ -510,7 +511,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
pet.setRoomUnit(new RoomUnit()); pet.setRoomUnit(new RoomUnit());
pet.getRoomUnit().setPathFinderRoom(this); pet.getRoomUnit().setPathFinderRoom(this);
pet.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y"))); pet.getRoomUnit().setLocation(this.layout.getTile((short) set.getInt("x"), (short) set.getInt("y")));
if (pet.getRoomUnit().getCurrentLocation() == null) { if (pet.getRoomUnit().getCurrentLocation() == null || pet.getRoomUnit().getCurrentLocation().state == RoomTileState.INVALID) {
pet.getRoomUnit().setZ(this.getLayout().getDoorTile().getStackHeight());
pet.getRoomUnit().setLocation(this.getLayout().getDoorTile()); pet.getRoomUnit().setLocation(this.getLayout().getDoorTile());
pet.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection())); pet.getRoomUnit().setRotation(RoomUserRotation.fromValue(this.getLayout().getDoorDirection()));
} else { } else {