mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2025-01-31 04:12:37 +01:00
Fix vending machines without sides
This commit is contained in:
parent
8c9faa56e6
commit
706577f220
@ -83,11 +83,10 @@ public class InteractionVendingMachine extends HabboItem {
|
||||
}
|
||||
}
|
||||
|
||||
List<Runnable> onSuccess = new ArrayList<>();
|
||||
List<Runnable> onFail = new ArrayList<>();
|
||||
|
||||
RoomTile finalTile = tile;
|
||||
onSuccess.add(() -> {
|
||||
client.getHabbo().getRoomUnit().setGoalLocation(tile);
|
||||
|
||||
Emulator.getThreading().run(new RoomUnitWalkToLocation(client.getHabbo().getRoomUnit(), tile, room, () -> {
|
||||
this.setExtradata("1");
|
||||
room.scheduledComposers.add(new FloorItemUpdateComposer(this).compose());
|
||||
|
||||
@ -98,7 +97,7 @@ public class InteractionVendingMachine extends HabboItem {
|
||||
}
|
||||
|
||||
Emulator.getThreading().run(() -> {
|
||||
Runnable procedure = () -> {
|
||||
client.getHabbo().getRoomUnit().setMoveBlockingTask(Emulator.getThreading().run(() -> {
|
||||
if (client.getHabbo().getRoomUnit().getCurrentLocation().equals(finalTile)) {
|
||||
this.rotateToMachine(client.getHabbo().getRoomUnit());
|
||||
room.sendComposer(new RoomUserStatusComposer(client.getHabbo().getRoomUnit()).compose());
|
||||
@ -117,14 +116,9 @@ public class InteractionVendingMachine extends HabboItem {
|
||||
} catch (InterruptedException | ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
};
|
||||
|
||||
client.getHabbo().getRoomUnit().setMoveBlockingTask(Emulator.getThreading().run(procedure, 300));
|
||||
}, 300));
|
||||
}, 250);
|
||||
});
|
||||
|
||||
client.getHabbo().getRoomUnit().setGoalLocation(tile);
|
||||
Emulator.getThreading().run(new RoomUnitWalkToLocation(client.getHabbo().getRoomUnit(), tile, room, onSuccess, onFail));
|
||||
}, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -781,7 +781,7 @@ public class RoomUnit {
|
||||
return this.getClosestTile(
|
||||
rotations.stream()
|
||||
.map(rotation -> room.getLayout().getTileInFront(baseTile, rotation))
|
||||
.filter(t -> t != null && t.isWalkable() && !room.hasHabbosAt(t.x, t.y))
|
||||
.filter(t -> t != null && t.isWalkable() && (this.getCurrentLocation().equals(t) || !room.hasHabbosAt(t.x, t.y)))
|
||||
.collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.eu.habbo.habbohotel.rooms.Room;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomTile;
|
||||
import com.eu.habbo.habbohotel.rooms.RoomUnit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RoomUnitWalkToLocation implements Runnable {
|
||||
@ -14,6 +15,18 @@ public class RoomUnitWalkToLocation implements Runnable {
|
||||
private List<Runnable> targetReached;
|
||||
private List<Runnable> failedReached;
|
||||
|
||||
public RoomUnitWalkToLocation(RoomUnit walker, RoomTile goalTile, Room room, Runnable targetReached, Runnable failedReached) {
|
||||
this.walker = walker;
|
||||
this.goalTile = goalTile;
|
||||
this.room = room;
|
||||
|
||||
this.targetReached = new ArrayList<>();
|
||||
if (targetReached != null) this.targetReached.add(targetReached);
|
||||
|
||||
this.failedReached = new ArrayList<>();
|
||||
if (failedReached != null) this.targetReached.add(failedReached);
|
||||
}
|
||||
|
||||
public RoomUnitWalkToLocation(RoomUnit walker, RoomTile goalTile, Room room, List<Runnable> targetReached, List<Runnable> failedReached) {
|
||||
this.walker = walker;
|
||||
this.goalTile = goalTile;
|
||||
|
Loading…
x
Reference in New Issue
Block a user