How do I 100% prevent a fleet from disengaging, ever, in both 1. Interaction dialog and 2. autoresolve?
My fleets are basically psuedo-stations that I always want to hold. However, since the interaction plugin uses a combined fleet with a standard modular AI rather than their custom AI, they often try to disengage. A interaction plugin only goes so far, because I found that retreating from a battle doesnt return my pluginpick for the next interaction (which btw has one condition: The battle is not null, and the battle has satellites involved). I have FIGHT_TO_THE_LAST set on them, btw.
And in autoresolve, they seem to enjoy disengaging, which sucks, because the second their battle ends, they immediately despawn.
Setting their station status to true is impossible, because this prevents them from joining station battles, which is an important part of my mod.
Hmm, you might try creating a custom AI module for the fleet - if it's AI is instanceof ModularFleetAIAPI, you can call ModularFleetAIAPI.setTacticalModule() to provide a custom implementation of the tactical module. Then you can have its pickEncounterOption() method always return ENGAGE or whatever the enum is. That should prevent it from retreating.
I don't know what you mean by "retreating from a battle doesnt return my pluginpick for the next interaction". In general, it would help if you could be a little more clear - I find myself having to read between the lines quite a bit.
On that topic, is there any way, precluding everyframe scripts and hijacking the autoresolve pluginpick to detect when a battle between 2 AI fleets has been created, or at least, inject ships into one side of the battle before autoresolve runs? Everyframes are gross and not performant, and the autoresolve plugin pick doesnt seem to inject ships fast enough, becauaes my satellites seem unscathed in the first round of every AI engagement. Plus they only spawn when autoresolvepluginpick is called, which is weird.
Honestly, it sounds like you have some bugs in there, the things you're describing don't make a lot of sense. How can it be not "fast enough"? And the spawning thing...
Sorry about being unclear, I admit I kinda just... post, things. Without thinking. I'll try to be more clear in the future.
Anyway! My fleets DO have a custom AI, that always returns either HOLD or HOLD_VS_STRONGER.
For the first thing-fleetInteractionPluginImpl uses battle.getCombinedFleetFor(allies) on whatever method it uses for determining the goal of the fleets engaged, I think it's pickEncounterOption? Whatever the case, the combinedfleet, despite being called on a battleside with only one fleet (my satellites with a custom ai), generates a fleet with the same name as the fleet, but with a standard vanilla AI. I looked into getCombinedFleet and it seems it should be getting the primary, which is again, the satellite fleet, but it's getting something else, which is weird.
It also seems that autoresolve uses getCombinedFleet(), which I'm pretty sure also won't use my custom AI, leading to autoresolve rounds with satellites resulting in a disengagement, at times.
The for the 2nd, I use a CampaignPlugin and a getInteractionDialogPlugin override to return a custom interaction dialog plugin that overrides the fleetWantsToDisengage, fleetWantsToEngage/Fight (I forgot the name), and fleetIsHoldingVsStronger, but this method is only returned if the provided interactionTarget is a fleet, who has a battle that has satellites involved in it. In these overrides, it gets the battleside that the provided fleet (the combined fleet) is in, and scans for any fleets with my satellite fleet memkey. If I find one, I get it, and then call super.method(foundFleet) so my custom AI is actually used. This doesn't seem to be called, though, when the player side retreats and is forced into a second round of combat, leading to a disengage attempt at times.
For the 3rd, I should clarify; I use a getAutoresolvePlugin method in my campaignplugin, that always returns null. It runs a method that returns a list of sectorentitytokens that have defense satellites that want to join the battle. I get the side they want to join, then spawn fleets onto the battle with battle.join(newSatelliteFleet, side), then return null. It seems that these satellite fleets that are spawned don't engage in the autoresolve round that this method is called in, as they don't take any damage in this "round", when the other ships do.