Compare commits

..

8 Commits

Author SHA1 Message Date
Frank
bf61f22dd1 Fixed UnHandleEvent for UNIT
#1365
2020-11-15 23:00:03 +01:00
Frank
5e8a36802c Github issues
#1360
#1361
2020-10-31 21:21:25 +01:00
Frank
b34b537a26 Update AI_Formation.lua
- Issue #1358
2020-10-28 09:46:03 +01:00
Frank
812fb99e66 Small Updates
AIRBOSS
- Added USS Harry S. Truman (CVN-75) [Super Carrier Module]
- Fixed little bug in stop time

RADIOQUEUE
- Allowing GROUND units as relay. Only ships cannot be used.
2020-10-26 16:16:04 +01:00
Frank
9cb3111dd5 Github issues addressed
- Fixes #1342
- Fixes #1333
- Fixes #1331
2020-10-26 09:13:49 +01:00
Frank
1312555690 Github Issues Addressed
**GROUP**
#1354
**ARTY v1.1.8**
#1356
#1357
2020-10-20 23:26:32 +02:00
Frank
aa4f8452fa Update Airbase.lua
- Fixed a bug inthe `AIRBASE:GetRunwayData()` function.
2020-10-03 23:11:05 +02:00
Frank
e2c1097ec5 Update Airboss.lua
- Fix for DCS bug that skill is not set in env.mission. Should not happen in current DCS version anyway.
2020-10-03 21:41:35 +02:00
13 changed files with 143 additions and 89 deletions

View File

@@ -2774,7 +2774,7 @@ do -- AI_A2A_DISPATCHER
-- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) -- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
-- --
-- -- Now Setup the default fuel treshold. -- -- Now Setup the default fuel treshold.
-- A2ADispatcher:SetSquadronRefuelThreshold( "SquadronName", 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank. -- A2ADispatcher:SetSquadronFuelThreshold( "SquadronName", 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
-- --
function AI_A2A_DISPATCHER:SetSquadronFuelThreshold( SquadronName, FuelThreshold ) function AI_A2A_DISPATCHER:SetSquadronFuelThreshold( SquadronName, FuelThreshold )
@@ -2817,7 +2817,7 @@ do -- AI_A2A_DISPATCHER
-- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection ) -- A2ADispatcher = AI_A2A_DISPATCHER:New( Detection )
-- --
-- -- Now Setup the squadron fuel treshold. -- -- Now Setup the squadron fuel treshold.
-- A2ADispatcher:SetSquadronRefuelThreshold( "SquadronName", 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank. -- A2ADispatcher:SetSquadronFuelThreshold( "SquadronName", 0.30 ) -- Go RTB when only 30% of fuel remaining in the tank.
-- --
-- -- Now Setup the squadron tanker. -- -- Now Setup the squadron tanker.
-- A2ADispatcher:SetSquadronTanker( "SquadronName", "Tanker" ) -- The group name of the tanker is "Tanker" in the Mission Editor. -- A2ADispatcher:SetSquadronTanker( "SquadronName", "Tanker" ) -- The group name of the tanker is "Tanker" in the Mission Editor.

View File

@@ -184,11 +184,13 @@ function AI_FORMATION:New( FollowUnit, FollowGroupSet, FollowName, FollowBriefin
self.FollowGroupSet:ForEachGroup( self.FollowGroupSet:ForEachGroup(
function( FollowGroup ) function( FollowGroup )
self:E("Following") --self:E("Following")
FollowGroup:SetState( self, "Mode", self.__Enum.Mode.Formation ) FollowGroup:SetState( self, "Mode", self.__Enum.Mode.Formation )
end end
) )
self:SetFlightModeFormation()
self:SetFlightRandomization( 2 ) self:SetFlightRandomization( 2 )
self:SetStartState( "None" ) self:SetStartState( "None" )
@@ -997,7 +999,7 @@ function AI_FORMATION:SetFlightModeMission( FollowGroup )
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) ) FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission ) FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Mission )
else else
self.EscortGroupSet:ForSomeGroupAlive( self.FollowGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup --- @param Core.Group#GROUP EscortGroup
function( FollowGroup ) function( FollowGroup )
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) ) FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
@@ -1021,7 +1023,7 @@ function AI_FORMATION:SetFlightModeAttack( FollowGroup )
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) ) FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack ) FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Attack )
else else
self.EscortGroupSet:ForSomeGroupAlive( self.FollowGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup --- @param Core.Group#GROUP EscortGroup
function( FollowGroup ) function( FollowGroup )
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) ) FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
@@ -1045,7 +1047,7 @@ function AI_FORMATION:SetFlightModeFormation( FollowGroup )
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) ) FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )
FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation ) FollowGroup:SetState( FollowGroup, "Mode", self.__Enum.Mode.Formation )
else else
self.EscortGroupSet:ForSomeGroupAlive( self.FollowGroupSet:ForSomeGroupAlive(
--- @param Core.Group#GROUP EscortGroup --- @param Core.Group#GROUP EscortGroup
function( FollowGroup ) function( FollowGroup )
FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) ) FollowGroup:SetState( FollowGroup, "PreviousMode", FollowGroup:GetState( FollowGroup, "Mode" ) )

