mirror of
https://github.com/ciribob/DCS-CTLD.git
synced 2025-08-15 06:17:22 +00:00
commit
This commit is contained in:
49
CTLD.lua
49
CTLD.lua
@@ -1896,8 +1896,8 @@ end
|
|||||||
--
|
--
|
||||||
-- Weights can be found in the ctld.spawnableCrates list
|
-- Weights can be found in the ctld.spawnableCrates list
|
||||||
-- Points can be made by hand or obtained from a Unit position by Unit.getByName("PilotName"):getPoint()
|
-- Points can be made by hand or obtained from a Unit position by Unit.getByName("PilotName"):getPoint()
|
||||||
-- e.g. ctld.spawnCrateAtZone("red", 500,{x=1,y=2,z=3}) -- spawn a humvee at triggerzone 1 for red side at a specified point
|
-- e.g. ctld.spawnCrateAtPoint("red", 500,{x=1,y=2,z=3}) -- spawn a humvee at triggerzone 1 for red side at a specified point
|
||||||
-- e.g. ctld.spawnCrateAtZone("blue", 505,{x=1,y=2,z=3}) -- spawn a tow humvee at triggerzone1 for blue side at a specified point
|
-- e.g. ctld.spawnCrateAtPoint("blue", 505,{x=1,y=2,z=3}) -- spawn a tow humvee at triggerzone1 for blue side at a specified point
|
||||||
--
|
--
|
||||||
--
|
--
|
||||||
function ctld.spawnCrateAtPoint(_side, _weight, _point, _hdg)
|
function ctld.spawnCrateAtPoint(_side, _weight, _point, _hdg)
|
||||||
@@ -2062,13 +2062,16 @@ function ctld.repackVehicle(_params, t) -- scan rrs table 'repackRequestsStack'
|
|||||||
end
|
end
|
||||||
|
|
||||||
local relativePoint = ctld.getRelativePoint(playerPoint, secureDistance + (i * offset), randomHeading) -- 7 meters from the transport unit
|
local relativePoint = ctld.getRelativePoint(playerPoint, secureDistance + (i * offset), randomHeading) -- 7 meters from the transport unit
|
||||||
ctld.spawnCrateStatic(PlayerTransportUnit:getCountry(), _unitId, relativePoint, _name, crateWeight,
|
if ctld.unitDynamicCargoCapable(PlayerTransportUnit) == false then
|
||||||
PlayerTransportUnit:getCoalition(), mist.getHeading(PlayerTransportUnit, true))
|
ctld.spawnCrateStatic(PlayerTransportUnit:getCountry(), _unitId, relativePoint, _name, crateWeight,
|
||||||
|
PlayerTransportUnit:getCoalition(), mist.getHeading(PlayerTransportUnit, true))
|
||||||
|
else
|
||||||
|
local _point = ctld.getPointAt6Oclock(PlayerTransportUnit, 15)
|
||||||
|
ctld.spawnCrateStatic(PlayerTransportUnit:getCountry(), _unitId, _point, _name, crateWeight,
|
||||||
|
PlayerTransportUnit:getCoalition(), mist.getHeading(PlayerTransportUnit, "dynamic"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--if ctld.isUnitInALogisticZone(repackableUnitName) == nil then
|
|
||||||
--ctld.addStaticLogisticUnit({ x = spawnRefPoint.x + 5, z = spawnRefPoint.z + 10 }, refCountry) -- create a temporary logistic unit to be able to repack the vehicle
|
|
||||||
--end
|
|
||||||
repackableUnit:destroy() -- destroy repacked unit
|
repackableUnit:destroy() -- destroy repacked unit
|
||||||
end
|
end
|
||||||
ctld.repackRequestsStack[ii] = nil
|
ctld.repackRequestsStack[ii] = nil
|
||||||
@@ -2083,7 +2086,7 @@ function ctld.repackVehicle(_params, t) -- scan rrs table 'repackRequestsStack'
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- ***************************************************************
|
-- ***************************************************************
|
||||||
function ctld.addStaticLogisticUnit(_point, _country) -- create a temporary logistic unit to be able to repack the vehicle
|
function ctld.addStaticLogisticUnit(_point, _country) -- create a temporary logistic unit with a Windsock object
|
||||||
local dynamicLogisticUnitName = "%dynLogisticName_" .. tostring(ctld.getNextDynamicLogisticUnitIndex())
|
local dynamicLogisticUnitName = "%dynLogisticName_" .. tostring(ctld.getNextDynamicLogisticUnitIndex())
|
||||||
ctld.logisticUnits[#ctld.logisticUnits + 1] = dynamicLogisticUnitName
|
ctld.logisticUnits[#ctld.logisticUnits + 1] = dynamicLogisticUnitName
|
||||||
local LogUnit = {
|
local LogUnit = {
|
||||||
@@ -2503,7 +2506,6 @@ function ctld.spawnCrate(_arguments, bypassCrateWaitTime)
|
|||||||
local _status, _err = pcall(function(_args)
|
local _status, _err = pcall(function(_args)
|
||||||
-- use the cargo weight to guess the type of unit as no way to add description :(
|
-- use the cargo weight to guess the type of unit as no way to add description :(
|
||||||
local _crateType = ctld.crateLookupTable[tostring(_args[2])]
|
local _crateType = ctld.crateLookupTable[tostring(_args[2])]
|
||||||
|
|
||||||
local _heli = ctld.getTransportUnit(_args[1])
|
local _heli = ctld.getTransportUnit(_args[1])
|
||||||
if not _heli then
|
if not _heli then
|
||||||
return
|
return
|
||||||
@@ -2531,7 +2533,6 @@ function ctld.spawnCrate(_arguments, bypassCrateWaitTime)
|
|||||||
if ctld.inLogisticsZone(_heli) == false then
|
if ctld.inLogisticsZone(_heli) == false then
|
||||||
ctld.displayMessageToGroup(_heli,
|
ctld.displayMessageToGroup(_heli,
|
||||||
ctld.i18n_translate("You are not close enough to friendly logistics to get a crate!"), 10)
|
ctld.i18n_translate("You are not close enough to friendly logistics to get a crate!"), 10)
|
||||||
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -5907,9 +5908,20 @@ function ctld.addTransportF10MenuOptions(_unitName)
|
|||||||
ctld.spawnCrate, { _unitName, _menu.crate.weight })
|
ctld.spawnCrate, { _unitName, _menu.crate.weight })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if ctld.unitDynamicCargoCapable(_unit) then
|
||||||
|
if ctld.vehicleCommandsPath[_unitName] == nil then
|
||||||
|
ctld.vehicleCommandsPath[_unitName] = mist.utils.deepCopy(_rootPath)
|
||||||
|
end
|
||||||
|
if ctld.enableRepackingVehicles then
|
||||||
|
ctld.updateRepackMenu(_unitName)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (ctld.enabledFOBBuilding or ctld.enableCrates) and _unitActions.crates then
|
if (ctld.enabledFOBBuilding or ctld.enableCrates) and _unitActions.crates then
|
||||||
local _crateCommands = missionCommands.addSubMenuForGroup(_groupId,
|
local _crateCommands = missionCommands.addSubMenuForGroup(_groupId,
|
||||||
ctld.i18n_translate("CTLD Commands"), _rootPath)
|
ctld.i18n_translate("CTLD Commands"), _rootPath)
|
||||||
@@ -6015,7 +6027,7 @@ function ctld.updateRepackMenu(_playerUnitName)
|
|||||||
local repackableVehicles = ctld.getUnitsInRepackRadius(_playerUnitName, ctld.maximumDistanceRepackableUnitsSearch)
|
local repackableVehicles = ctld.getUnitsInRepackRadius(_playerUnitName, ctld.maximumDistanceRepackableUnitsSearch)
|
||||||
if repackableVehicles then
|
if repackableVehicles then
|
||||||
ctld.logTrace("FG_ ctld.vehicleCommandsPath[_playerUnitName] = %s", ctld.p(ctld.vehicleCommandsPath[_playerUnitName]))
|
ctld.logTrace("FG_ ctld.vehicleCommandsPath[_playerUnitName] = %s", ctld.p(ctld.vehicleCommandsPath[_playerUnitName]))
|
||||||
local RepackCommandsPath = mist.utils.deepCopy(ctld.vehicleCommandsPath[_playerUnitName])
|
local RepackCommandsPath = mist.utils.deepCopy(ctld.vehicleCommandsPath[_playerUnitName])
|
||||||
RepackCommandsPath[#RepackCommandsPath + 1] = ctld.i18n_translate("Repack Vehicles")
|
RepackCommandsPath[#RepackCommandsPath + 1] = ctld.i18n_translate("Repack Vehicles")
|
||||||
--ctld.logTrace("FG_ RepackCommandsPath = %s", ctld.p(RepackCommandsPath))
|
--ctld.logTrace("FG_ RepackCommandsPath = %s", ctld.p(RepackCommandsPath))
|
||||||
missionCommands.removeItemForGroup(_groupId, RepackCommandsPath) -- remove existing "Repack Vehicles" menu
|
missionCommands.removeItemForGroup(_groupId, RepackCommandsPath) -- remove existing "Repack Vehicles" menu
|
||||||
@@ -6023,13 +6035,12 @@ function ctld.updateRepackMenu(_playerUnitName)
|
|||||||
local menuEntries = {}
|
local menuEntries = {}
|
||||||
--ctld.logTrace("FG_ RepackmenuPath = %s", ctld.p(RepackmenuPath))
|
--ctld.logTrace("FG_ RepackmenuPath = %s", ctld.p(RepackmenuPath))
|
||||||
for _, _vehicle in pairs(repackableVehicles) do
|
for _, _vehicle in pairs(repackableVehicles) do
|
||||||
table.insert(menuEntries, {
|
table.insert(menuEntries, { text = ctld.i18n_translate("repack ") .. _vehicle.unit,
|
||||||
text = ctld.i18n_translate("repack ") .. _vehicle.unit,
|
groupId = _groupId,
|
||||||
groupId = _groupId,
|
subMenuPath = RepackmenuPath,
|
||||||
subMenuPath = RepackmenuPath,
|
menuFunction = ctld.repackVehicleRequest,
|
||||||
menuFunction = ctld.repackVehicleRequest,
|
menuArgsTable = { _vehicle, _playerUnitName }
|
||||||
menuArgsTable = { _vehicle, _playerUnitName }
|
})
|
||||||
})
|
|
||||||
end
|
end
|
||||||
ctld.buildPaginatedMenu(menuEntries)
|
ctld.buildPaginatedMenu(menuEntries)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user