What I'd like to propose is for modules to, instead of adding their functions to existing structures without changing them, actually transform structures into other structures, with the new structure's stats overwriting the old structure's stats. For example, if a Factory Module was applied to a Light Factory, instead of preserving the factory's name ("A0LightFactory") and stats, it would transform the structure object to, say, a Medium Factory. The new structure would still retain some of the old structure's object properties, such as id, player, and coordinates, but properties such as the structure's name (which would be changed to, say, "A0MediumFactory"), stats, and base production speed (which would still be defined in functions.txt) would all change. Alternatively, the player could instead opt to apply an "Armored Structure" module to the Light Factory, transforming it into, say, an "Armored Light Factory", with similar production rates to a "Light Factory", but far more HP and armor (and its name property changed to, say, "A0LightFactoryArmored").
Some possible questions/comments that could arise:
How would modders be able to determine what is a module and what isn't a module?
- Modules could be defined in functions.txt, in which they'd take the following example format:
Code: Select all
Module Function, A0FacMod1, A0LightFactory, A0MediumFactory
Module Function, A0FacMod1, A0MediumFactory, A0HeavyFactory
Module Function, A0FacMod1, A0LightFactoryArmored, A0MediumFactoryArmored
Module Function, A0FacMod1, A0MediumFactoryArmored, A0HeavyFactoryArmored
Module Function, A0FacMod1, A0VtolFactory1, A0VtolFactory2
Module Function, A0FacMod1, A0VtolFactory2, A0VtolFactory3
Module Function, A0FacMod1, A0VtolFactory1Armored, A0VtolFactory2Armored
Module Function, A0FacMod1, A0VtolFactory2Armored, A0VtolFactory3Armored
Module Function, A0FacModArmor, A0LightFactory, A0LightFactoryArmored
Module Function, A0FacModArmor, A0MediumFactory, A0MediumFactoryArmored
Module Function, A0FacModArmor, A0HeavyFactory, A0HeavyFactoryArmored
Module Function, A0FacModArmor, A0VtolFactory1, A0VtolFactory1Armored
Module Function, A0FacModArmor, A0VtolFactory2, A0VtolFactory2Armored
Module Function, A0FacModArmor, A0VtolFactory3, A0VtolFactory3Armored
Module Function, A0FacModArmor, A0CyborgFactory, A0CyborgFactoryArmored
Production,FacProd1,LIGHT,10
Production,FacProd2,MEDIUM,20
Production,FacProd3,HEAVY,30Clicking on an existing structure that can be upgraded, such as, say, a Light Factory, while having a truck selected would normally order the truck to automatically upgrade the structure. What would happen to this feature if structures can choose from more than 1 module to be upgraded with?
- If both modules are available to a player, then the module that's placed higher up on functions.txt could be given priority over those lower on the list. For example, using the code list above, the truck would automatically choose to upgrade the Light Factory into a Medium Factory instead of an Armored Light Factory.
Won't compatability with older mods break?
- Depends on the mod. This would only be true if the mod modified structures.txt, functions.txt, and/or structurefunctions.txt (and possibly rules.js), meaning that mods such as NoQ's Ultimate Scavengers Mod, and my own Contingency Mod, would most likely require an update. Texture mods, tileset mods, or skybox mods would probably still work.

