|
|
|
@@ -4,6 +4,7 @@ local Logger = require("classes.util.Logger")
|
|
|
|
|
local SpearheadEvents = require("classes.spearhead_events")
|
|
|
|
|
local SupplyUnitsTracker = require("classes.stageClasses.helpers.SupplyUnitsTracker")
|
|
|
|
|
local SupplyConfigHelper = require("classes.stageClasses.helpers.SupplyConfigHelper")
|
|
|
|
|
local StageConfig = require("classes.configuration.StageConfig")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---@class MissionCommandsHelper
|
|
|
|
@@ -16,6 +17,7 @@ local SupplyConfigHelper = require("classes.stageClasses.helpers.SupplyConfigHel
|
|
|
|
|
---@field private _stageBriefings table<string, string> @table of stage briefings by stage name
|
|
|
|
|
---@field private _logger Logger @logger instance for logging
|
|
|
|
|
---@field private _supplyUnitsTracker SupplyUnitsTracker @supply units tracker instance
|
|
|
|
|
---@field private _stageConfig StageConfig
|
|
|
|
|
local MissionCommandsHelper = {}
|
|
|
|
|
MissionCommandsHelper.__index = MissionCommandsHelper
|
|
|
|
|
|
|
|
|
@@ -23,8 +25,8 @@ MissionCommandsHelper.__index = MissionCommandsHelper
|
|
|
|
|
---@param groupPos Vec2
|
|
|
|
|
local function sortMissions(list, groupPos)
|
|
|
|
|
table.sort(list, function(a, b)
|
|
|
|
|
local distA = Util.VectorDistance2d(groupPos, a.location or {x=0, y=0})
|
|
|
|
|
local distB = Util.VectorDistance2d(groupPos, b.location or {x=0, y=0})
|
|
|
|
|
local distA = Util.VectorDistance2d(groupPos, a.location or { x = 0, y = 0 })
|
|
|
|
|
local distB = Util.VectorDistance2d(groupPos, b.location or { x = 0, y = 0 })
|
|
|
|
|
return distA < distB;
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
@@ -34,12 +36,11 @@ local id = 0
|
|
|
|
|
local instance = nil
|
|
|
|
|
|
|
|
|
|
---@return MissionCommandsHelper
|
|
|
|
|
---@param logLevel string @log level for the logger
|
|
|
|
|
function MissionCommandsHelper.getOrCreate(logLevel)
|
|
|
|
|
function MissionCommandsHelper.getOrCreate()
|
|
|
|
|
if instance == nil then
|
|
|
|
|
instance = setmetatable({}, MissionCommandsHelper)
|
|
|
|
|
|
|
|
|
|
instance._logger = Logger.new("MissionCommandsHelper", logLevel)
|
|
|
|
|
instance._logger = Logger.new("MissionCommandsHelper")
|
|
|
|
|
|
|
|
|
|
instance._logger:info("Creating MissionCommandsHelper instance")
|
|
|
|
|
|
|
|
|
@@ -50,7 +51,9 @@ function MissionCommandsHelper.getOrCreate(logLevel)
|
|
|
|
|
instance.lastUpdate = 0
|
|
|
|
|
instance._stageBriefings = {}
|
|
|
|
|
|
|
|
|
|
instance._supplyUnitsTracker = SupplyUnitsTracker.getOrCreate(logLevel)
|
|
|
|
|
instance._stageConfig = StageConfig:getInstance()
|
|
|
|
|
|
|
|
|
|
instance._supplyUnitsTracker = SupplyUnitsTracker.getOrCreate()
|
|
|
|
|
|
|
|
|
|
instance._supplyUnitsTracker:AddOnSupplyUnitEventListener(
|
|
|
|
|
{
|
|
|
|
@@ -95,7 +98,6 @@ function MissionCommandsHelper.getOrCreate(logLevel)
|
|
|
|
|
|
|
|
|
|
timer.scheduleFunction(instance.updateContinuous, instance, timer.getTime() + 5)
|
|
|
|
|
SpearheadEvents.AddOnPlayerEnterUnitListener(instance)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return instance
|
|
|
|
@@ -124,12 +126,16 @@ function MissionCommandsHelper:RemoveMissionToCommands(mission)
|
|
|
|
|
self.updateNeeded = true
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---@param unit Unit
|
|
|
|
|
function MissionCommandsHelper:OnPlayerEntersUnit(unit)
|
|
|
|
|
if unit then
|
|
|
|
|
local group = unit:getGroup()
|
|
|
|
|
if group then self:updateCommandsForGroup(group:getID()) end
|
|
|
|
|
if group then
|
|
|
|
|
self:updateCommandsForGroup(group:getID())
|
|
|
|
|
if self._stageConfig.briefingOnSpawnEnabled == true then
|
|
|
|
|
self:OverviewToGroup(group:getID())
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
@@ -164,111 +170,116 @@ local pinMissionCommand = function(args)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@param groupID integer
|
|
|
|
|
function MissionCommandsHelper:OverviewToGroup(groupID)
|
|
|
|
|
local text = "Missions Overview\n\n"
|
|
|
|
|
|
|
|
|
|
local group = DcsUtil.GetPlayerGroupByGroupID(groupID)
|
|
|
|
|
---@type Vec2
|
|
|
|
|
local groupPos = { x = 0, y = 0 }
|
|
|
|
|
if group then
|
|
|
|
|
local pos = group:getUnit(1):getPosition().p
|
|
|
|
|
groupPos = { x = pos.x, y = pos.z }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@param mission Mission
|
|
|
|
|
---@return string
|
|
|
|
|
local function formatLine(mission)
|
|
|
|
|
local distanceText = "?"
|
|
|
|
|
if group then
|
|
|
|
|
local lead = group:getUnit(1)
|
|
|
|
|
if lead and lead:isExist() == true then
|
|
|
|
|
local pos = lead:getPoint()
|
|
|
|
|
local Vec2Pos = { x = pos.x, y = pos.z }
|
|
|
|
|
local distance = Util.VectorDistance2d(Vec2Pos, mission.location) / 1852
|
|
|
|
|
distanceText = string.format("~%d", math.floor(distance))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return string.format("[%s]\t%s \t%s \t%s %% \t%s nM\n", mission.code, mission.missionTypeDisplay, mission.name,
|
|
|
|
|
mission:PercentageComplete(), distanceText)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for _, briefing in pairs(self._stageBriefings) do
|
|
|
|
|
text = text .. briefing .. "\n\n"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---Primary missions
|
|
|
|
|
text = text .. "Primary Missions\n"
|
|
|
|
|
|
|
|
|
|
---@type Array<Mission>
|
|
|
|
|
local primaryMissions = {}
|
|
|
|
|
for code, enabled in pairs(self.enabledByCode) do
|
|
|
|
|
if enabled == true then
|
|
|
|
|
local mission = self.missionsByCode[code]
|
|
|
|
|
if mission and mission:getState() == "ACTIVE" and mission.priority == "primary" then
|
|
|
|
|
table.insert(primaryMissions, mission)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
sortMissions(primaryMissions, groupPos)
|
|
|
|
|
|
|
|
|
|
for _, mission in pairs(primaryMissions) do
|
|
|
|
|
text = text .. formatLine(mission)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---Secondary missions
|
|
|
|
|
text = text .. "\nSecondary Missions\n"
|
|
|
|
|
|
|
|
|
|
---@type Array<Mission>
|
|
|
|
|
local secondaryMissions = {}
|
|
|
|
|
for code, enabled in pairs(self.enabledByCode) do
|
|
|
|
|
if enabled == true then
|
|
|
|
|
local mission = self.missionsByCode[code]
|
|
|
|
|
if mission and mission:getState() == "ACTIVE" and mission.priority == "secondary" then
|
|
|
|
|
table.insert(secondaryMissions, mission)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
sortMissions(secondaryMissions, groupPos)
|
|
|
|
|
for _, mission in pairs(secondaryMissions) do
|
|
|
|
|
text = text .. formatLine(mission)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trigger.action.outTextForGroup(groupID, text, 20, true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@private
|
|
|
|
|
function MissionCommandsHelper:AddOverviewCommand(groupID)
|
|
|
|
|
|
|
|
|
|
local MissionsOverviewToGroup = function (id)
|
|
|
|
|
|
|
|
|
|
local text = "Missions Overview\n\n"
|
|
|
|
|
---@class OverviewToGroupCommandArgs
|
|
|
|
|
---@field self MissionCommandsHelper @the MissionCommandsHelper instance
|
|
|
|
|
---@field groupId integer @the group ID of the player requesting the overview
|
|
|
|
|
|
|
|
|
|
local group = DcsUtil.GetPlayerGroupByGroupID(id)
|
|
|
|
|
---@type Vec2
|
|
|
|
|
local groupPos = { x=0, y=0 }
|
|
|
|
|
if group then
|
|
|
|
|
local pos = group:getUnit(1):getPosition().p
|
|
|
|
|
groupPos = { x= pos.x, y=pos.z }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---comment
|
|
|
|
|
---@param mission Mission
|
|
|
|
|
---@return string
|
|
|
|
|
local function formatLine(mission)
|
|
|
|
|
|
|
|
|
|
local distanceText = "?"
|
|
|
|
|
if group then
|
|
|
|
|
local lead = group:getUnit(1)
|
|
|
|
|
if lead and lead:isExist() == true then
|
|
|
|
|
local pos = lead:getPoint()
|
|
|
|
|
local Vec2Pos = { x= pos.x, y=pos.z }
|
|
|
|
|
local distance = Util.VectorDistance2d(Vec2Pos, mission.location) / 1852
|
|
|
|
|
distanceText = string.format("~%d", math.floor(distance))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return string.format("[%s]\t%s \t%s \t%s %% \t%s nM\n", mission.code, mission.missionTypeDisplay, mission.name, mission:PercentageComplete(), distanceText)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for _, briefing in pairs(self._stageBriefings) do
|
|
|
|
|
text = text .. briefing .. "\n\n"
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---Primary missions
|
|
|
|
|
text = text .. "Primary Missions\n"
|
|
|
|
|
|
|
|
|
|
---@type Array<Mission>
|
|
|
|
|
local primaryMissions = {}
|
|
|
|
|
for code, enabled in pairs(self.enabledByCode) do
|
|
|
|
|
if enabled == true then
|
|
|
|
|
local mission = self.missionsByCode[code]
|
|
|
|
|
if mission and mission:getState() == "ACTIVE" and mission.priority == "primary" then
|
|
|
|
|
table.insert(primaryMissions, mission)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
sortMissions(primaryMissions, groupPos)
|
|
|
|
|
|
|
|
|
|
for _, mission in pairs(primaryMissions) do
|
|
|
|
|
text = text .. formatLine(mission)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---Secondary missions
|
|
|
|
|
text = text .. "\nSecondary Missions\n"
|
|
|
|
|
|
|
|
|
|
---@type Array<Mission>
|
|
|
|
|
local secondaryMissions = {}
|
|
|
|
|
for code, enabled in pairs(self.enabledByCode) do
|
|
|
|
|
|
|
|
|
|
if enabled == true then
|
|
|
|
|
local mission = self.missionsByCode[code]
|
|
|
|
|
if mission and mission:getState() == "ACTIVE" and mission.priority == "secondary" then
|
|
|
|
|
table.insert(secondaryMissions, mission)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
sortMissions(secondaryMissions, groupPos)
|
|
|
|
|
for _, mission in pairs(secondaryMissions) do
|
|
|
|
|
text = text .. formatLine(mission)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
trigger.action.outTextForGroup(id, text, 20, true)
|
|
|
|
|
---@param args OverviewToGroupCommandArgs
|
|
|
|
|
local MissionOverViewToGroup = function(args)
|
|
|
|
|
args.self:OverviewToGroup(args.groupId)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
missionCommands.removeItemForGroup(groupID, { "Overview" } )
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Overview", nil, MissionsOverviewToGroup, groupID)
|
|
|
|
|
---@type OverviewToGroupCommandArgs
|
|
|
|
|
local overviewToGroupCommandArgs = { self = self, groupId = groupID }
|
|
|
|
|
|
|
|
|
|
missionCommands.removeItemForGroup(groupID, { "Overview" })
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Overview", nil, MissionOverViewToGroup, overviewToGroupCommandArgs)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@private
|
|
|
|
|
---@param groupID number
|
|
|
|
|
function MissionCommandsHelper:AddPinnedMission(groupID)
|
|
|
|
|
|
|
|
|
|
local pinndedMission = self.pinnedByGroup[tostring(groupID)]
|
|
|
|
|
missionCommands.removeItemForGroup(groupID, { "Pinned Mission" })
|
|
|
|
|
|
|
|
|
|
if pinndedMission and self.enabledByCode[tostring(pinndedMission.code)] == true then
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Pinned Mission", nil, missionBriefingRequested, { groupId = groupID, mission = pinndedMission })
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Pinned Mission", nil, missionBriefingRequested,
|
|
|
|
|
{ groupId = groupID, mission = pinndedMission })
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@param groupID number
|
|
|
|
|
function MissionCommandsHelper:updateCommandsForGroup(groupID)
|
|
|
|
|
|
|
|
|
|
self._logger:debug("Updating commands for group: " .. tostring(groupID))
|
|
|
|
|
|
|
|
|
|
self:AddPinnedMission(groupID)
|
|
|
|
@@ -286,15 +297,14 @@ function MissionCommandsHelper:updateCommandsForGroup(groupID)
|
|
|
|
|
trigger.action.outTextForGroup(id, "clearing...", 1, true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
missionCommands.removeItemForGroup(groupID, { "Clear View" } )
|
|
|
|
|
missionCommands.removeItemForGroup(groupID, { "Clear View" })
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Clear View", nil, clearView, groupID)
|
|
|
|
|
|
|
|
|
|
missionCommands.removeItemForGroup(groupID, { "Refresh Missions" } )
|
|
|
|
|
missionCommands.removeItemForGroup(groupID, { "Refresh Missions" })
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Refresh Missions", nil, function(refresh_mission_id)
|
|
|
|
|
self._logger:debug("Manual refresh of missions for group: " .. tostring(refresh_mission_id))
|
|
|
|
|
self:updateCommandsForGroup(refresh_mission_id)
|
|
|
|
|
end, groupID)
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local folderNames = {
|
|
|
|
@@ -317,17 +327,16 @@ function MissionCommandsHelper:PinMission(mission, groupID)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function MissionCommandsHelper:AddAllMissionCommandsToGroup(groupID)
|
|
|
|
|
|
|
|
|
|
local perFolder = 9
|
|
|
|
|
|
|
|
|
|
local group = DcsUtil.GetPlayerGroupByGroupID(groupID)
|
|
|
|
|
---@type Vec2
|
|
|
|
|
local groupPos = { x=0, y=0 }
|
|
|
|
|
local groupPos = { x = 0, y = 0 }
|
|
|
|
|
if group then
|
|
|
|
|
local pos = group:getUnit(1):getPosition().p
|
|
|
|
|
groupPos = { x= pos.x, y=pos.z }
|
|
|
|
|
groupPos = { x = pos.x, y = pos.z }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do --- primary missions
|
|
|
|
|
local count = 0
|
|
|
|
|
local path = { [1] = folderNames.primary }
|
|
|
|
@@ -353,7 +362,7 @@ function MissionCommandsHelper:AddAllMissionCommandsToGroup(groupID)
|
|
|
|
|
else
|
|
|
|
|
local name = "Next Menu ..."
|
|
|
|
|
missionCommands.addSubMenuForGroup(groupID, name, path)
|
|
|
|
|
path[#path+1] = name
|
|
|
|
|
path[#path + 1] = name
|
|
|
|
|
count = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@@ -382,7 +391,7 @@ function MissionCommandsHelper:AddAllMissionCommandsToGroup(groupID)
|
|
|
|
|
else
|
|
|
|
|
local name = "Next Menu ..."
|
|
|
|
|
missionCommands.addSubMenuForGroup(groupID, name, path)
|
|
|
|
|
path[#path+1] = name
|
|
|
|
|
path[#path + 1] = name
|
|
|
|
|
count = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@@ -395,28 +404,28 @@ end
|
|
|
|
|
---@param path Array<string>
|
|
|
|
|
---@param mission Mission
|
|
|
|
|
function MissionCommandsHelper:addMissionCommands(groupId, path, mission)
|
|
|
|
|
|
|
|
|
|
if path then
|
|
|
|
|
|
|
|
|
|
local group = DcsUtil.GetPlayerGroupByGroupID(groupId)
|
|
|
|
|
local distance = "[?]"
|
|
|
|
|
if group then
|
|
|
|
|
local lead = group:getUnit(1)
|
|
|
|
|
if lead and lead:isExist() == true then
|
|
|
|
|
local pos = lead:getPoint()
|
|
|
|
|
local Vec2Pos = { x= pos.x, y=pos.z }
|
|
|
|
|
local Vec2Pos = { x = pos.x, y = pos.z }
|
|
|
|
|
local dist = Util.VectorDistance2d(Vec2Pos, mission.location) / 1852
|
|
|
|
|
distance = "[" .. string.format("~%dnM", math.floor(dist)) .. "]"
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local missionFolderName = "[" .. mission.code .. "]" .. distance .. mission.name .. "( " .. mission.missionTypeDisplay .. " )"
|
|
|
|
|
local missionFolderName = "[" ..
|
|
|
|
|
mission.code .. "]" .. distance .. mission.name .. "( " .. mission.missionTypeDisplay .. " )"
|
|
|
|
|
missionCommands.addSubMenuForGroup(groupId, missionFolderName, path)
|
|
|
|
|
table.insert(path, missionFolderName)
|
|
|
|
|
|
|
|
|
|
---@type MissionBriefingRequestedArgs
|
|
|
|
|
local missionBriefingRequestedArgs = { groupId = groupId, mission = mission }
|
|
|
|
|
missionCommands.addCommandForGroup(groupId, "Briefing", path, missionBriefingRequested,missionBriefingRequestedArgs)
|
|
|
|
|
missionCommands.addCommandForGroup(groupId, "Briefing", path, missionBriefingRequested,
|
|
|
|
|
missionBriefingRequestedArgs)
|
|
|
|
|
|
|
|
|
|
---@type PinMissionCommandArgs
|
|
|
|
|
local pinMissionCommandArgs = { self = self, groupId = groupId, mission = mission }
|
|
|
|
@@ -427,7 +436,6 @@ end
|
|
|
|
|
---@private
|
|
|
|
|
---@param groupID integer
|
|
|
|
|
function MissionCommandsHelper:AddSupplyHubCommandsIfApplicable(groupID)
|
|
|
|
|
|
|
|
|
|
if self._supplyUnitsTracker:IsGroupLeadInSupplyHub(groupID) ~= true then return end
|
|
|
|
|
|
|
|
|
|
self._logger:debug("Adding supply hub commands for group: " .. tostring(groupID))
|
|
|
|
@@ -458,28 +466,32 @@ function MissionCommandsHelper:AddSupplyHubCommandsIfApplicable(groupID)
|
|
|
|
|
local path = { [1] = folderNames.supplyHub }
|
|
|
|
|
|
|
|
|
|
---@type LoadCargoCommandParams
|
|
|
|
|
local farpParams1000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "FARP_CRATE_1000", supplyUnitsTracker = self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
local farpParams1000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "FARP_CRATE_1000", supplyUnitsTracker =
|
|
|
|
|
self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Load FARP Crate (1000)", path, loadCargoCommand, farpParams1000)
|
|
|
|
|
|
|
|
|
|
---@type LoadCargoCommandParams
|
|
|
|
|
local farpParams2000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "FARP_CRATE_2000", supplyUnitsTracker = self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
local farpParams2000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "FARP_CRATE_2000", supplyUnitsTracker =
|
|
|
|
|
self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Load FARP Crate (2000)", path, loadCargoCommand, farpParams2000)
|
|
|
|
|
|
|
|
|
|
---@type LoadCargoCommandParams
|
|
|
|
|
local samParms1000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "SAM_CRATE_2000", supplyUnitsTracker = self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
local samParms1000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "SAM_CRATE_2000", supplyUnitsTracker =
|
|
|
|
|
self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Load SAM Crate (1000)", path, loadCargoCommand, samParms1000)
|
|
|
|
|
|
|
|
|
|
---@type LoadCargoCommandParams
|
|
|
|
|
local samParms2000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "SAM_CRATE_2000", supplyUnitsTracker = self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
local samParms2000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "SAM_CRATE_2000", supplyUnitsTracker =
|
|
|
|
|
self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Load SAM Crate (2000)", path, loadCargoCommand, samParms2000)
|
|
|
|
|
|
|
|
|
|
---@type LoadCargoCommandParams
|
|
|
|
|
local airbaseParms2000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "AIRBASE_CRATE_2000", supplyUnitsTracker = self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
local airbaseParms2000 = { unitID = unit:getID(), groupID = group:getID(), crateType = "AIRBASE_CRATE_2000", supplyUnitsTracker =
|
|
|
|
|
self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Airbase Crate (2000)", path, loadCargoCommand, airbaseParms2000)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function MissionCommandsHelper:AddCargoCommands(groupID)
|
|
|
|
|
|
|
|
|
|
local group = DcsUtil.GetPlayerGroupByGroupID(groupID)
|
|
|
|
|
if group == nil then return end
|
|
|
|
|
|
|
|
|
@@ -509,20 +521,19 @@ function MissionCommandsHelper:AddCargoCommands(groupID)
|
|
|
|
|
for i = 1, amount do
|
|
|
|
|
local path = { [1] = folderNames.cargo }
|
|
|
|
|
---@type UnloadCargoCommandParams
|
|
|
|
|
local params = { unitID = unit:getID(), crateType = cargoType, supplyUnitsTracker = self._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Unload " .. cargoConfig.displayName, path, unloadCargoCommand, params)
|
|
|
|
|
local params = { unitID = unit:getID(), crateType = cargoType, supplyUnitsTracker = self
|
|
|
|
|
._supplyUnitsTracker, commandHelper = self }
|
|
|
|
|
missionCommands.addCommandForGroup(groupID, "Unload " .. cargoConfig.displayName, path,
|
|
|
|
|
unloadCargoCommand, params)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
---@private
|
|
|
|
|
---@param groupId integer
|
|
|
|
|
function MissionCommandsHelper:addMissionFolders(groupId)
|
|
|
|
|
|
|
|
|
|
missionCommands.addSubMenuForGroup(groupId, folderNames.primary)
|
|
|
|
|
missionCommands.addSubMenuForGroup(groupId, folderNames.secondary)
|
|
|
|
|
|
|
|
|
|