diff --git a/CTLD.lua b/CTLD.lua index f6fbef6..4a05bdb 100644 --- a/CTLD.lua +++ b/CTLD.lua @@ -16,15 +16,8 @@ - jmontleon - https://github.com/jmontleon - emilianomolina - https://github.com/emilianomolina - Version: 1.72 - 18/02/2018 - - Bug fix for crate spam - - Improved JTAC Performance - priority & targeting - - Added JTAC report for in view - - Added ability to set maximum group size that can be carried - - Added new sling load crates - - Fixed bug where crates and / or groups would disappear - - Fixed bug where count in zone wouldn't work for mission crates - - Delayed config of F10 menu and other scheduled functions so they can be overwritten by mission if a user wants + Version: 1.73 - 15/04/2018 + - Allow minimum distance from friendly logistics to be set ]] ctld = {} -- DONT REMOVE! @@ -52,6 +45,8 @@ ctld.maximumDistanceLogistic = 200 -- max distance from vehicle to logistics to ctld.maximumSearchDistance = 4000 -- max distance for troops to search for enemy ctld.maximumMoveDistance = 2000 -- max distance for troops to move from drop point if no enemy is nearby +ctld.minimumDeployDistance = 1000 -- minimum distance from a friendly pickup zone where you can deploy a crate + ctld.numberOfTroops = 10 -- default number of troops to load on a transport heli or C-130 -- also works as maximum size of group that'll fit into a helicopter unless overridden ctld.enableFastRopeInsertion = true -- allows you to drop troops by fast rope @@ -2888,6 +2883,16 @@ function ctld.unpackCrates(_arguments) local _crates = ctld.getCratesAndDistance(_heli) local _crate = ctld.getClosestCrate(_heli, _crates) + + if ctld.inLogisticsZone(_heli) == true or ctld.farEnoughFromLogisticZone(_heli) == true then + + ctld.displayMessageToGroup(_heli, "You can't unpack that here! Take it to where it's needed!", 20) + + return + end + + + if _crate ~= nil and _crate.dist < 750 and (_crate.details.unit == "FOB" or _crate.details.unit == "FOB-SMALL") then @@ -2897,13 +2902,6 @@ function ctld.unpackCrates(_arguments) elseif _crate ~= nil and _crate.dist < 200 then - if ctld.inLogisticsZone(_heli) == true then - - ctld.displayMessageToGroup(_heli, "You can't unpack that here! Take it to where it's needed!", 20) - - return - end - if ctld.forceCrateToBeMoved and ctld.crateMove[_crate.crateUnit:getName()] then ctld.displayMessageToGroup(_heli,"Sorry you must move this crate before you unpack it!", 20) return @@ -4385,6 +4383,36 @@ function ctld.inLogisticsZone(_heli) return false end + +-- are far enough from a friendly logistics zone +function ctld.farEnoughFromLogisticZone(_heli) + + if ctld.inAir(_heli) then + return false + end + + local _heliPoint = _heli:getPoint() + + local _farEnough = true + + for _, _name in pairs(ctld.logisticUnits) do + + local _logistic = StaticObject.getByName(_name) + + if _logistic ~= nil and _logistic:getCoalition() == _heli:getCoalition() then + + --get distance + local _dist = ctld.getDistance(_heliPoint, _logistic:getPoint()) + + if _dist <= ctld.minimumDeployDistance then + _farEnough = false + end + end + end + + return _farEnough +end + function ctld.refreshSmoke() if ctld.disableAllSmoke == true then diff --git a/Cargo Spawn Test.miz b/Cargo Spawn Test.miz index 79c87f1..2e0a5f8 100644 Binary files a/Cargo Spawn Test.miz and b/Cargo Spawn Test.miz differ diff --git a/Pickup-Dropoff-Demo.miz b/Pickup-Dropoff-Demo.miz index b3275ff..e69c10d 100644 Binary files a/Pickup-Dropoff-Demo.miz and b/Pickup-Dropoff-Demo.miz differ diff --git a/test-fob.miz b/test-fob.miz index 5afbb2d..a59952d 100644 Binary files a/test-fob.miz and b/test-fob.miz differ diff --git a/test-mission - real slingload.miz b/test-mission - real slingload.miz index 5e6ed9c..03e9d38 100644 Binary files a/test-mission - real slingload.miz and b/test-mission - real slingload.miz differ diff --git a/test-mission-jtac-priority.miz b/test-mission-jtac-priority.miz index 3d19205..da5f4de 100644 Binary files a/test-mission-jtac-priority.miz and b/test-mission-jtac-priority.miz differ diff --git a/test-mission.miz b/test-mission.miz index d0ce958..497adc0 100644 Binary files a/test-mission.miz and b/test-mission.miz differ