ZeroK-RTS / Zero-K

Open source RTS game running on the Spring/Recoil engine
https://zero-k.info
GNU General Public License v2.0
690 stars 206 forks source link

Split unitdefs_post into multiple files #4149

Open GoogleFrog opened 4 years ago

GoogleFrog commented 4 years ago

Currently unitdefs_post is mostly a set of independent operations that are applied to unitdefs. The order of these operations is irrelevant in most cases, with a notable exception for "ud.customparams IS NEVER NIL". This file is useful for mutators as it can be used to change many attributes at once, without worrying about later changes to unit files, but will break mutators when the game changes unitdefs_post.

Maps already have unitdefs_map to get around this issue in an ugly way. We could add unitdefs_mod to workaround the issue until people start nesting mutators.

The idea of this ticket is to a different approach to solving the map and mutator issue. We could simply create a subfolder of gamedata and have unitdefs_post include every file from that subfolder. Most of the things that currently live in unitdef_post could be moved to this subfolder, provided order isn't important. What to do about the cases when order is important for modding is an open question.

Licho1 commented 4 years ago

If people only want to add stuff I think it's better to just have some standardized way to "append" to this and similar file. It might be easier to maintain than splitting it into widget like system. Unitdefs_mod might work even for nested mods, you can get dependency tree and iterate in correct order and append in correct order (possibly VFS already does it). Argument for not splitting: