Update OpsGroup.lua

Better make this a unit and alive check
This commit is contained in:
Thomas 2025-03-31 14:04:07 +02:00 committed by GitHub
parent 82e1dcfc04
commit 222722225e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -9045,7 +9045,7 @@ function OPSGROUP:AddWeightCargo(UnitName, Weight)
self:T(self.lid..string.format("%s: Adding %.1f kg cargo weight. New cargo weight=%.1f kg", UnitName, Weight, element.weightCargo))
-- For airborne units, we set the weight in game.
if self.isFlightgroup and element.name then
if self.isFlightgroup and element.unit and element.unit:IsAlive() then -- #2272 trying to deduct cargo weight from possibly dead units
trigger.action.setUnitInternalCargo(element.name, element.weightCargo) --https://wiki.hoggitworld.com/view/DCS_func_setUnitInternalCargo
end