diff --git a/changelog/snippets/fix.6586.md b/changelog/snippets/fix.6586.md new file mode 100644 index 0000000000..ca2c908cc1 --- /dev/null +++ b/changelog/snippets/fix.6586.md @@ -0,0 +1 @@ +(#6586) Firestate toggle hotkey shows instant response on the order button ui instead of the half second delay it had previously. \ No newline at end of file diff --git a/lua/ui/game/gamemain.lua b/lua/ui/game/gamemain.lua index 06e6ac4ddc..7764531d8e 100644 --- a/lua/ui/game/gamemain.lua +++ b/lua/ui/game/gamemain.lua @@ -676,7 +676,8 @@ function OnSelectionChanged(oldSelection, newSelection, added, removed) local isOldSelection = table.equal(oldSelection, newSelection) if not gameUIHidden then - if not isReplay then + -- Not necessary to update the available orders if we're in a replay or the selection hasn't changed + if not (isReplay or isOldSelection) then import("/lua/ui/game/orders.lua").SetAvailableOrders(availableOrders, availableToggles, newSelection) end -- TODO change the current command mode if no longer available? or set to nil? diff --git a/lua/ui/game/orders.lua b/lua/ui/game/orders.lua index a79942c9af..d454e1f435 100644 --- a/lua/ui/game/orders.lua +++ b/lua/ui/game/orders.lua @@ -826,16 +826,6 @@ local function CreateFirestatePopup(parent, selected) end local function RetaliateOrderBehavior(self, modifiers) - if not self._OnFirestateSelection then - self._OnFirestateSelection = function(self, newState, id) - self._toggleState = newState - SetFireState(currentSelection, id) - self:SetNewTextures(GetOrderBitmapNames(retaliateStateInfo[newState].bitmap)) - self._curHelpText = retaliateStateInfo[newState].helpText - self._popup:Destroy() - self._popup = nil - end - end if self._popup then self._popup:Destroy() self._popup = nil @@ -889,14 +879,27 @@ local function RetaliateInitFunction(control, unitList) end Checkbox.OnDisable(self) end + control.CycleFireStateUp = function(self) + local newState = self._toggleState >= 2 and 0 or self._toggleState + 1 + self:_OnFirestateSelection(newState, retaliateStateInfo[newState].id) + end + control._OnFirestateSelection = function(self, newState, id) + self._toggleState = newState + SetFireState(currentSelection, id) + self:SetNewTextures(GetOrderBitmapNames(retaliateStateInfo[newState].bitmap)) + self._curHelpText = retaliateStateInfo[newState].helpText + if self._popup then + self._popup:Destroy() + self._popup = nil + end + end end function CycleRetaliateStateUp() - local currentFireState = GetFireState(currentSelection) - if currentFireState > 3 then - currentFireState = 0 + local retaliateCheckbox = orderCheckboxMap["RULEUCC_RetaliateToggle"] + if retaliateCheckbox then + retaliateCheckbox:CycleFireStateUp() end - ToggleFireState(currentSelection, currentFireState) end local function pauseFunc()