Skip to content

Commit

Permalink
Fix error with new stop command pausing silos (#6617)
Browse files Browse the repository at this point in the history
  • Loading branch information
lL1l1 authored Jan 25, 2025
1 parent cdc082c commit 7f7e353
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog/snippets/fix.6617.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6617) Fix an error when silos are given a hard-stop order, causing them to not pause missile construction.
16 changes: 12 additions & 4 deletions engine/User.lua
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,15 @@ function GetUIControlsAlpha()
end

--- Given a set of units, gets the union of orders and unit categories (for determining builds). You can use `GetUnitCommandFromCommandCap` to convert the toggles to unit commands
---@param unitSet any
---@param unitSet UserUnit[]
---@return string[] orders
---@return CommandCap[] availableToggles
---@return EntityCategory buildableCategories
function GetUnitCommandData(unitSet)
end

--- Retrieves the orders, toggles and buildable categories of the given unit. You can use `GetUnitCommandFromCommandCap` to convert the toggles to unit commands
---@param unit any
---@param unit UserUnit
---@return string[] orders
---@return CommandCap[] availableToggles
---@return EntityCategory buildableCategories
Expand Down Expand Up @@ -675,8 +675,8 @@ end
function IN_RemoveKeyMapTable(keyMapTable)
end

---
---@param queueIndex any
--- Increase the count at a given location of the current build queue
---@param queueIndex number
---@param count number
function IncreaseBuildCountInQueue(queueIndex, count)
end
Expand Down Expand Up @@ -837,6 +837,14 @@ end
function IssueBlueprintCommandToUnit(unit, command, blueprintid, count, clear)
end

--- Issue a command to a given unit
---@param unit UserUnit
---@param command UserUnitCommand # Will crash the game if not a valid command.
---@param luaParams? table | string | number | boolean # Will crash the game if the table contains non-serializable types.
---@param clear? boolean
IssueUnitCommandToUnit = function(unit, command, luaParams, clear)
end

--- Issue a command to the current selection.
---@param command UserUnitCommand # Will crash the game if not a valid command.
---@param luaParams? table | string | number | boolean # Will crash the game if the table contains non-serializable types.
Expand Down
2 changes: 1 addition & 1 deletion lua/keymap/keyactions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,7 @@ local keyActionsOrders = {
category = 'orders',
},
['shift_stop'] = {
action = 'IssueCommand Stop',
action = 'UI_Lua import("/lua/ui/game/orders.lua").Stop()',
category = 'orders',
},
['shift_dive'] = {
Expand Down
2 changes: 1 addition & 1 deletion lua/ui/game/orders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ function Stop(units)
if not GetIsPausedOfUnit(silo) then
local missileInfo = silo:GetMissileInfo()
if missileInfo.nukeSiloBuildCount > 0 or missileInfo.tacticalSiloBuildCount > 0 then
IssueUnitCommand(silo, 'Pause')
IssueUnitCommandToUnit(silo, 'Pause')
end
end
end
Expand Down
12 changes: 11 additions & 1 deletion lua/userInit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ do
commandMode.RestoreCommandMode(true)
end

---@param unit UserUnit[]
---@param unit UserUnit
---@param command UserUnitBlueprintCommand
---@param blueprintid UnitId
---@param count number
Expand All @@ -396,6 +396,16 @@ do
UnitsCache[1] = unit
IssueBlueprintCommandToUnits(UnitsCache, command, blueprintid, count, clear)
end

--- Issue a command to a given unit
---@param unit UserUnit
---@param command UserUnitCommand # Will crash the game if not a valid command.
---@param luaParams? table | string | number | boolean # Will crash the game if the table contains non-serializable types.
---@param clear? boolean
_G.IssueUnitCommandToUnit = function(unit, command, luaParams, clear)
UnitsCache[1] = unit
IssueUnitCommand(UnitsCache, command, luaParams, clear)
end
end

do
Expand Down

0 comments on commit 7f7e353

Please sign in to comment.