Fix wf_act_match_to_sshot packet sending (closes #338)

This commit is contained in:
Alejandro 2020-01-27 19:43:17 +02:00
parent b439774c11
commit fe78102678

View File

@ -57,7 +57,9 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
int oldRotation = item.getRotation(); int oldRotation = item.getRotation();
boolean slideAnimation = true; boolean slideAnimation = true;
if (this.direction) { double offsetZ = 0;
if (this.direction && item.getRotation() != setting.rotation) {
item.setRotation(setting.rotation); item.setRotation(setting.rotation);
slideAnimation = false; slideAnimation = false;
@ -73,12 +75,9 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
}); });
} }
//room.sendComposer(new ItemStateComposer(item).compose());
room.sendComposer(new FloorItemUpdateComposer(item).compose());
if (this.position) {
RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y); RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y);
if (this.position) {
if (t != null) { if (t != null) {
if (t.state != RoomTileState.INVALID) { if (t.state != RoomTileState.INVALID) {
boolean canMove = true; boolean canMove = true;
@ -111,7 +110,7 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
if (highestZ != -1d) { if (highestZ != -1d) {
tilesToUpdate.addAll(tiles); tilesToUpdate.addAll(tiles);
double offsetZ = highestZ - item.getZ(); offsetZ = highestZ - item.getZ();
double totalHeight = item.getZ() + offsetZ; 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)); tilesToUpdate.addAll(room.getLayout().getTilesAt(room.getLayout().getTile(item.getX(), item.getY()), item.getBaseItem().getWidth(), item.getBaseItem().getLength(), oldRotation));
@ -120,12 +119,16 @@ public class WiredEffectMatchFurni extends InteractionWiredEffect {
item.setX(t.x); item.setX(t.x);
item.setY(t.y); item.setY(t.y);
} }
}
}
}
}
}
if (slideAnimation && t != null) {
room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose()); room.sendComposer(new FloorItemOnRollerComposer(item, null, t, offsetZ, room).compose());
} } else {
} room.updateItem(item);
}
}
} }
item.needsUpdate(true); item.needsUpdate(true);