mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
Some stuff
This commit is contained in:
@@ -4705,7 +4705,8 @@ do -- SET_AIRBASE
|
||||
if _DATABASE then
|
||||
|
||||
-- We use the BaseCaptured event, which is generated by DCS when a base got captured.
|
||||
self:HandleEvent( EVENTS.BaseCaptured )
|
||||
self:HandleEvent(EVENTS.BaseCaptured)
|
||||
self:HandleEvent(EVENTS.Dead)
|
||||
|
||||
-- We initialize the first set.
|
||||
for ObjectName, Object in pairs( self.Database ) do
|
||||
@@ -4720,10 +4721,9 @@ do -- SET_AIRBASE
|
||||
return self
|
||||
end
|
||||
|
||||
--- Starts the filtering.
|
||||
--- Base capturing event.
|
||||
-- @param #SET_AIRBASE self
|
||||
-- @param Core.Event#EVENT EventData
|
||||
-- @return #SET_AIRBASE self
|
||||
function SET_AIRBASE:OnEventBaseCaptured(EventData)
|
||||
|
||||
-- When a base got captured, we reevaluate the set.
|
||||
@@ -4739,24 +4739,36 @@ do -- SET_AIRBASE
|
||||
|
||||
end
|
||||
|
||||
--- Dead event.
|
||||
-- @param #SET_AIRBASE self
|
||||
-- @param Core.Event#EVENT EventData
|
||||
function SET_AIRBASE:OnEventDead(EventData)
|
||||
|
||||
local airbaseName, airbase=self:FindInDatabase(EventData)
|
||||
|
||||
if airbase and airbase:IsShip() or airbase:IsHelipad() then
|
||||
self:RemoveAirbasesByName(airbaseName)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
--- 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!
|
||||
-- @param #SET_AIRBASE self
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the AIRBASE
|
||||
-- @return #table The AIRBASE
|
||||
-- @param Core.Event#EVENTDATA Event Event data.
|
||||
-- @return #string The name of the AIRBASE.
|
||||
-- @return Wrapper.Airbase#AIRBASE The AIRBASE object.
|
||||
function SET_AIRBASE:AddInDatabase( Event )
|
||||
self:F3( { Event } )
|
||||
|
||||
return Event.IniDCSUnitName, self.Database[Event.IniDCSUnitName]
|
||||
end
|
||||
|
||||
--- Handles the Database to check on any event that Object exists in the Database.
|
||||
-- This is required, because sometimes the _DATABASE event gets called later than the SET_BASE event or vise versa!
|
||||
-- @param #SET_AIRBASE self
|
||||
-- @param Core.Event#EVENTDATA Event
|
||||
-- @return #string The name of the AIRBASE
|
||||
-- @return #table The AIRBASE
|
||||
-- @param Core.Event#EVENTDATA Event Event data.
|
||||
-- @return #string The name of the AIRBASE.
|
||||
-- @return Wrapper.Airbase#AIRBASE The AIRBASE object.
|
||||
function SET_AIRBASE:FindInDatabase( Event )
|
||||
self:F3( { Event } )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user