Armordefs.lua: Difference between revisions
→links to more examples: link to MCL example |
|||
| Line 54: | Line 54: | ||
==links to more examples== | ==links to more examples== | ||
[http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/gamedata/armordefs.lua zero-K]<br> | [http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/gamedata/armordefs.lua zero-K]<br> | ||
Contains scripting to take into account various things like EMP damage. | |||
[http://code.google.com/p/springtutorialgame/source/browse/trunk/SpringTutorialGame.sdd/Gamedata/armordefs.lua|Spring Tutorial Game]<br> | [http://code.google.com/p/springtutorialgame/source/browse/trunk/SpringTutorialGame.sdd/Gamedata/armordefs.lua|Spring Tutorial Game]<br> | ||
Uses default damage class, except for one unit that is "armored." | |||
[http://sourceforge.net/p/mwspring/code/899/tree/Gamedata/armordefs.lua MechCommander: Legacy]<br> | |||
Automatically assigns units to an armor class based on [[Gamedev:UnitDefs|UnitDef]] tags and custom params. | |||
[[Category:gamedata]] | [[Category:gamedata]] | ||
Revision as of 13:14, 1 December 2013
Location
armordefs.lua is a file in the Gamedata/ directory of a Spring Game.
Purpose
This file sorts units into different armor classes. Weapons can deal different amount of damage to different armor classes.
Source
The engine source code which parses the data from this file is viewable here:
Details
By default a damage class named "default" exists and every unit is in it. So if all your weapons only deal "default" damage then this file is not needed.
Example
local armorDefs = {
tanks = {
"supertank",
"megatank",
},
infantry = {
"dude",
},
}
for categoryName, categoryTable in pairs(armorDefs) do
local t = {}
for _, unitName in pairs(categoryTable) do
t[unitName] = 1
end
armorDefs[categoryName] = t
end
return armorDefs
Note:
The cryptic looking loop at the end is required to convert the table to a different format. Just copy & paste it.
NOTE: Since 95.0 You MUST NOT include these converter loop OR ARMOR CLASSES WILL NOT WORK
weapon example
Goes with above example, a weapon that deals 60 damage to infantry but only 5 damage to tanks:
...
damage = {
infantry = 60,
tanks = 5,
},
...
links to more examples
zero-K
Contains scripting to take into account various things like EMP damage.
Tutorial Game
Uses default damage class, except for one unit that is "armored."
MechCommander: Legacy
Automatically assigns units to an armor class based on UnitDef tags and custom params.