mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
Set Sling Load to FALSE by default
Moved Smoke commands back under CTLD Enabled Cargo drop and pickup from a building of a roof Enabled troop drop from a roof Changed SlingLoad to FALSE by default. This means Simulated Sling load is default!
This commit is contained in:
parent
71147fbaf8
commit
a1be10fa39
115
CTLD.lua
115
CTLD.lua
@ -10,8 +10,12 @@
|
||||
|
||||
See https://github.com/ciribob/DCS-CTLD for a user manual and the latest version
|
||||
|
||||
Version: 1.23 - 27/06/2015 - Fast Rope for troops
|
||||
Version: 1.25 - 28/06/2015 - Sling Load is now DISABLED by default
|
||||
- Fast Rope for troops
|
||||
- Able to Drop Crate and troops while on a building
|
||||
- You can now pickup troops that are on a pickup zone instead of loading troops, once they're gone you can load as normal
|
||||
- Bug fix for hawk rearm crate not disappearing
|
||||
- Bug fix for smoke not being under the CTLD menu when slingload is disabled
|
||||
|
||||
|
||||
|
||||
@ -22,8 +26,6 @@
|
||||
- Report status every 5 minutes or when targets first appear
|
||||
- Report vague status like 5 armoured vehicles, soldiers and support trucks ??
|
||||
|
||||
TODO Make hawk only engage closer targets?
|
||||
|
||||
]]
|
||||
|
||||
ctld = {} -- DONT REMOVE!
|
||||
@ -34,7 +36,7 @@ ctld = {} -- DONT REMOVE!
|
||||
ctld.disableAllSmoke = false -- if true, all smoke is diabled at pickup and drop off zones regardless of settings below. Leave false to respect settings below
|
||||
|
||||
ctld.enableCrates = true -- if false, Helis will not be able to spawn or unpack crates so will be normal CTTS
|
||||
ctld.slingLoad = true -- if false, crates can be used WITHOUT slingloading, by hovering above the crate, simulating slingloading but not the weight...
|
||||
ctld.slingLoad = false -- if false, crates can be used WITHOUT slingloading, by hovering above the crate, simulating slingloading but not the weight...
|
||||
-- There are some bug with Sling-loading that can cause crashes, if these occur set slingLoad to false
|
||||
-- to use the other method.
|
||||
|
||||
@ -412,7 +414,7 @@ function ctld.cratesInZone(_zone, _flagNumber)
|
||||
|
||||
--in air seems buggy with crates so if in air is true, get the height above ground and the speed magnitude
|
||||
if _crate ~= nil and _crate:getLife() > 0
|
||||
and (_crate:inAir() == false or (ctld.heightDiff(_crate) < 10.0 and mist.vec.mag(_crate:getVelocity()) < 1.0)) then
|
||||
and (ctld.inAir(_crate) == false) then
|
||||
|
||||
local _dist = ctld.getDistance(_crate:getPoint(), _zonePos)
|
||||
|
||||
@ -742,7 +744,7 @@ function ctld.spawnCrate(_arguments)
|
||||
local _crateType = ctld.crateLookupTable[tostring(_args[2])]
|
||||
local _heli = ctld.getTransportUnit(_args[1])
|
||||
|
||||
if _crateType ~= nil and _heli ~= nil and _heli:inAir() == false then
|
||||
if _crateType ~= nil and _heli ~= nil and ctld.inAir(_heli) == false then
|
||||
|
||||
if ctld.inLogisticsZone(_heli) == false then
|
||||
|
||||
@ -887,7 +889,7 @@ function ctld.safeToFastRope(_heli)
|
||||
end
|
||||
|
||||
--landed or speed is less than 8 km/h and height is less than fast rope height
|
||||
if (_heli:inAir() == false or (ctld.heightDiff(_heli) <= ctld.fastRopeMaximumHeight + 3.0 and mist.vec.mag(_heli:getVelocity()) < 2.2)) then
|
||||
if (ctld.inAir(_heli) == false or (ctld.heightDiff(_heli) <= ctld.fastRopeMaximumHeight + 3.0 and mist.vec.mag(_heli:getVelocity()) < 2.2)) then
|
||||
return true
|
||||
end
|
||||
|
||||
@ -901,6 +903,19 @@ function ctld.metersToFeet(_meters)
|
||||
|
||||
end
|
||||
|
||||
function ctld.inAir(_heli)
|
||||
|
||||
if _heli:inAir() == false then
|
||||
return false
|
||||
end
|
||||
|
||||
-- less than 5 cm/s a second so landed
|
||||
if mist.vec.mag(_heli:getVelocity()) < 0.05 then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function ctld.deployTroops(_heli, _troops)
|
||||
|
||||
local _onboard = ctld.inTransitTroops[_heli:getName()]
|
||||
@ -908,7 +923,7 @@ function ctld.deployTroops(_heli, _troops)
|
||||
-- deloy troops
|
||||
if _troops then
|
||||
if _onboard.troops ~= nil and #_onboard.troops.units > 0 then
|
||||
if _heli:inAir() == false or ctld.safeToFastRope(_heli) then
|
||||
if ctld.inAir(_heli) == false or ctld.safeToFastRope(_heli) then
|
||||
|
||||
-- check we're not in extract zone
|
||||
local _extractZone = ctld.inExtractZone(_heli)
|
||||
@ -927,7 +942,7 @@ function ctld.deployTroops(_heli, _troops)
|
||||
|
||||
ctld.inTransitTroops[_heli:getName()].troops = nil
|
||||
|
||||
if _heli:inAir() then
|
||||
if ctld.inAir(_heli) then
|
||||
trigger.action.outTextForCoalition(_heli:getCoalition(), ctld.getPlayerNameOrType(_heli) .. " troops fast-ropped from " .. _heli:getTypeName() .. " into combat", 10)
|
||||
else
|
||||
trigger.action.outTextForCoalition(_heli:getCoalition(), ctld.getPlayerNameOrType(_heli) .. " troops dropped from " .. _heli:getTypeName() .. " into combat", 10)
|
||||
@ -943,7 +958,7 @@ function ctld.deployTroops(_heli, _troops)
|
||||
|
||||
ctld.inTransitTroops[_heli:getName()].troops = nil
|
||||
|
||||
if _heli:inAir() then
|
||||
if ctld.inAir(_heli) then
|
||||
trigger.action.outTextForCoalition(_heli:getCoalition(), ctld.getPlayerNameOrType(_heli) .. " troops fast-ropped from " .. _heli:getTypeName() .. " into " .. _extractZone.name, 10)
|
||||
else
|
||||
trigger.action.outTextForCoalition(_heli:getCoalition(), ctld.getPlayerNameOrType(_heli) .. " troops dropped from " .. _heli:getTypeName() .. " into " .. _extractZone.name, 10)
|
||||
@ -956,7 +971,7 @@ function ctld.deployTroops(_heli, _troops)
|
||||
end
|
||||
|
||||
else
|
||||
if _heli:inAir() == false then
|
||||
if ctld.inAir(_heli) == false then
|
||||
if _onboard.vehicles ~= nil and #_onboard.vehicles.units > 0 then
|
||||
|
||||
local _droppedVehicles = ctld.spawnDroppedGroup(_heli:getPoint(), _onboard.vehicles, true)
|
||||
@ -1099,7 +1114,7 @@ function ctld.loadUnloadFOBCrate(_args)
|
||||
return
|
||||
end
|
||||
|
||||
if _heli:inAir() == true then
|
||||
if ctld.inAir(_heli) == true then
|
||||
return
|
||||
end
|
||||
|
||||
@ -1252,7 +1267,7 @@ end
|
||||
|
||||
function ctld.extractTroops(_heli, _troops)
|
||||
|
||||
if _heli:inAir() then
|
||||
if ctld.inAir(_heli) then
|
||||
return
|
||||
end
|
||||
|
||||
@ -1417,13 +1432,13 @@ function ctld.checkHoverStatus()
|
||||
local _transUnit = ctld.getTransportUnit(_name)
|
||||
|
||||
--only check transports that are hovering and not planes
|
||||
if _transUnit ~= nil and ctld.inTransitSlingLoadCrates[_name] == nil and _transUnit:inAir() and ctld.unitCanCarryVehicles(_transUnit) == false then
|
||||
if _transUnit ~= nil and ctld.inTransitSlingLoadCrates[_name] == nil and ctld.inAir(_transUnit) and ctld.unitCanCarryVehicles(_transUnit) == false then
|
||||
|
||||
local _crates = ctld.getCratesAndDistance(_transUnit)
|
||||
|
||||
for _, _crate in pairs(_crates) do
|
||||
-- env.info("CRATE: ".._crate.crateUnit:getName().. " ".._crate.dist)
|
||||
if _crate.dist < 5.0 and _crate.details.unit ~= "FOB" then
|
||||
if _crate.dist < 5.5 and _crate.details.unit ~= "FOB" then
|
||||
|
||||
--check height!
|
||||
local _height = _transUnit:getPoint().y - _crate.crateUnit:getPoint().y
|
||||
@ -1715,7 +1730,7 @@ function ctld.getCratesAndDistance(_heli)
|
||||
|
||||
--in air seems buggy with crates so if in air is true, get the height above ground and the speed magnitude
|
||||
if _crate ~= nil and _crate:getLife() > 0
|
||||
and (_crate:inAir() == false or (ctld.heightDiff(_crate) < 20.0 and mist.vec.mag(_crate:getVelocity()) < 1.0)) then
|
||||
and (ctld.inAir(_crate) == false ) then
|
||||
|
||||
local _dist = ctld.getDistance(_crate:getPoint(), _heli:getPoint())
|
||||
|
||||
@ -1814,7 +1829,7 @@ function ctld.unpackCrates(_arguments)
|
||||
|
||||
local _heli = ctld.getTransportUnit(_args[1])
|
||||
|
||||
if _heli ~= nil and _heli:inAir() == false then
|
||||
if _heli ~= nil and ctld.inAir(_heli) == false then
|
||||
|
||||
local _crates = ctld.getCratesAndDistance(_heli)
|
||||
local _crate = ctld.getClosestCrate(_heli, _crates)
|
||||
@ -1827,12 +1842,12 @@ 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.inLogisticsZone(_heli) == true then
|
||||
|
||||
ctld.displayMessageToGroup(_heli, "You can't unpack that here! Take it to where it's needed!", 20)
|
||||
|
||||
return
|
||||
end
|
||||
|
||||
-- is multi crate?
|
||||
if ctld.isMultiCrate(_crate.details) then
|
||||
@ -1994,17 +2009,22 @@ function ctld.dropSlingCrate(_args)
|
||||
|
||||
local _heightDiff = ctld.heightDiff(_heli)
|
||||
|
||||
if _heightDiff > 40.0 then
|
||||
if ctld.inAir(_heli) == false or _heightDiff <= 7.5 then
|
||||
ctld.displayMessageToGroup(_heli, _currentCrate.desc .. " crate has been safely unhooked and is at your 12 o'clock", 10)
|
||||
_point = ctld.getPointAt12Oclock(_heli, 30)
|
||||
-- elseif _heightDiff > 40.0 then
|
||||
-- ctld.inTransitSlingLoadCrates[_heli:getName()] = nil
|
||||
-- ctld.displayMessageToGroup(_heli, "You were too high! The crate has been destroyed", 10)
|
||||
-- return
|
||||
elseif _heightDiff > 7.5 and _heightDiff <= 40.0 then
|
||||
ctld.displayMessageToGroup(_heli, _currentCrate.desc .. " crate has been safely dropped below you", 10)
|
||||
else -- _heightDiff > 40.0
|
||||
ctld.inTransitSlingLoadCrates[_heli:getName()] = nil
|
||||
ctld.displayMessageToGroup(_heli, "You were too high! The crate has been destroyed", 10)
|
||||
return
|
||||
elseif _heightDiff > 7.5 and _heightDiff <= 40.0 then
|
||||
ctld.displayMessageToGroup(_heli, _currentCrate.desc .. " crate has been safely dropped below you", 10)
|
||||
else
|
||||
ctld.displayMessageToGroup(_heli, _currentCrate.desc .. " crate has been safely unhooked and is at your 12 o'clock", 10)
|
||||
_point = ctld.getPointAt12Oclock(_heli, 30)
|
||||
end
|
||||
|
||||
|
||||
--remove crate from cargo
|
||||
ctld.inTransitSlingLoadCrates[_heli:getName()] = nil
|
||||
|
||||
@ -2325,7 +2345,7 @@ function ctld.dropRadioBeacon(_args)
|
||||
local _heli = ctld.getTransportUnit(_args[1])
|
||||
local _message = ""
|
||||
|
||||
if _heli ~= nil and _heli:inAir() == false then
|
||||
if _heli ~= nil and ctld.inAir(_heli) == false then
|
||||
|
||||
--deploy 50 m infront
|
||||
--try to spawn at 12 oclock to us
|
||||
@ -2348,7 +2368,7 @@ function ctld.removeRadioBeacon(_args)
|
||||
local _heli = ctld.getTransportUnit(_args[1])
|
||||
local _message = ""
|
||||
|
||||
if _heli ~= nil and _heli:inAir() == false then
|
||||
if _heli ~= nil and ctld.inAir(_heli) == false then
|
||||
|
||||
-- mark with flare?
|
||||
|
||||
@ -2507,13 +2527,17 @@ function ctld.rearmHawk(_heli, _nearestCrate, _nearbyCrates)
|
||||
|
||||
trigger.action.outTextForCoalition(_heli:getCoalition(), ctld.getPlayerNameOrType(_heli) .. " successfully rearmed a full HAWK AA System in the field", 10)
|
||||
|
||||
-- remove crate
|
||||
if _heli:getCoalition() == 1 then
|
||||
ctld.spawnedCratesRED[_nearestCrate.crateUnit:getName()] = nil
|
||||
else
|
||||
ctld.spawnedCratesBLUE[_nearestCrate.crateUnit:getName()] = nil
|
||||
end
|
||||
|
||||
-- remove crate
|
||||
if ctld.slingLoad == false then
|
||||
_nearestCrate.crateUnit:destroy()
|
||||
end
|
||||
|
||||
return true -- all done so quit
|
||||
end
|
||||
end
|
||||
@ -2682,7 +2706,10 @@ function ctld.unpackMultiCrate(_heli, _nearestCrate, _nearbyCrates)
|
||||
end
|
||||
|
||||
--destroy
|
||||
-- _crate.crateUnit:destroy()
|
||||
if ctld.slingLoad == false then
|
||||
_crate.crateUnit:destroy()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
@ -2739,8 +2766,8 @@ function ctld.spawnCrateGroup(_heli, _positions, _types)
|
||||
end
|
||||
|
||||
--mist function
|
||||
_group.category = Group.Category.GROUND;
|
||||
_group.country = _heli:getCountry();
|
||||
_group.category = Group.Category.GROUND
|
||||
_group.country = _heli:getCountry()
|
||||
|
||||
local _spawnedGroup = Group.getByName(mist.dynAdd(_group).name)
|
||||
|
||||
@ -2749,7 +2776,7 @@ function ctld.spawnCrateGroup(_heli, _positions, _types)
|
||||
--activate by moving and so we can set ROE and Alarm state
|
||||
|
||||
local _dest = _spawnedGroup:getUnit(1):getPoint()
|
||||
_dest = { x = _dest.x + 5, _y = _dest.y + 5, z = _dest.z + 5 }
|
||||
_dest = { x = _dest.x + 0.5, _y = _dest.y + 0.5, z = _dest.z + 0.5 }
|
||||
|
||||
ctld.orderGroupToMoveToPoint(_spawnedGroup:getUnit(1), _dest)
|
||||
|
||||
@ -3005,7 +3032,7 @@ end
|
||||
-- are we in pickup zone
|
||||
function ctld.inPickupZone(_heli)
|
||||
|
||||
if _heli:inAir() then
|
||||
if ctld.inAir(_heli) then
|
||||
return false
|
||||
end
|
||||
|
||||
@ -3066,7 +3093,7 @@ end
|
||||
-- are we in a dropoff zone
|
||||
function ctld.inDropoffZone(_heli)
|
||||
|
||||
if _heli:inAir() then
|
||||
if ctld.inAir(_heli) then
|
||||
return false
|
||||
end
|
||||
|
||||
@ -3094,7 +3121,7 @@ end
|
||||
-- are we near friendly logistics zone
|
||||
function ctld.inLogisticsZone(_heli)
|
||||
|
||||
if _heli:inAir() then
|
||||
if ctld.inAir(_heli) then
|
||||
return false
|
||||
end
|
||||
|
||||
@ -3319,11 +3346,11 @@ function ctld.addF10MenuOptions()
|
||||
|
||||
|
||||
if ctld.enableSmokeDrop then
|
||||
missionCommands.addSubMenuForGroup(_groupId, "Smoke Markers")
|
||||
missionCommands.addCommandForGroup(_groupId, "Drop Red Smoke", { "Smoke Markers" }, ctld.dropSmoke, { _unitName, trigger.smokeColor.Red })
|
||||
missionCommands.addCommandForGroup(_groupId, "Drop Blue Smoke", { "Smoke Markers" }, ctld.dropSmoke, { _unitName, trigger.smokeColor.Blue })
|
||||
missionCommands.addCommandForGroup(_groupId, "Drop Orange Smoke", { "Smoke Markers" }, ctld.dropSmoke, { _unitName, trigger.smokeColor.Orange })
|
||||
missionCommands.addCommandForGroup(_groupId, "Drop Green Smoke", { "Smoke Markers" }, ctld.dropSmoke, { _unitName, trigger.smokeColor.Green })
|
||||
local _smokeMenu = missionCommands.addSubMenuForGroup(_groupId, "Smoke Markers",_rootPath)
|
||||
missionCommands.addCommandForGroup(_groupId, "Drop Red Smoke", _smokeMenu, ctld.dropSmoke, { _unitName, trigger.smokeColor.Red })
|
||||
missionCommands.addCommandForGroup(_groupId, "Drop Blue Smoke", _smokeMenu, ctld.dropSmoke, { _unitName, trigger.smokeColor.Blue })
|
||||
missionCommands.addCommandForGroup(_groupId, "Drop Orange Smoke", _smokeMenu, ctld.dropSmoke, { _unitName, trigger.smokeColor.Orange })
|
||||
missionCommands.addCommandForGroup(_groupId, "Drop Green Smoke", _smokeMenu, ctld.dropSmoke, { _unitName, trigger.smokeColor.Green })
|
||||
end
|
||||
|
||||
if ctld.enabledRadioBeaconDrop then
|
||||
|
||||
44
README.md
44
README.md
@ -13,7 +13,7 @@ The script supports:
|
||||
* Coloured Smoke Marker Drops
|
||||
* Extractable Soldier Spawn at a trigger zone
|
||||
* Extractable soldier groups added via mission editor
|
||||
* Unit construction using crates spawned at a logistics area and dropped via cargo sling
|
||||
* Unit construction using crates spawned at a logistics area and dropped via Simulated Cargo Sling or Real Cargo Sling
|
||||
* HAWK AA System requires 3 separate and correct crates to build
|
||||
* HAWK system can also be rearmed after construction by dropping another Hawk Launcher nearby and unpacking
|
||||
* HMMWV TOW
|
||||
@ -60,13 +60,9 @@ An example is shown below:
|
||||
###Script Configuration
|
||||
The script has lots of configuration options that can be used to further customise the behaviour.
|
||||
|
||||
**If you experience crashes with Sling-loading, such as a game crash when shotdown, you can use the simulated sling-load behaviour instead to work around the DCS Bugs.**
|
||||
To use the simulated behaviour, set the ```ctld.slingLoad``` option to ```false```.
|
||||
The simulated Sling Loading will use a generator static instead of a crate and you just hover above it for 10 seconds to load it. No Need to use the F6 menu to first select the crate.
|
||||
**I have now changed the default behaviour of the script to use Simulated Cargo Sling instead of the Real Cargo Sling due to DCS Bugs causing crashing**
|
||||
To use the real cargo sling behaviour, set the ```ctld.slingLoad``` option to ```true```.
|
||||
|
||||
The crate can then be dropped using the CTLD Commands section of the Radio menu. Make sure you're not too high when the crate is dropped or it will be destroyed!
|
||||
|
||||
Unfortunately there is no way to simulate the added weight of the Simulated Sling Load.
|
||||
|
||||
```lua
|
||||
|
||||
@ -76,7 +72,7 @@ Unfortunately there is no way to simulate the added weight of the Simulated Slin
|
||||
ctld.disableAllSmoke = false -- if true, all smoke is diabled at pickup and drop off zones regardless of settings below. Leave false to respect settings below
|
||||
|
||||
ctld.enableCrates = true -- if false, Helis will not be able to spawn or unpack crates so will be normal CTTS
|
||||
ctld.slingLoad = true -- if false, crates can be used WITHOUT slingloading, by hovering above the crate, simulating slingloading but not the weight...
|
||||
ctld.slingLoad = false -- if false, crates can be used WITHOUT slingloading, by hovering above the crate, simulating slingloading but not the weight...
|
||||
-- There are some bug with Sling-loading that can cause crashes, if these occur set slingLoad to false
|
||||
-- to use the other method.
|
||||
|
||||
@ -458,7 +454,37 @@ The C-130 / IL-76 can also load and unload FOB crates from a Logistics area, see
|
||||
|
||||
##Cargo Spawning and Sling Loading
|
||||
|
||||
Cargo can be spawned by transport helicopters if they are close enough to a friendly logistics unit using the F10 menu. Crates are always spawned off the nose of the unit that requested them. Sling cargo weight differs drastically depending on what you are sling loading. The Huey will need to have 20% fuel and no armaments in order to be able to lift a HMMWV TOW crate! The Mi-8 has a higher max lifting weight than a Huey.
|
||||
Cargo can be spawned by transport helicopters if they are close enough to a friendly logistics unit using the F10 menu. Crates are always spawned off the nose of the unit that requested them.
|
||||
|
||||
###Simulated Sling Loading
|
||||
If ```ctld.slingLoad = false``` then Simulated Sling Loading will be used. This option is now the default due to DCS crashes caused by Sling Loading on multiplayer. Simulated sling loads will not add and weight to your helicopter when loaded.
|
||||
|
||||
To pickup a Sling Load, spawn the cargo you want and hover above the crate for 10 seconds. There is no need to select which crate you want to pickup. Status messages will tell you if you are too high or too low. If the countdown stops, it means you are no longer hovering in the correct position and the timer will reset.
|
||||
|
||||
Too high:
|
||||
|
||||

|
||||
|
||||
Too Low:
|
||||
|
||||

|
||||
|
||||
Correct height and the countdown is working:
|
||||
|
||||

|
||||
|
||||
|
||||
Crate Loaded:
|
||||
|
||||

|
||||
|
||||
Once you've loaded the crate, fly to where you want to drop it and drop using the Radio Menu CTLD->CTLD Commands->Drop Crate. If you are hovering the crate will be dropped below you and if you're on the ground it will appear off you're nose.
|
||||
|
||||
Once on the ground unpack as normal using the CTLD Commands Menu - CTLD->CTLD Commands->Unpack Crate
|
||||
|
||||
###Real Sling Loading
|
||||
|
||||
This uses the inbuilt DCS Sling cargo system and crates. Sling cargo weight differs drastically depending on what you are sling loading. The Huey will need to have 20% fuel and no armaments in order to be able to lift a HMMWV TOW crate! The Mi-8 has a higher max lifting weight than a Huey.
|
||||
|
||||
Once spawning the crate, to slingload the F6 menu needs to be used to select a cargo of the correct weight. If you've selected the right cargo RED smoke will appear and you can now sling load by hovering over the crate at a height of 15-30 feet or so.
|
||||
|
||||
|
||||
Binary file not shown.
BIN
test-mission.miz
BIN
test-mission.miz
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user