CTLD:SetTroopDropZoneRadius(Radius)

This commit is contained in:
Applevangelist 2022-02-13 12:08:23 +01:00
parent a4163017d5
commit ba5ccc1021

View File

@ -1021,7 +1021,7 @@ CTLD.UnitTypes = {
--- CTLD class version. --- CTLD class version.
-- @field #string version -- @field #string version
CTLD.version="1.0.6" CTLD.version="1.0.7"
--- Instantiate a new CTLD. --- Instantiate a new CTLD.
-- @param #CTLD self -- @param #CTLD self
@ -1149,6 +1149,7 @@ function CTLD:New(Coalition, Prefixes, Alias)
self.smokedistance = 2000 self.smokedistance = 2000
self.movetroopstowpzone = true self.movetroopstowpzone = true
self.movetroopsdistance = 5000 self.movetroopsdistance = 5000
self.troopdropzoneradius = 100
-- added support Hercules Mod -- added support Hercules Mod
self.enableHercules = false self.enableHercules = false
@ -1418,6 +1419,17 @@ function CTLD:_GenerateVHFrequencies()
return self return self
end end
--- (User) Set drop zone radius for troop drops in meters. Minimum distance is 25m for security reasons.
-- @param #CTLD self
-- @param #number Radius The radius to use.
function CTLD:SetTroopDropZoneRadius(Radius)
self:T(self.lid .. " SetTroopDropZoneRadius")
local tradius = Radius or 100
if tradius < 25 then tradius = 25 end
self.troopdropzoneradius = tradius
return self
end
--- (Internal) Event handler function --- (Internal) Event handler function
-- @param #CTLD self -- @param #CTLD self
-- @param Core.Event#EVENTDATA EventData -- @param Core.Event#EVENTDATA EventData
@ -2482,7 +2494,7 @@ function CTLD:_UnloadTroops(Group, Unit)
local name = cargo:GetName() or "none" local name = cargo:GetName() or "none"
local temptable = cargo:GetTemplates() or {} local temptable = cargo:GetTemplates() or {}
local position = Group:GetCoordinate() local position = Group:GetCoordinate()
local zoneradius = 100 -- drop zone radius local zoneradius = self.troopdropzoneradius or 100 -- drop zone radius
local factor = 1 local factor = 1
if IsHerc then if IsHerc then
factor = cargo:GetCratesNeeded() or 1 -- spread a bit more if airdropping factor = cargo:GetCratesNeeded() or 1 -- spread a bit more if airdropping