mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-17 20:56:08 +00:00
Ops
This commit is contained in:
@@ -5167,7 +5167,7 @@ function WAREHOUSE:onafterAssetSpawned(From, Event, To, group, asset, request)
|
|||||||
local text=string.format("Asset %s from request id=%d was spawned!", asset.spawngroupname, request.uid)
|
local text=string.format("Asset %s from request id=%d was spawned!", asset.spawngroupname, request.uid)
|
||||||
self:I(self.lid..text)
|
self:I(self.lid..text)
|
||||||
|
|
||||||
-- Sete asset state to spawned.
|
-- Set asset state to spawned.
|
||||||
asset.spawned=true
|
asset.spawned=true
|
||||||
|
|
||||||
-- Check if all assets groups are spawned and trigger events.
|
-- Check if all assets groups are spawned and trigger events.
|
||||||
|
|||||||
@@ -723,7 +723,7 @@ function AIRWING:onafterStatus(From, Event, To)
|
|||||||
text=text..string.format("\n* %s %s: %s*%d, Callsign=%s, Modex=%d, Skill=%s", squadron.name, squadron:GetState(), squadron.aircrafttype, #squadron.assets, callsign, modex, skill)
|
text=text..string.format("\n* %s %s: %s*%d, Callsign=%s, Modex=%d, Skill=%s", squadron.name, squadron:GetState(), squadron.aircrafttype, #squadron.assets, callsign, modex, skill)
|
||||||
|
|
||||||
-- Loop over all assets.
|
-- Loop over all assets.
|
||||||
if self.verbose>1 then
|
if self.verbose>0 then
|
||||||
for j,_asset in pairs(squadron.assets) do
|
for j,_asset in pairs(squadron.assets) do
|
||||||
local asset=_asset --#AIRWING.SquadronAsset
|
local asset=_asset --#AIRWING.SquadronAsset
|
||||||
local assignment=asset.assignment or "none"
|
local assignment=asset.assignment or "none"
|
||||||
@@ -742,8 +742,8 @@ function AIRWING:onafterStatus(From, Event, To)
|
|||||||
text=text..string.format("\n -[%d] %s*%d \"%s\": spawned=%s, mission=%s%s", j, typename, asset.nunits, asset.spawngroupname, spawned, tostring(self:IsAssetOnMission(asset)), missiontext)
|
text=text..string.format("\n -[%d] %s*%d \"%s\": spawned=%s, mission=%s%s", j, typename, asset.nunits, asset.spawngroupname, spawned, tostring(self:IsAssetOnMission(asset)), missiontext)
|
||||||
|
|
||||||
--TODO
|
--TODO
|
||||||
--local payload=asset.payload and table.concat(asset.payload.missiontypes, ", ") or "None"
|
local payload=asset.payload and table.concat(self:GetPayloadMissionTypes(asset.payload, MissionType), ", ") or "None"
|
||||||
--text=text.." payload="..payload
|
text=text.." payload="..payload
|
||||||
|
|
||||||
text=text..", flight: "
|
text=text..", flight: "
|
||||||
if asset.flightgroup and asset.flightgroup:IsAlive() then
|
if asset.flightgroup and asset.flightgroup:IsAlive() then
|
||||||
@@ -1941,8 +1941,7 @@ end
|
|||||||
--- Get mission types a payload can perform.
|
--- Get mission types a payload can perform.
|
||||||
-- @param #AIRWING self
|
-- @param #AIRWING self
|
||||||
-- @param #AIRWING.Payload Payload The payload table.
|
-- @param #AIRWING.Payload Payload The payload table.
|
||||||
-- @param #string MissionType Type of mission.
|
-- @return #table Mission types.
|
||||||
-- @return #number Performance or -1.
|
|
||||||
function AIRWING:GetPayloadMissionTypes(Payload)
|
function AIRWING:GetPayloadMissionTypes(Payload)
|
||||||
|
|
||||||
local missiontypes={}
|
local missiontypes={}
|
||||||
|
|||||||
@@ -286,6 +286,7 @@ AUFTRAG.TargetType={
|
|||||||
-- @field #string Name Target name.
|
-- @field #string Name Target name.
|
||||||
-- @field #number Ninital Number of initial targets.
|
-- @field #number Ninital Number of initial targets.
|
||||||
-- @field #number Lifepoints Total life points.
|
-- @field #number Lifepoints Total life points.
|
||||||
|
-- @field #number Lifepoints0 Inital life points.
|
||||||
|
|
||||||
--- Mission capability.
|
--- Mission capability.
|
||||||
-- @type AUFTRAG.Capability
|
-- @type AUFTRAG.Capability
|
||||||
@@ -783,15 +784,16 @@ function AUFTRAG:NewSEAD(Target)
|
|||||||
|
|
||||||
mission:_TargetFromObject(Target)
|
mission:_TargetFromObject(Target)
|
||||||
|
|
||||||
mission.engageWeaponType=ENUMS.WeaponFlag.AnyAG
|
mission.engageWeaponType=ENUMS.WeaponFlag.AnyAG --ENUMS.WeaponFlag.Cannons
|
||||||
mission.engageWeaponExpend=AI.Task.WeaponExpend.ALL
|
mission.engageWeaponExpend=AI.Task.WeaponExpend.ALL
|
||||||
mission.engageAsGroup=true
|
mission.engageAsGroup=true
|
||||||
|
|
||||||
mission.missionTask=ENUMS.MissionTask.SEAD
|
mission.missionTask=ENUMS.MissionTask.SEAD
|
||||||
mission.missionAltitude=nil
|
mission.missionAltitude=nil
|
||||||
mission.missionFraction=0.25
|
mission.missionFraction=0.2
|
||||||
mission.optionROE=ENUMS.ROE.OpenFire
|
mission.optionROE=ENUMS.ROE.OpenFire
|
||||||
mission.optionROT=ENUMS.ROT.AllowAbortMission
|
mission.optionROT=ENUMS.ROT.EvadeFire
|
||||||
|
--mission.optionROT=ENUMS.ROT.AllowAbortMission
|
||||||
|
|
||||||
mission.DCStask=mission:GetDCSMissionTask()
|
mission.DCStask=mission:GetDCSMissionTask()
|
||||||
|
|
||||||
@@ -2146,10 +2148,27 @@ function AUFTRAG:CountMissionTargets(Target)
|
|||||||
return N
|
return N
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get target life points.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @return #number Number of initial life points when mission was planned.
|
||||||
|
function AUFTRAG:GetTargetInitialLife()
|
||||||
|
return self:GetTargetData().Lifepoints
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get target damage.
|
||||||
|
-- @param #AUFTRAG self
|
||||||
|
-- @return #number Percent.
|
||||||
|
function AUFTRAG:GetTargetDamage()
|
||||||
|
local target=self:GetTargetData()
|
||||||
|
local life=self:GetTargetLife()/self:GetTargetData().Lifepoints
|
||||||
|
local damage=1-life
|
||||||
|
return damage*100
|
||||||
|
end
|
||||||
|
|
||||||
--- Get target life points.
|
--- Get target life points.
|
||||||
-- @param #AUFTRAG self
|
-- @param #AUFTRAG self
|
||||||
-- @param #AUFTRAG.TargetData Target (Optional) The target object.
|
-- @param #AUFTRAG.TargetData Target (Optional) The target object.
|
||||||
-- @return #number Number of alive target units.
|
-- @return #number Life points of target.
|
||||||
function AUFTRAG:GetTargetLife(Target)
|
function AUFTRAG:GetTargetLife(Target)
|
||||||
|
|
||||||
local N=0
|
local N=0
|
||||||
@@ -2192,10 +2211,12 @@ function AUFTRAG:GetTargetLife(Target)
|
|||||||
elseif Target.Type==AUFTRAG.TargetType.AIRBASE then
|
elseif Target.Type==AUFTRAG.TargetType.AIRBASE then
|
||||||
|
|
||||||
-- TODO: any (good) way to tell whether an airbase was "destroyed" or at least damaged? Is :GetLive() working?
|
-- TODO: any (good) way to tell whether an airbase was "destroyed" or at least damaged? Is :GetLive() working?
|
||||||
|
N=N+1
|
||||||
|
|
||||||
elseif Target.Type==AUFTRAG.TargetType.COORDINATE then
|
elseif Target.Type==AUFTRAG.TargetType.COORDINATE then
|
||||||
|
|
||||||
-- A coordinate does not live.
|
-- A coordinate does not live.
|
||||||
|
N=N+1
|
||||||
|
|
||||||
elseif Target.Type==AUFTRAG.TargetType.SETGROUP then
|
elseif Target.Type==AUFTRAG.TargetType.SETGROUP then
|
||||||
|
|
||||||
@@ -2371,7 +2392,7 @@ function AUFTRAG:UpdateMarker()
|
|||||||
-- Marker text.
|
-- Marker text.
|
||||||
local text=string.format("%s %s: %s", self.name, self.type:upper(), self.status:upper())
|
local text=string.format("%s %s: %s", self.name, self.type:upper(), self.status:upper())
|
||||||
text=text..string.format("\n%s", self:GetTargetName())
|
text=text..string.format("\n%s", self:GetTargetName())
|
||||||
text=text..string.format("\nTargets %d/%d, Life Points=%d", self:CountMissionTargets(), self.Ntargets, self:GetTargetLife())
|
text=text..string.format("\nTargets %d/%d, Life Points=%d/%d", self:CountMissionTargets(), self.Ntargets, self:GetTargetLife(), self:GetTargetInitialLife())
|
||||||
text=text..string.format("\nFlights %d/%d", self:CountFlightGroups(), self.nassets)
|
text=text..string.format("\nFlights %d/%d", self:CountFlightGroups(), self.nassets)
|
||||||
|
|
||||||
if not self.marker then
|
if not self.marker then
|
||||||
@@ -2547,6 +2568,12 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
-- SEAD Mission --
|
-- SEAD Mission --
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
--[[
|
||||||
|
local DCStask=CONTROLLABLE.EnRouteTaskEngageTargets(nil, nil ,{"Air Defence"} , 0)
|
||||||
|
table.insert(self.enrouteTasks, DCStask)
|
||||||
|
DCStask.key="SEAD"
|
||||||
|
]]
|
||||||
|
|
||||||
self:_GetDCSAttackTask(self.engageTarget, DCStasks)
|
self:_GetDCSAttackTask(self.engageTarget, DCStasks)
|
||||||
|
|
||||||
elseif self.type==AUFTRAG.Type.STRIKE then
|
elseif self.type==AUFTRAG.Type.STRIKE then
|
||||||
@@ -2633,7 +2660,7 @@ function AUFTRAG:GetDCSMissionTask()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self:T({missiontask=DCStasks})
|
self:I({missiontask=DCStasks})
|
||||||
|
|
||||||
-- Return the task.
|
-- Return the task.
|
||||||
if #DCStasks==1 then
|
if #DCStasks==1 then
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
--- **Utilities** Enumerators.
|
--- **Utilities** Enumerators.
|
||||||
--
|
--
|
||||||
|
-- An enumerator is a variable that holds a constant value. Enumerators are very useful because
|
||||||
|
--
|
||||||
|
-- https://wiki.hoggitworld.com/view/Category:Enumerators
|
||||||
|
--
|
||||||
-- See the [Simulator Scripting Engine Documentation](https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation) on Hoggit for further explanation and examples.
|
-- See the [Simulator Scripting Engine Documentation](https://wiki.hoggitworld.com/view/Simulator_Scripting_Engine_Documentation) on Hoggit for further explanation and examples.
|
||||||
--
|
--
|
||||||
-- @module ENUMS
|
-- @module ENUMS
|
||||||
@@ -12,7 +16,7 @@
|
|||||||
-- * Events and event handlers are all governed within world.
|
-- * Events and event handlers are all governed within world.
|
||||||
-- * A number of functions to get information about the game world.
|
-- * A number of functions to get information about the game world.
|
||||||
--
|
--
|
||||||
-- See [https://wiki.hoggitworld.com/view/DCS_singleton_world](https://wiki.hoggitworld.com/view/DCS_singleton_world)
|
-- Enumerator
|
||||||
-- @field #ENUMS
|
-- @field #ENUMS
|
||||||
ENUMS = {}
|
ENUMS = {}
|
||||||
|
|
||||||
@@ -46,50 +50,73 @@ ENUMS.ROT = {
|
|||||||
AllowAbortMission=4,
|
AllowAbortMission=4,
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Weapon types.
|
--- Weapon types. See https://wiki.hoggitworld.com/view/DCS_enum_weapon_flag
|
||||||
-- @type ENUMS.WeaponFlag
|
-- @type ENUMS.WeaponFlag
|
||||||
ENUMS.WeaponFlag={
|
ENUMS.WeaponFlag={
|
||||||
-- Combinations
|
--- Bombs
|
||||||
Auto=3221225470, --AnyWeapon (AnyBomb + AnyRocket + AnyMissile + Cannons)
|
LGB = 2,
|
||||||
AnyAG=2956984318,
|
TvGB = 4,
|
||||||
AnyAA=264241152,
|
SNSGB = 8,
|
||||||
AnyUnguided=2952822768,
|
HEBomb = 16,
|
||||||
AnyGuided=268402702,
|
Penetrator = 32,
|
||||||
-- Bombs
|
NapalmBomb = 64,
|
||||||
LGB=2,
|
FAEBomb = 128,
|
||||||
TvGB=4,
|
ClusterBomb = 256,
|
||||||
SNSGB=8,
|
Dispencer = 512,
|
||||||
HEBomb=16,
|
CandleBomb = 1024,
|
||||||
Penetrator=32,
|
ParachuteBomb = 2147483648,
|
||||||
NapalmBomb=64,
|
--- Rockets
|
||||||
FAEBomb=128,
|
LightRocket = 2048,
|
||||||
ClusterBomb=256,
|
MarkerRocket = 4096,
|
||||||
Dispencer=512,
|
CandleRocket = 8192,
|
||||||
CandleBomb=1024,
|
HeavyRocket = 16384,
|
||||||
ParachuteBomb=2147483648,
|
--- Air-To-Surface Missiles
|
||||||
GuidedBomb=14, -- (LGB + TvGB + SNSGB)
|
AntiRadarMissile = 32768,
|
||||||
AnyUnguidedBomb=2147485680, -- (HeBomb + Penetrator + NapalmBomb + FAEBomb + ClusterBomb + Dispencer + CandleBomb + ParachuteBomb)
|
AntiShipMissile = 65536,
|
||||||
AnyBomb=2147485694, -- (GuidedBomb + AnyUnguidedBomb)
|
AntiTankMissile = 131072,
|
||||||
-- Rockets
|
FireAndForgetASM = 262144,
|
||||||
LightRocket=2048,
|
LaserASM = 524288,
|
||||||
MarkerRocket=4096,
|
TeleASM = 1048576,
|
||||||
CandleRocket=8192,
|
CruiseMissile = 2097152,
|
||||||
HeavyRocket=16384,
|
AntiRadarMissile2 = 1073741824,
|
||||||
AnyRocket=30720, -- LightRocket + MarkerRocket + CandleRocket + HeavyRocket
|
|
||||||
--- Air-To-Air Missiles
|
--- Air-To-Air Missiles
|
||||||
SRAM=4194304,
|
SRAM = 4194304,
|
||||||
MRAAM=8388608,
|
MRAAM = 8388608,
|
||||||
LRAaM=16777216,
|
LRAAM = 16777216,
|
||||||
IR_AAM=33554432,
|
IR_AAM = 33554432,
|
||||||
SAR_AAM=67108864,
|
SAR_AAM = 67108864,
|
||||||
AR_AAM=134217728,
|
AR_AAM = 134217728,
|
||||||
AnyAAM=264241152, -- IR_AAM + SAR_AAM + AR_AAM + SRAAM + MRAAM + LRAAM
|
|
||||||
AnyMissile=268402688, -- ASM + AnyAAM
|
|
||||||
AnyAutonomousMissile=36012032, --IR_AAM + AntiRadarMissile + AntiShipMissile + FireAndForgetASM + CruiseMissile
|
|
||||||
--- Guns
|
--- Guns
|
||||||
GUN_POD=268435456,
|
GUN_POD = 268435456,
|
||||||
BuiltInCannon=536870912,
|
BuiltInCannon = 536870912,
|
||||||
Cannos=805306368, --GUN_POD + BuiltInCannon)
|
---
|
||||||
|
-- Combinations
|
||||||
|
--
|
||||||
|
-- Bombs
|
||||||
|
GuidedBomb = 14, -- (LGB + TvGB + SNSGB)
|
||||||
|
AnyUnguidedBomb = 2147485680, -- (HeBomb + Penetrator + NapalmBomb + FAEBomb + ClusterBomb + Dispencer + CandleBomb + ParachuteBomb)
|
||||||
|
AnyBomb = 2147485694, -- (GuidedBomb + AnyUnguidedBomb)
|
||||||
|
--- Rockets
|
||||||
|
AnyRocket = 30720, -- LightRocket + MarkerRocket + CandleRocket + HeavyRocket
|
||||||
|
--- Air-To-Surface Missiles
|
||||||
|
GuidedASM = 1572864, -- (LaserASM + TeleASM)
|
||||||
|
TacticalASM = 1835008, -- (GuidedASM + FireAndForgetASM)
|
||||||
|
AnyASM = 4161536, -- (AntiRadarMissile + AntiShipMissile + AntiTankMissile + FireAndForgetASM + GuidedASM + CruiseMissile)
|
||||||
|
AnyASM2 = 1077903360, -- 4161536+1073741824,
|
||||||
|
--- Air-To-Air Missiles
|
||||||
|
AnyAAM = 264241152, -- IR_AAM + SAR_AAM + AR_AAM + SRAAM + MRAAM + LRAAM
|
||||||
|
AnyAutonomousMissile = 36012032, -- IR_AAM + AntiRadarMissile + AntiShipMissile + FireAndForgetASM + CruiseMissile
|
||||||
|
AnyMissile = 268402688, -- AnyASM + AnyAAM
|
||||||
|
--- Guns
|
||||||
|
Cannons = 805306368, -- GUN_POD + BuiltInCannon
|
||||||
|
---
|
||||||
|
-- Even More Genral
|
||||||
|
Auto = 3221225470, -- Any Weapon (AnyBomb + AnyRocket + AnyMissile + Cannons)
|
||||||
|
AutoDCS = 1073741822, -- Something if often see
|
||||||
|
AnyAG = 2956984318, -- Any Air-To-Ground Weapon
|
||||||
|
AnyAA = 264241152, -- Any Air-To-Air Weapon
|
||||||
|
AnyUnguided = 2952822768, -- Any Unguided Weapon
|
||||||
|
AnyGuided = 268402702, -- Any Guided Weapon
|
||||||
}
|
}
|
||||||
|
|
||||||
--- Mission tasks.
|
--- Mission tasks.
|
||||||
|
|||||||
@@ -880,7 +880,7 @@ function CONTROLLABLE:TaskAttackGroup( AttackGroup, WeaponType, WeaponExpend, At
|
|||||||
weaponType = WeaponType or 1073741822,
|
weaponType = WeaponType or 1073741822,
|
||||||
expend = WeaponExpend or "Auto",
|
expend = WeaponExpend or "Auto",
|
||||||
attackQtyLimit = AttackQty and true or false,
|
attackQtyLimit = AttackQty and true or false,
|
||||||
attackQty = AttackQty,
|
attackQty = AttackQty or 1,
|
||||||
directionEnabled = Direction and true or false,
|
directionEnabled = Direction and true or false,
|
||||||
direction = Direction and math.rad(Direction) or 0,
|
direction = Direction and math.rad(Direction) or 0,
|
||||||
altitudeEnabled = Altitude and true or false,
|
altitudeEnabled = Altitude and true or false,
|
||||||
|
|||||||
@@ -70,6 +70,10 @@
|
|||||||
--
|
--
|
||||||
-- ## Removed
|
-- ## Removed
|
||||||
--
|
--
|
||||||
|
-- ## TextUpdate
|
||||||
|
--
|
||||||
|
-- ## CoordUpdate
|
||||||
|
--
|
||||||
--
|
--
|
||||||
-- # Examples
|
-- # Examples
|
||||||
--
|
--
|
||||||
|
|||||||
Reference in New Issue
Block a user