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 Logistics units and fob are still able to spawn crates even though they are destroyed #50
This commit is contained in:
David Pierron 2024-11-13 21:03:22 +01:00
parent 299af17841
commit 08af1aff18

View File

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