From 8adb814f66336fd227f4913b8316b283850117a8 Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Thu, 27 Feb 2020 23:52:40 +0200 Subject: [PATCH] Fix bot placing on chairs and beds --- .../java/com/eu/habbo/habbohotel/bots/BotManager.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java index 97484248..04e92001 100644 --- a/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java +++ b/src/main/java/com/eu/habbo/habbohotel/bots/BotManager.java @@ -113,15 +113,19 @@ public class BotManager { return; } - if (!room.hasHabbosAt(location.x, location.y) && !location.isWalkable() && location.state != RoomTileState.SIT) + if (!room.hasHabbosAt(location.x, location.y) && !location.isWalkable() && location.state != RoomTileState.SIT && location.state != RoomTileState.LAY) return; RoomUnit roomUnit = new RoomUnit(); roomUnit.setRotation(RoomUserRotation.SOUTH); roomUnit.setLocation(location); HabboItem topItem = room.getTopItemAt(location.x, location.y); - roomUnit.setZ(roomUnit.getCurrentLocation().getStackHeight()); - roomUnit.setPreviousLocationZ(roomUnit.getCurrentLocation().getStackHeight()); + + double topItemHeight = 0; + if (topItem != null) topItemHeight = Item.getCurrentHeight(topItem); + roomUnit.setPreviousLocationZ(roomUnit.getCurrentLocation().getStackHeight() - topItemHeight); + + roomUnit.setPathFinderRoom(room); roomUnit.setRoomUnitType(RoomUnitType.BOT); roomUnit.setCanWalk(room.isAllowBotsWalk()); @@ -136,7 +140,6 @@ public class BotManager { bot.onPlace(habbo, room); if (topItem != null) { - roomUnit.setZ(topItem.getBaseItem().allowSit() ? topItem.getZ() : topItem.getZ() + Item.getCurrentHeight(topItem)); try { topItem.onWalkOn(bot.getRoomUnit(), room, null); } catch (Exception e) {