mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-23 15:20:52 +01:00
Merge branch '1-pathfinder-and-teleport' into 'dev'
Resolve Pathfinder range limitation See merge request morningstar/Arcturus-Community!6
This commit is contained in:
commit
83fcc87a88
@ -1,6 +1,9 @@
|
|||||||
package com.eu.habbo.habbohotel.rooms;
|
package com.eu.habbo.habbohotel.rooms;
|
||||||
|
|
||||||
import com.eu.habbo.Emulator;
|
import com.eu.habbo.Emulator;
|
||||||
|
import com.eu.habbo.habbohotel.bots.Bot;
|
||||||
|
import com.eu.habbo.habbohotel.pets.Pet;
|
||||||
|
import com.eu.habbo.habbohotel.users.Habbo;
|
||||||
import gnu.trove.set.hash.THashSet;
|
import gnu.trove.set.hash.THashSet;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@ -271,10 +274,24 @@ public class RoomLayout
|
|||||||
|
|
||||||
openList.add(oldTile.copy());
|
openList.add(oldTile.copy());
|
||||||
|
|
||||||
|
List<RoomTile> unitsAt = new ArrayList<>();
|
||||||
|
|
||||||
|
for(Bot b : this.room.getCurrentBots().valueCollection()) {
|
||||||
|
unitsAt.add(b.getRoomUnit().getCurrentLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Habbo b : this.room.getCurrentHabbos().values()) {
|
||||||
|
unitsAt.add(b.getRoomUnit().getCurrentLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
for(Pet b : this.room.getCurrentPets().valueCollection()) {
|
||||||
|
unitsAt.add(b.getRoomUnit().getCurrentLocation());
|
||||||
|
}
|
||||||
|
|
||||||
long startMillis = System.currentTimeMillis();
|
long startMillis = System.currentTimeMillis();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (System.currentTimeMillis() - startMillis > 25)
|
if (System.currentTimeMillis() - startMillis > 50)
|
||||||
{
|
{
|
||||||
return new LinkedList<>();
|
return new LinkedList<>();
|
||||||
}
|
}
|
||||||
@ -294,9 +311,7 @@ public class RoomLayout
|
|||||||
if (closedList.contains(currentAdj)) continue;
|
if (closedList.contains(currentAdj)) continue;
|
||||||
|
|
||||||
//If the tile is sitable or layable and its not our goal tile, we cannot walk over it.
|
//If the tile is sitable or layable and its not our goal tile, we cannot walk over it.
|
||||||
if (
|
if (!currentAdj.equals(goalLocation) && (currentAdj.state == RoomTileState.BLOCKED || currentAdj.state == RoomTileState.SIT || currentAdj.state == RoomTileState.LAY))
|
||||||
(currentAdj.state == RoomTileState.BLOCKED) ||
|
|
||||||
((currentAdj.state == RoomTileState.SIT || currentAdj.state == RoomTileState.LAY) && !currentAdj.equals(goalLocation)))
|
|
||||||
{
|
{
|
||||||
closedList.add(currentAdj);
|
closedList.add(currentAdj);
|
||||||
openList.remove(currentAdj);
|
openList.remove(currentAdj);
|
||||||
@ -311,10 +326,10 @@ public class RoomLayout
|
|||||||
if (!ALLOW_FALLING && height < - MAXIMUM_STEP_HEIGHT) continue;
|
if (!ALLOW_FALLING && height < - MAXIMUM_STEP_HEIGHT) continue;
|
||||||
|
|
||||||
//If the step difference is bigger than the maximum step height, continue.
|
//If the step difference is bigger than the maximum step height, continue.
|
||||||
if (height > MAXIMUM_STEP_HEIGHT && currentAdj.state == RoomTileState.OPEN) continue;
|
if (currentAdj.state == RoomTileState.OPEN && height > MAXIMUM_STEP_HEIGHT) continue;
|
||||||
|
|
||||||
//Check if the tile has habbos.
|
//Check if the tile has habbos.
|
||||||
if (!this.room.isAllowWalkthrough() && this.room.hasHabbosAt(currentAdj.x, currentAdj.y))
|
if (unitsAt.contains(currentAdj) && (!this.room.isAllowWalkthrough() || currentAdj.equals(goalLocation)))
|
||||||
{
|
{
|
||||||
closedList.add(currentAdj);
|
closedList.add(currentAdj);
|
||||||
openList.remove(currentAdj);
|
openList.remove(currentAdj);
|
||||||
@ -392,11 +407,14 @@ public class RoomLayout
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
RoomTile cheapest = openList.get(0);
|
RoomTile cheapest = openList.get(0);
|
||||||
|
int cheapestFcost = Integer.MAX_VALUE;
|
||||||
for (RoomTile anOpenList : openList)
|
for (RoomTile anOpenList : openList)
|
||||||
{
|
{
|
||||||
if (anOpenList.getfCosts() < cheapest.getfCosts())
|
int f = cheapest.getfCosts();
|
||||||
|
if (anOpenList.getfCosts() < cheapestFcost)
|
||||||
{
|
{
|
||||||
cheapest = anOpenList;
|
cheapest = anOpenList;
|
||||||
|
cheapestFcost = f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cheapest;
|
return cheapest;
|
||||||
|
@ -54,6 +54,7 @@ public class RoomUnit
|
|||||||
public int kickCount = 0;
|
public int kickCount = 0;
|
||||||
private boolean statusUpdate = false;
|
private boolean statusUpdate = false;
|
||||||
private boolean invisible = false;
|
private boolean invisible = false;
|
||||||
|
private boolean lastCycleStatus = false;
|
||||||
|
|
||||||
private final ConcurrentHashMap<RoomUnitStatus, String> status;
|
private final ConcurrentHashMap<RoomUnitStatus, String> status;
|
||||||
private final THashMap<String, Object> cacheable;
|
private final THashMap<String, Object> cacheable;
|
||||||
@ -117,22 +118,32 @@ public class RoomUnit
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean isRiding = false;
|
Habbo rider = null;
|
||||||
Pet pet = room.getPet(this);
|
if(this.getRoomUnitType() == RoomUnitType.PET) {
|
||||||
if(pet != null) {
|
Pet pet = room.getPet(this);
|
||||||
if(pet instanceof RideablePet) {
|
if(pet instanceof RideablePet) {
|
||||||
isRiding = true;
|
rider = ((RideablePet) pet).getRider();
|
||||||
if (((RideablePet) pet).getRider() != null) {
|
|
||||||
if(!((RideablePet) pet).getRider().getRoomUnit().isWalking()) {
|
|
||||||
this.status.remove(RoomUnitStatus.MOVE);
|
|
||||||
this.setCurrentLocation(((RideablePet) pet).getRider().getRoomUnit().getPreviousLocation());
|
|
||||||
if (this.status.remove(RoomUnitStatus.MOVE) != null) this.statusUpdate = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(rider != null) {
|
||||||
|
// copy things from rider
|
||||||
|
if(this.status.containsKey(RoomUnitStatus.MOVE) && !rider.getRoomUnit().getStatusMap().containsKey(RoomUnitStatus.MOVE)) {
|
||||||
|
this.status.remove(RoomUnitStatus.MOVE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rider.getRoomUnit().getCurrentLocation().x != this.getX() || rider.getRoomUnit().getCurrentLocation().y != this.getY()) {
|
||||||
|
this.status.put(RoomUnitStatus.MOVE, rider.getRoomUnit().getCurrentLocation().x + "," + rider.getRoomUnit().getCurrentLocation().y + "," + (rider.getRoomUnit().getCurrentLocation().getStackHeight()));
|
||||||
|
this.setPreviousLocation(rider.getRoomUnit().getPreviousLocation());
|
||||||
|
this.setPreviousLocationZ(rider.getRoomUnit().getPreviousLocation().getStackHeight());
|
||||||
|
this.setCurrentLocation(rider.getRoomUnit().getCurrentLocation());
|
||||||
|
this.setZ(rider.getRoomUnit().getCurrentLocation().getStackHeight());
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.statusUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!this.isWalking() && !this.isKicked)
|
if (!this.isWalking() && !this.isKicked)
|
||||||
{
|
{
|
||||||
if (this.status.remove(RoomUnitStatus.MOVE) == null)
|
if (this.status.remove(RoomUnitStatus.MOVE) == null)
|
||||||
@ -182,9 +193,7 @@ public class RoomUnit
|
|||||||
|
|
||||||
if (next != null && room.hasHabbosAt(next.x, next.y))
|
if (next != null && room.hasHabbosAt(next.x, next.y))
|
||||||
{
|
{
|
||||||
if(!isRiding) {
|
return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,10 +292,10 @@ public class RoomUnit
|
|||||||
|
|
||||||
double zHeight = 0.0D;
|
double zHeight = 0.0D;
|
||||||
|
|
||||||
if (((habbo != null && habbo.getHabboInfo().getRiding() != null) || isRiding) && next.equals(this.goalLocation) && (next.state == RoomTileState.SIT || next.state == RoomTileState.LAY)) {
|
/*if (((habbo != null && habbo.getHabboInfo().getRiding() != null) || isRiding) && next.equals(this.goalLocation) && (next.state == RoomTileState.SIT || next.state == RoomTileState.LAY)) {
|
||||||
this.status.remove(RoomUnitStatus.MOVE);
|
this.status.remove(RoomUnitStatus.MOVE);
|
||||||
return false;
|
return false;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (habbo != null)
|
if (habbo != null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user