From fe78102678d8550d26c854427f3aa462aade960f Mon Sep 17 00:00:00 2001 From: Alejandro <25-alejandro@users.noreply.git.krews.org> Date: Mon, 27 Jan 2020 19:43:17 +0200 Subject: [PATCH] Fix wf_act_match_to_sshot packet sending (closes #338) --- .../wired/effects/WiredEffectMatchFurni.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java index 9ee38399..796eca31 100644 --- a/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java +++ b/src/main/java/com/eu/habbo/habbohotel/items/interactions/wired/effects/WiredEffectMatchFurni.java @@ -57,7 +57,9 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { int oldRotation = item.getRotation(); boolean slideAnimation = true; - if (this.direction) { + double offsetZ = 0; + + if (this.direction && item.getRotation() != setting.rotation) { item.setRotation(setting.rotation); slideAnimation = false; @@ -73,12 +75,9 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { }); } - //room.sendComposer(new ItemStateComposer(item).compose()); - room.sendComposer(new FloorItemUpdateComposer(item).compose()); + RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y); if (this.position) { - RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y); - if (t != null) { if (t.state != RoomTileState.INVALID) { boolean canMove = true; @@ -111,23 +110,27 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect { if (highestZ != -1d) { tilesToUpdate.addAll(tiles); - double offsetZ = highestZ - item.getZ(); + offsetZ = highestZ - item.getZ(); double totalHeight = item.getZ() + offsetZ; - if(totalHeight > 40) break; + if (totalHeight > 40) break; tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation)); if (!slideAnimation) { item.setX(t.x); item.setY(t.y); } - - room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose()); } } } } } + if (slideAnimation && t != null) { + room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose()); + } else { + room.updateItem(item); + } + item.needsUpdate(true); } }