mirror of
https://github.com/weyne85/DML.git
synced 2025-10-29 16:57:49 +00:00
Version 2.4.6
Fast-roping for heloTroops
This commit is contained in:
parent
59d8bb30cf
commit
4de5915ea4
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1,5 +1,5 @@
|
|||||||
autoCSAR = {}
|
autoCSAR = {}
|
||||||
autoCSAR.version = "2.2.1"
|
autoCSAR.version = "2.2.2"
|
||||||
autoCSAR.requiredLibs = {
|
autoCSAR.requiredLibs = {
|
||||||
"dcsCommon", -- always
|
"dcsCommon", -- always
|
||||||
"cfxZones", -- Zones, of course
|
"cfxZones", -- Zones, of course
|
||||||
@ -21,6 +21,8 @@ autoCSAR.trackedEjects = {} -- we start tracking on eject
|
|||||||
- no csar mission if pilot lands too close to airbase or farp
|
- no csar mission if pilot lands too close to airbase or farp
|
||||||
and noExploit is on
|
and noExploit is on
|
||||||
2.2.1 - DCS hardening for isExist
|
2.2.1 - DCS hardening for isExist
|
||||||
|
2.2.2 - more DCS bug hardening: getCoalition, getName, getID
|
||||||
|
|
||||||
--]]--
|
--]]--
|
||||||
autoCSAR.forbidden = {} -- indexed by name, contains point
|
autoCSAR.forbidden = {} -- indexed by name, contains point
|
||||||
autoCSAR.killDist = 2100 -- meters from center of forbidden
|
autoCSAR.killDist = 2100 -- meters from center of forbidden
|
||||||
@ -140,6 +142,12 @@ end
|
|||||||
autoCSAR.pilotInfo = {}
|
autoCSAR.pilotInfo = {}
|
||||||
function autoCSAR:onEvent(event)
|
function autoCSAR:onEvent(event)
|
||||||
if not event.initiator then return end
|
if not event.initiator then return end
|
||||||
|
-- more DCS bug stopping
|
||||||
|
local theUnit = event.initiator
|
||||||
|
if not theUnit.getName then return end
|
||||||
|
if not theUnit.getCoalition then return end
|
||||||
|
if not theUnit.getID then return end
|
||||||
|
|
||||||
local initiator = event.initiator
|
local initiator = event.initiator
|
||||||
if event.id == 31 then -- landing_after_eject, does not happen at sea
|
if event.id == 31 then -- landing_after_eject, does not happen at sea
|
||||||
-- to prevent double invocations for same process
|
-- to prevent double invocations for same process
|
||||||
|
|||||||
@ -27,7 +27,7 @@ cfxMX.verbose = false
|
|||||||
--]]--
|
--]]--
|
||||||
|
|
||||||
cfxMX.spawnedUnitCoaByName = {} -- reverse lookup for coas to reconstruct after kill
|
cfxMX.spawnedUnitCoaByName = {} -- reverse lookup for coas to reconstruct after kill
|
||||||
cfxMX.spawnedUnitCatByName = {} -- reverse lookup fir cat to recon after kill
|
cfxMX.spawnedUnitCatByName = {} -- reverse lookup for cat to recon after kill
|
||||||
cfxMX.spawnedUnitGroupNameByName = {}
|
cfxMX.spawnedUnitGroupNameByName = {}
|
||||||
|
|
||||||
cfxMX.groupNamesByID = {}
|
cfxMX.groupNamesByID = {}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
cfxHeloTroops = {}
|
cfxHeloTroops = {}
|
||||||
cfxHeloTroops.version = "5.0.0"
|
cfxHeloTroops.version = "5.1.0"
|
||||||
cfxHeloTroops.verbose = false
|
cfxHeloTroops.verbose = false
|
||||||
cfxHeloTroops.autoDrop = true
|
cfxHeloTroops.autoDrop = true
|
||||||
cfxHeloTroops.autoPickup = false
|
cfxHeloTroops.autoPickup = false
|
||||||
@ -8,29 +8,17 @@ cfxHeloTroops.requestRange = 500 -- meters
|
|||||||
--
|
--
|
||||||
--[[--
|
--[[--
|
||||||
VERSION HISTORY
|
VERSION HISTORY
|
||||||
4.0.0 - added dropZones
|
|
||||||
- enforceDropZones
|
|
||||||
- coalition for drop zones
|
|
||||||
4.1.0 - troops dropped in dropZones with active autodespawn are
|
|
||||||
filtered from load menu
|
|
||||||
- updated eventhandler to new events and unitLost
|
|
||||||
- timeStamp to avoid double-dipping
|
|
||||||
- auto-pickup restricted as well
|
|
||||||
- code cleanup
|
|
||||||
4.2.0 - support for individual lase codes
|
|
||||||
- support for drivable
|
|
||||||
4.2.1 - increased verbosity
|
|
||||||
- also supports 'pickupRang" for reverse-compatibility with manual typo.
|
|
||||||
4.2.2 - support for attachTo:
|
|
||||||
4.2.3 - dropZone supports 'keepWait' attribute
|
|
||||||
- dropZone supports 'setWait' attribute
|
|
||||||
4.2.4 - dropWait is always active outside of drop zones
|
|
||||||
5.0.0 - drop options and formation menus. Supported formations
|
5.0.0 - drop options and formation menus. Supported formations
|
||||||
circle_out
|
circle_out
|
||||||
chevron
|
chevron
|
||||||
line left
|
line left
|
||||||
line right
|
line right
|
||||||
scattered behind
|
scattered behind
|
||||||
|
5.0.1 - mande UI menu name a config option menuName
|
||||||
|
5.1.0 - new airdrop ability (prep)
|
||||||
|
- fastRope attribute
|
||||||
|
- ropeAGL attribute (30m)
|
||||||
|
- ropeVel attribute (1.1m/s = 4.00 km/h)
|
||||||
|
|
||||||
--]]--
|
--]]--
|
||||||
cfxHeloTroops.minTime = 3 -- seconds beween tandings
|
cfxHeloTroops.minTime = 3 -- seconds beween tandings
|
||||||
@ -285,7 +273,6 @@ end
|
|||||||
|
|
||||||
function cfxHeloTroops.addConfigMenu(conf)
|
function cfxHeloTroops.addConfigMenu(conf)
|
||||||
-- we add a menu for auto-drop-off and drop formation
|
-- we add a menu for auto-drop-off and drop formation
|
||||||
-- trigger.action.outText("enter addConfigMenu for <" .. conf.unit:getName() .. ">", 30)
|
|
||||||
if conf.myDeployMenu then
|
if conf.myDeployMenu then
|
||||||
missionCommands.removeItemForGroup(conf.id, conf.myDeployMenu)
|
missionCommands.removeItemForGroup(conf.id, conf.myDeployMenu)
|
||||||
end
|
end
|
||||||
@ -352,7 +339,6 @@ function cfxHeloTroops.addConfigMenu(conf)
|
|||||||
cfxHeloTroops.redirectDropFormation,
|
cfxHeloTroops.redirectDropFormation,
|
||||||
{conf, "gaggle"}
|
{conf, "gaggle"}
|
||||||
)
|
)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function cfxHeloTroops.setCommsMenu(theUnit)
|
function cfxHeloTroops.setCommsMenu(theUnit)
|
||||||
@ -384,7 +370,7 @@ function cfxHeloTroops.setCommsMenu(theUnit)
|
|||||||
if cfxHeloTroops.mainMenu then
|
if cfxHeloTroops.mainMenu then
|
||||||
mainMenu = radioMenu.getMainMenuFor(cfxHeloTroops.mainMenu)
|
mainMenu = radioMenu.getMainMenuFor(cfxHeloTroops.mainMenu)
|
||||||
end
|
end
|
||||||
conf.myMainMenu = missionCommands.addSubMenuForGroup(id, 'Airlift Troops', mainMenu)
|
conf.myMainMenu = missionCommands.addSubMenuForGroup(id, cfxHeloTroops.menuName, mainMenu) -- 'Airlift Troops'
|
||||||
end
|
end
|
||||||
-- clear out existing commands, add new
|
-- clear out existing commands, add new
|
||||||
cfxHeloTroops.clearCommsSubmenus(conf)
|
cfxHeloTroops.clearCommsSubmenus(conf)
|
||||||
@ -409,7 +395,17 @@ function cfxHeloTroops.addAirborneMenu(conf)
|
|||||||
-- while airborne, add a status menu
|
-- while airborne, add a status menu
|
||||||
local commandTxt = "(To load troops, land in proximity to them)"
|
local commandTxt = "(To load troops, land in proximity to them)"
|
||||||
if conf.troopsOnBoardNum > 0 then
|
if conf.troopsOnBoardNum > 0 then
|
||||||
commandTxt = "(You are carrying " .. conf.troopsOnBoardNum .. " Infantry. Land to deploy them)"
|
commandTxt = "(You are carrying " .. conf.troopsOnBoardNum .. " Infantry; "
|
||||||
|
if cfxHeloTroops.airDrop or cfxHeloTroops.fastRope then
|
||||||
|
if cfxHeloTroops.airDrop then
|
||||||
|
commandTxt = commandTxt .. "airdrop or "
|
||||||
|
end
|
||||||
|
if cfxHeloTroops.fastRope then
|
||||||
|
commandTxt = commandTxt .. "fast-rope or "
|
||||||
|
end
|
||||||
|
else
|
||||||
|
commandTxt = commandTxt .. "land to deploy)"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local theCommand = missionCommands.addCommandForGroup(
|
local theCommand = missionCommands.addCommandForGroup(
|
||||||
conf.id,
|
conf.id,
|
||||||
@ -419,6 +415,65 @@ function cfxHeloTroops.addAirborneMenu(conf)
|
|||||||
{conf, "none"}
|
{conf, "none"}
|
||||||
)
|
)
|
||||||
table.insert(conf.myCommands, theCommand)
|
table.insert(conf.myCommands, theCommand)
|
||||||
|
|
||||||
|
if conf.troopsOnBoardNum > 0
|
||||||
|
and (cfxHeloTroops.airDrop or cfxHeloTroops.fastRope) then
|
||||||
|
if cfxHeloTroops.airDrop then
|
||||||
|
local theCommand = missionCommands.addCommandForGroup(
|
||||||
|
conf.id,
|
||||||
|
"Air-Drop",
|
||||||
|
conf.myMainMenu,
|
||||||
|
cfxHeloTroops.redirectAirAction,
|
||||||
|
{conf, "drop"}
|
||||||
|
)
|
||||||
|
table.insert(conf.myCommands, theCommand)
|
||||||
|
end
|
||||||
|
if cfxHeloTroops.fastRope then
|
||||||
|
local theCommand = missionCommands.addCommandForGroup(
|
||||||
|
conf.id,
|
||||||
|
"Fast-Rope",
|
||||||
|
conf.myMainMenu,
|
||||||
|
cfxHeloTroops.redirectAirAction,
|
||||||
|
{conf, "rope"}
|
||||||
|
)
|
||||||
|
table.insert(conf.myCommands, theCommand)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function cfxHeloTroops.redirectAirAction(args)
|
||||||
|
timer.scheduleFunction(cfxHeloTroops.doAirAction, args, timer.getTime() + 0.1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function cfxHeloTroops.doAirAction(args)
|
||||||
|
local conf = args[1]
|
||||||
|
local what = args[2]
|
||||||
|
if not what then what = "NIL" end
|
||||||
|
if what == "drop" then
|
||||||
|
trigger.action.outText("+++heloT: NYI air action 'drop'.", 30)
|
||||||
|
|
||||||
|
elseif what == "rope" then
|
||||||
|
local theUnit = conf.unit
|
||||||
|
local theGroup = theUnit:getGroup()
|
||||||
|
local gid = theGroup:getID()
|
||||||
|
-- velocity and alt check
|
||||||
|
local vel = dcsCommon.getUnitSpeed(theUnit) -- in m/s
|
||||||
|
local alt = dcsCommon.getUnitAGL(theUnit) -- in m
|
||||||
|
if alt > cfxHeloTroops.ropeAGL then
|
||||||
|
trigger.action.outTextForGroup(gid, "Get below " .. cfxHeloTroops.ropeAGL .. "m AGL to fast-rope your troops.", 30)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if vel > cfxHeloTroops.ropeVel then
|
||||||
|
kmh = 3.6 * cfxHeloTroops.ropeVel
|
||||||
|
mph = math.floor(10 * kmh / 1.852) / 10
|
||||||
|
trigger.action.outTextForGroup(gid, "Slow down to " .. kmh .. "m (= ".. mph .. "kts) to fast-rope your troops.", 30)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
-- use doDeployTroops for the rest
|
||||||
|
cfxHeloTroops.doDeployTroops(args)
|
||||||
|
else
|
||||||
|
trigger.action.outText("+++heloT: unknown air action <" .. what .. ">.", 30)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function cfxHeloTroops.redirectNoAction(args)
|
function cfxHeloTroops.redirectNoAction(args)
|
||||||
@ -1155,13 +1210,18 @@ function cfxHeloTroops.readConfigZone()
|
|||||||
|
|
||||||
cfxHeloTroops.requestRange = theZone:getNumberFromZoneProperty("requestRange", 500)
|
cfxHeloTroops.requestRange = theZone:getNumberFromZoneProperty("requestRange", 500)
|
||||||
cfxHeloTroops.enforceDropZones = theZone:getBoolFromZoneProperty("enforceDropZones", false)
|
cfxHeloTroops.enforceDropZones = theZone:getBoolFromZoneProperty("enforceDropZones", false)
|
||||||
|
cfxHeloTroops.airdrop = theZone:getBoolFromZoneProperty("airDrop", false)
|
||||||
|
cfxHeloTroops.fastRope = theZone:getBoolFromZoneProperty("fastRope", false)
|
||||||
|
cfxHeloTroops.ropeAGL = theZone:getNumberFromZoneProperty("ropeAGL", 30) -- meters
|
||||||
|
cfxHeloTroops.ropeVel = theZone:getNumberFromZoneProperty("ropeVel", 1.1)
|
||||||
|
|
||||||
-- add own troop carriers
|
-- add own troop carriers
|
||||||
if theZone:hasProperty("troopCarriers") then
|
if theZone:hasProperty("troopCarriers") then
|
||||||
local tc = theZone:getStringFromZoneProperty("troopCarriers", "UH-1D")
|
local tc = theZone:getStringFromZoneProperty("troopCarriers", "UH-1D")
|
||||||
tc = dcsCommon.splitString(tc, ",")
|
tc = dcsCommon.splitString(tc, ",")
|
||||||
cfxHeloTroops.troopCarriers = dcsCommon.trimArray(tc)
|
cfxHeloTroops.troopCarriers = dcsCommon.trimArray(tc)
|
||||||
end
|
end
|
||||||
|
cfxHeloTroops.menuName = theZone:getStringFromZoneProperty("menuName", "Airlift Troops")
|
||||||
if theZone:hasProperty("attachTo:") then
|
if theZone:hasProperty("attachTo:") then
|
||||||
local attachTo = theZone:getStringFromZoneProperty("attachTo:", "<none>")
|
local attachTo = theZone:getStringFromZoneProperty("attachTo:", "<none>")
|
||||||
if radioMenu then -- requires optional radio menu to have loaded
|
if radioMenu then -- requires optional radio menu to have loaded
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
cfxPlayerScore = {}
|
cfxPlayerScore = {}
|
||||||
cfxPlayerScore.version = "5.2.2"
|
cfxPlayerScore.version = "5.2.3"
|
||||||
cfxPlayerScore.name = "cfxPlayerScore" -- compatibility with flag bangers
|
cfxPlayerScore.name = "cfxPlayerScore" -- compatibility with flag bangers
|
||||||
cfxPlayerScore.firstSave = true -- to force overwrite
|
cfxPlayerScore.firstSave = true -- to force overwrite
|
||||||
--[[-- VERSION HISTORY
|
--[[-- VERSION HISTORY
|
||||||
@ -20,6 +20,7 @@ cfxPlayerScore.firstSave = true -- to force overwrite
|
|||||||
- wiping score on enter and birth
|
- wiping score on enter and birth
|
||||||
- more robust initscore
|
- more robust initscore
|
||||||
5.2.2 - fixed typo in feat zone
|
5.2.2 - fixed typo in feat zone
|
||||||
|
5.2.3 - resolved nil vicCat
|
||||||
|
|
||||||
TODO: Kill event no longer invoked for map objetcs, attribute
|
TODO: Kill event no longer invoked for map objetcs, attribute
|
||||||
to faction now, reverse invocation direction with PlayerScore
|
to faction now, reverse invocation direction with PlayerScore
|
||||||
@ -189,6 +190,10 @@ function cfxPlayerScore.evalFeatDescription(name, theZone, playerUnit, victim)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function cfxPlayerScore.cat2BaseScore(inCat)
|
function cfxPlayerScore.cat2BaseScore(inCat)
|
||||||
|
if not inCat then
|
||||||
|
trigger.action.outText("+++scr cat2BaseScore: nil inCat, returning 1", 30)
|
||||||
|
return 1
|
||||||
|
end
|
||||||
if inCat == 0 then return cfxPlayerScore.aircraft end -- airplane
|
if inCat == 0 then return cfxPlayerScore.aircraft end -- airplane
|
||||||
if inCat == 1 then return cfxPlayerScore.helo end -- helo
|
if inCat == 1 then return cfxPlayerScore.helo end -- helo
|
||||||
if inCat == 2 then return cfxPlayerScore.ground end -- ground
|
if inCat == 2 then return cfxPlayerScore.ground end -- ground
|
||||||
|
|||||||
BIN
tutorial & demo missions/demo - fast-rope from helo.miz
Normal file
BIN
tutorial & demo missions/demo - fast-rope from helo.miz
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user