View File

@@ -451,23 +451,23 @@ do -- Event Handling
--- Subscribe to a DCS Event. --- Subscribe to a DCS Event.
-- @param #BASE self -- @param #BASE self
-- @param Core.Event#EVENTS Event -- @param Core.Event#EVENTS EventID Event ID.
-- @param #function EventFunction (optional) The function to be called when the event occurs for the unit. -- @param #function EventFunction (optional) The function to be called when the event occurs for the unit.
-- @return #BASE -- @return #BASE
function BASE:HandleEvent( Event, EventFunction ) function BASE:HandleEvent( EventID, EventFunction )
self:EventDispatcher():OnEventGeneric( EventFunction, self, Event ) self:EventDispatcher():OnEventGeneric( EventFunction, self, EventID )
return self return self
end end
--- UnSubscribe to a DCS event. --- UnSubscribe to a DCS event.
-- @param #BASE self -- @param #BASE self
-- @param Core.Event#EVENTS Event -- @param Core.Event#EVENTS EventID Event ID.
-- @return #BASE -- @return #BASE
function BASE:UnHandleEvent( Event ) function BASE:UnHandleEvent( EventID )
self:EventDispatcher():RemoveEvent( self, Event ) self:EventDispatcher():RemoveEvent( self, EventID )
return self return self
end end

View File

