Allow placing stack helpers on users, bots and pets

This commit is contained in:
Alejandro 2020-02-27 22:53:06 +02:00
parent b8d52b08d3
commit 09114ba977
2 changed files with 12 additions and 14 deletions

View File

@ -4366,6 +4366,8 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (!this.layout.fitsOnMap(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation))
return FurnitureMovementError.INVALID_MOVE;
if (item instanceof InteractionStackHelper) return FurnitureMovementError.NONE;
THashSet<RoomTile> occupiedTiles = this.layout.getTilesAt(tile, item.getBaseItem().getWidth(), item.getBaseItem().getLength(), rotation);
for (RoomTile t : occupiedTiles) {
@ -4374,24 +4376,20 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
if (this.hasPetsAt(t.x, t.y)) return FurnitureMovementError.TILE_HAS_PETS;
}
boolean magicTile = item instanceof InteractionStackHelper;
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
for (RoomTile t : occupiedTiles) {
tileFurniList.add(Pair.create(t, this.getItemsAt(t)));
if (!magicTile) {
List<Pair<RoomTile, THashSet<HabboItem>>> tileFurniList = new ArrayList<>();
for (RoomTile t : occupiedTiles) {
tileFurniList.add(Pair.create(t, this.getItemsAt(t)));
HabboItem topItem = this.getTopItemAt(t.x, t.y, item);
if (topItem != null && !topItem.getBaseItem().allowStack() && !t.getAllowStack()) {
return FurnitureMovementError.CANT_STACK;
}
}
if (!item.canStackAt(this, tileFurniList)) {
HabboItem topItem = this.getTopItemAt(t.x, t.y, item);
if (topItem != null && !topItem.getBaseItem().allowStack() && !t.getAllowStack()) {
return FurnitureMovementError.CANT_STACK;
}
}
if (!item.canStackAt(this, tileFurniList)) {
return FurnitureMovementError.CANT_STACK;
}
return FurnitureMovementError.NONE;
}

View File

@ -142,7 +142,7 @@ public class WiredHandler {
if (!((condition.operator() == WiredConditionOperator.OR && matchedConditions.contains(condition.getType())) ||
(condition.operator() == WiredConditionOperator.AND && condition.execute(roomUnit, room, stuff))) &&
!Emulator.getPluginManager().fireEvent(new WiredConditionFailedEvent(room, roomUnit, trigger, condition)).isCancelled()) {
return false;
}
}