Disabling specific units in BAR and getting wind speed in widgets

Two problems come up regularly in BAR modding. First, players want clean ways to ban specific units from appearing in custom games. Second, new widget developers struggle to pull wind data from the engine. Both have straightforward answers once you know where to look.

Tags: beyond all reason, unit disabling, tweakdef, wind tracker widget, Spring.GetWind, lua modding, Zero-K reference

Removing units from build menus

A well-known tweakdef pattern removes specified units from every unit's build options. The code iterates through UnitDefs in reverse order and strips matching entries. Once applied, banned units simply do not appear in any build menu.

Shared Google Docs in the community contain ready-to-use tweakdef lists. These handle the iteration logic for you.

Borrowing from Zero-K

When building custom gadgets, start by looking at how Zero-K implements similar features. Copy the pattern and add a shutdown condition: if no tweaked unit definitions exist, the gadget disables itself. This prevents interference with the base game.

Github pull requests in the BAR repository show how existing features were wired in. Reading those diffs teaches you more than any standalone tutorial.

Getting wind speed in widgets

The engine exposes wind data through the Spring.GetWind call. It returns seven values:

Even with zero coding experience, new widget developers can build functional wind tracking displays. The interface layer handles the visuals. Spring.GetWind provides the data.

Building on community knowledge

Every useful mod in BAR started as someone asking a specific question. The community answers, shares code, and the next person builds further. Groups like Creed of Champions understand this principle at their core.

[Crd] I love being able to communicate with my team, getting and sharing tips and constructive feedback on gameplay, and having a good spirited community.

That same knowledge-sharing mindset makes the BAR modding scene productive instead of frustrating.