|
|
|
@ -33,7 +33,7 @@ public class StuckJob extends AbstractScheduleJob {
@@ -33,7 +33,7 @@ public class StuckJob extends AbstractScheduleJob {
|
|
|
|
|
protected void doJob() { |
|
|
|
|
|
|
|
|
|
Vector3fImmutable stuckLoc; |
|
|
|
|
Building stuckBuilding = null; |
|
|
|
|
Building building = null; |
|
|
|
|
|
|
|
|
|
if (player == null) |
|
|
|
|
return; |
|
|
|
@ -45,75 +45,37 @@ public class StuckJob extends AbstractScheduleJob {
@@ -45,75 +45,37 @@ public class StuckJob extends AbstractScheduleJob {
|
|
|
|
|
|
|
|
|
|
for (AbstractWorldObject awo : awoList) { |
|
|
|
|
|
|
|
|
|
Building toStuckOutOf = (Building)awo; |
|
|
|
|
Building buildingEntry = (Building) awo; |
|
|
|
|
|
|
|
|
|
if (toStuckOutOf.getStuckLocation() == null) |
|
|
|
|
if (buildingEntry.getStuckLocation() == null) |
|
|
|
|
continue; |
|
|
|
|
|
|
|
|
|
if (Bounds.collide(player.getLoc(), toStuckOutOf)){ |
|
|
|
|
stuckBuilding = toStuckOutOf; |
|
|
|
|
if (Bounds.collide(player.getLoc(), buildingEntry)) { |
|
|
|
|
building = buildingEntry; |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Could not find closest building get stuck location of nearest building.
|
|
|
|
|
|
|
|
|
|
if (stuckBuilding == null){ |
|
|
|
|
if (building == null) { |
|
|
|
|
ErrorPopupMsg.sendErrorMsg(player, "Unable to find desired location"); |
|
|
|
|
return; |
|
|
|
|
} else |
|
|
|
|
stuckLoc = stuckBuilding.getStuckLocation(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
stuckLoc = building.getStuckLocation(); |
|
|
|
|
|
|
|
|
|
if (stuckLoc == null) { |
|
|
|
|
ErrorPopupMsg.sendErrorMsg(player, "Unable to find desired location"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
player.teleport(building.getLoc().add(stuckLoc)); |
|
|
|
|
|
|
|
|
|
player.teleport(stuckLoc); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Needs to be re-written with stuck locations
|
|
|
|
|
// Disabled for now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
|
|
// Cannot have a null zone or player
|
|
|
|
|
|
|
|
|
|
if (this.player == null) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
if (ZoneManager.findSmallestZone(player.getLoc()) == null) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
// If player is on a citygrid make sure the stuck direction
|
|
|
|
|
// is facing away from the tree
|
|
|
|
|
|
|
|
|
|
if ((ZoneManager.findSmallestZone(player.getLoc()).isNPCCity()) || |
|
|
|
|
(ZoneManager.findSmallestZone(player.getLoc()).isPlayerCity())) { |
|
|
|
|
|
|
|
|
|
zoneVector = player.getLoc().subtract(ZoneManager.findSmallestZone(player.getLoc()).getLoc()); |
|
|
|
|
zoneVector = zoneVector.normalize(); |
|
|
|
|
|
|
|
|
|
if (zoneVector.dot(player.getFaceDir()) > 0) |
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
player.teleport(player.getLoc().add(player.getFaceDir().mult(34))); |
|
|
|
|
*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
protected void _cancelJob() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void sendTrackArrow(float rotation) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|