wanted: script to clean up unitdef files
Posted: 14 Sep 2012, 15:31
Seeing the scripts by yanom and Cubex, I thought it might be cool to have a script to clean up unitdef files.
The problem:
In many mods, the tags in units files are basically ordered randomly.
I facepalm every time I open a unit file. (in my mod too
)
ctrl-f all the things?
Random example:
Say you want to edit the movent of that unit then you want to look at:
acceleration, brakeRate maxVelocity and turnRate
Those tags kind of go together in function.
In that file they are dozens of lines apart, that is annoying.
The idea:
Someone make a thingy to neatly reorder the lines like this:
The to-be order could be defined in some config file that lists the tags in the shall-be order.
Inspiration might be the grouping on this page:
http://springrts.com/wiki/Units-UnitDefs
Any unlisted tags can be considered invalide and should be removed. (maybe keep them at the end of the new file, commentated out, for manual checking)
pro tip:
If it was some .lua file that can simply be included in unitdefs_post.lua, then it would be simplest to use: No need to install funny frameworks or figuring out how they work
The problem:
In many mods, the tags in units files are basically ordered randomly.
I facepalm every time I open a unit file. (in my mod too

ctrl-f all the things?
Random example:
Say you want to edit the movent of that unit then you want to look at:
acceleration, brakeRate maxVelocity and turnRate
Those tags kind of go together in function.
In that file they are dozens of lines apart, that is annoying.
The idea:
Someone make a thingy to neatly reorder the lines like this:
Code: Select all
--Cost--
buildCostMetal = 500,
buildCostEnergy = 0,
buildTime = 25,
--Health--
maxDamage = 1500,
idleAutoHeal = 0,
--Movement--
maxVelocity = 3.0,
Acceleration = 0.5,
BrakeRate = 0.3,
FootprintX = 3,
...
Inspiration might be the grouping on this page:
http://springrts.com/wiki/Units-UnitDefs
Any unlisted tags can be considered invalide and should be removed. (maybe keep them at the end of the new file, commentated out, for manual checking)
pro tip:
If it was some .lua file that can simply be included in unitdefs_post.lua, then it would be simplest to use: No need to install funny frameworks or figuring out how they work
