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>(); List<Runnable> onFail = new ArrayList<Runnable>();
onSuccess.add(() -> { onSuccess.add(() -> {
unit.setCanLeaveRoomByDoor(false);
walkable = this.getBaseItem().allowWalk(); walkable = this.getBaseItem().allowWalk();
room.updateTile(currentLocation); RoomTile tile = room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation() + 4);
room.sendComposer(new ItemIntStateComposer(this.getId(), 0).compose()); unit.setGoalLocation(tile);
unit.removeOverrideTile(currentLocation); Emulator.getThreading().run(new RoomUnitWalkToLocation(unit, tile, room, onFail, onFail));
unit.setGoalLocation(room.getLayout().getTileInFront(room.getLayout().getTile(this.getX(), this.getY()), this.getRotation() + 4));
}); });
onFail.add(() -> { onFail.add(() -> {
unit.setCanLeaveRoomByDoor(true);
walkable = this.getBaseItem().allowWalk(); walkable = this.getBaseItem().allowWalk();
room.updateTile(currentLocation); room.updateTile(currentLocation);
room.sendComposer(new ItemIntStateComposer(this.getId(), 0).compose()); room.sendComposer(new ItemIntStateComposer(this.getId(), 0).compose());

View File

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

View File

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

View File

@ -57,6 +57,7 @@ public class RoomUnit
private boolean statusUpdate = false; private boolean statusUpdate = false;
private boolean invisible = false; private boolean invisible = false;
private boolean lastCycleStatus = false; private boolean lastCycleStatus = false;
private boolean canLeaveRoomByDoor = true;
private final ConcurrentHashMap<RoomUnitStatus, String> status; private final ConcurrentHashMap<RoomUnitStatus, String> status;
private final THashMap<String, Object> cacheable; private final THashMap<String, Object> cacheable;
@ -383,7 +384,7 @@ public class RoomUnit
if (habbo != null) 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); Emulator.getThreading().run(new RoomUnitKick(habbo, room, false), 500);
} }
@ -824,4 +825,12 @@ public class RoomUnit
public void clearOverrideTiles() { public void clearOverrideTiles() {
this.overridableTiles.clear(); 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.rooms.*;
import com.eu.habbo.habbohotel.users.HabboItem; import com.eu.habbo.habbohotel.users.HabboItem;
import com.eu.habbo.threading.runnables.HabboItemNewState; 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 class TeleportActionFive implements Runnable
{ {
@ -22,8 +26,10 @@ class TeleportActionFive implements Runnable
@Override @Override
public void run() public void run()
{ {
this.client.getHabbo().getRoomUnit().isTeleporting = false; RoomUnit unit = this.client.getHabbo().getRoomUnit();
this.client.getHabbo().getRoomUnit().setCanWalk(true);
unit.isTeleporting = false;
unit.setCanWalk(true);
if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != this.room) if (this.client.getHabbo().getHabboInfo().getCurrentRoom() != this.room)
return; return;
@ -35,10 +41,16 @@ class TeleportActionFive implements Runnable
if (tile != null) if (tile != null)
{ {
this.client.getHabbo().getRoomUnit().setGoalLocation(tile); List<Runnable> onSuccess = new ArrayList<Runnable>();
this.client.getHabbo().getRoomUnit().statusUpdate(true); 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.currentTeleport.setExtradata("1");
this.room.updateItem(this.currentTeleport); this.room.updateItem(this.currentTeleport);