mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
#PLAYERTASKCONTROLLER
* Additions for lasing unit being an ARMYGROUP
This commit is contained in:
parent
5c90afea76
commit
68756681fa
@ -98,7 +98,7 @@ PLAYERTASK = {
|
|||||||
|
|
||||||
--- PLAYERTASK class version.
|
--- PLAYERTASK class version.
|
||||||
-- @field #string version
|
-- @field #string version
|
||||||
PLAYERTASK.version="0.1.23"
|
PLAYERTASK.version="0.1.24"
|
||||||
|
|
||||||
--- Generic task condition.
|
--- Generic task condition.
|
||||||
-- @type PLAYERTASK.Condition
|
-- @type PLAYERTASK.Condition
|
||||||
@ -1966,6 +1966,8 @@ end
|
|||||||
-- Can optionally be handed as Ops.ArmyGroup#ARMYGROUP - **Note** might not find an LOS spot or get lost on the way. Cannot island-hop.
|
-- Can optionally be handed as Ops.ArmyGroup#ARMYGROUP - **Note** might not find an LOS spot or get lost on the way. Cannot island-hop.
|
||||||
-- @param #number LaserCode The lasercode to be used. Defaults to 1688.
|
-- @param #number LaserCode The lasercode to be used. Defaults to 1688.
|
||||||
-- @param Core.Point#COORDINATE HoldingPoint (Optional) Point where the drone should initially circle. If not set, defaults to BullsEye of the coalition.
|
-- @param Core.Point#COORDINATE HoldingPoint (Optional) Point where the drone should initially circle. If not set, defaults to BullsEye of the coalition.
|
||||||
|
-- @param #number Alt (Optional) Altitude in feet. Only applies if using a FLIGHTGROUP object! Defaults to 10000.
|
||||||
|
-- @param #number Speed (Optional) Speed in knots. Only applies if using a FLIGHTGROUP object! Defaults to 120.
|
||||||
-- @return #PLAYERTASKCONTROLLER self
|
-- @return #PLAYERTASKCONTROLLER self
|
||||||
-- @usage
|
-- @usage
|
||||||
-- -- Set up precision bombing, FlightGroup as lasing unit
|
-- -- Set up precision bombing, FlightGroup as lasing unit
|
||||||
@ -1980,7 +1982,7 @@ end
|
|||||||
-- ArmyGroup:Activate()
|
-- ArmyGroup:Activate()
|
||||||
-- taskmanager:EnablePrecisionBombing(ArmyGroup,1688)
|
-- taskmanager:EnablePrecisionBombing(ArmyGroup,1688)
|
||||||
--
|
--
|
||||||
function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,HoldingPoint)
|
function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,HoldingPoint, Alt, Speed)
|
||||||
self:T(self.lid.."EnablePrecisionBombing")
|
self:T(self.lid.."EnablePrecisionBombing")
|
||||||
if FlightGroup then
|
if FlightGroup then
|
||||||
if FlightGroup.ClassName and (FlightGroup.ClassName == "FLIGHTGROUP" or FlightGroup.ClassName == "ARMYGROUP")then
|
if FlightGroup.ClassName and (FlightGroup.ClassName == "FLIGHTGROUP" or FlightGroup.ClassName == "ARMYGROUP")then
|
||||||
@ -1993,11 +1995,20 @@ function PLAYERTASKCONTROLLER:EnablePrecisionBombing(FlightGroup,LaserCode,Holdi
|
|||||||
self.LasingDrone:SetLaser(LaserCode)
|
self.LasingDrone:SetLaser(LaserCode)
|
||||||
self.LaserCode = LaserCode or 1688
|
self.LaserCode = LaserCode or 1688
|
||||||
self.LasingDroneTemplate = self.LasingDrone:_GetTemplate(true)
|
self.LasingDroneTemplate = self.LasingDrone:_GetTemplate(true)
|
||||||
|
self.LasingDroneAlt = Alt or 10000
|
||||||
|
self.LasingDroneSpeed = Speed or 120
|
||||||
-- let it orbit the BullsEye if FG
|
-- let it orbit the BullsEye if FG
|
||||||
if self.LasingDrone:IsFlightgroup() then
|
if self.LasingDrone:IsFlightgroup() then
|
||||||
|
self.LasingDroneIsFlightgroup = true
|
||||||
local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( self.Coalition ))
|
local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( self.Coalition ))
|
||||||
if HoldingPoint then BullsCoordinate = HoldingPoint end
|
if HoldingPoint then BullsCoordinate = HoldingPoint end
|
||||||
local Orbit = AUFTRAG:NewORBIT_CIRCLE(BullsCoordinate,10000,120)
|
local Orbit = AUFTRAG:NewORBIT_CIRCLE(BullsCoordinate,self.LasingDroneAlt,self.LasingDroneSpeed)
|
||||||
|
self.LasingDrone:AddMission(Orbit)
|
||||||
|
elseif self.LasingDrone:IsArmygroup() then
|
||||||
|
self.LasingDroneIsArmygroup = true
|
||||||
|
local BullsCoordinate = COORDINATE:NewFromVec3( coalition.getMainRefPoint( self.Coalition ))
|
||||||
|
if HoldingPoint then BullsCoordinate = HoldingPoint end
|
||||||
|
local Orbit = AUFTRAG:NewONGUARD(BullsCoordinate)
|
||||||
self.LasingDrone:AddMission(Orbit)
|
self.LasingDrone:AddMission(Orbit)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -2536,10 +2547,16 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks()
|
|||||||
if self.LasingDrone then
|
if self.LasingDrone then
|
||||||
self.LasingDrone:_Respawn(1,nil,true)
|
self.LasingDrone:_Respawn(1,nil,true)
|
||||||
else
|
else
|
||||||
-- TODO: Handle ArmyGroup
|
-- DONE: Handle ArmyGroup
|
||||||
local FG = FLIGHTGROUP:New(self.LasingDroneTemplate)
|
if self.LasingDroneIsFlightgroup then
|
||||||
FG:Activate()
|
local FG = FLIGHTGROUP:New(self.LasingDroneTemplate)
|
||||||
self:EnablePrecisionBombing(FG,self.LaserCode or 1688)
|
FG:Activate()
|
||||||
|
self:EnablePrecisionBombing(FG,self.LaserCode or 1688)
|
||||||
|
else
|
||||||
|
local FG = ARMYGROUP:New(self.LasingDroneTemplate)
|
||||||
|
FG:Activate()
|
||||||
|
self:EnablePrecisionBombing(FG,self.LaserCode or 1688)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
@ -2554,13 +2571,11 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks()
|
|||||||
self.LasingDrone.playertask.inreach = false
|
self.LasingDrone.playertask.inreach = false
|
||||||
self.LasingDrone.playertask.reachmessage = false
|
self.LasingDrone.playertask.reachmessage = false
|
||||||
-- move the drone to target
|
-- move the drone to target
|
||||||
if self.LasingDrone:IsFlightgroup() then
|
if self.LasingDroneIsFlightgroup then
|
||||||
self.LasingDrone:CancelAllMissions()
|
self.LasingDrone:CancelAllMissions()
|
||||||
local auftrag = AUFTRAG:NewORBIT_CIRCLE(task.Target:GetCoordinate(),10000,120)
|
local auftrag = AUFTRAG:NewORBIT_CIRCLE(task.Target:GetCoordinate(),self.LasingDroneAlt,self.LasingDroneSpeed)
|
||||||
--local currmission = self.LasingDrone:GetMissionCurrent()
|
self.LasingDrone:AddMission(auftrag)
|
||||||
self.LasingDrone:AddMission(auftrag)
|
elseif self.LasingDroneIsArmygroup then
|
||||||
--currmission:__Cancel(-2)
|
|
||||||
elseif self.LasingDrone:IsArmygroup() then
|
|
||||||
local tgtcoord = task.Target:GetCoordinate()
|
local tgtcoord = task.Target:GetCoordinate()
|
||||||
local tgtzone = ZONE_RADIUS:New("ArmyGroup-"..math.random(1,10000),tgtcoord:GetVec2(),3000)
|
local tgtzone = ZONE_RADIUS:New("ArmyGroup-"..math.random(1,10000),tgtcoord:GetVec2(),3000)
|
||||||
local finalpos=nil -- Core.Point#COORDINATE
|
local finalpos=nil -- Core.Point#COORDINATE
|
||||||
@ -2573,11 +2588,10 @@ function PLAYERTASKCONTROLLER:_CheckPrecisionTasks()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if finalpos then
|
if finalpos then
|
||||||
|
self.LasingDrone:CancelAllMissions()
|
||||||
-- yeah we got one
|
-- yeah we got one
|
||||||
local auftrag = AUFTRAG:NewARMOREDGUARD(finalpos,"Off road")
|
local auftrag = AUFTRAG:NewARMOREDGUARD(finalpos,"Off road")
|
||||||
local currmission = self.LasingDrone:GetMissionCurrent()
|
|
||||||
self.LasingDrone:AddMission(auftrag)
|
self.LasingDrone:AddMission(auftrag)
|
||||||
if currmission then currmission:__Cancel(-2) end
|
|
||||||
else
|
else
|
||||||
-- could not find LOS position!
|
-- could not find LOS position!
|
||||||
self:E("***Could not find LOS position to post ArmyGroup for lasing!")
|
self:E("***Could not find LOS position to post ArmyGroup for lasing!")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user