Logistic units can now be DCS StaticUnits or DCS Units. When their life is at zero (destroyed but not removed from the battlefield), no crate can be spawned anymore.

See issue #50
This commit is contained in:
David Pierron
2024-11-13 21:11:55 +01:00
parent 299af17841
commit 0520c824d8

View File

@@ -4855,15 +4855,13 @@ function ctld.inLogisticsZone(_heli)
if ctld.inAir(_heli) then if ctld.inAir(_heli) then
return false return false
end end
local _heliPoint = _heli:getPoint() local _heliPoint = _heli:getPoint()
for _, _name in pairs(ctld.logisticUnits) do for _, _name in pairs(ctld.logisticUnits) do
local _logistic = StaticObject.getByName(_name) local _logistic = StaticObject.getByName(_name)
if not _logistic then
if _logistic ~= nil and _logistic:getCoalition() == _heli:getCoalition() then _logistic = Unit.getByName(_name)
end
if _logistic ~= nil and _logistic:getCoalition() == _heli:getCoalition() and _logistic:getLife() > 0 then
--get distance --get distance
local _dist = ctld.getDistance(_heliPoint, _logistic:getPoint()) local _dist = ctld.getDistance(_heliPoint, _logistic:getPoint())