| name | springrts widget |
| description | Widget file structure to be used in SpringRTS/Recoil engine games |
Skill: springrts widget
Description: Widget file structure to be used in SpringRTS/Recoil engine games
When to use
When creating or editing lua widget files, commonly within the luaui/widget folder and subfolders.
General Information
- There are two types of addons for SpringRTS/Recoil: widgets (UI-related, run only locally, called "unsynced") and gadgets (gameplay-related, must be multiplayer-replicated, called "synced").
- The engine API commands which may be called by widgets and gadgets on demand, like
Spring.GetUnitTeam(unitID), are called "callouts".
- The system events ("callins") shared by both (common), widget-only (unsynced) and gadget-only ('Synced Only' section), are listed in
springrts-wiki/Lua_Callins.html. Unsynced callins should be preceded with widget:, eg: widget:DefaultCommand(type, id).
- Widget to Gadget and Gadget to Widget communication is described in
springrts-wiki/LuaTutorials__InterCommunications.html.
How to
Checking similar pre-existing widgets within the luaui/widgets folder is a great option. Online docs might be hard to find and access, there's a dump to the official SpringRTS docs within /springrts-wiki. For general scripting, /springrts-wiki/Lua_Scripting.html is a good starting point.
/springrts-wiki/Lua_Tutorial_GettingStarted.html has some basic examples to be used as a reference as well.
Best practices