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()); RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y);
room.sendComposer(new FloorItemUpdateComposer(item).compose());
if (this.position) { if (this.position) {
RoomTile t = room.getLayout().getTile((short) setting.x, (short) setting.y);
if (t != null) { if (t != null) {
if (t.state != RoomTileState.INVALID) { if (t.state != RoomTileState.INVALID) {
boolean canMove = true; boolean canMove = true;
@ -111,23 +110,27 @@ 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));
if (!slideAnimation) { if (!slideAnimation) {
item.setX(t.x); item.setX(t.x);
item.setY(t.y); 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); item.needsUpdate(true);
} }
} }