132 if (fleets.isEmpty()) {
140 if (!
interval.intervalElapsed())
return;
146 Set<LocationAPI> locations =
new LinkedHashSet<LocationAPI>();
147 Set<LocationAPI> locationsWithBattles =
new LinkedHashSet<LocationAPI>();
152 LocationAPI conLoc = fleet.getContainingLocation();
153 locations.add(conLoc);
154 if (fleet.getBattle() !=
null) {
155 locationsWithBattles.add(conLoc);
170 if (
doNotGetSidetracked && !locationsWithBattles.contains(fleet.getContainingLocation())) {
175 boolean allInSameLocation = locations.size() == 1;
187 if (allInSameLocation) {
188 boolean allNear =
true;
190 Vector2f com =
new Vector2f();
192 String key =
"$FGTravelAction_ignoreFleetForCenterOfMass";
199 fleet.getMemoryWithoutUpdate().set(key,
true, 2f);
201 if (fleet.getMemoryWithoutUpdate().getBoolean(key)) {
205 float w = fleet.getFleetPoints();
206 Vector2f loc =
new Vector2f(fleet.getLocation());
208 Vector2f.add(com, loc, com);
214 if (!fleets.isEmpty()) {
215 com.set(fleets.get(0).getLocation());
218 com.scale(1f / weight);
220 Vector2f dest =
null;
224 }
else if (inHyper > 0) {
228 if (jd.getDestination() !=
null && jd.getDestination().isInHyperspace()) {
229 jumpExit = jd.getDestination();
233 if (jumpExit !=
null) {
249 float offset = Math.min(distComToDest, 5000f);
253 dest =
new Vector2f(dest);
254 Vector2f.add(com, dir, dest);
259 float comLeashRange = 750f;
260 int numFleets = fleets.size();
261 comLeashRange += Math.min(Math.max(numFleets - 5, 0) * 100f, 500f);
264 fleet.clearAssignments();
278 if (inTo > 0 && distComToDest < 500f +
to.
getRadius() && toCom < 500f) {
280 }
else if (inTo <= 0 && toCom < 1000 && (toDest < 750 || distComToDest < 500f)) {
284 }
else if (toCom > comLeashRange) {
289 Vector2f overshootCom = Vector2f.add(com, dir,
new Vector2f());
315 if (jd.getDestination() !=
null && jd.getDestination().isInHyperspace()) {
316 jumpExit = jd.getDestination();
320 if (jumpExit !=
null) {
321 rendezvous = jumpExit;
325 List<SectorEntityToken> potential =
new ArrayList<SectorEntityToken>();
336 float bestScore = Float.MAX_VALUE;
342 score += dist * fleet.getFleetPoints();
345 if (score < bestScore) {
352 if (rendezvous ==
null) {
359 fleet.clearAssignments();