WeightedRandomPicker<String> portriatIDs = Global.getSector().getFaction(Factions.PLAYER).getPortraits(FullName.Gender.ANY);
From there, you should be able to modify portraitIDs any way you like.
Right, yeah! But - use Gender.MALE and Gender.FEMALE - I don't think "ANY" will work here.
My objective would be having a modular ship and allow the player to swap any modules by some kind of dialogue option in a special station and have those modules change how the main ship operates, can that be done?
Hmm - maybe? I think you might have some problems if the player, say, saves off an autofit goal variant and then tries to apply it to a ship that has a different set of modules. That, I think, would likely cause a crash. But just as far as the effects you're talking about, that sounds doable with some built-in hullmods in the main body of the ship. In general, I'm not sure if this is 100% doable and/or will work smoothly, iirc some stuff assumes the module hull types don't change so it's... going against the grain, at best.
i can't use applyEffectBefore creation
Hmm, why not? I'd expect that's the one you'd want to use, it being the one that gets called in the campaign...
EDIT: Alternatively, is there some way in the API to reload settings.json? I know you can turn on DevMode -> Simulator -> Press F8, but I don't think that's something to be done while actually playing the game.
There isn't, no - some of the settings wouldn't take effect and it'd be a bit of a mess without a decent amount of code to help it along...
I am that type of guy that likes program logic more than text rule sets.
How do I create a salvage interaction upon selecting an option in InteractionDialogPlugin implementation?
Code example:
@Override
public void optionSelected(OptionId option, String optionText) {
if (option == OptionId.INIT) {
dialogInit();
} else if ...
} else if (option == OptionId.CONFIRM_DECONSTRUCT) {
String locationType = null;
...
replaceEntity(playerFleet.getStarSystem(), target, locationType, Factions.NEUTRAL);
// TODO: Get some resources back through salvage < ---- ---- ----
leaveDialog();
}
}
Something like:
dialog.setInteractionTarget(entity);
RuleBasedInteractionDialogPluginImpl plugin = new RuleBasedInteractionDialogPluginImpl("OpenInteractionDialog");
dialog.setPlugin(plugin);
plugin.init(dialog);
Would switch the dialog to another target ("entity") and fire off the initial interaction within the same dialog. Of course, that would use the rules specified in rules.csv for that interaction. If you want to avoid using rules.csv entirely, you'd have to re-code the salvage interaction from scratch, since the vanilla one is implemented using rules.csv.
Is there a good way to determine if a distant fleet would want to attack the player fleet if the two were close to each other? Failure to account for third parties wouldn't be a problem. Neither would only working for ModularFleetAIs. I thought this would do the trick, but I'm still getting false positives:
npcFleet.getAI().pickEncounterOption(null, playerFleet, true) == CampaignFleetAIAPI.EncounterOption.ENGAGE
That should work, actually; it's the method the fleets use when deciding to pursue or run away under the hood, too. The results *are* cached for 3 seconds, btw, so maybe that accounts for some discepancies?