Skip to content

Commit

Permalink
Add annotations about the command queue on the user side (FAForever#6212
Browse files Browse the repository at this point in the history
)
  • Loading branch information
clyfordv authored May 25, 2024
1 parent 87e6fb0 commit 9830fc5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
12 changes: 11 additions & 1 deletion engine/Sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ local Unit = {}
---| "HoldingPattern"
---| "SiloBuildingAmmo"

---@class UnitCommand
---@field _c_object userdata
---@field blueprintId? string -- For build commands
---@field commandType integer -- Integer representation of CommandType, see UnitQueueDataToCommand for details
---@field target? Prop|Unit|Entity -- For commands that target an entity
---@field targetId? EntityId
---@field x number -- X coordinate of command target
---@field y number -- Y coordinate of command target
---@field z number -- Z coordinate of command target

--- Adds a command cap to the unit
---@param category moho.EntityCategory
function Unit:AddBuildRestriction(category)
Expand Down Expand Up @@ -146,7 +156,7 @@ function Unit:GetCargo()
end

--- Returns table of commands queued up for this unit
---@return { }
---@return UnitCommand[]
function Unit:GetCommandQueue()
end

Expand Down
8 changes: 5 additions & 3 deletions engine/User.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,11 @@ end
function DecreaseBuildCountInQueue(queueIndex, count)
end

---
---@param id unknown
function DeleteCommand(id)
---Deletes a command from the player command queue.
---Each player has an array that holds all commands for all units, the commandID indexes to this array.
---Note: this function doesn't receive any units as arguments--you will have to retrieve the commandId by UserUnit:GetCommandQueue()[commandIndex].ID
---@param commandId number commandId, from UserUnit:GetCommandQueue()[commandIndex].ID
function DeleteCommand(commandId)
end

---
Expand Down
8 changes: 0 additions & 8 deletions lua/sim/Unit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,6 @@ SyncMeta = {
---@field AdjEnergyMod? number
---@field AdjRoFMod? number

---@class UnitCommand
---@field x number
---@field y number
---@field z number
---@field targetId? EntityId
---@field target? Entity
---@field commandType string

---@class AIUnitProperties
---@field AIPlatoonReference AIPlatoon
---@field AIBaseManager LocationType
Expand Down

0 comments on commit 9830fc5

Please sign in to comment.