Make teleporters work more like in Habbo

This commit is contained in:
Alejandro 2019-05-26 21:08:03 +03:00
parent f774e73cf9
commit 892900af33
2 changed files with 9 additions and 13 deletions

View File

@ -230,7 +230,7 @@ public class InteractionTeleport extends HabboItem
this.roomUnitID = -1; this.roomUnitID = -1;
habbo.getRoomUnit().isTeleporting = true; habbo.getRoomUnit().isTeleporting = true;
room.scheduledTasks.add(new TeleportActionOne(this, room, habbo.getClient())); Emulator.getThreading().run(new TeleportActionOne(this, room, habbo.getClient()), 500);
} }
@Override @Override

View File

@ -36,23 +36,19 @@ public class InteractionTeleportTile extends InteractionTeleport
@Override @Override
public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception public void onWalkOn(RoomUnit roomUnit, Room room, Object[] objects) throws Exception
{ {
if (roomUnit != null) if (roomUnit != null && this.canWalkOn(roomUnit, room, objects))
{ {
RoomTile currentLocation = room.getLayout().getTile(this.getX(), this.getY()); Habbo habbo = room.getHabbo(roomUnit);
if (roomUnit.getGoal().equals(currentLocation) && this.canWalkOn(roomUnit, room, objects)) if (habbo != null)
{ {
Habbo habbo = room.getHabbo(roomUnit); if(!canUseTeleport(habbo.getClient(), room))
return;
if (habbo != null) if (!habbo.getRoomUnit().isTeleporting)
{ {
if(!canUseTeleport(habbo.getClient(), room)) habbo.getRoomUnit().setGoalLocation(habbo.getRoomUnit().getCurrentLocation());
return; this.startTeleport(room, habbo);
if (!habbo.getRoomUnit().isTeleporting)
{
this.startTeleport(room, habbo);
}
} }
} }
} }