AI War 2:Partial Records and Mod Execution Order
Question: I have a small question about how partial records and inheriting are supposed to work together. Let's say I have ship B that inherits properties from ship A via copy_from: if I then override some of ship A stats in another mod, are those changes going to apply to ship B automatically?
Answer: So... this is actually a complicated question, and the answer is "it depends."
Basically it's going to process everything from the non-mods folders first. Then it's going to process stuff from mods, but not in any guaranteed order. I believe it just goes alphabetically.
So if you have copy_from or other forms of partial records, then it happens on an ordered basis. Aka, all of the non-mod stuff gets processed into distinct entities immediately. Then if you have a mod that makes changes, and that mod starts with A, it will process all of the full and partial records from that. If you then have a mod that starts with Z, then it would process all the full and partial records from THAT.
There may be a desire to inject, early into the process, changes to some sort of base entity (like the transport ship base) and have that propagate to any and all transports that might arise, but at the moment there's no way to guarantee that would happen. That's kind of a form of injection, really, and even with partial records (is_partial) stuff in a secondary file in the base game folders, it wouldn't be guaranteed to happen in the right order.
Eventually we need some broader abilities to either do injection or "update all things that are descendants of this original thing," but we don't have that in place yet. It's probably a post-1.0 thing for us, depending on time, but use cases will help us create the tools folks need.
Most of the mods we've been focused on thus far are things that either create their own stuff from scratch, or which inherit from original stuff and possibly add to it, but not that replace it per se.
One example of a way to handle a "replacement situation" in a very non-destructive fashion, using the current tools that the game has, would be to create a new AI Type with its own AI Ship Groups, if we're talking about AI ships. Then that AI type can have copies made (in the mod) of all the ships that are added into its AI Ship Groups. This would essentially keep things very isolated to your own AI Type and it would work just like you want and not be stomped by any other mods. Other mods also would never insert their own ships into the AI Type that you created, since you've got your own custom AI Ship Groups.
Note that NORMALLY we love it when mods all add ships together into the existing AI Ship Groups, and we created that with modding in mind -- that way it's all additive and the craziness multiplies. The same is true for available ships for players.
When it comes to something more akin to a total conversion, that doesn't work without creating an AI Type to kind of hold the TC, though. And on the player side... I can't think of a way to do that just yet, actually, with the current tools. You could definitely do a TC by manually altering all of the ships and their descendants, but you couldn't guarantee that other mods wouldn't also make changes, etc.
This was rambly, but hopefully gives some insight into the process as of 7/16/19.