Hi Alex!
I would be interested in a way to set either a wing as builtin or as UI-locked.
<snip>
Simplest advice: You also need to tell the game that the ship has a built-in wing of that type. You start as you have with "ship.getVariant().setWingId(...)", and immediately follow it with "ship.getHullSpec().getBuiltInWings().add(WING_ID)". It doesn't add a new wing, but instead does the equivalent of what you're asking for: it locks that wing you set in as a built-in.
<snip>
Thanks Axle! Didn't realise I could add it to the built-in's List directly (and also set the wing index). I used your example (tyvm) to do a bit of exploring.
This seems to be something that kind of works but is not exactly directly supported by the API:
- I can't seem to add a fighter bay to a ship if it has an existing built-in wing (the hullmod just doesn't get added at all, no error in log or anything) - EDIT: Actually I was wrong about this, seems to work fine
- If I use getHullSpec().getBuiltInWings.add("my_wing_id"), any existing wings also become locked (can get around this by shuffling things around like your example)
- This basically means only using one of these add-built-in-wing type hull mods at any given time - EDIT: I think this should be OK if a seperate second hull-mod to manage the removal of the built-in wing is used for each hull-mod type that adds a built-in wing
Given this, I suspect built-in wings are handled a little differently than normal wings and so perhaps it is not so straight-forward an API request
EDIT: Actually, it seems fine to add and remove built-in wings if there are already built in wings. Not sure how I was getting that issue. So, only really need to work with the shuffling around of non-built-in wings, which is possible with another hull mod to track (as per your neat example)
@Alex, probably OK to not worry about this now