mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Merge branch 'develop' into FF/Ops
This commit is contained in:
commit
6be0d82fc6
@ -344,7 +344,7 @@ function AUTOLASE:GetSmokeColor(RecceName)
|
|||||||
if self.RecceSmokeColor[RecceName] == nil then
|
if self.RecceSmokeColor[RecceName] == nil then
|
||||||
self.RecceSmokeColor[RecceName] = color
|
self.RecceSmokeColor[RecceName] = color
|
||||||
else
|
else
|
||||||
color = self.RecceLaserCode[RecceName]
|
color = self.RecceSmokeColor[RecceName]
|
||||||
end
|
end
|
||||||
return color
|
return color
|
||||||
end
|
end
|
||||||
|
|||||||
@ -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.9"
|
||||||
|
|
||||||
--- 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
|
||||||
@ -1832,7 +1844,7 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop)
|
|||||||
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
local capabilities = self:_GetUnitCapabilities(Unit) -- #CTLD.UnitCapabilities
|
||||||
local canloadcratesno = capabilities.cratelimit
|
local canloadcratesno = capabilities.cratelimit
|
||||||
local loaddist = self.CrateDistance or 35
|
local loaddist = self.CrateDistance or 35
|
||||||
local nearcrates, numbernearby = self:_FindCratesNearby(Group,Unit,loaddist)
|
local nearcrates, numbernearby = self:_FindCratesNearby(Group,Unit,loaddist,true)
|
||||||
if numbernearby >= canloadcratesno and not drop then
|
if numbernearby >= canloadcratesno and not drop then
|
||||||
self:_SendMessage("There are enough crates nearby already! Take care of those first!", 10, false, Group)
|
self:_SendMessage("There are enough crates nearby already! Take care of those first!", 10, false, Group)
|
||||||
return self
|
return self
|
||||||
@ -2015,7 +2027,7 @@ end
|
|||||||
function CTLD:_ListCratesNearby( _group, _unit)
|
function CTLD:_ListCratesNearby( _group, _unit)
|
||||||
self:T(self.lid .. " _ListCratesNearby")
|
self:T(self.lid .. " _ListCratesNearby")
|
||||||
local finddist = self.CrateDistance or 35
|
local finddist = self.CrateDistance or 35
|
||||||
local crates,number = self:_FindCratesNearby(_group,_unit, finddist) -- #table
|
local crates,number = self:_FindCratesNearby(_group,_unit, finddist,true) -- #table
|
||||||
if number > 0 then
|
if number > 0 then
|
||||||
local text = REPORT:New("Crates Found Nearby:")
|
local text = REPORT:New("Crates Found Nearby:")
|
||||||
text:Add("------------------------------------------------------------")
|
text:Add("------------------------------------------------------------")
|
||||||
@ -2072,9 +2084,10 @@ end
|
|||||||
-- @param Wrapper.Group#GROUP _group Group
|
-- @param Wrapper.Group#GROUP _group Group
|
||||||
-- @param Wrapper.Unit#UNIT _unit Unit
|
-- @param Wrapper.Unit#UNIT _unit Unit
|
||||||
-- @param #number _dist Distance
|
-- @param #number _dist Distance
|
||||||
|
-- @param #boolean _ignoreweight Find everything in range, ignore loadable weight
|
||||||
-- @return #table Table of crates
|
-- @return #table Table of crates
|
||||||
-- @return #number Number Number of crates found
|
-- @return #number Number Number of crates found
|
||||||
function CTLD:_FindCratesNearby( _group, _unit, _dist)
|
function CTLD:_FindCratesNearby( _group, _unit, _dist, _ignoreweight)
|
||||||
self:T(self.lid .. " _FindCratesNearby")
|
self:T(self.lid .. " _FindCratesNearby")
|
||||||
local finddist = _dist
|
local finddist = _dist
|
||||||
local location = _group:GetCoordinate()
|
local location = _group:GetCoordinate()
|
||||||
@ -2097,7 +2110,7 @@ function CTLD:_FindCratesNearby( _group, _unit, _dist)
|
|||||||
if static and static:IsAlive() then
|
if static and static:IsAlive() then
|
||||||
local staticpos = static:GetCoordinate()
|
local staticpos = static:GetCoordinate()
|
||||||
local distance = self:_GetDistance(location,staticpos)
|
local distance = self:_GetDistance(location,staticpos)
|
||||||
if distance <= finddist and static and weight <= maxloadable then
|
if distance <= finddist and static and (weight <= maxloadable or _ignoreweight) then
|
||||||
index = index + 1
|
index = index + 1
|
||||||
table.insert(found, staticid, cargo)
|
table.insert(found, staticid, cargo)
|
||||||
maxloadable = maxloadable - weight
|
maxloadable = maxloadable - weight
|
||||||
@ -2155,7 +2168,7 @@ function CTLD:_LoadCratesNearby(Group, Unit)
|
|||||||
end
|
end
|
||||||
-- get nearby crates
|
-- get nearby crates
|
||||||
local finddist = self.CrateDistance or 35
|
local finddist = self.CrateDistance or 35
|
||||||
local nearcrates,number = self:_FindCratesNearby(Group,Unit,finddist) -- #table
|
local nearcrates,number = self:_FindCratesNearby(Group,Unit,finddist,false) -- #table
|
||||||
self:T(self.lid .. " Crates found: " .. number)
|
self:T(self.lid .. " Crates found: " .. number)
|
||||||
if number == 0 and self.hoverautoloading then
|
if number == 0 and self.hoverautoloading then
|
||||||
return self -- exit
|
return self -- exit
|
||||||
@ -2482,7 +2495,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
|
||||||
@ -2651,7 +2664,7 @@ function CTLD:_BuildCrates(Group, Unit,Engineering)
|
|||||||
end
|
end
|
||||||
-- get nearby crates
|
-- get nearby crates
|
||||||
local finddist = self.CrateDistance or 35
|
local finddist = self.CrateDistance or 35
|
||||||
local crates,number = self:_FindCratesNearby(Group,Unit, finddist) -- #table
|
local crates,number = self:_FindCratesNearby(Group,Unit, finddist,true) -- #table
|
||||||
local buildables = {}
|
local buildables = {}
|
||||||
local foundbuilds = false
|
local foundbuilds = false
|
||||||
local canbuild = false
|
local canbuild = false
|
||||||
@ -2735,7 +2748,7 @@ function CTLD:_RepairCrates(Group, Unit, Engineering)
|
|||||||
self:T(self.lid .. " _RepairCrates")
|
self:T(self.lid .. " _RepairCrates")
|
||||||
-- get nearby crates
|
-- get nearby crates
|
||||||
local finddist = self.CrateDistance or 35
|
local finddist = self.CrateDistance or 35
|
||||||
local crates,number = self:_FindCratesNearby(Group,Unit,finddist) -- #table
|
local crates,number = self:_FindCratesNearby(Group,Unit,finddist,true) -- #table
|
||||||
local buildables = {}
|
local buildables = {}
|
||||||
local foundbuilds = false
|
local foundbuilds = false
|
||||||
local canbuild = false
|
local canbuild = false
|
||||||
@ -3690,8 +3703,8 @@ end
|
|||||||
-- @param #boolean Cantroops Unit can load troops. Default false.
|
-- @param #boolean Cantroops Unit can load troops. Default false.
|
||||||
-- @param #number Cratelimit Unit can carry number of crates. Default 0.
|
-- @param #number Cratelimit Unit can carry number of crates. Default 0.
|
||||||
-- @param #number Trooplimit Unit can carry number of troops. Default 0.
|
-- @param #number Trooplimit Unit can carry number of troops. Default 0.
|
||||||
-- @param #number Length Unit lenght (in mteres) for the load radius. Default 20.
|
-- @param #number Length Unit lenght (in metres) for the load radius. Default 20.
|
||||||
-- @param #number Maxcargoweight Maxmimum weight in kgs this helo can carry. Default 0.
|
-- @param #number Maxcargoweight Maxmimum weight in kgs this helo can carry. Default 500.
|
||||||
function CTLD:UnitCapabilities(Unittype, Cancrates, Cantroops, Cratelimit, Trooplimit, Length, Maxcargoweight)
|
function CTLD:UnitCapabilities(Unittype, Cancrates, Cantroops, Cratelimit, Trooplimit, Length, Maxcargoweight)
|
||||||
self:T(self.lid .. " UnitCapabilities")
|
self:T(self.lid .. " UnitCapabilities")
|
||||||
local unittype = nil
|
local unittype = nil
|
||||||
@ -3704,6 +3717,13 @@ end
|
|||||||
else
|
else
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
local length = 20
|
||||||
|
local maxcargo = 500
|
||||||
|
local existingcaps = self.UnitTypes[unittype] -- #CTLD.UnitCapabilities
|
||||||
|
if existingcaps then
|
||||||
|
length = existingcaps.length or 20
|
||||||
|
maxcargo = existingcaps.cargoweightlimit or 500
|
||||||
|
end
|
||||||
-- set capabilities
|
-- set capabilities
|
||||||
local capabilities = {} -- #CTLD.UnitCapabilities
|
local capabilities = {} -- #CTLD.UnitCapabilities
|
||||||
capabilities.type = unittype
|
capabilities.type = unittype
|
||||||
@ -3711,8 +3731,8 @@ end
|
|||||||
capabilities.troops = Cantroops or false
|
capabilities.troops = Cantroops or false
|
||||||
capabilities.cratelimit = Cratelimit or 0
|
capabilities.cratelimit = Cratelimit or 0
|
||||||
capabilities.trooplimit = Trooplimit or 0
|
capabilities.trooplimit = Trooplimit or 0
|
||||||
capabilities.length = Length or 20
|
capabilities.length = Length or length
|
||||||
capabilities.cargoweightlimit = Maxcargoweight or 0
|
capabilities.cargoweightlimit = Maxcargoweight or maxcargo
|
||||||
self.UnitTypes[unittype] = capabilities
|
self.UnitTypes[unittype] = capabilities
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -4004,7 +4024,7 @@ end
|
|||||||
self:T(_engineers.lid .. _engineers:GetStatus())
|
self:T(_engineers.lid .. _engineers:GetStatus())
|
||||||
if wrenches and wrenches:IsAlive() then
|
if wrenches and wrenches:IsAlive() then
|
||||||
if engineers:IsStatus("Running") or engineers:IsStatus("Searching") then
|
if engineers:IsStatus("Running") or engineers:IsStatus("Searching") then
|
||||||
local crates,number = self:_FindCratesNearby(wrenches,nil, self.EngineerSearch) -- #table
|
local crates,number = self:_FindCratesNearby(wrenches,nil, self.EngineerSearch,true) -- #table
|
||||||
engineers:Search(crates,number)
|
engineers:Search(crates,number)
|
||||||
elseif engineers:IsStatus("Moving") then
|
elseif engineers:IsStatus("Moving") then
|
||||||
engineers:Move()
|
engineers:Move()
|
||||||
|
|||||||
@ -2609,6 +2609,41 @@ function GROUP:GetSkill()
|
|||||||
return skill
|
return skill
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Get the unit in the group with the highest threat level, which is still alive.
|
||||||
|
-- @param #GROUP self
|
||||||
|
-- @return Wrapper.Unit#UNIT The most dangerous unit in the group.
|
||||||
|
-- @return #number Threat level of the unit.
|
||||||
|
function GROUP:GetHighestThreat()
|
||||||
|
|
||||||
|
-- Get units of the group.
|
||||||
|
local units=self:GetUnits()
|
||||||
|
|
||||||
|
if units then
|
||||||
|
|
||||||
|
local threat=nil ; local maxtl=0
|
||||||
|
for _,_unit in pairs(units or {}) do
|
||||||
|
local unit=_unit --Wrapper.Unit#UNIT
|
||||||
|
|
||||||
|
if unit and unit:IsAlive() then
|
||||||
|
|
||||||
|
-- Threat level of group.
|
||||||
|
local tl=unit:GetThreatLevel()
|
||||||
|
|
||||||
|
-- Check if greater the current threat.
|
||||||
|
if tl>maxtl then
|
||||||
|
maxtl=tl
|
||||||
|
threat=unit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return threat, maxtl
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil, nil
|
||||||
|
end
|
||||||
|
|
||||||
--do -- Smoke
|
--do -- Smoke
|
||||||
--
|
--
|
||||||
----- Signal a flare at the position of the GROUP.
|
----- Signal a flare at the position of the GROUP.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user