mirror of
https://github.com/ProjectSWGCore/Holocore.git
synced 2026-10-07 22:13:40 -04:00
Fixed FLIP patrol routes
This commit is contained in:
+12
-16
@@ -32,7 +32,6 @@ import com.projectswg.holocore.resources.support.data.server_info.loader.NpcPatr
|
||||
import com.projectswg.holocore.resources.support.npc.ai.AINavigationSupport;
|
||||
import com.projectswg.holocore.resources.support.npc.spawn.Spawner.ResolvedPatrolWaypoint;
|
||||
import com.projectswg.holocore.resources.support.objects.swg.SWGObject;
|
||||
import me.joshlarson.jlcommon.log.Log;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
@@ -79,22 +78,22 @@ public class PatrolAIObject extends AIObject {
|
||||
}
|
||||
|
||||
private void createPlannedRoute() {
|
||||
{ // Creates the full route
|
||||
Location prevLocation = getLocation();
|
||||
SWGObject prevParent = getParent();
|
||||
for (ResolvedPatrolWaypoint waypoint : waypoints) {
|
||||
Location prevLocation = getLocation();
|
||||
SWGObject prevParent = getParent();
|
||||
for (ResolvedPatrolWaypoint waypoint : waypoints) {
|
||||
appendPlannedRouteWaypoint(prevParent, prevLocation, waypoint);
|
||||
prevParent = waypoint.getParent();
|
||||
prevLocation = waypoint.getLocation();
|
||||
}
|
||||
if (patrolType.get() == PatrolType.FLIP) {
|
||||
List<ResolvedPatrolWaypoint> waypointsReverse = new ArrayList<>(waypoints);
|
||||
Collections.reverse(waypointsReverse);
|
||||
for (ResolvedPatrolWaypoint waypoint : waypointsReverse) {
|
||||
appendPlannedRouteWaypoint(prevParent, prevLocation, waypoint);
|
||||
prevParent = waypoint.getParent();
|
||||
prevLocation = waypoint.getLocation();
|
||||
}
|
||||
}
|
||||
|
||||
// Creates a route in reverse for flip patrol types
|
||||
if (patrolType.get() == PatrolType.FLIP) {
|
||||
List<Runnable> reversed = new ArrayList<>(plannedRoute);
|
||||
Collections.reverse(reversed);
|
||||
plannedRoute.addAll(reversed);
|
||||
}
|
||||
}
|
||||
|
||||
private void appendPlannedRouteWaypoint(SWGObject prevParent, Location prevLocation, ResolvedPatrolWaypoint waypoint) {
|
||||
@@ -115,10 +114,7 @@ public class PatrolAIObject extends AIObject {
|
||||
}
|
||||
|
||||
private void addToPlannedRoute(SWGObject parent, Location location) {
|
||||
plannedRoute.add(() -> {
|
||||
MoveObjectIntent.broadcast(this, parent, location, calculateWalkSpeed(), getNextUpdateCount());
|
||||
Log.d("AI Log: %s moving to %s @ %s", this, location, parent);
|
||||
});
|
||||
plannedRoute.add(() -> MoveObjectIntent.broadcast(this, parent, location, calculateWalkSpeed(), getNextUpdateCount()));
|
||||
}
|
||||
|
||||
private void addNopToPlannedRoute() {
|
||||
|
||||
Reference in New Issue
Block a user