Disabled Commands

Disabled Commands

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Disabled Commands

Post by trepan »

I've added the disabled parameter to CommandDescriptions. It does
not currently block commands, it only affects the rendering. To block
commands, you can use AllowCommand() in LuaRules (even if I add
real client-side blocking based on "disabled", a synced check should
still be provided in LuaRules).

Image

Test code (from LuaRules/main.lua):

Code: Select all

  local cmdDescs = Spring.GetUnitCmdDescs(unitID)
  for i = 1, cmdDescs.n do
    Spring.EditUnitCmdDesc(unitID, i, {
      disabled = (math.floor(math.mod(i, 4)) == 0)
    })
  end
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Post by trepan »

Commands are now blocked client-side (mouse and keyboard).
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

Mmm last missing piece needed for abilities/spells to work :)
User avatar
LOrDo
Posts: 1154
Joined: 27 Feb 2006, 00:21

Post by LOrDo »

Will be great for campaigns and stuff. Ahh OTA...
Post Reply

Return to “Lua Scripts”