From 08af1aff18e504320a4b4168f804973f6f5c70e7 Mon Sep 17 00:00:00 2001 From: David Pierron Date: Wed, 13 Nov 2024 21:03:22 +0100 Subject: [PATCH] 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 --- CTLD.lua | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/CTLD.lua b/CTLD.lua index bcd3ab7..1385323 100644 --- a/CTLD.lua +++ b/CTLD.lua @@ -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())