mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5452bc7539 | ||
|
|
2a4c9ed91a | ||
|
|
a78dd40688 | ||
|
|
44ff4d61da | ||
|
|
196efb7bcb | ||
|
|
38128b65c0 | ||
|
|
ee6977aa96 | ||
|
|
dc214da0d6 | ||
|
|
ee41e86628 | ||
|
|
fdc24a32c5 | ||
|
|
cb63b37494 | ||
|
|
cefd92f720 | ||
|
|
df8f19ee38 |
395
CTLD.lua
395
CTLD.lua
@@ -12,12 +12,16 @@
|
|||||||
|
|
||||||
Contributors:
|
Contributors:
|
||||||
- Steggles - https://github.com/Bob7heBuilder
|
- Steggles - https://github.com/Bob7heBuilder
|
||||||
|
- mvee - https://github.com/mvee
|
||||||
|
- jmontleon - https://github.com/jmontleon
|
||||||
|
- emilianomolina - https://github.com/emilianomolina
|
||||||
|
|
||||||
Version: 1.61 - 19/04/2015
|
Version: 1.70 - 25/06/2017
|
||||||
- Added ability to add Waypoint zones
|
- Added ability to set maximum group size that can be carried
|
||||||
-- Troops dropped in a waypoint zone will automatically head to the center of the zone
|
- 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
|
||||||
]]
|
]]
|
||||||
|
|
||||||
ctld = {} -- DONT REMOVE!
|
ctld = {} -- DONT REMOVE!
|
||||||
@@ -26,11 +30,11 @@ ctld = {} -- DONT REMOVE!
|
|||||||
-- ********************* USER CONFIGURATION ******************************
|
-- ********************* USER CONFIGURATION ******************************
|
||||||
-- ************************************************************************
|
-- ************************************************************************
|
||||||
|
|
||||||
ctld.staticBugFix = true -- When statics are destroyed, DCS Crashes. Set this to FALSE when this bug is fixed or if you want to use REAL sling loads :)
|
ctld.staticBugWorkaround = false -- DCS had a bug where destroying statics would cause a crash. If this happens again, set this to TRUE
|
||||||
|
|
||||||
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.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.hoverPickup = true -- if set to false you can load crates with the F10 menu instead of hovering...
|
ctld.hoverPickup = true -- if set to false you can load crates with the F10 menu instead of hovering... Only if not using real crates!
|
||||||
|
|
||||||
ctld.enableCrates = true -- if false, Helis will not be able to spawn or unpack crates so will be normal CTTS
|
ctld.enableCrates = true -- if false, Helis will not be able to spawn or unpack crates so will be normal CTTS
|
||||||
ctld.slingLoad = false -- 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...
|
||||||
@@ -46,6 +50,7 @@ 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.maximumMoveDistance = 2000 -- max distance for troops to move from drop point if no enemy is nearby
|
||||||
|
|
||||||
ctld.numberOfTroops = 10 -- default number of troops to load on a transport heli or C-130
|
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
|
ctld.enableFastRopeInsertion = true -- allows you to drop troops by fast rope
|
||||||
ctld.fastRopeMaximumHeight = 18.28 -- in meters which is 60 ft max fast rope (not rappell) safe height
|
ctld.fastRopeMaximumHeight = 18.28 -- in meters which is 60 ft max fast rope (not rappell) safe height
|
||||||
|
|
||||||
@@ -71,6 +76,10 @@ ctld.troopPickupAtFOB = true -- if true, troops can also be picked up at a creat
|
|||||||
|
|
||||||
ctld.buildTimeFOB = 120 --time in seconds for the FOB to be built
|
ctld.buildTimeFOB = 120 --time in seconds for the FOB to be built
|
||||||
|
|
||||||
|
ctld.crateWaitTime = 120 -- time in seconds to wait before you can spawn another crate
|
||||||
|
|
||||||
|
ctld.forceCrateToBeMoved = true -- a crate must be picked up at least once and moved before it can be unpacked. Helps to reduce crate spam
|
||||||
|
|
||||||
ctld.radioSound = "beacon.ogg" -- the name of the sound file to use for the FOB radio beacons. If this isnt added to the mission BEACONS WONT WORK!
|
ctld.radioSound = "beacon.ogg" -- the name of the sound file to use for the FOB radio beacons. If this isnt added to the mission BEACONS WONT WORK!
|
||||||
ctld.radioSoundFC3 = "beaconsilent.ogg" -- name of the second silent radio file, used so FC3 aircraft dont hear ALL the beacon noises... :)
|
ctld.radioSoundFC3 = "beaconsilent.ogg" -- name of the second silent radio file, used so FC3 aircraft dont hear ALL the beacon noises... :)
|
||||||
|
|
||||||
@@ -386,6 +395,49 @@ ctld.vehicleTransportEnabled = {
|
|||||||
"C-130",
|
"C-130",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- ************** Maximum Units SETUP for UNITS ******************
|
||||||
|
|
||||||
|
-- Put the name of the Unit you want to limit group sizes too
|
||||||
|
-- i.e
|
||||||
|
-- ["UH-1H"] = 10,
|
||||||
|
--
|
||||||
|
-- Will limit UH1 to only transport groups with a size 10 or less
|
||||||
|
-- Make sure the unit name is exactly right or it wont work
|
||||||
|
|
||||||
|
ctld.unitLoadLimits = {
|
||||||
|
|
||||||
|
-- Remove the -- below to turn on options
|
||||||
|
-- ["SA342Mistral"] = 4,
|
||||||
|
-- ["SA342L"] = 4,
|
||||||
|
-- ["SA342M"] = 4,
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
-- ************** Allowable actions for UNIT TYPES ******************
|
||||||
|
|
||||||
|
-- Put the name of the Unit you want to limit actions for
|
||||||
|
-- NOTE - the unit must've been listed in the transportPilotNames list above
|
||||||
|
-- This can be used in conjunction with the options above for group sizes
|
||||||
|
-- By default you can load both crates and troops unless overriden below
|
||||||
|
-- i.e
|
||||||
|
-- ["UH-1H"] = {crates=true, troops=false},
|
||||||
|
--
|
||||||
|
-- Will limit UH1 to only transport CRATES but NOT TROOPS
|
||||||
|
--
|
||||||
|
-- ["SA342Mistral"] = {crates=fales, troops=true},
|
||||||
|
-- Will allow Mistral Gazelle to only transport crates, not troops
|
||||||
|
|
||||||
|
ctld.unitActions = {
|
||||||
|
|
||||||
|
-- Remove the -- below to turn on options
|
||||||
|
-- ["SA342Mistral"] = {crates=true, troops=true},
|
||||||
|
-- ["SA342L"] = {crates=false, troops=true},
|
||||||
|
-- ["SA342M"] = {crates=false, troops=true},
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
-- ************** INFANTRY GROUPS FOR PICKUP ******************
|
-- ************** INFANTRY GROUPS FOR PICKUP ******************
|
||||||
-- Unit Types
|
-- Unit Types
|
||||||
-- inf is normal infantry
|
-- inf is normal infantry
|
||||||
@@ -475,6 +527,22 @@ ctld.jtacUnitTypes = {
|
|||||||
"SKP", "Hummer" -- there are some wierd encoding issues so if you write SKP-11 it wont match as the - sign is encoded differently...
|
"SKP", "Hummer" -- there are some wierd encoding issues so if you write SKP-11 it wont match as the - sign is encoded differently...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ctld.nextUnitId = 1;
|
||||||
|
ctld.getNextUnitId = function()
|
||||||
|
ctld.nextUnitId = ctld.nextUnitId + 1
|
||||||
|
|
||||||
|
return ctld.nextUnitId
|
||||||
|
end
|
||||||
|
|
||||||
|
ctld.nextGroupId = 1;
|
||||||
|
|
||||||
|
ctld.getNextGroupId = function()
|
||||||
|
ctld.nextGroupId = ctld.nextGroupId + 1
|
||||||
|
|
||||||
|
return ctld.nextGroupId
|
||||||
|
end
|
||||||
|
|
||||||
-- ***************************************************************
|
-- ***************************************************************
|
||||||
-- **************** Mission Editor Functions *********************
|
-- **************** Mission Editor Functions *********************
|
||||||
-- ***************************************************************
|
-- ***************************************************************
|
||||||
@@ -1172,7 +1240,7 @@ function ctld.spawnCrateAtZone(_side, _weight,_zone)
|
|||||||
local _alt = land.getHeight(_pos2)
|
local _alt = land.getHeight(_pos2)
|
||||||
local _point = { x = _pos2.x, y = _alt, z = _pos2.y }
|
local _point = { x = _pos2.x, y = _alt, z = _pos2.y }
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
|
|
||||||
local _name = string.format("%s #%i", _crateType.desc, _unitId)
|
local _name = string.format("%s #%i", _crateType.desc, _unitId)
|
||||||
|
|
||||||
@@ -1207,7 +1275,7 @@ function ctld.spawnCrateAtPoint(_side, _weight,_point)
|
|||||||
_country = 2
|
_country = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
|
|
||||||
local _name = string.format("%s #%i", _crateType.desc, _unitId)
|
local _name = string.format("%s #%i", _crateType.desc, _unitId)
|
||||||
|
|
||||||
@@ -1256,6 +1324,9 @@ ctld.AASystemTemplate = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ctld.crateWait = {}
|
||||||
|
ctld.crateMove = {}
|
||||||
|
|
||||||
---------------- INTERNAL FUNCTIONS ----------------
|
---------------- INTERNAL FUNCTIONS ----------------
|
||||||
function ctld.getTransportUnit(_unitName)
|
function ctld.getTransportUnit(_unitName)
|
||||||
|
|
||||||
@@ -1278,13 +1349,13 @@ function ctld.spawnCrateStatic(_country, _unitId, _point, _name, _weight,_side)
|
|||||||
local _crate
|
local _crate
|
||||||
local _spawnedCrate
|
local _spawnedCrate
|
||||||
|
|
||||||
if ctld.staticBugFix and ctld.slingLoad == false then
|
if ctld.staticBugWorkaround and ctld.slingLoad == false then
|
||||||
local _groupId = mist.getNextGroupId()
|
local _groupId = ctld.getNextGroupId()
|
||||||
local _groupName = "Crate Group #".._groupId
|
local _groupName = "Crate Group #".._groupId
|
||||||
|
|
||||||
local _group = {
|
local _group = {
|
||||||
["visible"] = false,
|
["visible"] = false,
|
||||||
["groupId"] = _groupId,
|
-- ["groupId"] = _groupId,
|
||||||
["hidden"] = false,
|
["hidden"] = false,
|
||||||
["units"] = {},
|
["units"] = {},
|
||||||
-- ["y"] = _positions[1].z,
|
-- ["y"] = _positions[1].z,
|
||||||
@@ -1309,10 +1380,10 @@ function ctld.spawnCrateStatic(_country, _unitId, _point, _name, _weight,_side)
|
|||||||
|
|
||||||
if ctld.slingLoad then
|
if ctld.slingLoad then
|
||||||
_crate = {
|
_crate = {
|
||||||
["category"] = "Cargo",
|
["category"] = "Cargos", --now plurar
|
||||||
["shape_name"] = "ab-212_cargo",
|
["shape_name"] = "bw_container_cargo", --new slingloadable container
|
||||||
["type"] = "Cargo1",
|
["type"] = "container_cargo", --new type
|
||||||
["unitId"] = _unitId,
|
-- ["unitId"] = _unitId,
|
||||||
["y"] = _point.z,
|
["y"] = _point.z,
|
||||||
["x"] = _point.x,
|
["x"] = _point.x,
|
||||||
["mass"] = _weight,
|
["mass"] = _weight,
|
||||||
@@ -1324,11 +1395,55 @@ function ctld.spawnCrateStatic(_country, _unitId, _point, _name, _weight,_side)
|
|||||||
-- ["cargoDisplayName"] = "cargo123",
|
-- ["cargoDisplayName"] = "cargo123",
|
||||||
-- ["CargoDisplayName"] = "cargo123",
|
-- ["CargoDisplayName"] = "cargo123",
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
--[[ Placeholder for different type of cargo containers. Let's say pipes and trunks, fuel for FOB building
|
||||||
|
["shape_name"] = "ab-212_cargo",
|
||||||
|
["type"] = "uh1h_cargo" --new type for the container previously used
|
||||||
|
|
||||||
|
["shape_name"] = "ammo_box_cargo",
|
||||||
|
["type"] = "ammo_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "barrels_cargo",
|
||||||
|
["type"] = "barrels_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "bw_container_cargo",
|
||||||
|
["type"] = "container_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "f_bar_cargo",
|
||||||
|
["type"] = "f_bar_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "fueltank_cargo",
|
||||||
|
["type"] = "fueltank_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "iso_container_cargo",
|
||||||
|
["type"] = "iso_container",
|
||||||
|
|
||||||
|
["shape_name"] = "iso_container_small_cargo",
|
||||||
|
["type"] = "iso_container_small",
|
||||||
|
|
||||||
|
["shape_name"] = "oiltank_cargo",
|
||||||
|
["type"] = "oiltank_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "pipes_big_cargo",
|
||||||
|
["type"] = "pipes_big_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "pipes_small_cargo",
|
||||||
|
["type"] = "pipes_small_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "tetrapod_cargo",
|
||||||
|
["type"] = "tetrapod_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "trunks_long_cargo",
|
||||||
|
["type"] = "trunks_long_cargo",
|
||||||
|
|
||||||
|
["shape_name"] = "trunks_small_cargo",
|
||||||
|
["type"] = "trunks_small_cargo",
|
||||||
|
]]--
|
||||||
|
else
|
||||||
_crate = {
|
_crate = {
|
||||||
["shape_name"] = "GeneratorF",
|
["shape_name"] = "GeneratorF",
|
||||||
["type"] = "GeneratorF",
|
["type"] = "GeneratorF",
|
||||||
["unitId"] = _unitId,
|
-- ["unitId"] = _unitId,
|
||||||
["y"] = _point.z,
|
["y"] = _point.z,
|
||||||
["x"] = _point.x,
|
["x"] = _point.x,
|
||||||
["name"] = _name,
|
["name"] = _name,
|
||||||
@@ -1362,7 +1477,7 @@ function ctld.spawnFOBCrateStatic(_country, _unitId, _point, _name)
|
|||||||
["category"] = "Fortifications",
|
["category"] = "Fortifications",
|
||||||
["shape_name"] = "konteiner_red1",
|
["shape_name"] = "konteiner_red1",
|
||||||
["type"] = "Container red 1",
|
["type"] = "Container red 1",
|
||||||
["unitId"] = _unitId,
|
-- ["unitId"] = _unitId,
|
||||||
["y"] = _point.z,
|
["y"] = _point.z,
|
||||||
["x"] = _point.x,
|
["x"] = _point.x,
|
||||||
["name"] = _name,
|
["name"] = _name,
|
||||||
@@ -1386,7 +1501,7 @@ function ctld.spawnFOB(_country, _unitId, _point, _name)
|
|||||||
local _crate = {
|
local _crate = {
|
||||||
["category"] = "Fortifications",
|
["category"] = "Fortifications",
|
||||||
["type"] = "outpost",
|
["type"] = "outpost",
|
||||||
["unitId"] = _unitId,
|
-- ["unitId"] = _unitId,
|
||||||
["y"] = _point.z,
|
["y"] = _point.z,
|
||||||
["x"] = _point.x,
|
["x"] = _point.x,
|
||||||
["name"] = _name,
|
["name"] = _name,
|
||||||
@@ -1399,10 +1514,10 @@ function ctld.spawnFOB(_country, _unitId, _point, _name)
|
|||||||
local _spawnedCrate = StaticObject.getByName(_crate["name"])
|
local _spawnedCrate = StaticObject.getByName(_crate["name"])
|
||||||
--local _spawnedCrate = coalition.addStaticObject(_country, _crate)
|
--local _spawnedCrate = coalition.addStaticObject(_country, _crate)
|
||||||
|
|
||||||
local _id = mist.getNextUnitId()
|
local _id = ctld.getNextUnitId()
|
||||||
local _tower = {
|
local _tower = {
|
||||||
["type"] = "house2arm",
|
["type"] = "house2arm",
|
||||||
["unitId"] = _id,
|
-- ["unitId"] = _id,
|
||||||
["rate"] = 100,
|
["rate"] = 100,
|
||||||
["y"] = _point.z + -36.57142857,
|
["y"] = _point.z + -36.57142857,
|
||||||
["x"] = _point.x + 14.85714286,
|
["x"] = _point.x + 14.85714286,
|
||||||
@@ -1465,14 +1580,23 @@ function ctld.spawnCrate(_arguments)
|
|||||||
|
|
||||||
local _position = _heli:getPosition()
|
local _position = _heli:getPosition()
|
||||||
|
|
||||||
|
-- check crate spam
|
||||||
|
if _heli:getPlayerName() ~= nil and ctld.crateWait[_heli:getPlayerName()] and ctld.crateWait[_heli:getPlayerName()] < timer.getTime() then
|
||||||
|
|
||||||
-- trigger.action.outText("Spawn Crate".._args[1].." ".._args[2],10)
|
ctld.displayMessageToGroup(_heli,"Sorry you must wait "..(ctld.crateWait[_heli:getPlayerName()] - timer.getTime()).. " seconds before you can get another crate", 20)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if _heli:getPlayerName() ~= nil then
|
||||||
|
ctld.crateWait[_heli:getPlayerName()] = timer.getTime() + ctld.crateWaitTime
|
||||||
|
end
|
||||||
|
-- trigger.action.outText("Spawn Crate".._args[1].." ".._args[2],10)
|
||||||
|
|
||||||
local _heli = ctld.getTransportUnit(_args[1])
|
local _heli = ctld.getTransportUnit(_args[1])
|
||||||
|
|
||||||
local _point = ctld.getPointAt12Oclock(_heli, 30)
|
local _point = ctld.getPointAt12Oclock(_heli, 30)
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
|
|
||||||
local _side = _heli:getCoalition()
|
local _side = _heli:getCoalition()
|
||||||
|
|
||||||
@@ -1480,6 +1604,9 @@ function ctld.spawnCrate(_arguments)
|
|||||||
|
|
||||||
local _spawnedCrate = ctld.spawnCrateStatic(_heli:getCountry(), _unitId, _point, _name, _crateType.weight,_side)
|
local _spawnedCrate = ctld.spawnCrateStatic(_heli:getCountry(), _unitId, _point, _name, _crateType.weight,_side)
|
||||||
|
|
||||||
|
-- add to move table
|
||||||
|
ctld.crateMove[_name] = _name
|
||||||
|
|
||||||
ctld.displayMessageToGroup(_heli, string.format("A %s crate weighing %s kg has been brought out and is at your 12 o'clock ", _crateType.desc, _crateType.weight), 20)
|
ctld.displayMessageToGroup(_heli, string.format("A %s crate weighing %s kg has been brought out and is at your 12 o'clock ", _crateType.desc, _crateType.weight), 20)
|
||||||
|
|
||||||
else
|
else
|
||||||
@@ -1676,7 +1803,7 @@ end
|
|||||||
function ctld.insertIntoTroopsArray(_troopType,_count,_troopArray)
|
function ctld.insertIntoTroopsArray(_troopType,_count,_troopArray)
|
||||||
|
|
||||||
for _i = 1, _count do
|
for _i = 1, _count do
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
table.insert(_troopArray, { type = _troopType, unitId = _unitId, name = string.format("Dropped %s #%i", _troopType, _unitId) })
|
table.insert(_troopArray, { type = _troopType, unitId = _unitId, name = string.format("Dropped %s #%i", _troopType, _unitId) })
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1749,13 +1876,13 @@ function ctld.generateTroopTypes(_side, _countOrTemplate, _country)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
|
|
||||||
_troops[_i] = { type = _unitType, unitId = _unitId, name = string.format("Dropped %s #%i", _unitType, _unitId) }
|
_troops[_i] = { type = _unitType, unitId = _unitId, name = string.format("Dropped %s #%i", _unitType, _unitId) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _groupId = mist.getNextGroupId()
|
local _groupId = ctld.getNextGroupId()
|
||||||
local _details = { units = _troops, groupId = _groupId, groupName = string.format("Dropped Group %i", _groupId), side = _side, country = _country }
|
local _details = { units = _troops, groupId = _groupId, groupName = string.format("Dropped Group %i", _groupId), side = _side, country = _country }
|
||||||
|
|
||||||
return _details
|
return _details
|
||||||
@@ -1849,13 +1976,13 @@ function ctld.generateVehiclesForTransport(_side, _country)
|
|||||||
|
|
||||||
for _i, _type in ipairs(_list) do
|
for _i, _type in ipairs(_list) do
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
|
|
||||||
_vehicles[_i] = { type = _type, unitId = _unitId, name = string.format("Dropped %s #%i", _type, _unitId) }
|
_vehicles[_i] = { type = _type, unitId = _unitId, name = string.format("Dropped %s #%i", _type, _unitId) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local _groupId = mist.getNextGroupId()
|
local _groupId = ctld.getNextGroupId()
|
||||||
local _details = { units = _vehicles, groupId = _groupId, groupName = string.format("Dropped Group %i", _groupId), side = _side, country = _country }
|
local _details = { units = _vehicles, groupId = _groupId, groupName = string.format("Dropped Group %i", _groupId), side = _side, country = _country }
|
||||||
|
|
||||||
return _details
|
return _details
|
||||||
@@ -1895,11 +2022,11 @@ function ctld.loadUnloadFOBCrate(_args)
|
|||||||
|
|
||||||
local _side = _heli:getCoalition()
|
local _side = _heli:getCoalition()
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
|
|
||||||
local _name = string.format("FOB Crate #%i", _unitId)
|
local _name = string.format("FOB Crate #%i", _unitId)
|
||||||
|
|
||||||
local _spawnedCrate = ctld.spawnFOBCrateStatic(_heli:getCountry(), mist.getNextUnitId(), { x = _point.x + _xOffset, z = _point.z + _yOffset }, _name)
|
local _spawnedCrate = ctld.spawnFOBCrateStatic(_heli:getCountry(), ctld.getNextUnitId(), { x = _point.x + _xOffset, z = _point.z + _yOffset }, _name)
|
||||||
|
|
||||||
if _side == 1 then
|
if _side == 1 then
|
||||||
ctld.droppedFOBCratesRED[_name] = _name
|
ctld.droppedFOBCratesRED[_name] = _name
|
||||||
@@ -2116,8 +2243,21 @@ function ctld.extractTroops(_args)
|
|||||||
_extractTroops = ctld.findNearestGroup(_heli, ctld.droppedTroopsBLUE)
|
_extractTroops = ctld.findNearestGroup(_heli, ctld.droppedTroopsBLUE)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if _extractTroops ~= nil then
|
if _extractTroops ~= nil then
|
||||||
|
|
||||||
|
local _limit = ctld.getTransportLimit(_heli:getTypeName())
|
||||||
|
|
||||||
|
local _size = #_extractTroops.group:getUnits()
|
||||||
|
|
||||||
|
if _limit < #_extractTroops.group:getUnits() then
|
||||||
|
|
||||||
|
ctld.displayMessageToGroup(_heli, "Sorry - The group of ".._size.." is too large to fit. \n\nLimit is ".._limit.." for ".._heli:getTypeName(), 20)
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
_onboard.troops = _extractTroops.details
|
_onboard.troops = _extractTroops.details
|
||||||
|
|
||||||
trigger.action.outTextForCoalition(_heli:getCoalition(), ctld.getPlayerNameOrType(_heli) .. " extracted troops in " .. _heli:getTypeName() .. " from combat", 10)
|
trigger.action.outTextForCoalition(_heli:getCoalition(), ctld.getPlayerNameOrType(_heli) .. " extracted troops in " .. _heli:getTypeName() .. " from combat", 10)
|
||||||
@@ -2294,6 +2434,9 @@ function ctld.checkHoverStatus()
|
|||||||
ctld.hoverStatus[_transUnit:getName()] = nil
|
ctld.hoverStatus[_transUnit:getName()] = nil
|
||||||
ctld.displayMessageToGroup(_transUnit, "Loaded " .. _crate.details.desc .. " crate!", 10,true)
|
ctld.displayMessageToGroup(_transUnit, "Loaded " .. _crate.details.desc .. " crate!", 10,true)
|
||||||
|
|
||||||
|
--crates been moved once!
|
||||||
|
ctld.crateMove[_crate.crateUnit:getName()] = nil
|
||||||
|
|
||||||
if _transUnit:getCoalition() == 1 then
|
if _transUnit:getCoalition() == 1 then
|
||||||
ctld.spawnedCratesRED[_crate.crateUnit:getName()] = nil
|
ctld.spawnedCratesRED[_crate.crateUnit:getName()] = nil
|
||||||
else
|
else
|
||||||
@@ -2354,6 +2497,8 @@ function ctld.loadNearbyCrate(_name)
|
|||||||
ctld.spawnedCratesBLUE[_crate.crateUnit:getName()] = nil
|
ctld.spawnedCratesBLUE[_crate.crateUnit:getName()] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ctld.crateMove[_crate.crateUnit:getName()] = nil
|
||||||
|
|
||||||
_crate.crateUnit:destroy()
|
_crate.crateUnit:destroy()
|
||||||
|
|
||||||
local _copiedCrate = mist.utils.deepCopy(_crate.details)
|
local _copiedCrate = mist.utils.deepCopy(_crate.details)
|
||||||
@@ -2717,7 +2862,7 @@ end
|
|||||||
function ctld.getCrateObject(_name)
|
function ctld.getCrateObject(_name)
|
||||||
local _crate
|
local _crate
|
||||||
|
|
||||||
if ctld.staticBugFix then
|
if ctld.staticBugWorkaround then
|
||||||
_crate = Unit.getByName(_name)
|
_crate = Unit.getByName(_name)
|
||||||
else
|
else
|
||||||
_crate = StaticObject.getByName(_name)
|
_crate = StaticObject.getByName(_name)
|
||||||
@@ -2756,6 +2901,12 @@ function ctld.unpackCrates(_arguments)
|
|||||||
return
|
return
|
||||||
end
|
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
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local _aaTemplate = ctld.getAATemplate(_crate.details.unit)
|
local _aaTemplate = ctld.getAATemplate(_crate.details.unit)
|
||||||
|
|
||||||
if _aaTemplate then
|
if _aaTemplate then
|
||||||
@@ -2780,12 +2931,12 @@ function ctld.unpackCrates(_arguments)
|
|||||||
local _cratePoint = _crate.crateUnit:getPoint()
|
local _cratePoint = _crate.crateUnit:getPoint()
|
||||||
local _crateName = _crate.crateUnit:getName()
|
local _crateName = _crate.crateUnit:getName()
|
||||||
|
|
||||||
-- ctld.spawnCrateStatic( _heli:getCoalition(),mist.getNextUnitId(),{x=100,z=100},_crateName,100)
|
-- ctld.spawnCrateStatic( _heli:getCoalition(),ctld.getNextUnitId(),{x=100,z=100},_crateName,100)
|
||||||
|
|
||||||
--remove crate
|
--remove crate
|
||||||
if ctld.slingLoad == false then
|
-- if ctld.slingLoad == false then
|
||||||
_crate.crateUnit:destroy()
|
_crate.crateUnit:destroy()
|
||||||
end
|
-- end
|
||||||
|
|
||||||
local _spawnedGroups = ctld.spawnCrateGroup(_heli, { _cratePoint }, { _crate.details.unit })
|
local _spawnedGroups = ctld.spawnCrateGroup(_heli, { _cratePoint }, { _crate.details.unit })
|
||||||
|
|
||||||
@@ -2898,7 +3049,7 @@ function ctld.unpackFOBCrates(_crates, _heli)
|
|||||||
|
|
||||||
timer.scheduleFunction(function(_args)
|
timer.scheduleFunction(function(_args)
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
local _name = "Deployed FOB #" .. _unitId
|
local _name = "Deployed FOB #" .. _unitId
|
||||||
|
|
||||||
local _fob = ctld.spawnFOB(_args[2], _unitId, _args[1], _name)
|
local _fob = ctld.spawnFOB(_args[2], _unitId, _args[1], _name)
|
||||||
@@ -2958,7 +3109,7 @@ function ctld.dropSlingCrate(_args)
|
|||||||
|
|
||||||
local _point = _heli:getPoint()
|
local _point = _heli:getPoint()
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
|
|
||||||
local _side = _heli:getCoalition()
|
local _side = _heli:getCoalition()
|
||||||
|
|
||||||
@@ -3107,20 +3258,20 @@ end
|
|||||||
|
|
||||||
function ctld.spawnRadioBeaconUnit(_point, _country, _type)
|
function ctld.spawnRadioBeaconUnit(_point, _country, _type)
|
||||||
|
|
||||||
local _groupId = mist.getNextGroupId()
|
local _groupId = ctld.getNextGroupId()
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
|
|
||||||
local _radioGroup = {
|
local _radioGroup = {
|
||||||
["visible"] = false,
|
["visible"] = false,
|
||||||
["groupId"] = _groupId,
|
-- ["groupId"] = _groupId,
|
||||||
["hidden"] = false,
|
["hidden"] = false,
|
||||||
["units"] = {
|
["units"] = {
|
||||||
[1] = {
|
[1] = {
|
||||||
["y"] = _point.z,
|
["y"] = _point.z,
|
||||||
["type"] = "2B11 mortar",
|
["type"] = "2B11 mortar",
|
||||||
["name"] = _type .. " Radio Beacon Unit #" .. _unitId,
|
["name"] = _type .. " Radio Beacon Unit #" .. _unitId,
|
||||||
["unitId"] = _unitId,
|
-- ["unitId"] = _unitId,
|
||||||
["heading"] = 0,
|
["heading"] = 0,
|
||||||
["playerCanDrive"] = true,
|
["playerCanDrive"] = true,
|
||||||
["skill"] = "Excellent",
|
["skill"] = "Excellent",
|
||||||
@@ -3420,9 +3571,9 @@ function ctld.rearmAASystem(_heli, _nearestCrate, _nearbyCrates, _aaSystemTempla
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- remove crate
|
-- remove crate
|
||||||
if ctld.slingLoad == false then
|
-- if ctld.slingLoad == false then
|
||||||
_nearestCrate.crateUnit:destroy()
|
_nearestCrate.crateUnit:destroy()
|
||||||
end
|
-- end
|
||||||
|
|
||||||
return true -- all done so quit
|
return true -- all done so quit
|
||||||
end
|
end
|
||||||
@@ -3564,9 +3715,9 @@ function ctld.unpackAASystem(_heli, _nearestCrate, _nearbyCrates,_aaSystemTempla
|
|||||||
end
|
end
|
||||||
|
|
||||||
--destroy
|
--destroy
|
||||||
if ctld.slingLoad == false then
|
-- if ctld.slingLoad == false then
|
||||||
_systemPart.crate.crateUnit:destroy()
|
_systemPart.crate.crateUnit:destroy()
|
||||||
end
|
--end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- HAWK / BUK READY!
|
-- HAWK / BUK READY!
|
||||||
@@ -3681,9 +3832,9 @@ function ctld.repairAASystem(_heli, _nearestCrate,_aaSystem)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- remove crate
|
-- remove crate
|
||||||
if ctld.slingLoad == false then
|
-- if ctld.slingLoad == false then
|
||||||
_nearestCrate.crateUnit:destroy()
|
_nearestCrate.crateUnit:destroy()
|
||||||
end
|
-- end
|
||||||
|
|
||||||
else
|
else
|
||||||
ctld.displayMessageToGroup(_heli, "Cannot repair ".._aaSystem.name..". No damaged ".._aaSystem.name.." within 300m", 10)
|
ctld.displayMessageToGroup(_heli, "Cannot repair ".._aaSystem.name..". No damaged ".._aaSystem.name.." within 300m", 10)
|
||||||
@@ -3729,9 +3880,9 @@ function ctld.unpackMultiCrate(_heli, _nearestCrate, _nearbyCrates)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--destroy
|
--destroy
|
||||||
if ctld.slingLoad == false then
|
-- if ctld.slingLoad == false then
|
||||||
_crate.crateUnit:destroy()
|
_crate.crateUnit:destroy()
|
||||||
end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -3754,7 +3905,7 @@ end
|
|||||||
|
|
||||||
function ctld.spawnCrateGroup(_heli, _positions, _types)
|
function ctld.spawnCrateGroup(_heli, _positions, _types)
|
||||||
|
|
||||||
local _id = mist.getNextGroupId()
|
local _id = ctld.getNextGroupId()
|
||||||
|
|
||||||
local _groupName = _types[1] .. " #" .. _id
|
local _groupName = _types[1] .. " #" .. _id
|
||||||
|
|
||||||
@@ -3762,7 +3913,7 @@ function ctld.spawnCrateGroup(_heli, _positions, _types)
|
|||||||
|
|
||||||
local _group = {
|
local _group = {
|
||||||
["visible"] = false,
|
["visible"] = false,
|
||||||
["groupId"] = _id,
|
-- ["groupId"] = _id,
|
||||||
["hidden"] = false,
|
["hidden"] = false,
|
||||||
["units"] = {},
|
["units"] = {},
|
||||||
-- ["y"] = _positions[1].z,
|
-- ["y"] = _positions[1].z,
|
||||||
@@ -3773,7 +3924,7 @@ function ctld.spawnCrateGroup(_heli, _positions, _types)
|
|||||||
|
|
||||||
if #_positions == 1 then
|
if #_positions == 1 then
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
local _details = { type = _types[1], unitId = _unitId, name = string.format("Unpacked %s #%i", _types[1], _unitId) }
|
local _details = { type = _types[1], unitId = _unitId, name = string.format("Unpacked %s #%i", _types[1], _unitId) }
|
||||||
|
|
||||||
_group.units[1] = ctld.createUnit(_positions[1].x + 5, _positions[1].z + 5, 120, _details)
|
_group.units[1] = ctld.createUnit(_positions[1].x + 5, _positions[1].z + 5, 120, _details)
|
||||||
@@ -3782,7 +3933,7 @@ function ctld.spawnCrateGroup(_heli, _positions, _types)
|
|||||||
|
|
||||||
for _i, _pos in ipairs(_positions) do
|
for _i, _pos in ipairs(_positions) do
|
||||||
|
|
||||||
local _unitId = mist.getNextUnitId()
|
local _unitId = ctld.getNextUnitId()
|
||||||
local _details = { type = _types[_i], unitId = _unitId, name = string.format("Unpacked %s #%i", _types[_i], _unitId) }
|
local _details = { type = _types[_i], unitId = _unitId, name = string.format("Unpacked %s #%i", _types[_i], _unitId) }
|
||||||
|
|
||||||
_group.units[_i] = ctld.createUnit(_pos.x + 5, _pos.z + 5, 120, _details)
|
_group.units[_i] = ctld.createUnit(_pos.x + 5, _pos.z + 5, 120, _details)
|
||||||
@@ -3816,7 +3967,7 @@ function ctld.spawnDroppedGroup(_point, _details, _spawnBehind, _maxSearch)
|
|||||||
|
|
||||||
local _group = {
|
local _group = {
|
||||||
["visible"] = false,
|
["visible"] = false,
|
||||||
["groupId"] = _details.groupId,
|
-- ["groupId"] = _details.groupId,
|
||||||
["hidden"] = false,
|
["hidden"] = false,
|
||||||
["units"] = {},
|
["units"] = {},
|
||||||
-- ["y"] = _positions[1].z,
|
-- ["y"] = _positions[1].z,
|
||||||
@@ -4013,7 +4164,7 @@ function ctld.createUnit(_x, _y, _angle, _details)
|
|||||||
["y"] = _y,
|
["y"] = _y,
|
||||||
["type"] = _details.type,
|
["type"] = _details.type,
|
||||||
["name"] = _details.name,
|
["name"] = _details.name,
|
||||||
["unitId"] = _details.unitId,
|
-- ["unitId"] = _details.unitId,
|
||||||
["heading"] = _angle,
|
["heading"] = _angle,
|
||||||
["playerCanDrive"] = true,
|
["playerCanDrive"] = true,
|
||||||
["skill"] = "Excellent",
|
["skill"] = "Excellent",
|
||||||
@@ -4270,7 +4421,7 @@ function ctld.refreshSmoke()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--waypoint zones
|
--waypoint zones
|
||||||
for _, _zoneDetails in pairs(ctld.wpZones) do
|
for _, _zoneDetails in pairs(ctld.wpZones) do
|
||||||
|
|
||||||
local _triggerZone = trigger.misc.getZone(_zoneDetails[1])
|
local _triggerZone = trigger.misc.getZone(_zoneDetails[1])
|
||||||
|
|
||||||
@@ -4448,6 +4599,26 @@ function ctld.checkAIStatus()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ctld.getTransportLimit(_unitType)
|
||||||
|
|
||||||
|
if ctld.unitLoadLimits[_unitType] then
|
||||||
|
|
||||||
|
return ctld.unitLoadLimits[_unitType]
|
||||||
|
end
|
||||||
|
|
||||||
|
return ctld.numberOfTroops
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function ctld.getUnitActions(_unitType)
|
||||||
|
|
||||||
|
if ctld.unitActions[_unitType] then
|
||||||
|
return ctld.unitActions[_unitType]
|
||||||
|
end
|
||||||
|
|
||||||
|
return {crates=true,troops=true}
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
-- Adds menuitem to all heli units that are active
|
-- Adds menuitem to all heli units that are active
|
||||||
function ctld.addF10MenuOptions()
|
function ctld.addF10MenuOptions()
|
||||||
@@ -4471,35 +4642,46 @@ function ctld.addF10MenuOptions()
|
|||||||
|
|
||||||
local _rootPath = missionCommands.addSubMenuForGroup(_groupId, "CTLD")
|
local _rootPath = missionCommands.addSubMenuForGroup(_groupId, "CTLD")
|
||||||
|
|
||||||
local _troopCommandsPath = missionCommands.addSubMenuForGroup(_groupId, "Troop Transport", _rootPath)
|
local _unitActions = ctld.getUnitActions(_unit:getTypeName())
|
||||||
|
|
||||||
missionCommands.addCommandForGroup(_groupId, "Unload / Extract Troops", _troopCommandsPath, ctld.unloadExtractTroops, { _unitName })
|
|
||||||
|
|
||||||
missionCommands.addCommandForGroup(_groupId, "Check Cargo", _troopCommandsPath, ctld.checkTroopStatus, { _unitName })
|
if _unitActions.troops then
|
||||||
|
|
||||||
-- local _loadPath = missionCommands.addSubMenuForGroup(_groupId, "Load From Zone", _troopCommandsPath)
|
local _troopCommandsPath = missionCommands.addSubMenuForGroup(_groupId, "Troop Transport", _rootPath)
|
||||||
for _,_loadGroup in pairs(ctld.loadableGroups) do
|
|
||||||
if not _loadGroup.side or _loadGroup.side == _unit:getCoalition() then
|
missionCommands.addCommandForGroup(_groupId, "Unload / Extract Troops", _troopCommandsPath, ctld.unloadExtractTroops, { _unitName })
|
||||||
missionCommands.addCommandForGroup(_groupId, "Load ".._loadGroup.name, _troopCommandsPath, ctld.loadTroopsFromZone, { _unitName, true,_loadGroup,false })
|
|
||||||
|
missionCommands.addCommandForGroup(_groupId, "Check Cargo", _troopCommandsPath, ctld.checkTroopStatus, { _unitName })
|
||||||
|
|
||||||
|
-- local _loadPath = missionCommands.addSubMenuForGroup(_groupId, "Load From Zone", _troopCommandsPath)
|
||||||
|
for _,_loadGroup in pairs(ctld.loadableGroups) do
|
||||||
|
if not _loadGroup.side or _loadGroup.side == _unit:getCoalition() then
|
||||||
|
|
||||||
|
-- check size & unit
|
||||||
|
if ctld.getTransportLimit(_unit:getTypeName()) >= _loadGroup.total then
|
||||||
|
missionCommands.addCommandForGroup(_groupId, "Load ".._loadGroup.name, _troopCommandsPath, ctld.loadTroopsFromZone, { _unitName, true,_loadGroup,false })
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if ctld.unitCanCarryVehicles(_unit) then
|
if ctld.unitCanCarryVehicles(_unit) then
|
||||||
|
|
||||||
local _vehicleCommandsPath = missionCommands.addSubMenuForGroup(_groupId, "Vehicle / FOB Transport", _rootPath)
|
local _vehicleCommandsPath = missionCommands.addSubMenuForGroup(_groupId, "Vehicle / FOB Transport", _rootPath)
|
||||||
|
|
||||||
missionCommands.addCommandForGroup(_groupId, "Unload Vehicles", _vehicleCommandsPath, ctld.unloadTroops, { _unitName, false })
|
missionCommands.addCommandForGroup(_groupId, "Unload Vehicles", _vehicleCommandsPath, ctld.unloadTroops, { _unitName, false })
|
||||||
missionCommands.addCommandForGroup(_groupId, "Load / Extract Vehicles", _vehicleCommandsPath, ctld.loadTroopsFromZone, { _unitName, false,"",true })
|
missionCommands.addCommandForGroup(_groupId, "Load / Extract Vehicles", _vehicleCommandsPath, ctld.loadTroopsFromZone, { _unitName, false,"",true })
|
||||||
|
|
||||||
if ctld.enabledFOBBuilding and ctld.staticBugFix == false then
|
if ctld.enabledFOBBuilding and ctld.staticBugWorkaround == false then
|
||||||
|
|
||||||
missionCommands.addCommandForGroup(_groupId, "Load / Unload FOB Crate", _vehicleCommandsPath, ctld.loadUnloadFOBCrate, { _unitName, false })
|
missionCommands.addCommandForGroup(_groupId, "Load / Unload FOB Crate", _vehicleCommandsPath, ctld.loadUnloadFOBCrate, { _unitName, false })
|
||||||
|
end
|
||||||
|
missionCommands.addCommandForGroup(_groupId, "Check Cargo", _vehicleCommandsPath, ctld.checkTroopStatus, { _unitName })
|
||||||
end
|
end
|
||||||
missionCommands.addCommandForGroup(_groupId, "Check Cargo", _vehicleCommandsPath, ctld.checkTroopStatus, { _unitName })
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if ctld.enableCrates then
|
if ctld.enableCrates and _unitActions.crates then
|
||||||
|
|
||||||
if ctld.unitCanCarryVehicles(_unit) == false then
|
if ctld.unitCanCarryVehicles(_unit) == false then
|
||||||
|
|
||||||
@@ -4529,10 +4711,13 @@ function ctld.addF10MenuOptions()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if ctld.enabledFOBBuilding or ctld.enableCrates then
|
if (ctld.enabledFOBBuilding or ctld.enableCrates) and _unitActions.crates then
|
||||||
|
|
||||||
local _crateCommands = missionCommands.addSubMenuForGroup(_groupId, "CTLD Commands", _rootPath)
|
local _crateCommands = missionCommands.addSubMenuForGroup(_groupId, "CTLD Commands", _rootPath)
|
||||||
if ctld.hoverPickup == false then
|
if ctld.hoverPickup == false then
|
||||||
missionCommands.addCommandForGroup(_groupId, "Load Nearby Crate", _crateCommands, ctld.loadNearbyCrate, _unitName )
|
if ctld.slingLoad == false then
|
||||||
|
missionCommands.addCommandForGroup(_groupId, "Load Nearby Crate", _crateCommands, ctld.loadNearbyCrate, _unitName )
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
missionCommands.addCommandForGroup(_groupId, "Unpack Any Crate", _crateCommands, ctld.unpackCrates, { _unitName })
|
missionCommands.addCommandForGroup(_groupId, "Unpack Any Crate", _crateCommands, ctld.unpackCrates, { _unitName })
|
||||||
@@ -4563,6 +4748,9 @@ function ctld.addF10MenuOptions()
|
|||||||
missionCommands.addCommandForGroup(_groupId, "List Beacons", _radioCommands, ctld.listRadioBeacons, { _unitName })
|
missionCommands.addCommandForGroup(_groupId, "List Beacons", _radioCommands, ctld.listRadioBeacons, { _unitName })
|
||||||
missionCommands.addCommandForGroup(_groupId, "Drop Beacon", _radioCommands, ctld.dropRadioBeacon, { _unitName })
|
missionCommands.addCommandForGroup(_groupId, "Drop Beacon", _radioCommands, ctld.dropRadioBeacon, { _unitName })
|
||||||
missionCommands.addCommandForGroup(_groupId, "Remove Closet Beacon", _radioCommands, ctld.removeRadioBeacon, { _unitName })
|
missionCommands.addCommandForGroup(_groupId, "Remove Closet Beacon", _radioCommands, ctld.removeRadioBeacon, { _unitName })
|
||||||
|
elseif ctld.deployedRadioBeacons ~= {} then
|
||||||
|
local _radioCommands = missionCommands.addSubMenuForGroup(_groupId, "Radio Beacons", _rootPath)
|
||||||
|
missionCommands.addCommandForGroup(_groupId, "List Beacons", _radioCommands, ctld.listRadioBeacons, { _unitName })
|
||||||
end
|
end
|
||||||
|
|
||||||
ctld.addedTo[tostring(_groupId)] = true
|
ctld.addedTo[tostring(_groupId)] = true
|
||||||
@@ -5118,9 +5306,9 @@ function ctld.findNearestVisibleEnemy(_jtacUnit, _targetType,_distance)
|
|||||||
_allowedTarget = (string.match(_units[_x]:getName(), "priority") ~= nil) and ctld.isVehicle(_units[_x])
|
_allowedTarget = (string.match(_units[_x]:getName(), "priority") ~= nil) and ctld.isVehicle(_units[_x])
|
||||||
elseif _targetType == "vehicle" then
|
elseif _targetType == "vehicle" then
|
||||||
_allowedTarget = ctld.isVehicle(_units[_x])
|
_allowedTarget = ctld.isVehicle(_units[_x])
|
||||||
elseif _targetType == "troop" and _hpriority == true then
|
elseif _targetType == "troop" and _thpriority == true then
|
||||||
_allowedTarget = (string.match(_units[_x]:getName(), "hpriority") ~= nil) and ctld.isInfantry(_units[_x])
|
_allowedTarget = (string.match(_units[_x]:getName(), "hpriority") ~= nil) and ctld.isInfantry(_units[_x])
|
||||||
elseif _targetType == "troop" and _priority == true then
|
elseif _targetType == "troop" and _tpriority == true then
|
||||||
_allowedTarget = (string.match(_units[_x]:getName(), "priority") ~= nil) and ctld.isInfantry(_units[_x])
|
_allowedTarget = (string.match(_units[_x]:getName(), "priority") ~= nil) and ctld.isInfantry(_units[_x])
|
||||||
elseif _targetType == "troop" then
|
elseif _targetType == "troop" then
|
||||||
_allowedTarget = ctld.isInfantry(_units[_x])
|
_allowedTarget = ctld.isInfantry(_units[_x])
|
||||||
@@ -5720,20 +5908,52 @@ if ctld.allowRandomAiTeamPickups == true then
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- add total count
|
||||||
|
|
||||||
-- Scheduled functions (run cyclically)
|
for _,_loadGroup in pairs(ctld.loadableGroups) do
|
||||||
|
|
||||||
timer.scheduleFunction(ctld.refreshSmoke, nil, timer.getTime() + 5)
|
_loadGroup.total = 0
|
||||||
timer.scheduleFunction(ctld.addF10MenuOptions, nil, timer.getTime() + 5)
|
if _loadGroup.aa then
|
||||||
timer.scheduleFunction(ctld.checkAIStatus, nil, timer.getTime() + 1)
|
_loadGroup.total = _loadGroup.aa + _loadGroup.total
|
||||||
timer.scheduleFunction(ctld.checkTransportStatus, nil, timer.getTime() + 5)
|
end
|
||||||
timer.scheduleFunction(ctld.refreshRadioBeacons, nil, timer.getTime() + 5)
|
|
||||||
|
if _loadGroup.inf then
|
||||||
|
_loadGroup.total = _loadGroup.inf + _loadGroup.total
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if _loadGroup.mg then
|
||||||
|
_loadGroup.total = _loadGroup.mg + _loadGroup.total
|
||||||
|
end
|
||||||
|
|
||||||
|
if _loadGroup.at then
|
||||||
|
_loadGroup.total = _loadGroup.at + _loadGroup.total
|
||||||
|
end
|
||||||
|
|
||||||
|
if _loadGroup.mortar then
|
||||||
|
_loadGroup.total = _loadGroup.mortar + _loadGroup.total
|
||||||
|
end
|
||||||
|
|
||||||
if ctld.enableCrates == true and ctld.slingLoad == false and ctld.hoverPickup then
|
|
||||||
timer.scheduleFunction(ctld.checkHoverStatus, nil, timer.getTime() + 1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Scheduled functions (run cyclically) -- but hold execution for a second so we can override parts
|
||||||
|
|
||||||
|
timer.scheduleFunction(ctld.checkAIStatus, nil, timer.getTime() + 1)
|
||||||
|
timer.scheduleFunction(ctld.checkTransportStatus, nil, timer.getTime() + 5)
|
||||||
|
|
||||||
|
timer.scheduleFunction(function()
|
||||||
|
|
||||||
|
timer.scheduleFunction(ctld.refreshRadioBeacons, nil, timer.getTime() + 5)
|
||||||
|
timer.scheduleFunction(ctld.refreshSmoke, nil, timer.getTime() + 5)
|
||||||
|
timer.scheduleFunction(ctld.addF10MenuOptions, nil, timer.getTime() + 5)
|
||||||
|
|
||||||
|
if ctld.enableCrates == true and ctld.slingLoad == false and ctld.hoverPickup == true then
|
||||||
|
timer.scheduleFunction(ctld.checkHoverStatus, nil, timer.getTime() + 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
end,nil, timer.getTime()+1 )
|
||||||
|
|
||||||
--event handler for deaths
|
--event handler for deaths
|
||||||
--world.addEventHandler(ctld.eventHandler)
|
--world.addEventHandler(ctld.eventHandler)
|
||||||
|
|
||||||
@@ -5781,9 +6001,10 @@ for _coalitionName, _coalitionData in pairs(env.mission.coalition) do
|
|||||||
for _groupId, _group in pairs(_objectTypeData.group) do
|
for _groupId, _group in pairs(_objectTypeData.group) do
|
||||||
if _group and _group.units and type(_group.units) == 'table' then
|
if _group and _group.units and type(_group.units) == 'table' then
|
||||||
for _unitNum, _unit in pairs(_group.units) do
|
for _unitNum, _unit in pairs(_group.units) do
|
||||||
if _unit.type == "Cargo1" and _unit.canCargo == true then
|
if _unit.canCargo == true then
|
||||||
ctld.missionEditorCargoCrates[_unit.name] = _unit.name
|
local _cargoName = env.getValueDictByKey(_unit.name)
|
||||||
env.info("Crate Found: " .. _unit.name)
|
ctld.missionEditorCargoCrates[_cargoName] = _cargoName
|
||||||
|
env.info("Crate Found: " .. _unit.name.." - Unit: ".._cargoName)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
BIN
test-fob.miz
BIN
test-fob.miz
Binary file not shown.
BIN
test-mission - real slingload.miz
Normal file
BIN
test-mission - real slingload.miz
Normal file
Binary file not shown.
BIN
test-mission.miz
BIN
test-mission.miz
Binary file not shown.
Reference in New Issue
Block a user