Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error with new stop command pausing silos #6617

Merged
merged 5 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading