mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
PlayerTaskController - SEAD attributes configure (#1769)
Making SEAD attributes for the task decision tree configure-able. Added ` PLAYERTASKCONTROLLER:SetSEADAttributes(Attributes)`
This commit is contained in:
parent
b4e2d3edfe
commit
c99a7b6666
@ -992,6 +992,17 @@ PLAYERTASKCONTROLLER.Type = {
|
|||||||
--- Define a new AUFTRAG Type
|
--- Define a new AUFTRAG Type
|
||||||
AUFTRAG.Type.PRECISIONBOMBING = "Precision Bombing"
|
AUFTRAG.Type.PRECISIONBOMBING = "Precision Bombing"
|
||||||
|
|
||||||
|
---
|
||||||
|
-- @type SeadAttributes
|
||||||
|
-- @field #number SAM GROUP.Attribute.GROUND_SAM
|
||||||
|
-- @field #number AAA GROUP.Attribute.GROUND_AAA
|
||||||
|
-- @field #number EWR GROUP.Attribute.GROUND_EWR
|
||||||
|
PLAYERTASKCONTROLLER.SeadAttributes = {
|
||||||
|
SAM = GROUP.Attribute.GROUND_SAM,
|
||||||
|
AAA = GROUP.Attribute.GROUND_AAA,
|
||||||
|
EWR = GROUP.Attribute.GROUND_EWR,
|
||||||
|
}
|
||||||
|
|
||||||
---
|
---
|
||||||
-- @field Messages
|
-- @field Messages
|
||||||
PLAYERTASKCONTROLLER.Messages = {
|
PLAYERTASKCONTROLLER.Messages = {
|
||||||
@ -1109,7 +1120,7 @@ PLAYERTASKCONTROLLER.Messages = {
|
|||||||
|
|
||||||
--- PLAYERTASK class version.
|
--- PLAYERTASK class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PLAYERTASKCONTROLLER.version="0.1.25"
|
PLAYERTASKCONTROLLER.version="0.1.26"
|
||||||
|
|
||||||
--- Constructor
|
--- Constructor
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
@ -1825,6 +1836,41 @@ function PLAYERTASKCONTROLLER:SetTaskBlackList(BlackList)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- [User] Change the list of attributes, which are considered on GROUP or SET\_GROUP level of a target to create SEAD player tasks.
|
||||||
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
|
-- @param #table Attributes Table of attribute types considered to lead to a SEAD type player task.
|
||||||
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
|
-- @usage
|
||||||
|
-- Default attribute types are: GROUP.Attribute.GROUND_SAM, GROUP.Attribute.GROUND_AAA, and GROUP.Attribute.GROUND_EWR.
|
||||||
|
-- If you want to e.g. exclude AAA, so target groups with this attribute are assigned CAS or BAI tasks, and not SEAD, use this function as follows:
|
||||||
|
--
|
||||||
|
-- `mycontroller:SetSEADAttributes({GROUP.Attribute.GROUND_SAM, GROUP.Attribute.GROUND_EWR})`
|
||||||
|
--
|
||||||
|
function PLAYERTASKCONTROLLER:SetSEADAttributes(Attributes)
|
||||||
|
self:T(self.lid.."SetSEADAttributes")
|
||||||
|
if type(Attributes) ~= table then
|
||||||
|
Attributes = {Attributes}
|
||||||
|
end
|
||||||
|
self.SeadAttributes = Attributes
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
|
--- [Internal] Function the check against SeadAttributes
|
||||||
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
|
-- @param #string Attribute
|
||||||
|
-- @return #boolean IsSead
|
||||||
|
function PLAYERTASKCONTROLLER:_IsAttributeSead(Attribute)
|
||||||
|
self:T(self.lid.."_IsAttributeSead?")
|
||||||
|
local IsSead = false
|
||||||
|
for _,_attribute in pairs(self.SeadAttributes) do
|
||||||
|
if Attribute == _attribute then
|
||||||
|
IsSead = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return IsSead
|
||||||
|
end
|
||||||
|
|
||||||
--- [Internal] Add a task to the task queue
|
--- [Internal] Add a task to the task queue
|
||||||
-- @param #PLAYERTASKCONTROLLER self
|
-- @param #PLAYERTASKCONTROLLER self
|
||||||
-- @param Ops.Target#TARGET Target
|
-- @param Ops.Target#TARGET Target
|
||||||
@ -1852,7 +1898,7 @@ function PLAYERTASKCONTROLLER:_AddTask(Target)
|
|||||||
elseif targetobject:IsInstanceOf("GROUP") then
|
elseif targetobject:IsInstanceOf("GROUP") then
|
||||||
self:T("SEAD Check GROUP")
|
self:T("SEAD Check GROUP")
|
||||||
local attribute = targetobject:GetAttribute()
|
local attribute = targetobject:GetAttribute()
|
||||||
if attribute == GROUP.Attribute.GROUND_SAM or attribute == GROUP.Attribute.GROUND_AAA or attribute == GROUP.Attribute.GROUND_EWR then
|
if self:_IsAttributeSead(attribute) then
|
||||||
type = AUFTRAG.Type.SEAD
|
type = AUFTRAG.Type.SEAD
|
||||||
--ttstype = "suppress air defense"
|
--ttstype = "suppress air defense"
|
||||||
ttstype = self.gettext:GetEntry("SEADTTS",self.locale)
|
ttstype = self.gettext:GetEntry("SEADTTS",self.locale)
|
||||||
@ -1862,12 +1908,11 @@ function PLAYERTASKCONTROLLER:_AddTask(Target)
|
|||||||
targetobject:ForEachGroup(
|
targetobject:ForEachGroup(
|
||||||
function (group)
|
function (group)
|
||||||
local attribute = group:GetAttribute()
|
local attribute = group:GetAttribute()
|
||||||
if attribute == GROUP.Attribute.GROUND_SAM or attribute == GROUP.Attribute.GROUND_AAA or attribute == GROUP.Attribute.GROUND_EWR then
|
if self:_IsAttributeSead(attribute) then
|
||||||
type = AUFTRAG.Type.SEAD
|
type = AUFTRAG.Type.SEAD
|
||||||
--ttstype = "suppress air defense"
|
--ttstype = "suppress air defense"
|
||||||
ttstype = self.gettext:GetEntry("SEADTTS",self.locale)
|
ttstype = self.gettext:GetEntry("SEADTTS",self.locale)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
)
|
)
|
||||||
elseif targetobject:IsInstanceOf("SET_UNIT") then
|
elseif targetobject:IsInstanceOf("SET_UNIT") then
|
||||||
self:T("SEAD Check SET_UNIT")
|
self:T("SEAD Check SET_UNIT")
|
||||||
@ -2741,4 +2786,3 @@ end
|
|||||||
-- END PLAYERTASKCONTROLLER
|
-- END PLAYERTASKCONTROLLER
|
||||||
-----
|
-----
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user