From Spring

This file sorts units into different armor classes. Weapons can deal different amount of damage to different armor classes.


armordefs.lua is a file in the Gamedata/ directory of a Spring Game.


The engine source code which parses the data from this file is viewable here:


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.


local armorDefs = {
	tanks = {

	infantry = {

--NOTE: only needed for <95.0 (before engine was expecting a cryptic format)
if not(Game) or not(Game.version) then
  for categoryName, categoryTable in pairs(armorDefs) do
    local t = {}
    for _, unitName in pairs(categoryTable) do
      t[unitName] = 1
    armorDefs[categoryName] = t

return armorDefs

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,


In engine versions =< 96.0 the damage dealt to shields is the weapon's default value. This changed in v98.0

Putting a shield into an armor class is analogical to units, ie. the armorDefs entry is its weaponDef name:

armorDefs = {
  units = { "shieldbot" },
  shields = { "shieldbot_shield" }

Then in some damage table:

damage = {
  default = 123,
  units = 456,
  shields = 789

More efficient with Lua

Spring armor categories are kludgy and messy because they are extremely inefficient. There are a lot of inconsistencies. In some cases, only the first category listed will be obeyed. At other times in that same list, all will be obeyed.

In other words, do not rely on categories too heavily, because you will end up quite frustrated with the results.

You should look at smoth's armor system code. Evo uses it rather extensively.

Links to more Examples

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.