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