Pets can swim!

This commit is contained in:
Beny 2019-05-27 01:02:30 +01:00
parent 798da6d85a
commit f5869158e4

View File

@ -144,14 +144,31 @@ public class InteractionWater extends InteractionDefault {
} }
@Override @Override
public void onWalk(RoomUnit roomUnit, Room room, Object[] objects) throws Exception { public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOn(roomUnit, room, objects);
Pet pet = room.getPet(roomUnit); Pet pet = room.getPet(roomUnit);
if (pet != null) { if(pet == null)
pet.getRoomUnit().setStatus(RoomUnitStatus.DIP, "0"); return;
if (!pet.getRoomUnit().hasStatus(RoomUnitStatus.SWIM)) {
pet.getRoomUnit().setStatus(RoomUnitStatus.SWIM, "");
} }
} }
@Override
public void onWalkOff(RoomUnit roomUnit, Room room, Object[] objects) throws Exception {
super.onWalkOff(roomUnit, room, objects);
Pet pet = room.getPet(roomUnit);
if(pet == null)
return;
pet.getRoomUnit().removeStatus(RoomUnitStatus.SWIM);
}
private void recalculate(Room room) { private void recalculate(Room room) {
THashMap<Short, TIntArrayList> tiles = new THashMap<>(); THashMap<Short, TIntArrayList> tiles = new THashMap<>();