#ATC_GROUND

This commit is contained in:
Applevangelist 2023-11-23 17:00:54 +01:00
parent 1c1daa4ebe
commit 3e40d72e25

View File

@ -26,7 +26,8 @@
-- @module Functional.ATC_Ground -- @module Functional.ATC_Ground
-- @image Air_Traffic_Control_Ground_Operations.JPG -- @image Air_Traffic_Control_Ground_Operations.JPG
--- @type ATC_GROUND ---
-- @type ATC_GROUND
-- @field Core.Set#SET_CLIENT SetClient -- @field Core.Set#SET_CLIENT SetClient
-- @extends Core.Base#BASE -- @extends Core.Base#BASE
@ -39,7 +40,8 @@ ATC_GROUND = {
AirbaseNames = nil, AirbaseNames = nil,
} }
--- @type ATC_GROUND.AirbaseNames ---
-- @type ATC_GROUND.AirbaseNames
-- @list <#string> -- @list <#string>
@ -82,7 +84,7 @@ function ATC_GROUND:New( Airbases, AirbaseList )
end end
self.SetClient:ForEachClient( self.SetClient:ForEachClient(
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
function( Client ) function( Client )
Client:SetState( self, "Speeding", false ) Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0) Client:SetState( self, "Warnings", 0)
@ -246,11 +248,11 @@ function ATC_GROUND:SetMaximumKickSpeedMiph( MaximumKickSpeedMiph, Airbase )
return self return self
end end
--- @param #ATC_GROUND self -- @param #ATC_GROUND self
function ATC_GROUND:_AirbaseMonitor() function ATC_GROUND:_AirbaseMonitor()
self.SetClient:ForEachClient( self.SetClient:ForEachClient(
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
function( Client ) function( Client )
if Client:IsAlive() then if Client:IsAlive() then
@ -331,7 +333,7 @@ function ATC_GROUND:_AirbaseMonitor()
Client:SetState( self, "Warnings", SpeedingWarnings + 1 ) Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
else else
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll() MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
Client:Destroy() Client:Destroy()
Client:SetState( self, "Speeding", false ) Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0 ) Client:SetState( self, "Warnings", 0 )
@ -363,7 +365,7 @@ function ATC_GROUND:_AirbaseMonitor()
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 ) Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
else else
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll() MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
Client:Destroy() Client:Destroy()
Client:SetState( self, "IsOffRunway", false ) Client:SetState( self, "IsOffRunway", false )
Client:SetState( self, "OffRunwayWarnings", 0 ) Client:SetState( self, "OffRunwayWarnings", 0 )
@ -424,8 +426,15 @@ ATC_GROUND_UNIVERSAL = {
--- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map. --- Creates a new ATC\_GROUND\_UNIVERSAL object. This works on any map.
-- @param #ATC_GROUND_UNIVERSAL self -- @param #ATC_GROUND_UNIVERSAL self
-- @param AirbaseList (Optional) A table of Airbase Names. -- @param AirbaseList A table of Airbase Names. Leave empty to cover **all** airbases of the map.
-- @return #ATC_GROUND_UNIVERSAL self -- @return #ATC_GROUND_UNIVERSAL self
-- @usage
-- -- define monitoring for one airbase
-- local atc=ATC_GROUND_UNIVERSAL:New({AIRBASE.Syria.Gecitkale})
-- -- set kick speed
-- atc:SetKickSpeed(UTILS.KnotsToMps(20))
-- -- start monitoring evey 10 secs
-- atc:Start(10)
function ATC_GROUND_UNIVERSAL:New(AirbaseList) function ATC_GROUND_UNIVERSAL:New(AirbaseList)
-- Inherits from BASE -- Inherits from BASE
@ -440,6 +449,13 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
self.AirbaseList = AirbaseList self.AirbaseList = AirbaseList
if not self.AirbaseList then
self.AirbaseList = {}
for _name,_ in pairs(_DATABASE.AIRBASES) do
self.AirbaseList[_name]=_name
end
end
self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart() self.SetClient = SET_CLIENT:New():FilterCategories( "plane" ):FilterStart()
@ -460,8 +476,9 @@ function ATC_GROUND_UNIVERSAL:New(AirbaseList)
self.Airbases[AirbaseName].Monitor = true self.Airbases[AirbaseName].Monitor = true
end end
self.SetClient:ForEachClient( self.SetClient:ForEachClient(
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
function( Client ) function( Client )
Client:SetState( self, "Speeding", false ) Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0) Client:SetState( self, "Warnings", 0)
@ -681,7 +698,7 @@ end
function ATC_GROUND_UNIVERSAL:_AirbaseMonitor() function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
self.SetClient:ForEachClient( self.SetClient:ForEachClient(
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
function( Client ) function( Client )
if Client:IsAlive() then if Client:IsAlive() then
@ -766,7 +783,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
Client:SetState( self, "Warnings", SpeedingWarnings + 1 ) Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
else else
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll() MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
Client:Destroy() Client:Destroy()
Client:SetState( self, "Speeding", false ) Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0 ) Client:SetState( self, "Warnings", 0 )
@ -798,7 +815,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 ) Client:SetState( self, "OffRunwayWarnings", OffRunwayWarnings + 1 )
else else
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll() MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
--- @param Wrapper.Client#CLIENT Client -- @param Wrapper.Client#CLIENT Client
Client:Destroy() Client:Destroy()
Client:SetState( self, "IsOffRunway", false ) Client:SetState( self, "IsOffRunway", false )
Client:SetState( self, "OffRunwayWarnings", 0 ) Client:SetState( self, "OffRunwayWarnings", 0 )
@ -838,7 +855,7 @@ end
--- Start SCHEDULER for ATC_GROUND_UNIVERSAL object. --- Start SCHEDULER for ATC_GROUND_UNIVERSAL object.
-- @param #ATC_GROUND_UNIVERSAL self -- @param #ATC_GROUND_UNIVERSAL self
-- @param RepeatScanSeconds Time in second for defining occurency of alerts. -- @param RepeatScanSeconds Time in second for defining schedule of alerts.
-- @return #ATC_GROUND_UNIVERSAL self -- @return #ATC_GROUND_UNIVERSAL self
function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds ) function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds )
RepeatScanSeconds = RepeatScanSeconds or 0.05 RepeatScanSeconds = RepeatScanSeconds or 0.05
@ -846,7 +863,8 @@ function ATC_GROUND_UNIVERSAL:Start( RepeatScanSeconds )
return self return self
end end
--- @type ATC_GROUND_CAUCASUS ---
-- @type ATC_GROUND_CAUCASUS
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
--- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL} --- # ATC\_GROUND\_CAUCASUS, extends @{#ATC_GROUND_UNIVERSAL}
@ -985,8 +1003,8 @@ function ATC_GROUND_CAUCASUS:Start( RepeatScanSeconds )
end end
---
--- @type ATC_GROUND_NEVADA -- @type ATC_GROUND_NEVADA
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
@ -1123,8 +1141,8 @@ function ATC_GROUND_NEVADA:Start( RepeatScanSeconds )
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds ) self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
end end
---
--- @type ATC_GROUND_NORMANDY -- @type ATC_GROUND_NORMANDY
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
@ -1280,7 +1298,8 @@ function ATC_GROUND_NORMANDY:Start( RepeatScanSeconds )
self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds ) self.AirbaseMonitor = SCHEDULER:New( self, self._AirbaseMonitor, { self }, 0, 2, RepeatScanSeconds )
end end
--- @type ATC_GROUND_PERSIANGULF ---
-- @type ATC_GROUND_PERSIANGULF
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
@ -1423,7 +1442,7 @@ function ATC_GROUND_PERSIANGULF:Start( RepeatScanSeconds )
end end
--- @type ATC_GROUND_MARIANAISLANDS -- @type ATC_GROUND_MARIANAISLANDS
-- @extends #ATC_GROUND -- @extends #ATC_GROUND
@ -1517,7 +1536,7 @@ end
-- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour. -- * @{#ATC_GROUND.SetMaximumKickSpeedKmph}(): Set the maximum speed allowed at an airbase in kilometers per hour.
-- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour. -- * @{#ATC_GROUND.SetMaximumKickSpeedMiph}(): Set the maximum speed allowed at an airbase in miles per hour.
-- --
---- @field #ATC_GROUND_MARIANAISLANDS -- @field #ATC_GROUND_MARIANAISLANDS
ATC_GROUND_MARIANAISLANDS = { ATC_GROUND_MARIANAISLANDS = {
ClassName = "ATC_GROUND_MARIANAISLANDS", ClassName = "ATC_GROUND_MARIANAISLANDS",
} }
@ -1529,7 +1548,7 @@ ATC_GROUND_MARIANAISLANDS = {
function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames ) function ATC_GROUND_MARIANAISLANDS:New( AirbaseNames )
-- Inherits from BASE -- Inherits from BASE
local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( self.Airbases, AirbaseNames ) ) local self = BASE:Inherit( self, ATC_GROUND_UNIVERSAL:New( AirbaseNames ) )
self:SetKickSpeedKmph( 50 ) self:SetKickSpeedKmph( 50 )
self:SetMaximumKickSpeedKmph( 150 ) self:SetMaximumKickSpeedKmph( 150 )