mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
commit
57919704be
@ -1578,7 +1578,7 @@ do
|
|||||||
function SET_GROUP:AddInDatabase( Event )
|
function SET_GROUP:AddInDatabase( Event )
|
||||||
self:F3( { Event } )
|
self:F3( { Event } )
|
||||||
|
|
||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
if not self.Database[Event.IniDCSGroupName] then
|
if not self.Database[Event.IniDCSGroupName] then
|
||||||
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
||||||
self:T3( self.Database[Event.IniDCSGroupName] )
|
self:T3( self.Database[Event.IniDCSGroupName] )
|
||||||
@ -2641,7 +2641,7 @@ do -- SET_UNIT
|
|||||||
function SET_UNIT:AddInDatabase( Event )
|
function SET_UNIT:AddInDatabase( Event )
|
||||||
self:F3( { Event } )
|
self:F3( { Event } )
|
||||||
|
|
||||||
if Event.IniObjectCategory == 1 then
|
if Event.IniObjectCategory == Object.Category.UNIT then
|
||||||
if not self.Database[Event.IniDCSUnitName] then
|
if not self.Database[Event.IniDCSUnitName] then
|
||||||
self.Database[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnitName )
|
self.Database[Event.IniDCSUnitName] = UNIT:Register( Event.IniDCSUnitName )
|
||||||
self:T3( self.Database[Event.IniDCSUnitName] )
|
self:T3( self.Database[Event.IniDCSUnitName] )
|
||||||
@ -4518,7 +4518,7 @@ do -- SET_CLIENT
|
|||||||
function SET_CLIENT:_EventPlayerEnterUnit(Event)
|
function SET_CLIENT:_EventPlayerEnterUnit(Event)
|
||||||
self:I( "_EventPlayerEnterUnit" )
|
self:I( "_EventPlayerEnterUnit" )
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then
|
if Event.IniObjectCategory == Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||||
-- CA Slot entered
|
-- CA Slot entered
|
||||||
local ObjectName, Object = self:AddInDatabase( Event )
|
local ObjectName, Object = self:AddInDatabase( Event )
|
||||||
self:I( ObjectName, UTILS.PrintTableToLog(Object) )
|
self:I( ObjectName, UTILS.PrintTableToLog(Object) )
|
||||||
@ -4537,7 +4537,7 @@ do -- SET_CLIENT
|
|||||||
function SET_CLIENT:_EventPlayerLeaveUnit(Event)
|
function SET_CLIENT:_EventPlayerLeaveUnit(Event)
|
||||||
self:I( "_EventPlayerLeaveUnit" )
|
self:I( "_EventPlayerLeaveUnit" )
|
||||||
if Event.IniDCSUnit then
|
if Event.IniDCSUnit then
|
||||||
if Event.IniObjectCategory == 1 and Event.IniGroup and Event.IniGroup:IsGround() then
|
if Event.IniObjectCategory == Object.Category.UNIT and Event.IniGroup and Event.IniGroup:IsGround() then
|
||||||
-- CA Slot left
|
-- CA Slot left
|
||||||
local ObjectName, Object = self:FindInDatabase( Event )
|
local ObjectName, Object = self:FindInDatabase( Event )
|
||||||
if ObjectName then
|
if ObjectName then
|
||||||
@ -7837,6 +7837,29 @@ do -- SET_OPSGROUP
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Handles the OnBirth event for the Set.
|
||||||
|
-- @param #SET_OPSGROUP self
|
||||||
|
-- @param Core.Event#EVENTDATA Event Event data.
|
||||||
|
function SET_OPSGROUP:_EventOnBirth( Event )
|
||||||
|
self:F3( { Event } )
|
||||||
|
|
||||||
|
if Event.IniDCSUnit and Event.IniDCSGroup then
|
||||||
|
local DCSgroup=Event.IniDCSGroup --DCS#Group
|
||||||
|
|
||||||
|
if DCSgroup:getInitialSize() == DCSgroup:getSize() then -- This seems to be not a good check as even for the first birth event, getSize returns the total number of units in the group.
|
||||||
|
|
||||||
|
local groupname, group = self:AddInDatabase( Event )
|
||||||
|
|
||||||
|
if group and group:CountAliveUnits()==DCSgroup:getInitialSize() then
|
||||||
|
if group and self:IsIncludeObject( group ) then
|
||||||
|
self:Add( groupname, group )
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--- Handles the OnDead or OnCrash event for alive groups set.
|
--- Handles the OnDead or OnCrash event for alive groups set.
|
||||||
-- Note: The GROUP object in the SET_OPSGROUP collection will only be removed if the last unit is destroyed of the GROUP.
|
-- Note: The GROUP object in the SET_OPSGROUP collection will only be removed if the last unit is destroyed of the GROUP.
|
||||||
-- @param #SET_OPSGROUP self
|
-- @param #SET_OPSGROUP self
|
||||||
@ -7857,12 +7880,12 @@ do -- SET_OPSGROUP
|
|||||||
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
--- Handles the Database to check on an event (birth) that the Object was added in the Database.
|
||||||
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
-- This is required, because sometimes the _DATABASE birth event gets called later than the SET_BASE birth event!
|
||||||
-- @param #SET_OPSGROUP self
|
-- @param #SET_OPSGROUP self
|
||||||
-- @param Core.Event#EVENTDATA Event
|
-- @param Core.Event#EVENTDATA Event Event data.
|
||||||
-- @return #string The name of the GROUP
|
-- @return #string The name of the GROUP.
|
||||||
-- @return #table The GROUP
|
-- @return Wrapper.Group#GROUP The GROUP object.
|
||||||
function SET_OPSGROUP:AddInDatabase( Event )
|
function SET_OPSGROUP:AddInDatabase( Event )
|
||||||
|
|
||||||
if Event.IniObjectCategory==1 then
|
if Event.IniObjectCategory==Object.Category.UNIT then
|
||||||
|
|
||||||
if not self.Database[Event.IniDCSGroupName] then
|
if not self.Database[Event.IniDCSGroupName] then
|
||||||
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
self.Database[Event.IniDCSGroupName] = GROUP:Register( Event.IniDCSGroupName )
|
||||||
@ -7877,8 +7900,8 @@ do -- SET_OPSGROUP
|
|||||||
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
||||||
-- @param #SET_OPSGROUP self
|
-- @param #SET_OPSGROUP self
|
||||||
-- @param Core.Event#EVENTDATA Event Event data table.
|
-- @param Core.Event#EVENTDATA Event Event data table.
|
||||||
-- @return #string The name of the GROUP
|
-- @return #string The name of the GROUP.
|
||||||
-- @return #table The GROUP
|
-- @return Wrapper.Group#GROUP The GROUP object.
|
||||||
function SET_OPSGROUP:FindInDatabase(Event)
|
function SET_OPSGROUP:FindInDatabase(Event)
|
||||||
return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName]
|
return Event.IniDCSGroupName, self.Database[Event.IniDCSGroupName]
|
||||||
end
|
end
|
||||||
@ -8197,7 +8220,7 @@ do -- SET_SCENERY
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Get a table of alive objects.
|
--- Get a table of alive objects.
|
||||||
-- @param #SET_GROUP self
|
-- @param #SET_SCENERY self
|
||||||
-- @return #table Table of alive objects
|
-- @return #table Table of alive objects
|
||||||
-- @return Core.Set#SET_SCENERY SET of alive objects
|
-- @return Core.Set#SET_SCENERY SET of alive objects
|
||||||
function SET_SCENERY:GetAliveSet()
|
function SET_SCENERY:GetAliveSet()
|
||||||
|
|||||||
@ -3526,7 +3526,7 @@ function AWACS:_Showtask(Group)
|
|||||||
local targetstatus = currenttask.Target:GetState()
|
local targetstatus = currenttask.Target:GetState()
|
||||||
local ToDo = currenttask.ToDo
|
local ToDo = currenttask.ToDo
|
||||||
local description = currenttask.ScreenText
|
local description = currenttask.ScreenText
|
||||||
local descTTS = currenttask.ScreenText
|
local descTTS = currenttask.ScreenText
|
||||||
local callsign = Callsign
|
local callsign = Callsign
|
||||||
|
|
||||||
if self.debug then
|
if self.debug then
|
||||||
@ -3547,7 +3547,7 @@ function AWACS:_Showtask(Group)
|
|||||||
local alti = currenttask.Cluster.altitude or currenttask.Contact.altitude or currenttask.Contact.group:GetAltitude()
|
local alti = currenttask.Cluster.altitude or currenttask.Contact.altitude or currenttask.Contact.group:GetAltitude()
|
||||||
local direction, direcTTS = self:_ToStringBRA(pposition,targetpos,alti)
|
local direction, direcTTS = self:_ToStringBRA(pposition,targetpos,alti)
|
||||||
description = description .. "\nBRA "..direction
|
description = description .. "\nBRA "..direction
|
||||||
descTTS = descTTS ..";BRA "..direcTTS
|
descTTS = descTTS ..";BRA "..direcTTS
|
||||||
end
|
end
|
||||||
elseif currenttask.ToDo == AWACS.TaskDescription.ANCHOR or currenttask.ToDo == AWACS.TaskDescription.REANCHOR then
|
elseif currenttask.ToDo == AWACS.TaskDescription.ANCHOR or currenttask.ToDo == AWACS.TaskDescription.REANCHOR then
|
||||||
local targetpos = currenttask.Target:GetCoordinate()
|
local targetpos = currenttask.Target:GetCoordinate()
|
||||||
|
|||||||
@ -605,6 +605,16 @@ function OPSTRANSPORT:AddCargoGroups(GroupSet, TransportZoneCombo, DisembarkActi
|
|||||||
self:AddCargoGroups(group, TransportZoneCombo, DisembarkActivation)
|
self:AddCargoGroups(group, TransportZoneCombo, DisembarkActivation)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Use FSM function to keep the SET up-to-date. Note that it overwrites the user FMS function, which cannot be used any more now.
|
||||||
|
local groupset=GroupSet --Core.Set#SET_OPSGROUP
|
||||||
|
function groupset.OnAfterAdded(groupset, From, Event, To, ObjectName, Object)
|
||||||
|
|
||||||
|
self:T(self.lid..string.format("Adding Cargo Group %s", tostring(ObjectName)))
|
||||||
|
self:AddCargoGroups(Object, TransportZoneCombo, DisembarkActivation, DisembarkZone, DisembarkCarriers)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Debug info.
|
-- Debug info.
|
||||||
|
|||||||
@ -689,7 +689,15 @@ function GROUP:GetUnits()
|
|||||||
local DCSUnits = DCSGroup:getUnits() or {}
|
local DCSUnits = DCSGroup:getUnits() or {}
|
||||||
local Units = {}
|
local Units = {}
|
||||||
for Index, UnitData in pairs( DCSUnits ) do
|
for Index, UnitData in pairs( DCSUnits ) do
|
||||||
Units[#Units+1] = UNIT:Find( UnitData )
|
|
||||||
|
local unit=UNIT:Find( UnitData )
|
||||||
|
if unit then
|
||||||
|
Units[#Units+1] = UNIT:Find( UnitData )
|
||||||
|
else
|
||||||
|
local UnitName=UnitData:getName()
|
||||||
|
unit=_DATABASE:AddUnit(UnitName)
|
||||||
|
Units[#Units+1]=unit
|
||||||
|
end
|
||||||
end
|
end
|
||||||
self:T3( Units )
|
self:T3( Units )
|
||||||
return Units
|
return Units
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user