And I actually have a different question now - is there a way to make a single fighter return to its mothership? I'm thinking of a hullmod that makes a fighter retreat if it suffers a certain amount of hull damage.
See: FighterWingAPI.orderReturn(ShipAPI fighter)
If a route-spawned fleet takes losses in combat, is this reflected anywhere in the route data at all? Neither OptionalFleetData.fp nor OptionalFleetData.damage are being updated in my RouteFleetSpawner implementation.
It's not reflected anywhere. However, there is an OptionalFleetData.damage field - which is *only* used in WarSimScript.getFactionStrength(). So if one wanted to, one could have their route-spawned fleet store the level of damage (i.e. losses taken) in that value, use it when spawning (or re-spawning) the fleet, and its strength would vary accordingly for the various strength checks used for resolving not-near-the-player events.
I don't know if I'd recommend it, though - if you try to spawn a fleet using the same random seed but less fleet points, it'd likely end up being a very different fleet. Using the damage field would make more sense for fleets that have never actually spawned.
However, none of the vanilla fleets will use the damage field when spawning, so this would only work for routes where both the spawning and taking damage aspect of this is used. I.E. you couldn't hurt an existing patrol fleet route by setting its OptionalFleetData.damage - or, rather, it would affect it for strength checks, but not for when it was spawned due to being near the player.
What about when two hostile routes meet in a location while player isn't nearby, is any combat simulated between them (or with local non-abstracted fleets)?
No. Route fleets used for strength checks which can affect things like, say, the outcome of a raid, but don't actually affect the routes themselves.
(What I'm trying to do: a persistent route-based fleet that flies around joining raids against hostile systems, or defending against raids on friendly systems, or simply patrols friendly systems. If it takes enough losses, it goes to a faction-held market to replace lost ships with new ones. The route is never actually terminated unless its FP drops to zero, or certain (currently undetermined) conditions are met).
The "damage" field sounds like it'd work for your case, I think. Except for the part where if it despawns and respawns again, the ships would be different.
Btw, you should be able to force a route to end by setting the current segment to null and by clearing the segments, i.e.:
route.setCurrent(null);
route.getSegments().clear();
Should do it.