mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-02-19 20:02:35 +01:00
Rollers and teleporting to seats fixed
This commit is contained in:
parent
0dee065524
commit
90918309b7
@ -48,15 +48,17 @@ public class InteractionDefault extends HabboItem {
|
|||||||
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
|
public void onMove(Room room, RoomTile oldLocation, RoomTile newLocation) {
|
||||||
super.onMove(room, oldLocation, newLocation);
|
super.onMove(room, oldLocation, newLocation);
|
||||||
|
|
||||||
for (RoomUnit unit : room.getRoomUnits()) {
|
if(room.getItemsAt(oldLocation).stream().noneMatch(item -> item.getClass().isAssignableFrom(InteractionRoller.class))) {
|
||||||
if (!oldLocation.unitIsOnFurniOnTile(unit, this.getBaseItem()))
|
for (RoomUnit unit : room.getRoomUnits()) {
|
||||||
continue; // If the unit was previously on the furni...
|
if (!oldLocation.unitIsOnFurniOnTile(unit, this.getBaseItem()))
|
||||||
if (newLocation.unitIsOnFurniOnTile(unit, this.getBaseItem())) continue; // but is not anymore...
|
continue; // If the unit was previously on the furni...
|
||||||
|
if (newLocation.unitIsOnFurniOnTile(unit, this.getBaseItem())) continue; // but is not anymore...
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.onWalkOff(unit, room, new Object[]{ oldLocation, newLocation }); // the unit walked off!
|
this.onWalkOff(unit, room, new Object[]{oldLocation, newLocation}); // the unit walked off!
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1462,7 +1462,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
tile.setStackHeight(ridingUnit.getZ() + zOffset);
|
tile.setStackHeight(ridingUnit.getZ() + zOffset);
|
||||||
rolledUnitIds.add(ridingUnit.getId());
|
rolledUnitIds.add(ridingUnit.getId());
|
||||||
updatedUnit.remove(ridingUnit);
|
updatedUnit.remove(ridingUnit);
|
||||||
messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tile, tile.getStackHeight() + (nextTileChair != null ? -1 : 0), room));
|
messages.add(new RoomUnitOnRollerComposer(ridingUnit, roller, ridingUnit.getCurrentLocation(), ridingUnit.getZ(), tile, tile.getStackHeight(), room));
|
||||||
isRiding = true;
|
isRiding = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1471,7 +1471,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
usersRolledThisTile.add(unit.getId());
|
usersRolledThisTile.add(unit.getId());
|
||||||
rolledUnitIds.add(unit.getId());
|
rolledUnitIds.add(unit.getId());
|
||||||
updatedUnit.remove(unit);
|
updatedUnit.remove(unit);
|
||||||
messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tile, tile.getStackHeight() + (isRiding ? 1 : 0) + (nextTileChair != null ? -1 : 0), room));
|
messages.add(new RoomUnitOnRollerComposer(unit, roller, unit.getCurrentLocation(), unit.getZ() + (isRiding ? 1 : 0), tile, tile.getStackHeight() + (isRiding ? 1 : 0), room));
|
||||||
|
|
||||||
if (itemsOnRoller.isEmpty()) {
|
if (itemsOnRoller.isEmpty()) {
|
||||||
HabboItem item = room.getTopItemAt(tileInFront.x, tileInFront.y);
|
HabboItem item = room.getTopItemAt(tileInFront.x, tileInFront.y);
|
||||||
@ -3613,7 +3613,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
HabboItem item = this.getTopItemAt(x, y, exclude);
|
HabboItem item = this.getTopItemAt(x, y, exclude);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
canStack = item.getBaseItem().allowStack();
|
canStack = item.getBaseItem().allowStack();
|
||||||
height = item.getZ() + Item.getCurrentHeight(item);
|
height = item.getZ() + (item.getBaseItem().allowSit() ? 0 : Item.getCurrentHeight(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*HabboItem lowestChair = this.getLowestChair(x, y);
|
/*HabboItem lowestChair = this.getLowestChair(x, y);
|
||||||
|
@ -51,7 +51,8 @@ public class RoomUserLookAtPoint extends MessageHandler {
|
|||||||
|
|
||||||
if (tile != null) {
|
if (tile != null) {
|
||||||
roomUnit.lookAtPoint(tile);
|
roomUnit.lookAtPoint(tile);
|
||||||
room.sendComposer(new RoomUserStatusComposer(roomUnit).compose());
|
roomUnit.statusUpdate(true);
|
||||||
|
//room.sendComposer(new RoomUserStatusComposer(roomUnit).compose());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ public class FloorItemOnRollerComposer extends MessageComposer {
|
|||||||
THashSet<RoomTile> tiles = this.room.getLayout().getTilesAt(this.room.getLayout().getTile(oldX, oldY), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation());
|
THashSet<RoomTile> tiles = this.room.getLayout().getTilesAt(this.room.getLayout().getTile(oldX, oldY), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation());
|
||||||
tiles.addAll(this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation()));
|
tiles.addAll(this.room.getLayout().getTilesAt(this.room.getLayout().getTile(this.item.getX(), this.item.getY()), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation()));
|
||||||
this.room.updateTiles(tiles);
|
this.room.updateTiles(tiles);
|
||||||
this.room.sendComposer(new UpdateStackHeightComposer(oldX, oldY, this.room.getStackHeight(oldX, oldY, true)).compose());
|
//this.room.sendComposer(new UpdateStackHeightComposer(oldX, oldY, this.room.getStackHeight(oldX, oldY, true)).compose());
|
||||||
//
|
//
|
||||||
//this.room.updateHabbosAt(RoomLayout.getRectangle(this.item.getX(), this.item.getY(), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation()));
|
//this.room.updateHabbosAt(RoomLayout.getRectangle(this.item.getX(), this.item.getY(), this.item.getBaseItem().getWidth(), this.item.getBaseItem().getLength(), this.item.getRotation()));
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.items.interactions.InteractionRoller;
|
|||||||
import com.eu.habbo.habbohotel.rooms.Room;
|
import com.eu.habbo.habbohotel.rooms.Room;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import com.eu.habbo.habbohotel.users.HabboItem;
|
import com.eu.habbo.habbohotel.users.HabboItem;
|
||||||
import com.eu.habbo.messages.ServerMessage;
|
import com.eu.habbo.messages.ServerMessage;
|
||||||
import com.eu.habbo.messages.outgoing.MessageComposer;
|
import com.eu.habbo.messages.outgoing.MessageComposer;
|
||||||
@ -66,25 +67,53 @@ public class RoomUnitOnRollerComposer extends MessageComposer {
|
|||||||
this.response.appendString(this.newZ + "");
|
this.response.appendString(this.newZ + "");
|
||||||
|
|
||||||
if (this.roller != null && room.getLayout() != null) {
|
if (this.roller != null && room.getLayout() != null) {
|
||||||
RoomTile rollerTile = room.getLayout().getTile(this.roller.getX(), this.roller.getY());
|
|
||||||
HabboItem topItem = this.room.getTopItemAt(this.roomUnit.getCurrentLocation().x, this.roomUnit.getCurrentLocation().y);
|
|
||||||
if (topItem != null && (topItem == roller || oldTopItem != topItem)) {
|
|
||||||
try {
|
|
||||||
topItem.onWalkOff(this.roomUnit, this.room, new Object[]{this});
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.error("Caught exception", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Emulator.getThreading().run(() -> {
|
Emulator.getThreading().run(() -> {
|
||||||
if (RoomUnitOnRollerComposer.this.oldLocation == rollerTile && RoomUnitOnRollerComposer.this.roomUnit.getGoal() == rollerTile) {
|
if(!this.roomUnit.isWalking() && this.roomUnit.getCurrentLocation() == this.oldLocation) {
|
||||||
RoomUnitOnRollerComposer.this.roomUnit.setLocation(room.getLayout().getTile(newLocation.x, newLocation.y));
|
HabboItem topItem = this.room.getTopItemAt(this.oldLocation.x, this.oldLocation.y);
|
||||||
RoomUnitOnRollerComposer.this.roomUnit.setPreviousLocationZ(RoomUnitOnRollerComposer.this.newLocation.getStackHeight());
|
HabboItem topItemNewLocation = this.room.getTopItemAt(this.newLocation.x, this.newLocation.y);
|
||||||
RoomUnitOnRollerComposer.this.roomUnit.setZ(RoomUnitOnRollerComposer.this.newLocation.getStackHeight());
|
|
||||||
RoomUnitOnRollerComposer.this.roomUnit.sitUpdate = true;
|
|
||||||
|
|
||||||
|
if (topItem != null && (oldTopItem == null || oldTopItem != topItemNewLocation)) {
|
||||||
|
try {
|
||||||
|
topItem.onWalkOff(this.roomUnit, this.room, new Object[]{this});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Caught exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.roomUnit.setLocation(this.newLocation);
|
||||||
|
this.roomUnit.setZ(this.newLocation.getStackHeight());
|
||||||
|
this.roomUnit.setPreviousLocationZ(this.newLocation.getStackHeight());
|
||||||
|
|
||||||
|
if (topItemNewLocation != null && topItemNewLocation != roller && oldTopItem != topItemNewLocation) {
|
||||||
|
try {
|
||||||
|
topItemNewLocation.onWalkOn(this.roomUnit, this.room, new Object[]{this});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Caught exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, this.room.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY);
|
}, this.room.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY);
|
||||||
|
/*
|
||||||
|
RoomTile rollerTile = room.getLayout().getTile(this.roller.getX(), this.roller.getY());
|
||||||
|
Emulator.getThreading().run(() -> {
|
||||||
|
if (this.oldLocation == rollerTile && this.roomUnit.getGoal() == rollerTile) {
|
||||||
|
this.roomUnit.setLocation(newLocation);
|
||||||
|
this.roomUnit.setGoalLocation(newLocation);
|
||||||
|
this.roomUnit.setPreviousLocationZ(newLocation.getStackHeight());
|
||||||
|
this.roomUnit.setZ(newLocation.getStackHeight());
|
||||||
|
this.roomUnit.sitUpdate = true;
|
||||||
|
|
||||||
|
HabboItem topItem = this.room.getTopItemAt(this.roomUnit.getCurrentLocation().x, this.roomUnit.getCurrentLocation().y);
|
||||||
|
if (topItem != null && topItem != roller && oldTopItem != topItem) {
|
||||||
|
try {
|
||||||
|
topItem.onWalkOff(this.roomUnit, this.room, new Object[]{this});
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Caught exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, this.room.getRollerSpeed() == 0 ? 250 : InteractionRoller.DELAY);
|
||||||
|
*/
|
||||||
} else {
|
} else {
|
||||||
this.roomUnit.setLocation(this.newLocation);
|
this.roomUnit.setLocation(this.newLocation);
|
||||||
this.roomUnit.setZ(this.newZ);
|
this.roomUnit.setZ(this.newZ);
|
||||||
|
@ -54,9 +54,9 @@ public class RoomUnitTeleport implements Runnable {
|
|||||||
this.roomUnit.setZ(this.z);
|
this.roomUnit.setZ(this.z);
|
||||||
this.roomUnit.setPreviousLocationZ(this.z);
|
this.roomUnit.setPreviousLocationZ(this.z);
|
||||||
this.roomUnit.removeStatus(RoomUnitStatus.MOVE);
|
this.roomUnit.removeStatus(RoomUnitStatus.MOVE);
|
||||||
ServerMessage teleportMessage = new RoomUnitOnRollerComposer(this.roomUnit, newLocation, this.room).compose();
|
//ServerMessage teleportMessage = new RoomUnitOnRollerComposer(this.roomUnit, newLocation, this.room).compose();
|
||||||
this.roomUnit.setLocation(newLocation);
|
this.roomUnit.setLocation(newLocation);
|
||||||
this.room.sendComposer(teleportMessage);
|
//this.room.sendComposer(teleportMessage);
|
||||||
roomUnit.isWiredTeleporting = false;
|
roomUnit.isWiredTeleporting = false;
|
||||||
|
|
||||||
this.room.updateHabbosAt(newLocation.x, newLocation.y);
|
this.room.updateHabbosAt(newLocation.x, newLocation.y);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user