Gamedev%3AFeatureDefs - beyond-all-reason/springrts_engine_wiki_mirror GitHub Wiki
Location
FeatureDef files are .lua files stored in the Features/
directory of a
Spring Game.
Purpose
FeatureDef files have one purpose; to define the properties of features. They are the main description file for what attributes your features should have and how units interact with them.
Source
The engine source code which loads the tags from these files is viewable here:
Data Types
Details
There follows a comprehensive list of the tags available, their data type, default value and a brief description of what they do. Bear in mind that the source code linked above is the ultimate reference when dealing with these tags.
In lua tables keys (i.e. the tags) should be lower case, here they are
represented in camelCase for readability. In your files you may use the
lowerkeys
function on your final table to ensure the keys are properly
cased.
It is usual to name the returned FeatureDef table the internal
featureName
desired for the unit.
General
Visual
Reclaim & Resources
Placement
Decals
Collision Volumes
See Gamedev:UnitDefs#Collision_Volumes.
Selection Volumes
See Gamedev:UnitDefs#Selection_Volumes.
Other
Sub Tables
customParams
The customParams
subtable of a FeatureDef allows the game designer to
give their features custom attributes, which can then be accessed via
lua gadgets and widgets. It is a map (key-value pair indexed table) of
strings. When accessing these attributes in lua the strings can be
turned back into numbers, bools or even tables. This gives great control
to game designers to essentially implement their own behaviour tags.
There are no additional tags specific to this subtable.
collisionVolume
See Gamedev:UnitDefs#collisionVolume.
selectionVolume
See Gamedev:UnitDefs#selectionVolume.
Examples
Many games include unit corpse features into the UnitDef (See Gamedev:UnitDefs#Examples)