From 7a60b97ecd074a4f468f7cb4ae1047934abcc55c Mon Sep 17 00:00:00 2001 From: Beny Date: Sat, 4 May 2019 11:15:45 +0100 Subject: [PATCH] Fixed horse to work with walk through --- .../eu/habbo/habbohotel/rooms/RoomUnit.java | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java index 0f43d8f6..161284a1 100644 --- a/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java +++ b/src/main/java/com/eu/habbo/habbohotel/rooms/RoomUnit.java @@ -54,6 +54,7 @@ public class RoomUnit public int kickCount = 0; private boolean statusUpdate = false; private boolean invisible = false; + private boolean lastCycleStatus = false; private final ConcurrentHashMap status; private final THashMap cacheable; @@ -117,22 +118,32 @@ public class RoomUnit return false; } - Boolean isRiding = false; - Pet pet = room.getPet(this); - if(pet != null) { + Habbo rider = null; + if(this.getRoomUnitType() == RoomUnitType.PET) { + Pet pet = room.getPet(this); if(pet instanceof RideablePet) { - isRiding = true; - if (((RideablePet) pet).getRider() != null) { - if(!((RideablePet) pet).getRider().getRoomUnit().isWalking()) { - this.status.remove(RoomUnitStatus.MOVE); - this.setCurrentLocation(((RideablePet) pet).getRider().getRoomUnit().getPreviousLocation()); - if (this.status.remove(RoomUnitStatus.MOVE) != null) this.statusUpdate = true; - - } - } + rider = ((RideablePet) pet).getRider(); } } + if(rider != null) { + // copy things from rider + if(this.status.containsKey(RoomUnitStatus.MOVE) && !rider.getRoomUnit().getStatusMap().containsKey(RoomUnitStatus.MOVE)) { + this.status.remove(RoomUnitStatus.MOVE); + } + + if(rider.getRoomUnit().getCurrentLocation().x != this.getX() || rider.getRoomUnit().getCurrentLocation().y != this.getY()) { + this.status.put(RoomUnitStatus.MOVE, rider.getRoomUnit().getCurrentLocation().x + "," + rider.getRoomUnit().getCurrentLocation().y + "," + (rider.getRoomUnit().getCurrentLocation().getStackHeight())); + this.setPreviousLocation(rider.getRoomUnit().getPreviousLocation()); + this.setPreviousLocationZ(rider.getRoomUnit().getPreviousLocation().getStackHeight()); + this.setCurrentLocation(rider.getRoomUnit().getCurrentLocation()); + this.setZ(rider.getRoomUnit().getCurrentLocation().getStackHeight()); + } + + return this.statusUpdate; + } + + if (!this.isWalking() && !this.isKicked) { if (this.status.remove(RoomUnitStatus.MOVE) == null) @@ -182,9 +193,7 @@ public class RoomUnit if (next != null && room.hasHabbosAt(next.x, next.y)) { - if(!isRiding) { - return false; - } + return false; } } @@ -283,10 +292,10 @@ public class RoomUnit double zHeight = 0.0D; - if (((habbo != null && habbo.getHabboInfo().getRiding() != null) || isRiding) && next.equals(this.goalLocation) && (next.state == RoomTileState.SIT || next.state == RoomTileState.LAY)) { + /*if (((habbo != null && habbo.getHabboInfo().getRiding() != null) || isRiding) && next.equals(this.goalLocation) && (next.state == RoomTileState.SIT || next.state == RoomTileState.LAY)) { this.status.remove(RoomUnitStatus.MOVE); return false; - } + }*/ if (habbo != null) {