Exploring unitdef values like Canreclaim and navigating the Spring RTS unit definition wiki.
The Spring RTS engine wiki lists unit definition properties at springrts.com/wiki/Gamedev:UnitDefs. BAR renamed some properties to match the Lua naming conventions, so wiki entries and actual game values may not match exactly. Always cross-reference with the actual unit files in the BAR repository.
Setting Canreclaim = true on a unit determines whether that unit can be reclaimed after destruction. Commanders default to false for this value, which prevents commander wreckage from being reclaimed. Changing this in a tweakdef affects gameplay balance, since reclaiming commander wrecks returns resources.
The property does not appear in all unit lua files explicitly. Default engine values fill in when the unit file omits a property entirely.
Lua does not care about spaces between tokens in most cases. if ud.maxacc then and if ud.maxacc then parse identically. Excessive whitespace hurts readability but does not cause functional errors. The real constraint is syntax structure, not spacing.
Editing a unit property through tweakdefs follows a consistent pattern:
for name, ud in pairs(UnitDefs) do
if ud.maxacc then
ud.maxacc = 0.2
end
end
The if ud.maxacc guard ensures the property exists before attempting assignment. Units without the property skip silently instead of throwing errors. This defensive approach works for any optional unitdef field.
Testing assumptions before deploying changes saves everyone time. The BAR community values players who verify their code and share corrections without ego.
I love being able to communicate with my team, getting and sharing tips and constructive feedback on gameplay, and having a good spirited community.