fixed for logistics
This commit is contained in:
@@ -130,23 +130,6 @@ local missionBriefingRequested = function(args)
|
||||
mission:ShowBriefing(groupID)
|
||||
end
|
||||
|
||||
---@class MarkRequestedArgs
|
||||
---@field mission Mission @the mission object
|
||||
---@field groupId integer @the group ID of the player requesting the briefing
|
||||
|
||||
---@param args MarkRequestedArgs
|
||||
local markRequested = function(args)
|
||||
|
||||
local mission = args.mission
|
||||
if not mission then return end
|
||||
|
||||
if mission.missionType == "LOGISTICS" then
|
||||
mission:MarkMissionAreaToGroup(args.groupId)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
---@class PinMissionCommandArgs
|
||||
---@field self MissionCommandsHelper @the MissionCommandsHelper instance
|
||||
---@field groupId integer @the group ID of the player requesting the briefing
|
||||
@@ -343,13 +326,6 @@ function MissionCommandsHelper:addMissionCommands(groupId, path, mission)
|
||||
---@type PinMissionCommandArgs
|
||||
local pinMissionCommandArgs = { self = self, groupId = groupId, mission = mission }
|
||||
missionCommands.addCommandForGroup(groupId, "Pin", path, pinMissionCommand, pinMissionCommandArgs)
|
||||
|
||||
if mission.missionType == "LOGISTICS" then
|
||||
---@type MarkRequestedArgs
|
||||
local markRequestArgs = { groupId = groupId, mission = mission }
|
||||
missionCommands.addCommandForGroup(groupId, "Mark", path, markRequested, markRequestArgs)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -167,18 +167,19 @@ function SupplyUnitsTracker:RemoveCargoFromUnit(unitID, crateType)
|
||||
|
||||
end
|
||||
|
||||
function SupplyUnitsTracker:UpdateWeightForUnit(unitID)
|
||||
---@param unit Unit
|
||||
function SupplyUnitsTracker:UpdateWeightForUnit(unit)
|
||||
|
||||
local weight = 0
|
||||
if self._cargoInUnits[tostring(unitID)] then
|
||||
for crateType, count in pairs(self._cargoInUnits[tostring(unitID)]) do
|
||||
if self._cargoInUnits[tostring(unit:getID())] then
|
||||
for crateType, count in pairs(self._cargoInUnits[tostring(unit:getID())]) do
|
||||
local crateConfig = Spearhead.classes.stageClasses.helpers.supplies.SupplyConfigHelper.getSupplyConfig(crateType)
|
||||
if crateConfig and count then
|
||||
weight = weight + (crateConfig.weight * count)
|
||||
end
|
||||
end
|
||||
end
|
||||
trigger.action.setUnitInternalCargo(unitID, weight)
|
||||
trigger.action.setUnitInternalCargo(unit:getName(), weight)
|
||||
end
|
||||
|
||||
|
||||
@@ -247,7 +248,7 @@ function SupplyUnitsTracker:UnloadRequested(unitID, crateType)
|
||||
end
|
||||
|
||||
self:RemoveCargoFromUnit(unitID, crateType)
|
||||
self:UpdateWeightForUnit(unitID)
|
||||
self:UpdateWeightForUnit(unit)
|
||||
|
||||
local cargoConfig = Spearhead.classes.stageClasses.helpers.supplies.SupplyConfigHelper.getSupplyConfig(crateType)
|
||||
|
||||
@@ -366,7 +367,7 @@ function SupplyUnitsTracker:TryLoadCrateInUnit(unit, crateType)
|
||||
end
|
||||
|
||||
self:AddCargoToUnit(unit:getID(), crateType)
|
||||
self:UpdateWeightForUnit(unit:getID())
|
||||
self:UpdateWeightForUnit(unit)
|
||||
|
||||
local group = unit:getGroup()
|
||||
if group == nil then return false end
|
||||
|
||||
@@ -128,7 +128,7 @@ function BuildableMission:MarkMissionAreaToGroup(groupID)
|
||||
Spearhead.DcsUtil.RemoveMark(self._markIDsPerGroup[groupID])
|
||||
end
|
||||
|
||||
local text = "[" .. self.code .. "] " .. self.name
|
||||
local text = "[" .. self.code .. "] " .. self.name .. " | " .. self._crateType
|
||||
local location = { x= self.location.x, y=land.getHeight(self.location), z=self.location.y }
|
||||
local markID = Spearhead.DcsUtil.AddMarkToGroup(groupID, text, location)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user