mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Ops
This commit is contained in:
parent
32c9a59ff0
commit
adc89feda9
@ -157,15 +157,15 @@ function ARMYGROUP:GetClosestRoad()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Add a *scheduled* task.
|
--- Add a *scheduled* task to fire at a given coordinate.
|
||||||
-- @param #ARMYGROUP self
|
-- @param #ARMYGROUP self
|
||||||
-- @param Core.Point#COORDINATE Coordinate Coordinate of the target.
|
-- @param Core.Point#COORDINATE Coordinate Coordinate of the target.
|
||||||
|
-- @param #string Clock Time when to start the attack.
|
||||||
-- @param #number Radius Radius in meters. Default 100 m.
|
-- @param #number Radius Radius in meters. Default 100 m.
|
||||||
-- @param #number Nshots Number of shots to fire. Default 3.
|
-- @param #number Nshots Number of shots to fire. Default 3.
|
||||||
-- @param #number WeaponType Type of weapon. Default auto.
|
-- @param #number WeaponType Type of weapon. Default auto.
|
||||||
-- @param #string Clock Time when to start the attack.
|
|
||||||
-- @param #number Prio Priority of the task.
|
-- @param #number Prio Priority of the task.
|
||||||
function ARMYGROUP:AddTaskFireAtPoint(Coordinate, Radius, Nshots, WeaponType, Clock, Prio)
|
function ARMYGROUP:AddTaskFireAtPoint(Coordinate, Clock, Radius, Nshots, WeaponType, Prio)
|
||||||
|
|
||||||
local DCStask=CONTROLLABLE.TaskFireAtPoint(nil, Coordinate:GetVec2(), Radius, Nshots, WeaponType)
|
local DCStask=CONTROLLABLE.TaskFireAtPoint(nil, Coordinate:GetVec2(), Radius, Nshots, WeaponType)
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ function ARMYGROUP:AddTaskFireAtPoint(Coordinate, Radius, Nshots, WeaponType, Cl
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Add a *waypoint* task.
|
--- Add a *waypoint* task to fire at a given coordinate.
|
||||||
-- @param #ARMYGROUP self
|
-- @param #ARMYGROUP self
|
||||||
-- @param Core.Point#COORDINATE Coordinate Coordinate of the target.
|
-- @param Core.Point#COORDINATE Coordinate Coordinate of the target.
|
||||||
-- @param Ops.OpsGroup#OPSGROUP.Waypoint Waypoint Where the task is executed. Default is next waypoint.
|
-- @param Ops.OpsGroup#OPSGROUP.Waypoint Waypoint Where the task is executed. Default is next waypoint.
|
||||||
|
|||||||
@ -107,8 +107,9 @@
|
|||||||
--
|
--
|
||||||
-- @field #number optionROE ROE.
|
-- @field #number optionROE ROE.
|
||||||
-- @field #number optionROT ROT.
|
-- @field #number optionROT ROT.
|
||||||
-- @field #number optionCM Counter measures.
|
-- @field #number optionAlarm Alarm state.
|
||||||
-- @field #number optionFormation Formation.
|
-- @field #number optionFormation Formation.
|
||||||
|
-- @field #number optionCM Counter measures.
|
||||||
-- @field #number optionRTBammo RTB on out-of-ammo.
|
-- @field #number optionRTBammo RTB on out-of-ammo.
|
||||||
-- @field #number optionRTBfuel RTB on out-of-fuel.
|
-- @field #number optionRTBfuel RTB on out-of-fuel.
|
||||||
-- @field #number optionECM ECM.
|
-- @field #number optionECM ECM.
|
||||||
@ -431,7 +432,7 @@ AUFTRAG.version="0.3.1"
|
|||||||
-- TODO list
|
-- TODO list
|
||||||
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- TODO: Option to assign a specific payload for the mission (requires an AIRWING).
|
-- DONE: Option to assign a specific payload for the mission (requires an AIRWING).
|
||||||
-- TODO: Mission success options damaged, destroyed.
|
-- TODO: Mission success options damaged, destroyed.
|
||||||
-- TODO: Recon mission. What input? Set of coordinates?
|
-- TODO: Recon mission. What input? Set of coordinates?
|
||||||
-- NOPE: Clone mission. How? Deepcopy? ==> Create a new auftrag.
|
-- NOPE: Clone mission. How? Deepcopy? ==> Create a new auftrag.
|
||||||
@ -1169,6 +1170,7 @@ function AUFTRAG:NewTargetAir(Target)
|
|||||||
|
|
||||||
self.engageTarget=Target
|
self.engageTarget=Target
|
||||||
|
|
||||||
|
--[[
|
||||||
if Target.category==TARGET.Category.GROUND then
|
if Target.category==TARGET.Category.GROUND then
|
||||||
|
|
||||||
|
|
||||||
@ -1184,14 +1186,18 @@ function AUFTRAG:NewTargetAir(Target)
|
|||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
]]
|
||||||
|
|
||||||
local mission=self:NewAUTO()
|
local target=self.engageTarget:GetObject()
|
||||||
|
|
||||||
|
local mission=self:NewAUTO(target)
|
||||||
|
|
||||||
|
|
||||||
if mission then
|
if mission then
|
||||||
mission:SetPriority(10, true)
|
mission:SetPriority(10, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return mission
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -1411,6 +1417,15 @@ function AUFTRAG:SetRepeatOnFailure(Nrepeat)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set how many times the mission is repeated if it was successful.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @param #number Nrepeat Number of repeats. Default 0.
|
||||||
|
-- @return #AUFTRAG self
|
||||||
|
function AUFTRAG:SetRepeatOnSuccess(Nrepeat)
|
||||||
|
self.NrepeatSuccess=Nrepeat or 0
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Define how many assets are required to do the job.
|
--- Define how many assets are required to do the job.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #number Nassets Number of asset groups. Default 1.
|
-- @param #number Nassets Number of asset groups. Default 1.
|
||||||
@ -1549,6 +1564,17 @@ function AUFTRAG:SetROT(rot)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Set alarm state for this mission.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @param #number Alarmstate Alarm state 0=Auto, 1=Green, 2=Red.
|
||||||
|
-- @return #AUFTRAG self
|
||||||
|
function AUFTRAG:SetAlarmstate(Alarmstate)
|
||||||
|
|
||||||
|
self.optionAlarm=Alarmstate
|
||||||
|
|
||||||
|
return self
|
||||||
|
end
|
||||||
|
|
||||||
--- Set formation for this mission.
|
--- Set formation for this mission.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #number Formation Formation.
|
-- @param #number Formation Formation.
|
||||||
@ -1688,7 +1714,7 @@ function AUFTRAG:AssignSquadrons(Squadrons)
|
|||||||
self.squadrons=Squadrons
|
self.squadrons=Squadrons
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the required payload for this mission.
|
--- Set the required payload for this mission. Only available for use with an AIRWING.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param Ops.AirWing#AIRWING.Payload Required payload
|
-- @param Ops.AirWing#AIRWING.Payload Required payload
|
||||||
-- @return #AUFTRAG self
|
-- @return #AUFTRAG self
|
||||||
@ -2463,21 +2489,6 @@ function AUFTRAG:onafterAssetDead(From, Event, To, Asset)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- On after "Success" event.
|
|
||||||
-- @param #AUFTRAG self
|
|
||||||
-- @param #string From From state.
|
|
||||||
-- @param #string Event Event.
|
|
||||||
-- @param #string To To state.
|
|
||||||
function AUFTRAG:onafterSuccess(From, Event, To)
|
|
||||||
|
|
||||||
self.status=AUFTRAG.Status.SUCCESS
|
|
||||||
self:T(self.lid..string.format("New mission status=%s", self.status))
|
|
||||||
|
|
||||||
-- Stop mission.
|
|
||||||
self:Stop()
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
--- On after "Cancel" event. Cancells the mission.
|
--- On after "Cancel" event. Cancells the mission.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
@ -2493,6 +2504,7 @@ function AUFTRAG:onafterCancel(From, Event, To)
|
|||||||
|
|
||||||
-- No more repeats.
|
-- No more repeats.
|
||||||
self.missionRepeatMax=self.missionRepeated
|
self.missionRepeatMax=self.missionRepeated
|
||||||
|
self.NrepeatSuccess=self.missionRepeated
|
||||||
|
|
||||||
-- Not necessary to delay the evaluaton?!
|
-- Not necessary to delay the evaluaton?!
|
||||||
self.dTevaluate=0
|
self.dTevaluate=0
|
||||||
@ -2529,6 +2541,32 @@ function AUFTRAG:onafterCancel(From, Event, To)
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- On after "Success" event.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @param #string From From state.
|
||||||
|
-- @param #string Event Event.
|
||||||
|
-- @param #string To To state.
|
||||||
|
function AUFTRAG:onafterSuccess(From, Event, To)
|
||||||
|
|
||||||
|
self.status=AUFTRAG.Status.SUCCESS
|
||||||
|
self:T(self.lid..string.format("New mission status=%s", self.status))
|
||||||
|
|
||||||
|
if self.missionRepeated>=self.NrepeatSuccess then
|
||||||
|
|
||||||
|
-- Stop mission.
|
||||||
|
self:I(self.lid..string.format("Mission SUCCESS! Number of max repeats reached [%d>=%d] ==> Stopping mission!", self.missionRepeated, self.NrepeatSuccess))
|
||||||
|
self:Stop()
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
-- Repeat mission.
|
||||||
|
self:I(self.lid..string.format("Mission SUCCESS! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.missionRepeated+1, self.NrepeatSuccess))
|
||||||
|
self:Repeat()
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--- On after "Failed" event.
|
--- On after "Failed" event.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #string From From state.
|
-- @param #string From From state.
|
||||||
@ -2547,7 +2585,7 @@ function AUFTRAG:onafterFailed(From, Event, To)
|
|||||||
else
|
else
|
||||||
|
|
||||||
-- Repeat mission.
|
-- Repeat mission.
|
||||||
self:I(self.lid..string.format("Mission failed! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.missionRepeated+1, self.missionRepeatMax))
|
self:I(self.lid..string.format("Mission FAILED! Repeating mission for the %d time (max %d times) ==> Repeat mission!", self.missionRepeated+1, self.missionRepeatMax))
|
||||||
self:Repeat()
|
self:Repeat()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -189,10 +189,10 @@ end
|
|||||||
--- Add a *scheduled* task.
|
--- Add a *scheduled* task.
|
||||||
-- @param #NAVYGROUP self
|
-- @param #NAVYGROUP self
|
||||||
-- @param Core.Point#COORDINATE Coordinate Coordinate of the target.
|
-- @param Core.Point#COORDINATE Coordinate Coordinate of the target.
|
||||||
|
-- @param #string Clock Time when to start the attack.
|
||||||
-- @param #number Radius Radius in meters. Default 100 m.
|
-- @param #number Radius Radius in meters. Default 100 m.
|
||||||
-- @param #number Nshots Number of shots to fire. Default 3.
|
-- @param #number Nshots Number of shots to fire. Default 3.
|
||||||
-- @param #number WeaponType Type of weapon. Default auto.
|
-- @param #number WeaponType Type of weapon. Default auto.
|
||||||
-- @param #string Clock Time when to start the attack.
|
|
||||||
-- @param #number Prio Priority of the task.
|
-- @param #number Prio Priority of the task.
|
||||||
-- @return Ops.OpsGroup#OPSGROUP.Task The task data.
|
-- @return Ops.OpsGroup#OPSGROUP.Task The task data.
|
||||||
function NAVYGROUP:AddTaskFireAtPoint(Coordinate, Radius, Nshots, WeaponType, Clock, Prio)
|
function NAVYGROUP:AddTaskFireAtPoint(Coordinate, Radius, Nshots, WeaponType, Clock, Prio)
|
||||||
|
|||||||
@ -252,6 +252,7 @@ OPSGROUP.TaskType={
|
|||||||
-- @field #boolean detour If true, this waypoint is not part of the normal route.
|
-- @field #boolean detour If true, this waypoint is not part of the normal route.
|
||||||
-- @field #boolean intowind If true, this waypoint is a turn into wind route point.
|
-- @field #boolean intowind If true, this waypoint is a turn into wind route point.
|
||||||
-- @field #boolean astar If true, this waypint was found by A* pathfinding algorithm.
|
-- @field #boolean astar If true, this waypint was found by A* pathfinding algorithm.
|
||||||
|
-- @field #number npassed Number of times a groups passed this waypoint.
|
||||||
-- @field Core.Point#COORDINATE coordinate Waypoint coordinate.
|
-- @field Core.Point#COORDINATE coordinate Waypoint coordinate.
|
||||||
-- @field Core.Point#COORDINATE roadcoord Closest point to road.
|
-- @field Core.Point#COORDINATE roadcoord Closest point to road.
|
||||||
-- @field #number roaddist Distance to closest point on road.
|
-- @field #number roaddist Distance to closest point on road.
|
||||||
@ -1851,13 +1852,13 @@ function OPSGROUP:onbeforeMissionStart(From, Event, To, Mission)
|
|||||||
-- Activate group if it is late activated.
|
-- Activate group if it is late activated.
|
||||||
if self:IsLateActivated() then
|
if self:IsLateActivated() then
|
||||||
self:Activate(delay)
|
self:Activate(delay)
|
||||||
--delay=delay+1
|
delay=delay+1
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Startup group if it is uncontrolled.
|
-- Startup group if it is uncontrolled.
|
||||||
if self.isAircraft and self:IsParking() and self:IsUncontrolled() then
|
if self.isAircraft and self:IsUncontrolled() then
|
||||||
self:StartUncontrolled(delay)
|
self:StartUncontrolled(delay)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -241,12 +241,12 @@ function SQUADRON:SetSkill(Skill)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set maintenance and repair time.
|
--- Set turnover and repair time. If an asset returns from a mission to the airwing, it will need some time until the asset is available for further missions.
|
||||||
-- @param #SQUADRON self
|
-- @param #SQUADRON self
|
||||||
-- @param #number MaintenanceTime Time in minutes it takes until a flight is combat ready again. Default is 0 min.
|
-- @param #number MaintenanceTime Time in minutes it takes until a flight is combat ready again. Default is 0 min.
|
||||||
-- @param #number RepairTime Time in minutes it takes to repair a flight for each percent damage taken. Default is 0 min.
|
-- @param #number RepairTime Time in minutes it takes to repair a flight for each percent damage taken. Default is 0 min.
|
||||||
-- @return #SQUADRON self
|
-- @return #SQUADRON self
|
||||||
function SQUADRON:SetMaintenanceTime(MaintenanceTime, RepairTime)
|
function SQUADRON:SetTurnoverTime(MaintenanceTime, RepairTime)
|
||||||
self.maintenancetime=MaintenanceTime and MaintenanceTime*60 or 0
|
self.maintenancetime=MaintenanceTime and MaintenanceTime*60 or 0
|
||||||
self.repairtime=RepairTime and RepairTime*60 or 0
|
self.repairtime=RepairTime and RepairTime*60 or 0
|
||||||
return self
|
return self
|
||||||
|
|||||||
@ -764,6 +764,35 @@ function TARGET:GetTargetByName(ObjectName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
--- Get the first target objective alive.
|
||||||
|
-- @param #TARGET self
|
||||||
|
-- @return #TARGET.Object The target objective.
|
||||||
|
function TARGET:GetObjective()
|
||||||
|
|
||||||
|
for _,_target in pairs(self.targets) do
|
||||||
|
local target=_target --#TARGET.Object
|
||||||
|
if target.Status==TARGET.ObjectStatus.ALIVE then
|
||||||
|
return target
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the first target object alive.
|
||||||
|
-- @param #TARGET self
|
||||||
|
-- @return Wrapper.Positionable#POSITIONABLE The target object or nil.
|
||||||
|
function TARGET:GetObject()
|
||||||
|
|
||||||
|
local target=self:GetObjective()
|
||||||
|
if target then
|
||||||
|
return target.Object
|
||||||
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Count alive targets.
|
--- Count alive targets.
|
||||||
-- @param #TARGET self
|
-- @param #TARGET self
|
||||||
-- @return #number Number of alive target objects.
|
-- @return #number Number of alive target objects.
|
||||||
|
|||||||
@ -56,6 +56,17 @@ ENUMS.ROT = {
|
|||||||
AllowAbortMission=4,
|
AllowAbortMission=4,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--- Alarm state.
|
||||||
|
-- @type ENUMS.AlarmState
|
||||||
|
-- @field #number Auto AI will automatically switch alarm states based on the presence of threats. The AI kind of cheats in this regard.
|
||||||
|
-- @field #number Green Group is not combat ready. Sensors are stowed if possible.
|
||||||
|
-- @field #number Red Group is combat ready and actively searching for targets. Some groups like infantry will not move in this state.
|
||||||
|
ENUMS.AlarmState = {
|
||||||
|
Auto=0,
|
||||||
|
Green=1,
|
||||||
|
Red=2,
|
||||||
|
}
|
||||||
|
|
||||||
--- Weapon types. See the [Weapon Flag](https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag) enumerotor on hoggit wiki.
|
--- Weapon types. See the [Weapon Flag](https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag) enumerotor on hoggit wiki.
|
||||||
-- @type ENUMS.WeaponFlag
|
-- @type ENUMS.WeaponFlag
|
||||||
ENUMS.WeaponFlag={
|
ENUMS.WeaponFlag={
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user