Compare commits

..

43 Commits

Author SHA1 Message Date
Thomas b33890ff03 Merge pull request #2613 from FlightControl-Master/master-ng
Merge
2026-07-17 07:20:29 +02:00
Thomas 1be2c92a5c Merge pull request #2612 from shaji-Dev/master-ng
CTLD + ENUMS
2026-07-17 07:19:31 +02:00
shafik 4c8a17fe57 Merge remote-tracking branch 'origin/master-ng' into master-ng 2026-07-16 19:58:51 +02:00
shafik 64dea17982 [FIXED] Hardcoded "blue" coalition in SET filters (Doesn't work for redfor in PvP).
[FIXED] Unnecessary new COORDINATE objects that don't hold reference (used only for distance calc).
2026-07-16 19:58:36 +02:00
shafik b1f86c702d [ADDED] F-100 weapons enums 2026-07-16 19:48:35 +02:00
Thomas 1a9540d0d4 Merge pull request #2611 from FlightControl-Master/develop
Develop
2026-07-16 06:45:05 +02:00
Thomas cdfaac527c Merge pull request #2606 from shaji-Dev/master-ng
[FIX] "Parameter #1 (group id) missed" refreshing menus for dead groups
2026-07-15 19:53:58 +02:00
Thomas 4e3bf9969b Merge pull request #2610 from FlightControl-Master/master-ng
Merge from master
2026-07-15 19:52:43 +02:00
Thomas 74c16bd4f0 Merge pull request #2609 from leka1986/agent/group-change-option-event
Add group option change event support
2026-07-15 19:51:38 +02:00
leka1986 55e048b322 Add group option change event support 2026-07-15 18:39:46 +02:00
Thomas b31fb7ece3 Merge pull request #2608 from FlightControl-Master/master-ng
Merge from master
2026-07-15 18:35:50 +02:00
Thomas 149e3421d9 Merge pull request #2607 from patpatpowercat/develop
Update Mantis.lua
2026-07-15 18:34:53 +02:00
patpatpowercat 338ec34604 Update Mantis.lua
Added ships to MANTIS.

NAVYGROUPs may be integrated. Need to be aware MANTIS doesn't change ROE.

SEAD does not (by default) effect ships.

Ships are individually identified, not as group. Group will react to jamming as a whole, will go live/sleep based upon longest range/best radar.

No longer need prefixes for either ground or naval units.
2026-07-14 21:47:47 -07:00
Shafik 3d79a16d3a [FIX] "Parameter #1 (group id) missed" refreshing menus for dead groups 2026-07-13 11:02:42 +03:00
Thomas efa08c1280 Merge pull request #2605 from FlightControl-Master/master-ng
Merge from master
2026-07-12 17:58:28 +02:00
Thomas 589e65963f Merge pull request #2604 from FlightControl-Master/leka1986-patch-2
Fix aircraft model names for Lancer and Kiowa
2026-07-12 17:57:29 +02:00
leka1986 af4f20af67 Fix aircraft model names for Lancer and Kiowa 2026-07-12 13:30:33 +02:00
Applevangelist b1b8630d21 Merge remote-tracking branch 'origin/master-ng' into develop 2026-06-28 09:31:16 +02:00
Applevangelist 98ed7d50c1 #EASYGCICAP
* Added `SetDefaultINTERCEPTAlt()`
2026-06-28 09:30:45 +02:00
Applevangelist 4ba81cb8bc Merge remote-tracking branch 'origin/master-ng' into develop 2026-06-27 10:57:53 +02:00
Applevangelist 626b12f486 #MSRS #HOUND corrected frequency formatting to allow 1000ths of a frequency 2026-06-27 10:57:27 +02:00
Thomas 36c0297344 Merge pull request #2603 from FlightControl-Master/master-ng
Update ScheduleDispatcher.lua
2026-06-26 12:35:03 +02:00
Thomas 8c60a8c678 Update ScheduleDispatcher.lua
Undoing previous change as some delayed event calls stopped working, probably FSM. Need to find the reason for that.
2026-06-26 12:31:54 +02:00
Thomas 6829d75464 Merge pull request #2602 from FlightControl-Master/master-ng
Merge
2026-06-24 06:30:19 +02:00
Thomas 867f919d5f Merge pull request #2601 from FlightControl-Master/leka1986-patch-2
Update Utils.lua
2026-06-24 06:29:28 +02:00
leka1986 f769a0deb5 Update Utils.lua
Added KA-50_3 door check.
2026-06-24 01:56:31 +02:00
Applevangelist 4efd71e36a Merge remote-tracking branch 'origin/master-ng' into develop 2026-06-23 12:30:14 +02:00
Applevangelist 7e9dd9deff #EASYGCICAP - fall back to GCI behaviour if no CAP Points have been defined. 2026-06-23 12:29:45 +02:00
Applevangelist fed9174bcb Merge remote-tracking branch 'origin/master-ng' into develop 2026-06-21 12:53:35 +02:00
Thomas 9963c737a3 Merge pull request #2599 from FlightControl-Master/master-ng
Merge from master
2026-06-14 17:53:05 +02:00
Applevangelist 73d3ed119c Merge remote-tracking branch 'origin/master-ng' into develop 2026-06-14 16:11:05 +02:00
Applevangelist 23112c9954 Merge remote-tracking branch 'origin/master-ng' into develop 2026-06-14 13:45:08 +02:00
Applevangelist 23c59d906f Merge remote-tracking branch 'origin/develop' into develop 2026-06-14 12:07:31 +02:00
Applevangelist cc62655ffe Merge remote-tracking branch 'origin/master-ng' into develop 2026-06-14 12:07:25 +02:00
Thomas 401e9d9e8e Merge pull request #2597 from FlightControl-Master/master-ng
Merge from master
2026-06-14 09:57:46 +02:00
Applevangelist 9b1a3e4894 Merge remote-tracking branch 'origin/master-ng' into develop
# Conflicts:
#	Moose Development/Moose/Core/Spawn.lua
2026-06-11 17:34:53 +02:00
Thomas 6c32aa6044 Merge pull request #2595 from geofffranks/fix/spawn-air-takeoff-event-args
fix(Spawn): air-spawn takeoff event never fired (wrong arg packing)
2026-06-11 07:59:43 +02:00
Geoff Franks edf70e971c fix(Spawn): air-spawn takeoff event never fired (wrong arg packing)
SPAWN:SpawnAtAirbase scheduled the synthetic takeoff event for air-spawned
groups with:

    self:ScheduleOnce(5, BASE.CreateEventTakeoff,
                      {GroupSpawned, timer.getTime(), UnitSpawned:GetDCSObject()})

BASE:ScheduleOnce(Start, SchedulerFunction, ...) forwards its trailing
arguments to the scheduled function as varargs (it wraps `...` in a table
internally). Wrapping the arguments in a table here made that table argument
number one, so CreateEventTakeoff ran with the {group, time, dcs} table as
`self`. A plain table has no :F(), the very first line errored, and the
S_EVENT_TAKEOFF event was never raised. Air-spawned AI_A2A_DISPATCHER GCI
defenders therefore never activated (observed: zero QRA scrambled with
takeoff = Air).

The sibling call site in SpawnAtParkingSpot is correct because it uses
SCHEDULER:New(nil, fn, {args}, 5), which DOES take a single argument table.
Drop the braces so the args pass as varargs, matching CreateEventTakeoff's
(self=group, EventTime, Initiator) signature.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 21:02:40 -04:00
Thomas 7c5af54473 Merge pull request #2594 from FlightControl-Master/master-ng
Merge from master
2026-06-07 20:04:55 +02:00
Applevangelist 2aa9b91ce5 Merge remote-tracking branch 'origin/master-ng' into develop 2026-06-05 14:25:35 +02:00
Applevangelist fdc19a6898 Merge remote-tracking branch 'origin/develop' into develop 2026-05-24 13:01:26 +02:00
Applevangelist d3ebf023fb Merge remote-tracking branch 'origin/master-ng' into develop 2026-05-24 13:01:22 +02:00
Thomas d40c559d2d Merge pull request #2592 from FlightControl-Master/master-ng
Merge
2026-05-21 20:04:54 +02:00
20 changed files with 1097 additions and 277 deletions
+22
View File
@@ -736,6 +736,12 @@ do -- Event Handling
-- @param #BASE self -- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure. -- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when an option is changed for an AI group.
-- The event identifies the initiating group, but does not provide the option ID or value.
-- @function [parent=#BASE] OnEventGroupChangeOption
-- @param #BASE self
-- @param Core.Event#EVENTDATA EventData The EventData structure.
--- Occurs when a player creates a dynamic cargo object from the F8 ground crew menu. --- Occurs when a player creates a dynamic cargo object from the F8 ground crew menu.
-- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024. -- *** NOTE *** this is a workarounf for DCS not creating these events as of Aug 2024.
-- @function [parent=#BASE] OnEventNewDynamicCargo -- @function [parent=#BASE] OnEventNewDynamicCargo
@@ -881,6 +887,22 @@ end
world.onEvent(Event) world.onEvent(Event)
end end
--- Creation of a `S_EVENT_GROUP_CHANGE_OPTION` event.
-- @param #BASE self
-- @param DCS#Time EventTime The time stamp of the event.
-- @param DCS#Group Initiator The initiating group of the event.
function BASE:CreateEventGroupChangeOption( EventTime, Initiator )
self:F( { EventTime, Initiator } )
local Event = {
id = EVENTS.GroupChangeOption,
time = EventTime,
initiator = Initiator,
}
world.onEvent( Event )
end
--- Creation of a S_EVENT_NEW_DYNAMIC_CARGO event. --- Creation of a S_EVENT_NEW_DYNAMIC_CARGO event.
-- @param #BASE self -- @param #BASE self
-- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object -- @param Wrapper.DynamicCargo#DYNAMICCARGO DynamicCargo the dynamic cargo object
-36
View File
@@ -92,8 +92,6 @@ DATABASE = {
ZONES_GOAL = {}, ZONES_GOAL = {},
WAREHOUSES = {}, WAREHOUSES = {},
FLIGHTGROUPS = {}, FLIGHTGROUPS = {},
COHORTS={},
LEGIONS={},
FLIGHTCONTROLS = {}, FLIGHTCONTROLS = {},
OPSZONES = {}, OPSZONES = {},
PATHLINES = {}, PATHLINES = {},
@@ -2089,40 +2087,6 @@ function DATABASE:FindOpsGroupFromUnit(unitname)
end end
end end
--
--- Add an OPS COHORT (SQUADRON, PLATOON, FLOTILLA) to the data base.
-- @param #DATABASE self
-- @param Ops.Cohort#COHORT cohort The cohort added to the DB.
function DATABASE:AddCohort(cohort)
self.COHORTS[cohort.name]=cohort
end
--- Find an OPS COHORT (SQUADRON, PLATOON, FLOTILLA) in the data base.
-- @param #DATABASE self
-- @param #string cohortname Name of the cohort.
-- @return Ops.Cohort#COHORT Cohort object.
function DATABASE:FindCohort(cohortname)
return self.COHORTS[cohortname]
end
--- Add an OPS LEGION (AIRWING, BRIGADE, FLEET) to the data base.
-- @param #DATABASE self
-- @param Ops.Legion#LEGION legion The legion added to the DB.
function DATABASE:AddLegion(legion)
self.LEGIONS[legion.alias]=legion
end
--- Find an OPS LEGION (AIRWING, BRIGADE, FLEET) in the data base.
-- @param #DATABASE self
-- @param #string legionname Name of the legion.
-- @return Ops.Legion#LEGION Legion object.
function DATABASE:FindLegion(legionname)
return self.LEGIONS[legionname]
end
--
--- Add a flight control to the data base. --- Add a flight control to the data base.
-- @param #DATABASE self -- @param #DATABASE self
-- @param OPS.FlightControl#FLIGHTCONTROL flightcontrol -- @param OPS.FlightControl#FLIGHTCONTROL flightcontrol
+25 -7
View File
@@ -278,6 +278,7 @@ EVENTS = {
SimulationUnfreeze = world.event.S_EVENT_SIMULATION_UNFREEZE or -1, SimulationUnfreeze = world.event.S_EVENT_SIMULATION_UNFREEZE or -1,
HumanAircraftRepairStart = world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_START or -1, HumanAircraftRepairStart = world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_START or -1,
HumanAircraftRepairFinish = world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH or -1, HumanAircraftRepairFinish = world.event.S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH or -1,
GroupChangeOption = world.event.S_EVENT_GROUP_CHANGE_OPTION or -1,
-- dynamic cargo -- dynamic cargo
NewDynamicCargo = world.event.S_EVENT_NEW_DYNAMIC_CARGO or -1, NewDynamicCargo = world.event.S_EVENT_NEW_DYNAMIC_CARGO or -1,
DynamicCargoLoaded = world.event.S_EVENT_DYNAMIC_CARGO_LOADED or -1, DynamicCargoLoaded = world.event.S_EVENT_DYNAMIC_CARGO_LOADED or -1,
@@ -291,23 +292,25 @@ EVENTS = {
-- --
-- * A (Object.Category.)UNIT : A UNIT object type is involved in the Event. -- * A (Object.Category.)UNIT : A UNIT object type is involved in the Event.
-- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event. -- * A (Object.Category.)STATIC : A STATIC object type is involved in the Event.
-- * A GROUP : A DCS Group object is involved in the Event.
-- --
-- @type EVENTDATA -- @type EVENTDATA
-- @field #number id The identifier of the event. -- @field #number id The identifier of the event.
-- --
-- @field DCS#Unit initiator (UNIT/STATIC/SCENERY) The initiating @{DCS#Unit} or @{DCS#StaticObject}. -- @field DCS#Unit initiator (UNIT/STATIC/SCENERY/GROUP) The initiating @{DCS#Unit} or @{DCS#StaticObject}. For `S_EVENT_GROUP_CHANGE_OPTION`, this is a DCS Group.
-- @field DCS#Object.Category IniObjectCategory (UNIT/STATIC/SCENERY) The initiator object category ( Object.Category.UNIT or Object.Category.STATIC ). -- @field DCS#Object.Category IniObjectCategory (UNIT/STATIC/SCENERY) The initiator object category ( Object.Category.UNIT or Object.Category.STATIC ).
-- @field DCS#Unit IniDCSUnit (UNIT/STATIC) The initiating @{DCS#Unit} or @{DCS#StaticObject}. -- @field DCS#Unit IniDCSUnit (UNIT/STATIC) The initiating @{DCS#Unit} or @{DCS#StaticObject}.
-- @field #string IniDCSUnitName (UNIT/STATIC) The initiating Unit name. -- @field #string IniDCSUnitName (UNIT/STATIC) The initiating Unit name.
-- @field Wrapper.Unit#UNIT IniUnit (UNIT/STATIC) The initiating MOOSE wrapper @{Wrapper.Unit#UNIT} of the initiator Unit object. -- @field Wrapper.Unit#UNIT IniUnit (UNIT/STATIC) The initiating MOOSE wrapper @{Wrapper.Unit#UNIT} of the initiator Unit object.
-- @field #string IniUnitName (UNIT/STATIC) The initiating UNIT name (same as IniDCSUnitName). -- @field #string IniUnitName (UNIT/STATIC) The initiating UNIT name (same as IniDCSUnitName).
-- @field DCS#Group IniDCSGroup (UNIT) The initiating {DCSGroup#Group}. -- @field DCS#Group IniDCSGroup (UNIT/GROUP) The initiating @{DCS#Group}.
-- @field #string IniDCSGroupName (UNIT) The initiating Group name. -- @field #string IniDCSGroupName (UNIT/GROUP) The initiating Group name.
-- @field Wrapper.Group#GROUP IniGroup (UNIT) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object. -- @field Wrapper.Group#GROUP IniGroup (UNIT/GROUP) The initiating MOOSE wrapper @{Wrapper.Group#GROUP} of the initiator Group object.
-- @field #string IniGroupName UNIT) The initiating GROUP name (same as IniDCSGroupName). -- @field #string IniGroupName (UNIT/GROUP) The initiating GROUP name (same as IniDCSGroupName).
-- @field DCS#Group.Category IniGroupCategory (GROUP) The category of the initiating group.
-- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot. -- @field #string IniPlayerName (UNIT) The name of the initiating player in case the Unit is a client or player slot.
-- @field #string IniPlayerUCID (UNIT) The UCID of the initiating player in case the Unit is a client or player slot and on a multi-player server. -- @field #string IniPlayerUCID (UNIT) The UCID of the initiating player in case the Unit is a client or player slot and on a multi-player server.
-- @field DCS#coalition.side IniCoalition (UNIT) The coalition of the initiator. -- @field DCS#coalition.side IniCoalition (UNIT/GROUP) The coalition of the initiator.
-- @field DCS#Unit.Category IniCategory (UNIT) The category of the initiator. -- @field DCS#Unit.Category IniCategory (UNIT) The category of the initiator.
-- @field #string IniTypeName (UNIT) The type name of the initiator. -- @field #string IniTypeName (UNIT) The type name of the initiator.
-- --
@@ -734,6 +737,12 @@ local _EVENTMETA = {
Side = "I", Side = "I",
Event = "OnEventHumanAircraftRepairFinish", Event = "OnEventHumanAircraftRepairFinish",
Text = "S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH" Text = "S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH"
},
[EVENTS.GroupChangeOption] = {
Order = 1,
Side = "I",
Event = "OnEventGroupChangeOption",
Text = "S_EVENT_GROUP_CHANGE_OPTION"
}, },
-- dynamic cargo -- dynamic cargo
[EVENTS.NewDynamicCargo] = { [EVENTS.NewDynamicCargo] = {
@@ -1234,7 +1243,16 @@ function EVENT:onEvent( Event )
if Event.initiator then if Event.initiator then
Event.IniObjectCategory = Object.getCategory(Event.initiator) if Event.id == EVENTS.GroupChangeOption then
Event.IniDCSGroup = Event.initiator
Event.IniDCSGroupName = Group.getName(Event.initiator)
Event.IniGroupName = Event.IniDCSGroupName
Event.IniGroup = GROUP:FindByName(Event.IniDCSGroupName)
Event.IniCoalition = Group.getCoalition(Event.initiator)
Event.IniGroupCategory = Group.getCategory(Event.initiator)
else
Event.IniObjectCategory = Object.getCategory(Event.initiator)
end
if Event.IniObjectCategory == Object.Category.STATIC then if Event.IniObjectCategory == Object.Category.STATIC then
--- ---
@@ -246,11 +246,11 @@ function SCHEDULEDISPATCHER:AddSchedule( Scheduler, ScheduleFunction, ScheduleAr
-- self:T3( { Repeat = CallID, CurrentTime, ScheduleTime, ScheduleArguments } ) -- self:T3( { Repeat = CallID, CurrentTime, ScheduleTime, ScheduleArguments } )
return ScheduleTime -- returns the next time the function needs to be called. return ScheduleTime -- returns the next time the function needs to be called.
else else
self:_Reclaim( Scheduler, CallID ) self:Stop( Scheduler, CallID )
end end
else else
self:_Reclaim( Scheduler, CallID ) self:Stop( Scheduler, CallID )
end end
else else
self:I( "<<<>" .. Name .. ":" .. Line .. " (" .. Source .. ")" ) self:I( "<<<>" .. Name .. ":" .. Line .. " (" .. Source .. ")" )
+2 -1
View File
@@ -87,7 +87,8 @@ do -- world
-- @field S_EVENT_SIMULATION_UNFREEZE = 58 -- @field S_EVENT_SIMULATION_UNFREEZE = 58
-- @field S_EVENT_HUMAN_AIRCRAFT_REPAIR_START = 59 -- @field S_EVENT_HUMAN_AIRCRAFT_REPAIR_START = 59
-- @field S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH = 60 -- @field S_EVENT_HUMAN_AIRCRAFT_REPAIR_FINISH = 60
-- @field S_EVENT_MAX = 61 -- @field S_EVENT_GROUP_CHANGE_OPTION = 61
-- @field S_EVENT_MAX = 62
--- The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events. --- The birthplace enumerator is used to define where an aircraft or helicopter has spawned in association with birth events.
-- @type world.BirthPlace -- @type world.BirthPlace
File diff suppressed because it is too large Load Diff
+28 -45
View File
@@ -290,9 +290,6 @@ function AIRWING:New(warehousename, airwingname)
-- @param Ops.FlightGroup#FLIGHTGROUP FlightGroup The FLIGHTGROUP on mission. -- @param Ops.FlightGroup#FLIGHTGROUP FlightGroup The FLIGHTGROUP on mission.
-- @param Ops.Auftrag#AUFTRAG Mission The mission. -- @param Ops.Auftrag#AUFTRAG Mission The mission.
-- Add legion to DB
_DATABASE:AddLegion(self)
return self return self
end end
@@ -544,47 +541,6 @@ function AIRWING:AddPayloadCapability(Payload, MissionTypes, Performance)
return self return self
end end
--- Filter available payloads for a given aircraft type and mission type.
-- @param #AIRWING self
-- @param #string UnitType The type of the unit.
-- @param #string MissionType The mission type.
-- @param #table Payloads Specific payloads only to be considered.
-- @return #AIRWING.Payload Payload table or *nil*.
function AIRWING:_FilterPlayloads(UnitType, MissionType, Payloads)
local function _checkPayloads(payload)
if Payloads then
for _,Payload in pairs(Payloads) do
if Payload.uid==payload.uid then
return true
end
end
else
-- Payload was not specified.
return nil
end
return false
end
-- Pre-selection: filter out only those payloads that are valid for the airframe and mission type and are available.
local payloads={}
for _,_payload in pairs(self.payloads) do
local payload=_payload --#AIRWING.Payload
local specialpayload=_checkPayloads(payload)
local compatible=AUFTRAG.CheckMissionCapability(MissionType, payload.capabilities)
local goforit = specialpayload or (specialpayload==nil and compatible)
if payload.aircrafttype==UnitType and payload.navail>0 and goforit then
table.insert(payloads, payload)
end
end
return payloads
end
--- Fetch a payload from the airwing resources for a given unit and mission type. --- Fetch a payload from the airwing resources for a given unit and mission type.
-- The payload with the highest priority is preferred. -- The payload with the highest priority is preferred.
-- @param #AIRWING self -- @param #AIRWING self
@@ -633,7 +589,34 @@ function AIRWING:FetchPayloadFromStock(UnitType, MissionType, Payloads)
end end
end end
local payloads=self:_FilterPlayloads(UnitType, MissionType, Payloads) local function _checkPayloads(payload)
if Payloads then
for _,Payload in pairs(Payloads) do
if Payload.uid==payload.uid then
return true
end
end
else
-- Payload was not specified.
return nil
end
return false
end
-- Pre-selection: filter out only those payloads that are valid for the airframe and mission type and are available.
local payloads={}
for _,_payload in pairs(self.payloads) do
local payload=_payload --#AIRWING.Payload
local specialpayload=_checkPayloads(payload)
local compatible=AUFTRAG.CheckMissionCapability(MissionType, payload.capabilities)
local goforit = specialpayload or (specialpayload==nil and compatible)
if payload.aircrafttype==UnitType and payload.navail>0 and goforit then
table.insert(payloads, payload)
end
end
-- Debug. -- Debug.
if self.verbose>=4 then if self.verbose>=4 then
+1
View File
@@ -5120,6 +5120,7 @@ end
-- FSM Functions -- FSM Functions
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- On after "Planned" event. --- On after "Planned" event.
-- @param #AUFTRAG self -- @param #AUFTRAG self
-- @param #string From From state. -- @param #string From From state.
-3
View File
@@ -150,9 +150,6 @@ function BRIGADE:New(WarehouseName, BrigadeName)
-- @param Ops.ArmyGroup#ARMYGROUP ArmyGroup The ARMYGROUP on mission. -- @param Ops.ArmyGroup#ARMYGROUP ArmyGroup The ARMYGROUP on mission.
-- @param Ops.Auftrag#AUFTRAG Mission The mission. -- @param Ops.Auftrag#AUFTRAG Mission The mission.
-- Add legion to DB
_DATABASE:AddLegion(self)
return self return self
end end
+18 -15
View File
@@ -3747,16 +3747,16 @@ function CTLD:_C130GetUnits(Group, Unit, Name)
return self return self
end end
local coord = Unit:GetCoordinate() or Group:GetCoordinate() local coord = Unit:GetCoord() or Group:GetCoord()
local capabilities = self:_GetUnitCapabilities(Unit) local capabilities = self:_GetUnitCapabilities(Unit)
local innerDist = (capabilities.length and capabilities.length/2) or 15 local innerDist = (capabilities.length and capabilities.length/2) or 15
local maxUnitsNearby = self.maxUnitsNearby or 3 local maxUnitsNearby = self.maxUnitsNearby or 3
local searchRadius = self.UnitDistance or 90 local searchRadius = self.UnitDistance or 90
local checkZone = ZONE_RADIUS:New("CTLD_C130UnitsZone",coord:GetVec2(),searchRadius,false) local checkZone = ZONE_RADIUS:New("CTLD_C130UnitsZone",coord:GetVec2(),searchRadius,false)
local nearGroups = SET_GROUP:New():FilterCoalitions("blue"):FilterZones({checkZone}):FilterOnce() local nearGroups = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterZones({checkZone}):FilterOnce()
local nearbyCount = 0 local nearbyCount = 0
for _,gr in pairs(nearGroups.Set) do for _,gr in pairs(nearGroups.Set) do
local gc = gr:GetCoordinate() local gc = gr:GetCoord()
if gc then if gc then
local dist = coord:Get2DDistance(gc) local dist = coord:Get2DDistance(gc)
if dist > innerDist then if dist > innerDist then
@@ -3925,7 +3925,7 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack, quiet, suppress
-- Check cargo location if available -- Check cargo location if available
local location = Cargo:GetLocation() local location = Cargo:GetLocation()
if location then if location then
local unitcoord = Unit:GetCoordinate() or Group:GetCoordinate() local unitcoord = Unit:GetCoord() or Group:GetCoord()
if unitcoord then if unitcoord then
if not location:IsCoordinateInZone(unitcoord) then if not location:IsCoordinateInZone(unitcoord) then
-- no we're not at the right spot -- no we're not at the right spot
@@ -4136,8 +4136,8 @@ function CTLD:_GetCrates(Group, Unit, Cargo, number, drop, pack, quiet, suppress
if type(ship) == "string" then if type(ship) == "string" then
self:T("Spawning on ship "..ship) self:T("Spawning on ship "..ship)
local Ship = UNIT:FindByName(ship) local Ship = UNIT:FindByName(ship)
local shipcoord = Ship:GetCoordinate() local shipcoord = Ship:GetCoord()
local unitcoord = Unit:GetCoordinate() local unitcoord = Unit:GetCoord()
local dist = shipcoord:Get2DDistance(unitcoord) local dist = shipcoord:Get2DDistance(unitcoord)
dist = dist - (20 + math.random(1, 10)) dist = dist - (20 + math.random(1, 10))
local halfwidth = (width or 20) / 2 local halfwidth = (width or 20) / 2
@@ -4395,11 +4395,11 @@ function CTLD:_C130RemoveUnitsNearby(_group,_unit)
local innerDist = (capabilities.length and capabilities.length/2) or 15 local innerDist = (capabilities.length and capabilities.length/2) or 15
local finddist = self.PackDistance or (self.CrateDistance or 35) local finddist = self.PackDistance or (self.CrateDistance or 35)
local zone = ZONE_RADIUS:New("CTLD_C130RemoveZone",location:GetVec2(),finddist,false) local zone = ZONE_RADIUS:New("CTLD_C130RemoveZone",location:GetVec2(),finddist,false)
local nearestGroups = SET_GROUP:New():FilterCoalitions("blue"):FilterZones({zone}):FilterOnce() local nearestGroups = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterZones({zone}):FilterOnce()
local removedAny = false local removedAny = false
local removedTable = {} local removedTable = {}
for _, gr in pairs(nearestGroups.Set) do for _, gr in pairs(nearestGroups.Set) do
local gc = gr:GetCoordinate() local gc = gr:GetCoord()
if gc then if gc then
local dist = location:Get2DDistance(gc) local dist = location:Get2DDistance(gc)
if dist > innerDist then if dist > innerDist then
@@ -5683,18 +5683,18 @@ end
-- @return #number Number -- @return #number Number
function CTLD:_FindPackableGroupsNearby(Group, Unit) function CTLD:_FindPackableGroupsNearby(Group, Unit)
self:T(self.lid .. " _FindPackableGroupsNearby") self:T(self.lid .. " _FindPackableGroupsNearby")
local location = Group:GetCoordinate() local location = Group:GetCoord()
if not location then return {}, 0 end if not location then return {}, 0 end
local capabilities = self:_GetUnitCapabilities(Unit) local capabilities = self:_GetUnitCapabilities(Unit)
local innerDist = (capabilities.length and capabilities.length/2) or 15 local innerDist = (capabilities.length and capabilities.length/2) or 15
local finddist = self.PackDistance or (self.CrateDistance or 35) local finddist = self.PackDistance or (self.CrateDistance or 35)
local zone = ZONE_RADIUS:New("CTLD_PackableZone", location:GetVec2(), finddist, false) local zone = ZONE_RADIUS:New("CTLD_PackableZone", location:GetVec2(), finddist, false)
local nearestGroups = SET_GROUP:New():FilterCoalitions("blue"):FilterZones({zone}):FilterOnce() local nearestGroups = SET_GROUP:New():FilterCoalitions(self.coalitiontxt):FilterZones({zone}):FilterOnce()
local packable = {} local packable = {}
for _, gr in pairs(nearestGroups.Set) do for _, gr in pairs(nearestGroups.Set) do
if gr and gr:GetName() ~= Group:GetName() then if gr and gr:GetName() ~= Group:GetName() then
local gc = gr:GetCoordinate() local gc = gr:GetCoord()
if gc then if gc then
local dist = location:Get2DDistance(gc) local dist = location:Get2DDistance(gc)
if dist > innerDist and dist <= finddist then if dist > innerDist and dist <= finddist then
@@ -6217,8 +6217,11 @@ function CTLD:_BuildObjectFromCrates(Group,Unit,Build,Repair,RepairLocation,Mult
self:__CratesBuild(1,Group,Unit,self.DroppedTroops[self.TroopCounter]) self:__CratesBuild(1,Group,Unit,self.DroppedTroops[self.TroopCounter])
end end
end -- template loop end -- template loop
self:_RefreshLoadCratesMenu(Group, Unit)
self:_RefreshPackMenus(Group, Unit) if Group and Group:IsAlive() and Group:GetID() then
self:_RefreshLoadCratesMenu(Group, Unit)
self:_RefreshPackMenus(Group, Unit)
end
else else
self:T(self.lid.."Group KIA while building!") self:T(self.lid.."Group KIA while building!")
end end
@@ -9008,7 +9011,7 @@ function CTLD:IsUnitInZone(Unit,Zonetype)
local zoneret = nil local zoneret = nil
local zonewret = nil local zonewret = nil
local zonenameret = nil local zonenameret = nil
local unitcoord = Unit:GetCoordinate() local unitcoord = Unit:GetCoord()
if not unitcoord then if not unitcoord then
if Zonetype == CTLD.CargoZoneType.SHIP then if Zonetype == CTLD.CargoZoneType.SHIP then
return false, nil, nil, 1000000, nil return false, nil, nil, 1000000, nil
@@ -9029,7 +9032,7 @@ function CTLD:IsUnitInZone(Unit,Zonetype)
self:T("Checking Type Ship: "..zonename) self:T("Checking Type Ship: "..zonename)
local ZoneUNIT = UNIT:FindByName(zonename) local ZoneUNIT = UNIT:FindByName(zonename)
if not ZoneUNIT then return false end if not ZoneUNIT then return false end
zonecoord = ZoneUNIT:GetCoordinate() zonecoord = ZoneUNIT:GetCoord()
zoneradius = czone.shiplength zoneradius = czone.shiplength
zonewidth = czone.shipwidth zonewidth = czone.shipwidth
zone = ZONE_UNIT:New( ZoneUNIT:GetName(), ZoneUNIT, zoneradius/2) zone = ZONE_UNIT:New( ZoneUNIT:GetName(), ZoneUNIT, zoneradius/2)
+32 -4
View File
@@ -135,6 +135,7 @@
-- local mywing = EASYGCICAP:New("Blue CAP Operations",AIRBASE.Caucasus.Kutaisi,"blue","Blue EWR") -- local mywing = EASYGCICAP:New("Blue CAP Operations",AIRBASE.Caucasus.Kutaisi,"blue","Blue EWR")
-- --
-- -- Add a CAP patrol point belonging to our airbase, we'll be at 30k ft doing 400 kn, initial direction 90 degrees (East), leg 20NM -- -- Add a CAP patrol point belonging to our airbase, we'll be at 30k ft doing 400 kn, initial direction 90 degrees (East), leg 20NM
-- -- NOTE - Skip this function and do not create CAP Points if you want GCI behaviour only.
-- mywing:AddPatrolPointCAP(AIRBASE.Caucasus.Kutaisi,ZONE:FindByName("Blue Zone 1"):GetCoordinate(),30000,400,90,20) -- mywing:AddPatrolPointCAP(AIRBASE.Caucasus.Kutaisi,ZONE:FindByName("Blue Zone 1"):GetCoordinate(),30000,400,90,20)
-- --
-- -- Add a Squadron with template "Blue Sq1 M2000c", 20 airframes, skill good, Modex starting with 102 and skin "Vendee Jeanne" -- -- Add a Squadron with template "Blue Sq1 M2000c", 20 airframes, skill good, Modex starting with 102 and skin "Vendee Jeanne"
@@ -190,9 +191,10 @@
-- * @{#EASYGCICAP.SetDefaultResurrection}: Set how many seconds the AirWing stays inoperable after the AirWing STATIC HQ ist destroyed, default 900 secs. -- * @{#EASYGCICAP.SetDefaultResurrection}: Set how many seconds the AirWing stays inoperable after the AirWing STATIC HQ ist destroyed, default 900 secs.
-- * @{#EASYGCICAP.SetDefaultCAPSpeed}: Set how many knots the CAP flights should do (will be altitude corrected), default 300 kn. -- * @{#EASYGCICAP.SetDefaultCAPSpeed}: Set how many knots the CAP flights should do (will be altitude corrected), default 300 kn.
-- * @{#EASYGCICAP.SetDefaultCAPAlt}: Set at which altitude (ASL) the CAP planes will fly, default 25,000 ft. -- * @{#EASYGCICAP.SetDefaultCAPAlt}: Set at which altitude (ASL) the CAP planes will fly, default 25,000 ft.
-- * @{#EASYGCICAP.SetDefaultINTERCEPTAlt}: Set at which altitude (ASL) the Intercept planes will fly, default 25,000 ft.
-- * @{#EASYGCICAP.SetDefaultCAPDirection}: Set the initial direction from the CAP point the planes will fly in degrees, default is 90°. -- * @{#EASYGCICAP.SetDefaultCAPDirection}: Set the initial direction from the CAP point the planes will fly in degrees, default is 90°.
-- * @{#EASYGCICAP.SetDefaultCAPLeg}: Set the length of the CAP leg, default is 15 NM. -- * @{#EASYGCICAP.SetDefaultCAPLeg}: Set the length of the CAP leg, default is 15 NM.
-- * @{#EASYGCICAP.SetDefaultCAPGrouping}: Set how many planes will be spawned per mission (CVAP/GCI), defaults to 2. -- * @{#EASYGCICAP.SetDefaultCAPGrouping}: Set how many planes will be spawned per mission (CAP/GCI), defaults to 2.
-- * @{#EASYGCICAP.SetDefaultMissionRange}: Set how many NM the planes can go from the home base, defaults to 100. -- * @{#EASYGCICAP.SetDefaultMissionRange}: Set how many NM the planes can go from the home base, defaults to 100.
-- * @{#EASYGCICAP.SetDefaultNumberAlert5Standby}: Set how many planes will be spawned on cold standby (Alert5), default 2. -- * @{#EASYGCICAP.SetDefaultNumberAlert5Standby}: Set how many planes will be spawned on cold standby (Alert5), default 2.
-- * @{#EASYGCICAP.SetDefaultEngageRange}: Set max engage range for CAP flights if they detect intruders, defaults to 50. -- * @{#EASYGCICAP.SetDefaultEngageRange}: Set max engage range for CAP flights if they detect intruders, defaults to 50.
@@ -286,7 +288,7 @@ EASYGCICAP = {
--- EASYGCICAP class version. --- EASYGCICAP class version.
-- @field #string version -- @field #string version
EASYGCICAP.version="0.1.36" EASYGCICAP.version="0.1.38"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- --
@@ -587,6 +589,17 @@ function EASYGCICAP:SetDefaultCAPAlt(Altitude)
return self return self
end end
--- Set default INTERCEPT Altitude in feet
-- @param #EASYGCICAP self
-- @param #number Altitude (Optional) Altitude defaults to 25000
-- @return #EASYGCICAP self
function EASYGCICAP:SetDefaultINTERCEPTAlt(Altitude)
self:T(self.lid.."SetDefaultINTERCEPTAlt")
self.interceptalt = Altitude or 25000
return self
end
--
--- Set default CAP lieg initial direction in degrees --- Set default CAP lieg initial direction in degrees
-- @param #EASYGCICAP self -- @param #EASYGCICAP self
-- @param #number Direction (Optional) Direction defaults to 90 (East) -- @param #number Direction (Optional) Direction defaults to 90 (East)
@@ -754,6 +767,15 @@ end
function EASYGCICAP:_AddAirwing(Airbasename, Alias) function EASYGCICAP:_AddAirwing(Airbasename, Alias)
self:T(self.lid.."_AddAirwing "..Airbasename) self:T(self.lid.."_AddAirwing "..Airbasename)
-- Gather Some Stats
local function counttable(tbl)
local count = 0
for _,_data in pairs(tbl) do
count = count + 1
end
return count
end
local CapFormation = self.CapFormation local CapFormation = self.CapFormation
local DespawnAfterLanding = self.DespawnAfterLanding local DespawnAfterLanding = self.DespawnAfterLanding
local DespawnAfterHolding = self.DespawnAfterHolding local DespawnAfterHolding = self.DespawnAfterHolding
@@ -772,7 +794,11 @@ function EASYGCICAP:_AddAirwing(Airbasename, Alias)
CAP_Wing:SetMarker(false) CAP_Wing:SetMarker(false)
CAP_Wing:SetAirbase(AIRBASE:FindByName(Airbasename)) CAP_Wing:SetAirbase(AIRBASE:FindByName(Airbasename))
CAP_Wing:SetRespawnAfterDestroyed() CAP_Wing:SetRespawnAfterDestroyed()
CAP_Wing:SetNumberCAP(self.capgrouping)
--- #DONE avoid wings with no CAP points starting CAP anyhow; AirWing uses this to start CAP and creates points when there are none.
if counttable(self.ManagedCP) >0 then
CAP_Wing:SetNumberCAP(self.capgrouping)
end
CAP_Wing:SetCapCloseRaceTrack(true) CAP_Wing:SetCapCloseRaceTrack(true)
if self.showpatrolpointmarks then if self.showpatrolpointmarks then
@@ -1039,7 +1065,7 @@ function EASYGCICAP:_SetCAPPatrolPoints()
MESSAGE:New(self.lid.."You are trying to create a CAP point for which there is no wing! "..tostring(data.AirbaseName),30,"CHECK"):ToAllIf(self.debug):ToLog() MESSAGE:New(self.lid.."You are trying to create a CAP point for which there is no wing! "..tostring(data.AirbaseName),30,"CHECK"):ToAllIf(self.debug):ToLog()
return return
end end
local Wing = self.wings[data.AirbaseName][1] -- Ops.Airwing#AIRWING local Wing = self.wings[data.AirbaseName][1] -- Ops.AirWing#AIRWING
local Coordinate = data.Coordinate local Coordinate = data.Coordinate
local Altitude = data.Altitude local Altitude = data.Altitude
local Speed = data.Speed local Speed = data.Speed
@@ -1505,6 +1531,7 @@ function EASYGCICAP:_AssignIntercept(Cluster)
local overhead = self.overhead local overhead = self.overhead
local capspeed = self.capspeed + 100 local capspeed = self.capspeed + 100
local capalt = self.capalt local capalt = self.capalt
local interalt = self.interceptalt or self.capalt
local maxsize = self.maxinterceptsize local maxsize = self.maxinterceptsize
local repeatsonfailure = self.repeatsonfailure local repeatsonfailure = self.repeatsonfailure
@@ -1592,6 +1619,7 @@ function EASYGCICAP:_AssignIntercept(Cluster)
:SetRepeatOnFailure(repeats) :SetRepeatOnFailure(repeats)
:SetMissionSpeed(UTILS.KnotsToAltKIAS(capspeed,capalt)) :SetMissionSpeed(UTILS.KnotsToAltKIAS(capspeed,capalt))
:SetMissionAltitude(capalt) :SetMissionAltitude(capalt)
:SetEngageAltitude(interalt)
if nogozoneset:Count() > 0 then if nogozoneset:Count() > 0 then
InterceptAuftrag:AddConditionSuccess( InterceptAuftrag:AddConditionSuccess(
-3
View File
@@ -167,9 +167,6 @@ function FLEET:New(WarehouseName, FleetName)
-- @param Ops.NavyGroup#NAVYGROUP NavyGroup The NAVYGROUP on mission. -- @param Ops.NavyGroup#NAVYGROUP NavyGroup The NAVYGROUP on mission.
-- @param Ops.Auftrag#AUFTRAG Mission The mission. -- @param Ops.Auftrag#AUFTRAG Mission The mission.
-- Add legion to DB
_DATABASE:AddLegion(self)
return self return self
end end
-3
View File
@@ -73,9 +73,6 @@ function FLOTILLA:New(TemplateGroupName, Ngroups, FlotillaName)
-- Get initial ammo. -- Get initial ammo.
self.ammo=self:_CheckAmmo() self.ammo=self:_CheckAmmo()
-- Add cohort to DB
_DATABASE:AddCohort(self)
return self return self
end end
+1
View File
@@ -306,6 +306,7 @@ function LEGION:New(WarehouseName, LegionName)
-- @param Ops.Cohort#COHORT Cohort The cohort the asset belongs to. -- @param Ops.Cohort#COHORT Cohort The cohort the asset belongs to.
-- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The asset that returned. -- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The asset that returned.
return self return self
end end
-3
View File
@@ -72,9 +72,6 @@ function PLATOON:New(TemplateGroupName, Ngroups, PlatoonName)
-- Get ammo. -- Get ammo.
self.ammo=self:_CheckAmmo() self.ammo=self:_CheckAmmo()
-- Add cohort to DB
_DATABASE:AddCohort(self)
return self return self
end end
-3
View File
@@ -116,9 +116,6 @@ function SQUADRON:New(TemplateGroupName, Ngroups, SquadronName)
-- See COHORT class -- See COHORT class
-- Add cohort to DB
_DATABASE:AddCohort(self)
return self return self
end end
+52 -92
View File
@@ -153,7 +153,7 @@ _TARGETID=0
--- TARGET class version. --- TARGET class version.
-- @field #string version -- @field #string version
TARGET.version="0.8.0" TARGET.version="0.7.1"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- TODO list -- TODO list
@@ -206,9 +206,6 @@ function TARGET:New(TargetObject)
self:AddTransition("*", "Status", "*") -- Status update. self:AddTransition("*", "Status", "*") -- Status update.
self:AddTransition("*", "Stop", "Stopped") -- Stop FSM. self:AddTransition("*", "Stop", "Stopped") -- Stop FSM.
self:AddTransition("*", "ElementDestroyed", "*") -- A target element was destroyed.
self:AddTransition("*", "ElementDead", "*") -- A target element is dead (destroyed or despawned).
self:AddTransition("*", "ObjectDamaged", "*") -- A target object was damaged. self:AddTransition("*", "ObjectDamaged", "*") -- A target object was damaged.
self:AddTransition("*", "ObjectDestroyed", "*") -- A target object was destroyed. self:AddTransition("*", "ObjectDestroyed", "*") -- A target object was destroyed.
self:AddTransition("*", "ObjectDead", "*") -- A target object is dead (destroyed or despawned). self:AddTransition("*", "ObjectDead", "*") -- A target object is dead (destroyed or despawned).
@@ -248,19 +245,6 @@ function TARGET:New(TargetObject)
-- @param #number delay Delay in seconds. -- @param #number delay Delay in seconds.
--- Triggers the FSM event "ElementDestroyed".
-- @function [parent=#TARGET] ElementDestroyed
-- @param #TARGET self
-- @param #string ElementName Name of the element.
-- @param #TARGET.Object Target Target object.
--- Triggers the FSM event "ElementDead".
-- @function [parent=#TARGET] ElementDead
-- @param #TARGET self
-- @param #string ElementName Name of the element.
-- @param #TARGET.Object Target Target object.
--- Triggers the FSM event "ObjectDamaged". --- Triggers the FSM event "ObjectDamaged".
-- @function [parent=#TARGET] ObjectDamaged -- @function [parent=#TARGET] ObjectDamaged
-- @param #TARGET self -- @param #TARGET self
@@ -659,19 +643,6 @@ function TARGET:onafterStatus(From, Event, To)
-- FSM state. -- FSM state.
local fsmstate=self:GetState() local fsmstate=self:GetState()
-- First we check any target has been destroyed and the dead/unitlost event was not fired
for i,_target in pairs(self.targets) do
local target=_target --#TARGET.Object
local life=self:GetTargetLife(target)
if life<1 and target.Status~=TARGET.ObjectStatus.DEAD then
self:E(self.lid..string.format("FF life is zero but no object dead event fired ==> waiting for target object %s events!", tostring(target.Name)))
-- We wait 60 seconds for the events to occur
self:__Status(-60)
return self
end
end
-- Update damage. -- Update damage.
local damaged=false local damaged=false
for i,_target in pairs(self.targets) do for i,_target in pairs(self.targets) do
@@ -765,61 +736,6 @@ end
-- FSM Events -- FSM Events
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- On after "ElementDestroyed" event.
-- @param #TARGET self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param #string Name Name of the element.
-- @param #TARGET.Object Target Target object.
function TARGET:onafterElementDestroyed(From, Event, To, Name, Target)
-- Debug message.
self:T(self.lid..string.format("Element %s of target object %s destroyed", Name, Target.Name))
-- Increase destroyed counter.
Target.Ndestroyed=Target.Ndestroyed+1
-- Increase dead counter.
self.Ndestroyed=self.Ndestroyed+1
self:ElementDead(Name, Target)
return self
end
--- On after "ElementDead" event.
-- @param #TARGET self
-- @param #string From From state.
-- @param #string Event Event.
-- @param #string To To state.
-- @param #string Name Name of the element.
-- @param #TARGET.Object Target Target object.
function TARGET:onafterElementDead(From, Event, To, Name, Target)
-- Debug message.
self:T(self.lid..string.format("Element %s of target object %s dead", Name, Target.Name))
-- Increase dead counter.
Target.Ndead=Target.Ndead+1
-- Increase dead counter.
self.Ndead=self.Ndead+1
-- All dead ==> Trigger event.
if Target.Ndestroyed==Target.N0 then
self:ObjectDestroyed(Target)
elseif Target.Ndead==Target.N0 then
self:ObjectDead(Target)
end
return self
end
--- On after "ObjectDamaged" event. --- On after "ObjectDamaged" event.
-- @param #TARGET self -- @param #TARGET self
-- @param #string From From state. -- @param #string From From state.
@@ -845,6 +761,11 @@ function TARGET:onafterObjectDestroyed(From, Event, To, Target)
-- Debug message. -- Debug message.
self:T(self.lid..string.format("Object %s destroyed", Target.Name)) self:T(self.lid..string.format("Object %s destroyed", Target.Name))
-- Increase destroyed counter.
self.Ndestroyed=self.Ndestroyed+1
Target.Ndestroyed=Target.Ndestroyed+1
Target.Life=0 Target.Life=0
-- Call object dead event. -- Call object dead event.
@@ -867,9 +788,15 @@ function TARGET:onafterObjectDead(From, Event, To, Target)
-- Set target status. -- Set target status.
Target.Status=TARGET.ObjectStatus.DEAD Target.Status=TARGET.ObjectStatus.DEAD
-- Increase dead object counter
Target.Ndead=Target.Ndead+1
-- Set target object life to 0. -- Set target object life to 0.
Target.Life=0 Target.Life=0
-- Increase dead counter.
self.Ndead=self.Ndead+1
-- Check if anyone is alive? -- Check if anyone is alive?
local dead=true local dead=true
for _,_target in pairs(self.targets) do for _,_target in pairs(self.targets) do
@@ -962,21 +889,54 @@ function TARGET:OnEventUnitDeadOrLost(EventData)
-- Add to the list of casualties. -- Add to the list of casualties.
table.insert(self.casualties, Name) table.insert(self.casualties, Name)
-- Get target from Group or Unit. -- Try to get target Group.
local target=self:GetTargetByName(EventData.IniGroupName) or self:GetTargetByName(EventData.IniUnitName) local target=self:GetTargetByName(EventData.IniGroupName)
-- Try unit target.
if not target then
target=self:GetTargetByName(EventData.IniUnitName)
end
-- Check if we could find a target object. -- Check if we could find a target object.
if target then if target then
-- Increase dead/destroyed counter local Ndead=target.Ndead
local Ndestroyed=target.Ndestroyed
if EventData.id==EVENTS.RemoveUnit then if EventData.id==EVENTS.RemoveUnit then
self:ElementDead(Name, target) Ndead=Ndead+1
else else
self:ElementDestroyed(Name, target) Ndestroyed=Ndestroyed+1
Ndead=Ndead+1
end
-- Check if ALL objects are dead
if Ndead==target.N0 then
if Ndestroyed>=target.N0 then
-- Debug message.
self:T2(self.lid..string.format("EVENT ID=%d: target %s dead/lost ==> destroyed", EventData.id, tostring(target.Name)))
target.Life = 0
-- Trigger object destroyed event. This sets the Life to zero and increases Ndestroyed
self:ObjectDestroyed(target)
else
-- Debug message.
self:T2(self.lid..string.format("EVENT ID=%d: target %s removed ==> dead", EventData.id, tostring(target.Name)))
target.Life = 0
-- Trigger object dead event. This sets the Life to zero and increases Ndead counter
self:ObjectDead(target)
end
end end
else
self:E(self.lid..string.format("ERROR: Could not get target from IniGroup or IniUnit name when event Dead or UnitLost occured! Stats are not correctly updated :("))
end -- Event belongs to this TARGET end -- Event belongs to this TARGET
end end
+3 -3
View File
@@ -2108,7 +2108,7 @@ function MSRS:_HoundTextToSpeech(Message,Frequencies,Modulations,Volume,Label,Co
local ffs = {} local ffs = {}
for _,_f in pairs(Frequencies) do for _,_f in pairs(Frequencies) do
table.insert(ffs,string.format("%.1f",_f)) table.insert(ffs,string.format("%.3f",_f))
end end
local freqs = table.concat(ffs, ",") local freqs = table.concat(ffs, ",")
@@ -2214,7 +2214,7 @@ function MSRS:_HoundTestTone(Frequencies, Modulations, Coalition)
local ffs = {} local ffs = {}
for _,_f in pairs(Frequencies or self.frequencies) do for _,_f in pairs(Frequencies or self.frequencies) do
table.insert(ffs,string.format("%.1f",_f)) table.insert(ffs,string.format("%.3f",_f))
end end
local freqs = table.concat(ffs, ",") local freqs = table.concat(ffs, ",")
@@ -2291,7 +2291,7 @@ function MSRS:RadioJammerOn(Frequencies, Modulations, Coalition, Noisetype, Volu
local ffs = {} local ffs = {}
for _,_f in pairs(Frequencies or self.frequencies) do for _,_f in pairs(Frequencies or self.frequencies) do
table.insert(ffs,string.format("%.1f",_f)) table.insert(ffs,string.format("%.3f",_f))
end end
local freqs = table.concat(ffs, ",") local freqs = table.concat(ffs, ",")
+43 -2
View File
@@ -523,7 +523,7 @@ ENUMS.ReportingName =
Tornado = "Tornado", Tornado = "Tornado",
-- Transport / Bomber / Others -- Transport / Bomber / Others
Atlas = "A400", Atlas = "A400",
Lancer = "B1-B", Lancer = "B-1B",
Stratofortress = "B-52H", Stratofortress = "B-52H",
Herc = "C-130", Herc = "C-130",
Hercules = "C-130J-30", Hercules = "C-130J-30",
@@ -568,7 +568,7 @@ ENUMS.ReportingName =
Apache = "AH-64", Apache = "AH-64",
Chinook = "CH-47", Chinook = "CH-47",
Sea_Stallion = "CH-53", Sea_Stallion = "CH-53",
Kiowa = "OH-58", Kiowa = "OH58D",
Seahawk = "SH-60", Seahawk = "SH-60",
Blackhawk = "UH-60", Blackhawk = "UH-60",
Sea_King = "S-61", Sea_King = "S-61",
@@ -2126,6 +2126,47 @@ ENUMS.Storage.weapons.containers.UH60_GAU19_RIGHT = 'weapons.containers.{UH60_GA
ENUMS.Storage.weapons.containers.UH60_M230_RIGHT = 'weapons.containers.{UH60_M230_RIGHT}' ENUMS.Storage.weapons.containers.UH60_M230_RIGHT = 'weapons.containers.{UH60_M230_RIGHT}'
ENUMS.Storage.weapons.containers.UH60L_M2_GUNNER = 'weapons.containers.{UH60L_M2_GUNNER}' ENUMS.Storage.weapons.containers.UH60L_M2_GUNNER = 'weapons.containers.{UH60L_M2_GUNNER}'
ENUMS.Storage.weapons.adapters.GD_F100_SUU_13 = 'weapons.adapters.GD_F100_SUU-13'
ENUMS.Storage.weapons.containers.GPU_5_POD = 'weapons.containers.{GPU_5_POD}'
ENUMS.Storage.weapons.bombs.BOLT_117 = 'weapons.bombs.BOLT-117'
ENUMS.Storage.weapons.shells.F100_M39_20_TP_T = 'weapons.shells.F100_M39_20_TP_T'
ENUMS.Storage.weapons.gunmounts.M_39_F_100 = 'weapons.gunmounts.M-39 F-100'
ENUMS.Storage.weapons.droptanks.GD_F100_TANK_275_L = 'weapons.droptanks.GD_F100_TANK_275_L'
ENUMS.Storage.weapons.bombs.BLU_4B_R_GROUP_R = 'weapons.bombs.BLU-4B_R_GROUP_R'
ENUMS.Storage.weapons.containers.F100_CAMERA_P2 = 'weapons.containers.F100_CAMERA_P2'
ENUMS.Storage.weapons.containers.HB_ORD_SUU_7 = 'weapons.containers.HB_ORD_SUU_7'
ENUMS.Storage.weapons.adapters.SidewinderPylon = 'weapons.adapters.SidewinderPylon'
ENUMS.Storage.weapons.adapters.apu_470 = 'weapons.adapters.apu_470'
ENUMS.Storage.weapons.droptanks.GD_F100_TANK_335_R = 'weapons.droptanks.GD_F100_TANK_335_R'
ENUMS.Storage.weapons.bombs.BLU_3B_R_GROUP_R = 'weapons.bombs.BLU-3B_R_GROUP_R'
ENUMS.Storage.weapons.droptanks.GD_F100_TANK_335_L = 'weapons.droptanks.GD_F100_TANK_335_L'
ENUMS.Storage.weapons.adapters.mbdz_u2t = 'weapons.adapters.mbdz_u2t'
ENUMS.Storage.weapons.containers.ZellRocket = 'weapons.containers.ZellRocket'
ENUMS.Storage.weapons.containers.apu_73 = 'weapons.containers.apu-73'
ENUMS.Storage.weapons.gunmounts.GAU_13 = 'weapons.gunmounts.GAU-13'
ENUMS.Storage.weapons.shells.F100_M39_20_TP = 'weapons.shells.F100_M39_20_TP'
ENUMS.Storage.weapons.shells.F100_M39_20_API = 'weapons.shells.F100_M39_20_API'
ENUMS.Storage.weapons.adapters.bdz_umk2b = 'weapons.adapters.bdz_umk2b'
ENUMS.Storage.weapons.droptanks.GD_F100_TANK_450 = 'weapons.droptanks.GD_F100_TANK_450'
ENUMS.Storage.weapons.droptanks.GD_F100_TANK_275_R = 'weapons.droptanks.GD_F100_TANK_275_R'
ENUMS.Storage.weapons.bombs.BLU_18_B_GROUP = 'weapons.bombs.BLU-18/B_GROUP'
ENUMS.Storage.weapons.containers.ZELL_Booster = 'weapons.containers.ZELL Booster'
ENUMS.Storage.weapons.adapters.apu_60 = 'weapons.adapters.apu_60'
ENUMS.Storage.weapons.gunmounts.GPU_5_POD = 'weapons.gunmounts.{GPU_5_POD}'
ENUMS.Storage.weapons.containers.F100_CAMERA_KA71A = 'weapons.containers.F100_CAMERA_KA71A'
ENUMS.Storage.weapons.bombs.BLU_3_R_GROUP_R = 'weapons.bombs.BLU-3_R_GROUP_R'
ENUMS.Storage.weapons.shells.F100_M39_20_HEI = 'weapons.shells.F100_M39_20_HEI'
ENUMS.Storage.weapons.droptanks.GD_F100_TANK_200 = 'weapons.droptanks.GD_F100_TANK_200'
ENUMS.Storage.weapons.adapters.apu_73 = 'weapons.adapters.apu-73'
ENUMS.Storage.weapons.gunmounts.AKAN_NO_TRC = 'weapons.gunmounts.AKAN_NO_TRC'
ENUMS.Storage.weapons.gunmounts.AKAN = 'weapons.gunmounts.AKAN'
ENUMS.Storage.weapons.shells.F100_M39_20_HEI_T = 'weapons.shells.F100_M39_20_HEI_T'
ENUMS.Storage.weapons.shells.F100_M39_20_API_T = 'weapons.shells.F100_M39_20_API_T'
ENUMS.Storage.weapons.containers.GD_F100_STRIKE_CAMERA = 'weapons.containers.GD_F100_STRIKE_CAMERA'
ENUMS.Storage.weapons.bombs.BLU_49_B = 'weapons.bombs.BLU-49/B'
ENUMS.Storage.weapons.containers.GD_F100_SUU_13 = 'weapons.containers.GD_F100_SUU-13'
--- ---
-- @type ENUMS.FARPType -- @type ENUMS.FARPType
-- @field #string FARP -- @field #string FARP
@@ -2379,6 +2379,11 @@ function UTILS.IsLoadingDoorOpen( unit_name )
return true return true
end end
if type_name == "Ka-50_3" and unit:getDrawArgumentValue(38) == 1 then
BASE:T(unit_name .. " cockpit door is open")
return true
end
if type_name=="C-130J-30" and (unit:getDrawArgumentValue(86)==1)then if type_name=="C-130J-30" and (unit:getDrawArgumentValue(86)==1)then
BASE:T(unit_name.." rear doors are open") BASE:T(unit_name.." rear doors are open")
return true return true