mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-22 23:10:52 +01:00
Merge branch 'bot-rotation' into 'dev'
Make bots rotate on furniture rotation See merge request morningstar/Arcturus-Community!24
This commit is contained in:
commit
7098b80121
@ -759,6 +759,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
|
||||
for (RoomTile tile : updatedTiles)
|
||||
{
|
||||
this.updateHabbosAt(tile.x, tile.y);
|
||||
this.updateBotsAt(tile.x, tile.y);
|
||||
}
|
||||
}
|
||||
else if (item.getBaseItem().getType() == FurnitureType.WALL)
|
||||
@ -879,6 +880,41 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
|
||||
}
|
||||
}
|
||||
|
||||
private void updateBotsAt(short x, short y)
|
||||
{
|
||||
HabboItem topItem = this.getTopItemAt(x, y);
|
||||
|
||||
THashSet<RoomUnit> roomUnits = new THashSet<>();
|
||||
|
||||
for (Bot bot: this.getBotsAt(this.layout.getTile(x, y))) {
|
||||
if (topItem != null)
|
||||
{
|
||||
if (topItem.getBaseItem().allowSit())
|
||||
{
|
||||
bot.getRoomUnit().setZ(topItem.getZ());
|
||||
bot.getRoomUnit().setPreviousLocationZ(topItem.getZ());
|
||||
bot.getRoomUnit().setRotation(RoomUserRotation.fromValue(topItem.getRotation()));
|
||||
} else{
|
||||
bot.getRoomUnit().setZ(topItem.getZ() + topItem.getBaseItem().getHeight());
|
||||
|
||||
if (topItem.getBaseItem().allowLay())
|
||||
{
|
||||
bot.getRoomUnit().setStatus(RoomUnitStatus.LAY, (topItem.getZ() + topItem.getBaseItem().getHeight()) + "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bot.getRoomUnit().setZ(bot.getRoomUnit().getCurrentLocation().getStackHeight());
|
||||
}
|
||||
|
||||
roomUnits.add(bot.getRoomUnit());
|
||||
}
|
||||
|
||||
if (!roomUnits.isEmpty())
|
||||
{
|
||||
this.sendComposer(new RoomUserStatusComposer(roomUnits, true).compose());
|
||||
}
|
||||
}
|
||||
|
||||
public void pickupPetsForHabbo(Habbo habbo)
|
||||
{
|
||||
THashSet<Pet> pets = new THashSet<>();
|
||||
@ -5449,6 +5485,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
|
||||
for (RoomTile t : occupiedTiles)
|
||||
{
|
||||
this.updateHabbosAt(t.x, t.y);
|
||||
this.updateBotsAt(t.x, t.y);
|
||||
}
|
||||
|
||||
Emulator.getThreading().run(item);
|
||||
@ -5572,6 +5609,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
|
||||
for (RoomTile t : occupiedTiles)
|
||||
{
|
||||
this.updateHabbosAt(t.x, t.y);
|
||||
this.updateBotsAt(t.x, t.y);
|
||||
}
|
||||
return FurnitureMovementError.NONE;
|
||||
}
|
||||
@ -5620,6 +5658,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable
|
||||
for (RoomTile t : occupiedTiles)
|
||||
{
|
||||
this.updateHabbosAt(t.x, t.y);
|
||||
this.updateBotsAt(t.x, t.y);
|
||||
}
|
||||
return FurnitureMovementError.NONE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user