Skip to content

Commit

Permalink
Add ActiveCommandChanged callin. (#4101)
Browse files Browse the repository at this point in the history
  • Loading branch information
saurtron authored Jan 3, 2025
1 parent 6929d00 commit 06ae8eb
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions luarules/gadgets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ local callInLists = {
-- "UnitMoveFailed",
"StockpileChanged",

"ActiveCommandChanged",
"CommandNotify",

-- Feature CallIns
Expand Down Expand Up @@ -2149,6 +2150,12 @@ function gadgetHandler:DefaultCommand(type, id, cmd)
return
end

function gadgetHandler:ActiveCommandChanged(id, cmdType)
for _, g in ipairs(self.ActiveCommandChangedList) do
g:ActiveCommandChanged(id, cmdType)
end
end

function gadgetHandler:CommandNotify(id, params, options)
for _, g in ipairs(self.CommandNotifyList) do
if g:CommandNotify(id, params, options) then
Expand Down
9 changes: 9 additions & 0 deletions luaui/barwidgets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ local flexCallIns = {
'ShockFront',
'WorldTooltip',
'MapDrawCmd',
'ActiveCommandChanged',
'DefaultCommand',
'UnitCreated',
'UnitFinished',
Expand Down Expand Up @@ -1342,6 +1343,14 @@ function widgetHandler:ConfigureLayout(command)
return false
end

function widgetHandler:ActiveCommandChanged(id, cmdType)
tracy.ZoneBeginN("W:ActiveCommandChanged")
for _, w in ipairs(self.ActiveCommandChangedList) do
w:ActiveCommandChanged(id, cmdType)
end
tracy.ZoneEnd()
end

function widgetHandler:CommandNotify(id, params, options)
tracy.ZoneBeginN("W:CommandNotify")
for _, w in ipairs(self.CommandNotifyList) do
Expand Down
1 change: 1 addition & 0 deletions luaui/callins.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ CallInsList = {
"Shutdown",
"LayoutButtons",
"ConfigureLayout",
"ActiveCommandChanged",
"CommandNotify",

"KeyPress",
Expand Down

0 comments on commit 06ae8eb

Please sign in to comment.