Merge branch '46-bug-teleports' into 'dev'

Resolve "Bug: Teleports"

See merge request morningstar/Arcturus-Community!31
This commit is contained in:
Beny 2019-05-15 17:54:48 -04:00
commit 4e1f3c3ff9
5 changed files with 36 additions and 11 deletions

View File

@ -91,15 +91,15 @@ public class InteractionOneWayGate extends HabboItem
List<Runnable> onFail = new ArrayList<Runnable>();
onSuccess.add(() -> {
unit.setCanLeaveRoomByDoor(false);
walkable = this.getBaseItem().allowWalk();
room.updateTile(currentLocation);
room.sendComposer(new ItemIntStateComposer(this.getId(), 0).compose());
unit.removeOverrideTile(currentLocation);
unit.setGoalLocation(room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation() + 4));
RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation() + 4);
unit.setGoalLocation(tile);
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tile, room, onFail, onFail));
});
onFail.add(() -> {
unit.setCanLeaveRoomByDoor(true);
walkable = this.getBaseItem().allowWalk();
room.updateTile(currentLocation);
room.sendComposer(new ItemIntStateComposer(this.getId(), 0).compose());

View File

@ -103,6 +103,7 @@ public class InteractionTeleport extends HabboItem
room.updateTile(currentLocation);
tryTeleport(client, room);
unit.removeOverrideTile(currentLocation);
unit.setCanLeaveRoomByDoor(true);
});
onFail.add(() -> {
@ -112,12 +113,14 @@ public class InteractionTeleport extends HabboItem
room.updateItem(this);
this.roomUnitID = -1;
unit.removeOverrideTile(currentLocation);
unit.setCanLeaveRoomByDoor(true);
});
walkable = true;
room.updateTile(currentLocation);
unit.addOverrideTile(currentLocation);
unit.setGoalLocation(currentLocation);
unit.setCanLeaveRoomByDoor(false);
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, currentLocation, room, onSuccess, onFail));
}
else {

View File

@ -720,6 +720,7 @@ public class RoomManager
habbo.getRoomUnit().setHeadRotation(RoomUserRotation.values()[room.getLayout().getDoorDirection()]);
}
else {
habbo.getRoomUnit().setCanLeaveRoomByDoor(false);
habbo.getRoomUnit().isTeleporting = true;
HabboItem topItem = room.getTopItemAt(doorLocation.x, doorLocation.y);
if(topItem != null) {

View File

@ -57,6 +57,7 @@ public class RoomUnit
private boolean statusUpdate = false;
private boolean invisible = false;
private boolean lastCycleStatus = false;
private boolean canLeaveRoomByDoor = true;
private final ConcurrentHashMap<RoomUnitStatus, String> status;
private final THashMap<String, Object> cacheable;
@ -383,7 +384,7 @@ public class RoomUnit
if (habbo != null)
{
if (next.x == room.getLayout().getDoorX() && next.y == room.getLayout().getDoorY() && (!room.isPublicRoom()) || (room.isPublicRoom() && Emulator.getConfig().getBoolean("hotel.room.public.doortile.kick")))
if (this.canLeaveRoomByDoor && next.x == room.getLayout().getDoorX() && next.y == room.getLayout().getDoorY() && (!room.isPublicRoom()) || (room.isPublicRoom() && Emulator.getConfig().getBoolean("hotel.room.public.doortile.kick")))
{
Emulator.getThreading().run(new RoomUnitKick(habbo, room, false), 500);
}
@ -824,4 +825,12 @@ public class RoomUnit
public void clearOverrideTiles() {
this.overridableTiles.clear();
}
public boolean canLeaveRoomByDoor() {
return canLeaveRoomByDoor;
}
public void setCanLeaveRoomByDoor(boolean canLeaveRoomByDoor) {
this.canLeaveRoomByDoor = canLeaveRoomByDoor;
}
}

View File

@ -5,6 +5,10 @@ import com.eu.habbo.habbohotel.gameclients.GameClient;
import com.eu.habbo.habbohotel.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.threading.runnables.HabboItemNewState;
import com.eu.habbo.threading.runnables.RoomUnitWalkToLocation;
import java.util.ArrayList;
import java.util.List;
class TeleportActionFive implements Runnable
{
@ -22,8 +26,10 @@ class TeleportActionFive implements Runnable
@Override
public void run()
{
this.client.getHabbo().getRoomUnit().isTeleporting = false;
this.client.getHabbo().getRoomUnit().setCanWalk(true);
RoomUnit unit = this.client.getHabbo().getRoomUnit();
unit.isTeleporting = false;
unit.setCanWalk(true);
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != this.room)
return;
@ -35,10 +41,16 @@ class TeleportActionFive implements Runnable
if (tile != null)
{
this.client.getHabbo().getRoomUnit().setGoalLocation(tile);
this.client.getHabbo().getRoomUnit().statusUpdate(true);
}
List<Runnable> onSuccess = new ArrayList<Runnable>();
onSuccess.add(() -> {
unit.setCanLeaveRoomByDoor(true);
});
unit.setCanLeaveRoomByDoor(false);
unit.setGoalLocation(tile);
unit.statusUpdate(true);
Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tile, room, onSuccess, onSuccess));
}
this.currentTeleport.setExtradata("1");
this.room.updateItem(this.currentTeleport);