@@ -526,17 +526,21 @@ local _EVENTMETA = {
-- @param #EVENT self -- @param #EVENT self
-- @return #EVENT self -- @return #EVENT self
function EVENT:New() function EVENT:New()
-- Inherit base.
local self = BASE:Inherit( self, BASE:New() ) local self = BASE:Inherit( self, BASE:New() )
self:F2()
self.EventHandler = world.addEventHandler( self ) -- Add world event handler.
self.EventHandler = world.addEventHandler(self)
return self return self
end end
--- Initializes the Events structure for the event --- Initializes the Events structure for the event.
-- @param #EVENT self -- @param #EVENT self
-- @param DCS#world.event EventID -- @param DCS#world.event EventID Event ID.
-- @param Core.Base#BASE EventClass -- @param Core.Base#BASE EventClass The class object for which events are handled.
-- @return #EVENT.Events -- @return #EVENT.Events
function EVENT:Init( EventID, EventClass ) function EVENT:Init( EventID, EventClass )
self:F3( { _EVENTMETA[EventID].Text, EventClass } ) self:F3( { _EVENTMETA[EventID].Text, EventClass } )
@@ -548,6 +552,7 @@ function EVENT:Init( EventID, EventClass )
-- Each event has a subtable of EventClasses, ordered by EventPriority. -- Each event has a subtable of EventClasses, ordered by EventPriority.
local EventPriority = EventClass:GetEventPriority() local EventPriority = EventClass:GetEventPriority()
if not self.Events[EventID][EventPriority] then if not self.Events[EventID][EventPriority] then
self.Events[EventID][EventPriority] = setmetatable( {}, { __mode = "k" } ) self.Events[EventID][EventPriority] = setmetatable( {}, { __mode = "k" } )
end end
@@ -556,39 +561,44 @@ function EVENT:Init( EventID, EventClass )
self.Events[EventID][EventPriority][EventClass] = {} self.Events[EventID][EventPriority][EventClass] = {}
end end
return self.Events[EventID][EventPriority][EventClass] return self.Events[EventID][EventPriority][EventClass]
end end
--- Removes a subscription --- Removes a subscription
-- @param #EVENT self -- @param #EVENT self
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is. -- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
-- @param DCS#world.event EventID -- @param DCS#world.event EventID Event ID.
-- @return #EVENT.Events -- @return #EVENT self
function EVENT:RemoveEvent( EventClass, EventID ) function EVENT:RemoveEvent( EventClass, EventID )
-- Debug info.
self:F2( { "Removing subscription for class: ", EventClass:GetClassNameAndID() } ) self:F2( { "Removing subscription for class: ", EventClass:GetClassNameAndID() } )
-- Get event prio.
local EventPriority = EventClass:GetEventPriority() local EventPriority = EventClass:GetEventPriority()
-- Events.
self.Events = self.Events or {} self.Events = self.Events or {}
self.Events[EventID] = self.Events[EventID] or {} self.Events[EventID] = self.Events[EventID] or {}
self.Events[EventID][EventPriority] = self.Events[EventID][EventPriority] or {} self.Events[EventID][EventPriority] = self.Events[EventID][EventPriority] or {}
-- Remove
self.Events[EventID][EventPriority][EventClass] = nil self.Events[EventID][EventPriority][EventClass] = nil
return self
end end
--- Resets subscriptions --- Resets subscriptions.
-- @param #EVENT self -- @param #EVENT self
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is. -- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
-- @param DCS#world.event EventID -- @param DCS#world.event EventID Event ID.
-- @return #EVENT.Events -- @return #EVENT.Events
function EVENT:Reset( EventObject ) --R2.1 function EVENT:Reset( EventObject ) --R2.1
self:F( { "Resetting subscriptions for class: ", EventObject:GetClassNameAndID() } ) self:F( { "Resetting subscriptions for class: ", EventObject:GetClassNameAndID() } )
local EventPriority = EventObject:GetEventPriority() local EventPriority = EventObject:GetEventPriority()
for EventID, EventData in pairs( self.Events ) do for EventID, EventData in pairs( self.Events ) do
if self.EventsDead then if self.EventsDead then
if self.EventsDead[EventID] then if self.EventsDead[EventID] then
@@ -603,19 +613,22 @@ function EVENT:Reset( EventObject ) --R2.1
end end
--- Clears all event subscriptions for a @{Core.Base#BASE} derived object. --- Clears all event subscriptions for a @{Core.Base#BASE} derived object.
-- @param #EVENT self -- @param #EVENT self
-- @param Core.Base#BASE EventObject -- @param Core.Base#BASE EventClass The self class object for which the events are removed.
function EVENT:RemoveAll( EventObject ) -- @return #EVENT self
self:F3( { EventObject:GetClassNameAndID() } ) function EVENT:RemoveAll(EventClass)
local EventClass = EventObject:GetClassNameAndID() local EventClassName = EventClass:GetClassNameAndID()
-- Get Event prio.
local EventPriority = EventClass:GetEventPriority() local EventPriority = EventClass:GetEventPriority()
for EventID, EventData in pairs( self.Events ) do for EventID, EventData in pairs( self.Events ) do
self.Events[EventID][EventPriority][EventClass] = nil self.Events[EventID][EventPriority][EventClass] = nil
end end
return self
end end
@@ -636,7 +649,7 @@ function EVENT:OnEventForTemplate( EventTemplate, EventFunction, EventClass, Eve
return self return self
end end
--- Set a new listener for an S_EVENT_X event independent from a unit or a weapon. --- Set a new listener for an `S_EVENT_X` event independent from a unit or a weapon.
-- @param #EVENT self -- @param #EVENT self
-- @param #function EventFunction The function to be called when the event occurs for the unit. -- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is captured. When the event happens, the event process will be called in this class provided. -- @param Core.Base#BASE EventClass The self instance of the class for which the event is captured. When the event happens, the event process will be called in this class provided.
@@ -652,13 +665,13 @@ function EVENT:OnEventGeneric( EventFunction, EventClass, EventID )
end end
--- Set a new listener for an S_EVENT_X event for a UNIT. --- Set a new listener for an `S_EVENT_X` event for a UNIT.
-- @param #EVENT self -- @param #EVENT self
-- @param #string UnitName The name of the UNIT. -- @param #string UnitName The name of the UNIT.
-- @param #function EventFunction The function to be called when the event occurs for the GROUP. -- @param #function EventFunction The function to be called when the event occurs for the GROUP.
-- @param Core.Base#BASE EventClass The self instance of the class for which the event is. -- @param Core.Base#BASE EventClass The self instance of the class for which the event is.
-- @param EventID -- @param EventID
-- @return #EVENT -- @return #EVENT self
function EVENT:OnEventForUnit( UnitName, EventFunction, EventClass, EventID ) function EVENT:OnEventForUnit( UnitName, EventFunction, EventClass, EventID )
self:F2( UnitName ) self:F2( UnitName )
@@ -724,10 +737,10 @@ do -- OnDead
--- Create an OnDead event handler for a group --- Create an OnDead event handler for a group
-- @param #EVENT self -- @param #EVENT self
-- @param Wrapper.Group#GROUP EventGroup -- @param Wrapper.Group#GROUP EventGroup The GROUP object.
-- @param #function EventFunction The function to be called when the event occurs for the unit. -- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @param EventClass The self instance of the class for which the event is. -- @param #table EventClass The self instance of the class for which the event is.
-- @return #EVENT -- @return #EVENT self
function EVENT:OnDeadForTemplate( EventTemplate, EventFunction, EventClass ) function EVENT:OnDeadForTemplate( EventTemplate, EventFunction, EventClass )
self:F2( EventTemplate.name ) self:F2( EventTemplate.name )
@@ -740,12 +753,13 @@ end
do -- OnLand do -- OnLand
--- Create an OnLand event handler for a group --- Create an OnLand event handler for a group
-- @param #EVENT self -- @param #EVENT self
-- @param #table EventTemplate -- @param #table EventTemplate
-- @param #function EventFunction The function to be called when the event occurs for the unit. -- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @param EventClass The self instance of the class for which the event is. -- @param #table EventClass The self instance of the class for which the event is.
-- @return #EVENT -- @return #EVENT self
function EVENT:OnLandForTemplate( EventTemplate, EventFunction, EventClass ) function EVENT:OnLandForTemplate( EventTemplate, EventFunction, EventClass )
self:F2( EventTemplate.name ) self:F2( EventTemplate.name )
@@ -757,12 +771,13 @@ do -- OnLand
end end
do -- OnTakeOff do -- OnTakeOff
--- Create an OnTakeOff event handler for a group --- Create an OnTakeOff event handler for a group
-- @param #EVENT self -- @param #EVENT self
-- @param #table EventTemplate -- @param #table EventTemplate Template table.
-- @param #function EventFunction The function to be called when the event occurs for the unit. -- @param #function EventFunction The function to be called when the event occurs for the unit.
-- @param EventClass The self instance of the class for which the event is. -- @param #table EventClass The self instance of the class for which the event is.
-- @return #EVENT -- @return #EVENT self
function EVENT:OnTakeOffForTemplate( EventTemplate, EventFunction, EventClass ) function EVENT:OnTakeOffForTemplate( EventTemplate, EventFunction, EventClass )
self:F2( EventTemplate.name ) self:F2( EventTemplate.name )
@@ -902,8 +917,9 @@ do -- Event Creation
end end
--- @param #EVENT self --- Main event function.
-- @param #EVENTDATA Event -- @param #EVENT self
-- @param #EVENTDATA Event Event data table.
function EVENT:onEvent( Event ) function EVENT:onEvent( Event )
local ErrorHandler = function( errmsg ) local ErrorHandler = function( errmsg )
@@ -1287,7 +1303,7 @@ function EVENT:onEvent( Event )
Event = nil Event = nil
end end
--- The EVENTHANDLER structure --- The EVENTHANDLER structure.
-- @type EVENTHANDLER -- @type EVENTHANDLER
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
EVENTHANDLER = { EVENTHANDLER = {
@@ -1295,7 +1311,7 @@ EVENTHANDLER = {
ClassID = 0, ClassID = 0,
} }
--- The EVENTHANDLER constructor --- The EVENTHANDLER constructor.
-- @param #EVENTHANDLER self -- @param #EVENTHANDLER self
-- @return #EVENTHANDLER self -- @return #EVENTHANDLER self
function EVENTHANDLER:New() function EVENTHANDLER:New()

View File

@@ -525,7 +525,7 @@ end
--- Get unit from which we want to transmit a radio message. This has to be an aircraft for subtitles to work. --- Get unit from which we want to transmit a radio message. This has to be an aircraft for subtitles to work.
-- @param #RADIOQUEUE self -- @param #RADIOQUEUE self
-- @return Wrapper.Unit#UNIT Sending aircraft unit or nil if was not setup, is not an aircraft or is not alive. -- @return Wrapper.Unit#UNIT Sending unit or nil if was not setup, is not an aircraft or ground unit or is not alive.
function RADIOQUEUE:_GetRadioSender() function RADIOQUEUE:_GetRadioSender()
-- Check if we have a sending aircraft. -- Check if we have a sending aircraft.
@@ -538,7 +538,7 @@ function RADIOQUEUE:_GetRadioSender()
sender=UNIT:FindByName(self.sendername) sender=UNIT:FindByName(self.sendername)
-- Check that sender is alive and an aircraft. -- Check that sender is alive and an aircraft.
if sender and sender:IsAlive() and sender:IsAir() then if sender and sender:IsAlive() and (sender:IsAir() or sender:IsGround()) then
return sender return sender
end end

View File

@@ -341,7 +341,7 @@ do
-- @return #SPOT -- @return #SPOT
function SPOT:onafterLaseOff( From, Event, To ) function SPOT:onafterLaseOff( From, Event, To )
self:F( {"Stopped lasing for ", self.Target:GetName() , SpotIR = self.SportIR, SpotLaser = self.SpotLaser } ) self:F( {"Stopped lasing for ", self.Target and self.Target:GetName() or "coord", SpotIR = self.SportIR, SpotLaser = self.SpotLaser } )
self.Lasing = false self.Lasing = false

View File

@@ -693,7 +693,7 @@ ARTY.db={
--- Arty script version. --- Arty script version.
-- @field #string version -- @field #string version
ARTY.version="1.1.7" ARTY.version="1.1.8"
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@@ -2770,7 +2770,7 @@ function ARTY:onafterStatus(Controllable, From, Event, To)
-- FSM state. -- FSM state.
local fsmstate=self:GetState() local fsmstate=self:GetState()
self:I(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, ntot, nshells, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles)) self:T(self.lid..string.format("Status %s, Ammo total=%d: shells=%d [smoke=%d, illu=%d, nukes=%d*%.3f kT], rockets=%d, missiles=%d", fsmstate, ntot, nshells, self.Nsmoke, self.Nillu, self.Nukes, self.nukewarhead/1000000, nrockets, nmissiles))
if self.Controllable and self.Controllable:IsAlive() then if self.Controllable and self.Controllable:IsAlive() then
@@ -4814,7 +4814,8 @@ function ARTY:_CheckShootingStarted()
end end
-- Check if we waited long enough and no shot was fired. -- Check if we waited long enough and no shot was fired.
if dt > self.WaitForShotTime and self.Nshots==0 then --if dt > self.WaitForShotTime and self.Nshots==0 then
if dt > self.WaitForShotTime and (self.Nshots==0 or self.currentTarget.nshells >= self.Nshots) then --https://github.com/FlightControl-Master/MOOSE/issues/1356
-- Debug info. -- Debug info.
self:T(self.lid..string.format("%s, no shot event after %d seconds. Removing current target %s from list.", self.groupname, self.WaitForShotTime, name)) self:T(self.lid..string.format("%s, no shot event after %d seconds. Removing current target %s from list.", self.groupname, self.WaitForShotTime, name))

View File

@@ -7025,7 +7025,7 @@ function WAREHOUSE:_CheckRequestNow(request)
-- If no transport is requested, assets need to be mobile unless it is a self request. -- If no transport is requested, assets need to be mobile unless it is a self request.
local onlymobile=false local onlymobile=false
if type(request.transport)=="number" and request.ntransport==0 and not request.toself then if type(request.ntransport)=="number" and request.ntransport==0 and not request.toself then
onlymobile=true onlymobile=true
end end

View File

@@ -1273,17 +1273,19 @@ AIRBOSS.AircraftCarrier={
--- Carrier types. --- Carrier types.
-- @type AIRBOSS.CarrierType -- @type AIRBOSS.CarrierType
-- @field #string ROOSEVELT USS Theodore Roosevelt (CVN-71) -- @field #string ROOSEVELT USS Theodore Roosevelt (CVN-71) [Super Carrier Module]
-- @field #string LINCOLN USS Abraham Lincoln (CVN-72) -- @field #string LINCOLN USS Abraham Lincoln (CVN-72) [Super Carrier Module]
-- @field #string WASHINGTON USS George Washington (CVN-73) -- @field #string WASHINGTON USS George Washington (CVN-73) [Super Carrier Module]
-- @field #string STENNIS USS John C. Stennis (CVN-74) -- @field #string STENNIS USS John C. Stennis (CVN-74)
-- @field #string VINSON USS Carl Vinson (CVN-70) -- @field #string TRUMAN USS Harry S. Truman (CVN-75) [Super Carrier Module]
-- @field #string VINSON USS Carl Vinson (CVN-70) [Obsolete]
-- @field #string TARAWA USS Tarawa (LHA-1) -- @field #string TARAWA USS Tarawa (LHA-1)
-- @field #string KUZNETSOV Admiral Kuznetsov (CV 1143.5) -- @field #string KUZNETSOV Admiral Kuznetsov (CV 1143.5)
AIRBOSS.CarrierType={ AIRBOSS.CarrierType={
ROOSEVELT="CVN_71", ROOSEVELT="CVN_71",
LINCOLN="CVN_72", LINCOLN="CVN_72",
WASHINGTON="CVN_73", WASHINGTON="CVN_73",
TRUMAN="CVN_75",
STENNIS="Stennis", STENNIS="Stennis",
VINSON="VINSON", VINSON="VINSON",
TARAWA="LHA_Tarawa", TARAWA="LHA_Tarawa",
@@ -1941,6 +1943,8 @@ function AIRBOSS:New(carriername, alias)
self:_InitNimitz() self:_InitNimitz()
elseif self.carriertype==AIRBOSS.CarrierType.WASHINGTON then elseif self.carriertype==AIRBOSS.CarrierType.WASHINGTON then
self:_InitNimitz() self:_InitNimitz()
elseif self.carriertype==AIRBOSS.CarrierType.TRUMAN then
self:_InitNimitz()
elseif self.carriertype==AIRBOSS.CarrierType.VINSON then elseif self.carriertype==AIRBOSS.CarrierType.VINSON then
-- TODO: Carl Vinson parameters. -- TODO: Carl Vinson parameters.
self:_InitStennis() self:_InitStennis()
@@ -2464,7 +2468,7 @@ function AIRBOSS:AddRecoveryWindow(starttime, stoptime, case, holdingoffset, tur
local Tstart=UTILS.ClockToSeconds(starttime) local Tstart=UTILS.ClockToSeconds(starttime)
-- Set stop time. -- Set stop time.
local Tstop=UTILS.ClockToSeconds(stoptime or Tstart+90*60) local Tstop=stoptime and UTILS.ClockToSeconds(stoptime) or Tstart+90*60
-- Consistancy check for timing. -- Consistancy check for timing.
if Tstart>Tstop then if Tstart>Tstop then
@@ -7895,7 +7899,7 @@ end
function AIRBOSS:_RemoveUnitFromFlight(unit) function AIRBOSS:_RemoveUnitFromFlight(unit)
-- Check if unit exists. -- Check if unit exists.
if unit then if unit and unit:IsInstanceOf("UNIT") then
-- Get group. -- Get group.
local group=unit:GetGroup() local group=unit:GetGroup()
@@ -14048,10 +14052,10 @@ function AIRBOSS:_GetOnboardNumbers(group, playeronly)
-- Onboard number and unit name. -- Onboard number and unit name.
local n=tostring(unit.onboard_num) local n=tostring(unit.onboard_num)
local name=unit.name local name=unit.name
local skill=unit.skill local skill=unit.skill or "Unknown"
-- Debug text. -- Debug text.
text=text..string.format("\n- unit %s: onboard #=%s skill=%s", name, n, skill) text=text..string.format("\n- unit %s: onboard #=%s skill=%s", name, n, tostring(skill))
if playeronly and skill=="Client" or skill=="Player" then if playeronly and skill=="Client" or skill=="Player" then
-- There can be only one player in the group, so we skip everything else. -- There can be only one player in the group, so we skip everything else.

View File

@@ -1272,8 +1272,7 @@ function AIRBASE:GetRunwayData(magvar, mark)
name==AIRBASE.PersianGulf.Abu_Dhabi_International_Airport or name==AIRBASE.PersianGulf.Abu_Dhabi_International_Airport or
name==AIRBASE.PersianGulf.Dubai_Intl or name==AIRBASE.PersianGulf.Dubai_Intl or
name==AIRBASE.PersianGulf.Shiraz_International_Airport or name==AIRBASE.PersianGulf.Shiraz_International_Airport or
name==AIRBASE.PersianGulf.Kish_International_Airport name==AIRBASE.PersianGulf.Kish_International_Airport then
then
-- 1-->4, 2-->3, 3-->2, 4-->1 -- 1-->4, 2-->3, 3-->2, 4-->1
exception=1 exception=1
@@ -1290,13 +1289,14 @@ function AIRBASE:GetRunwayData(magvar, mark)
end end
--- Function returning the index of the runway coordinate belonding to the given index i.
local function f(i) local function f(i)
local j local j
if exception==1 then if exception==1 then
j=N-(i+1) -- 1-->4, 2-->3 j=N-(i-1) -- 1-->4, 2-->3
elseif exception==2 then elseif exception==2 then
@@ -1358,6 +1358,9 @@ function AIRBASE:GetRunwayData(magvar, mark)
-- Get the other spawn point coordinate. -- Get the other spawn point coordinate.
local j=f(i) local j=f(i)
-- Debug info.
--env.info(string.format("Runway i=%s j=%s (N=%d #runwaycoord=%d)", tostring(i), tostring(j), N, #runwaycoords))
-- Coordinates of the two runway points. -- Coordinates of the two runway points.
local c1=runwaycoords[i] --Core.Point#COORDINATE local c1=runwaycoords[i] --Core.Point#COORDINATE
local c2=runwaycoords[j] --Core.Point#COORDINATE local c2=runwaycoords[j] --Core.Point#COORDINATE

View File

@@ -2828,7 +2828,7 @@ function CONTROLLABLE:GetDetectedUnitSet(DetectVisual, DetectOptical, DetectRada
return unitset return unitset
end end
--- Return the detected target groups of the controllable as a @{SET_GROUP}. --- Return the detected target groups of the controllable as a @{Core.Set#SET_GROUP}.
-- The optional parametes specify the detection methods that can be applied. -- The optional parametes specify the detection methods that can be applied.
-- If no detection method is given, the detection will use all the available methods by default. -- If no detection method is given, the detection will use all the available methods by default.
-- @param Wrapper.Controllable#CONTROLLABLE self -- @param Wrapper.Controllable#CONTROLLABLE self

View File

@@ -2202,6 +2202,10 @@ function GROUP:IsAirborne(AllUnits)
if units then if units then
if AllUnits then
--- We want to know if ALL units are airborne.
for _,_unit in pairs(units) do for _,_unit in pairs(units) do
local unit=_unit --Wrapper.Unit#UNIT local unit=_unit --Wrapper.Unit#UNIT
@@ -2210,19 +2214,40 @@ function GROUP:IsAirborne(AllUnits)
-- Unit in air or not. -- Unit in air or not.
local inair=unit:InAir() local inair=unit:InAir()
-- Unit is not in air and we wanted to know whether ALL units are ==> return false -- At least one unit is not in air.
if inair==false and AllUnits==true then if not inair then
return false return false
end end
end
-- At least one unit is in are and we did not care which one. end
if inair==true and not AllUnits then
-- All units are in air.
return true
else
--- We want to know if ANY unit is airborne.
for _,_unit in pairs(units) do
local unit=_unit --Wrapper.Unit#UNIT
if unit then
-- Unit in air or not.
local inair=unit:InAir()
if inair then
-- At least one unit is in air.
return true return true
end end
end end
-- At least one unit is in the air.
return true -- No unit is in air.
return false
end
end end
end end

View File

@@ -1180,23 +1180,26 @@ do -- Event Handling
--- Subscribe to a DCS Event. --- Subscribe to a DCS Event.
-- @param #UNIT self -- @param #UNIT self
-- @param Core.Event#EVENTS Event -- @param Core.Event#EVENTS EventID Event ID.
-- @param #function EventFunction (optional) The function to be called when the event occurs for the unit. -- @param #function EventFunction (Optional) The function to be called when the event occurs for the unit.
-- @return #UNIT -- @return #UNIT self
function UNIT:HandleEvent( Event, EventFunction ) function UNIT:HandleEvent(EventID, EventFunction)
self:EventDispatcher():OnEventForUnit( self:GetName(), EventFunction, self, Event ) self:EventDispatcher():OnEventForUnit(self:GetName(), EventFunction, self, EventID)
return self return self
end end
--- UnSubscribe to a DCS event. --- UnSubscribe to a DCS event.
-- @param #UNIT self -- @param #UNIT self
-- @param Core.Event#EVENTS Event -- @param Core.Event#EVENTS EventID Event ID.
-- @return #UNIT -- @return #UNIT self
function UNIT:UnHandleEvent( Event ) function UNIT:UnHandleEvent(EventID)
self:EventDispatcher():RemoveForUnit( self:GetName(), self, Event ) --self:EventDispatcher():RemoveForUnit( self:GetName(), self, EventID )
-- Fixes issue #1365 https://github.com/FlightControl-Master/MOOSE/issues/1365
self:EventDispatcher():RemoveEvent(self, EventID)
return self return self
end end