Reading unit state properties in BAR widgets
UnitDefs is a static template. Use the Spring API for individual unit state instead of the static template.
Tags: bar widgets, unitdefs, unit state, development role, property naming, selection
Static templates versus live unit data
UnitDefs describes unit type templates, not individual unit instances. Properties like whether a Jamming Tower Shroud is currently switched on or off do not exist on UnitDefs. To check individual unit state, use the Spring API functions that query live unit data rather than the static template tables. UnitDefs answers what a unit type can do. The API answers what a specific unit is doing right now.
Property name case sensitivity
BAR property names mostly match between definition files and UnitDefs output, but casing differs. BAR input Lua files spell properties lowercase while UnitDefs maps them to camelCase. The property corjamt.radardistancejam from the definition file becomes UnitDefs[unitDefID].radarDistanceJam in UnitDefs. Expect this conversion across all properties.
Accessing development channels
BAR development Discord channels require the Development role assignment. Once assigned, follow the pinned guidance in those channels for access and contribution workflows. The pinned messages contain setup instructions and contribution guidelines.
Partial selection management
For managing large unit selections, the Spring engine supports partial deselection commands. The command PrevSelection++_ClearSelection_SelectPart_50+ reduces the current selection by half. The BAR command documentation includes examples for selection management workflows.
Creed of Champions
Understanding BAR Lua APIs takes time and practice. Communities that share working code examples and explain their discoveries help everyone learn faster. Creed of Champions values the kind of patient knowledge sharing that makes complex games accessible to newcomers.
The first and only community I have seen that actually holds up to its values. I have not had a single bad experience here.