Only move item with wired if location or rotation changed

This commit is contained in:
Beny 2020-10-15 05:03:47 +02:00
parent f8d0893c13
commit 3c4782ef3d
4 changed files with 7 additions and 6 deletions

View File

@ -55,7 +55,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
HabboItem item = room.getHabboItem(setting.itemId);
if (item != null) {
if (this.state && (this.checkForWiredResetPermission && item.allowWiredResetState())) {
if (!setting.state.equals(" ")) {
if (!setting.state.equals(" ") && !item.getExtradata().equals(setting.state)) {
item.setExtradata(setting.state);
room.updateItemState(item);
}
@ -72,9 +72,10 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
else if(this.position) {
boolean slideAnimation = !this.direction || item.getRotation() == setting.rotation;
RoomTile newLocation = room.getLayout().getTile((short) setting.x, (short) setting.y);
int newRotation = this.direction ? setting.rotation : item.getRotation();
if(newLocation != null && newLocation.state != RoomTileState.INVALID && room.furnitureFitsAt(newLocation, item, this.direction ? setting.rotation : item.getRotation(), true) == FurnitureMovementError.NONE) {
if(room.moveFurniTo(item, newLocation, this.direction ? setting.rotation : item.getRotation(), null, !slideAnimation) == FurnitureMovementError.NONE) {
if(newLocation != null && newLocation.state != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && room.furnitureFitsAt(newLocation, item, newRotation, true) == FurnitureMovementError.NONE) {
if(room.moveFurniTo(item, newLocation, newRotation, null, !slideAnimation) == FurnitureMovementError.NONE) {
if(slideAnimation) {
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
}

View File

@ -86,7 +86,7 @@ public class WiredEffectMoveFurniAway extends InteractionWiredEffect {
RoomTile oldLocation = room.getLayout().getTile(item.getX(), item.getY());
double oldZ = item.getZ();
if(newLocation != null && newLocation.state != RoomTileState.INVALID && room.furnitureFitsAt(newLocation, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
if(newLocation != null && newLocation.state != RoomTileState.INVALID && newLocation != oldLocation && room.furnitureFitsAt(newLocation, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
if(room.moveFurniTo(item, newLocation, item.getRotation(), null, false) == FurnitureMovementError.NONE) {
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());
}

View File

@ -220,7 +220,7 @@ public class WiredEffectMoveFurniTowards extends InteractionWiredEffect {
if(newTile != null) {
lastDirections.put(item.getId(), moveDirection);
if(newTile.state != RoomTileState.INVALID && room.furnitureFitsAt(newTile, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
if(newTile.state != RoomTileState.INVALID && newTile != oldLocation && room.furnitureFitsAt(newTile, item, item.getRotation(), true) == FurnitureMovementError.NONE) {
if (room.moveFurniTo(item, newTile, item.getRotation(), null, false) == FurnitureMovementError.NONE) {
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newTile, item.getZ(), 0, room).compose());
}

View File

@ -66,7 +66,7 @@ public class WiredEffectMoveRotateFurni extends InteractionWiredEffect {
boolean slideAnimation = item.getRotation() == newRotation;
FurnitureMovementError furniMoveTest = room.furnitureFitsAt(newLocation, item, newRotation, true);
if(newLocation != null && newLocation.state != RoomTileState.INVALID && (furniMoveTest == FurnitureMovementError.NONE || ((furniMoveTest == FurnitureMovementError.TILE_HAS_BOTS || furniMoveTest == FurnitureMovementError.TILE_HAS_HABBOS || furniMoveTest == FurnitureMovementError.TILE_HAS_PETS) && newLocation == oldLocation))) {
if(newLocation != null && newLocation.state != RoomTileState.INVALID && (newLocation != oldLocation || newRotation != item.getRotation()) && (furniMoveTest == FurnitureMovementError.NONE || ((furniMoveTest == FurnitureMovementError.TILE_HAS_BOTS || furniMoveTest == FurnitureMovementError.TILE_HAS_HABBOS || furniMoveTest == FurnitureMovementError.TILE_HAS_PETS) && newLocation == oldLocation))) {
if(room.furnitureFitsAt(newLocation, item, newRotation, false) == FurnitureMovementError.NONE && room.moveFurniTo(item, newLocation, newRotation, null, !slideAnimation) == FurnitureMovementError.NONE) {
if(slideAnimation) {
room.sendComposer(new FloorItemOnRollerComposer(item, null, oldLocation, oldZ, newLocation, item.getZ(), 0, room).compose());