#ATC_Ground - stop kicking players immediately for speeding

This commit is contained in:
Applevangelist 2024-10-29 11:37:06 +01:00
parent 216ea230a8
commit 2fb460c4bb

View File

@ -18,7 +18,7 @@
-- ### Author: FlightControl - Framework Design & Programming -- ### Author: FlightControl - Framework Design & Programming
-- ### Refactoring to use the Runway auto-detection: Applevangelist -- ### Refactoring to use the Runway auto-detection: Applevangelist
-- @date August 2022 -- @date August 2022
-- Last Update Nov 2023 -- Last Update Oct 2024
-- --
-- === -- ===
-- --
@ -721,14 +721,18 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
if NotInRunwayZone then if NotInRunwayZone then
local Taxi = Client:GetState( self, "Taxi" )
if IsOnGround then if IsOnGround then
local Taxi = Client:GetState( self, "Taxi" )
self:T( Taxi ) self:T( Taxi )
if Taxi == false then if Taxi == false then
local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed ) local Velocity = VELOCITY:New( AirbaseMeta.KickSpeed or self.KickSpeed )
Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " .. Client:Message( "Welcome to " .. AirbaseID .. ". The maximum taxiing speed is " ..
Velocity:ToString() , 20, "ATC" ) Velocity:ToString() , 20, "ATC" )
Client:SetState( self, "Taxi", true ) Client:SetState( self, "Taxi", true )
Client:SetState( self, "Speeding", false )
Client:SetState( self, "Warnings", 0 )
end end
-- TODO: GetVelocityKMH function usage -- TODO: GetVelocityKMH function usage
@ -737,7 +741,7 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
local IsAboveRunway = Client:IsAboveRunway() local IsAboveRunway = Client:IsAboveRunway()
self:T( {IsAboveRunway, IsOnGround, Velocity:Get() }) self:T( {IsAboveRunway, IsOnGround, Velocity:Get() })
if IsOnGround then if IsOnGround and not Taxi then
local Speeding = false local Speeding = false
if AirbaseMeta.MaximumKickSpeed then if AirbaseMeta.MaximumKickSpeed then
if Velocity:Get() > AirbaseMeta.MaximumKickSpeed then if Velocity:Get() > AirbaseMeta.MaximumKickSpeed then
@ -749,15 +753,17 @@ function ATC_GROUND_UNIVERSAL:_AirbaseMonitor()
end end
end end
if Speeding == true then if Speeding == true then
MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() .. --MESSAGE:New( "Penalty! Player " .. Client:GetPlayerName() ..
" has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll() -- " has been kicked, due to a severe airbase traffic rule violation ...", 10, "ATC" ):ToAll()
Client:Destroy() --Client:Destroy()
Client:SetState( self, "Speeding", false ) Client:SetState( self, "Speeding", true )
Client:SetState( self, "Warnings", 0 ) local SpeedingWarnings = Client:GetState( self, "Warnings" )
Client:SetState( self, "Warnings", SpeedingWarnings + 1 )
Client:Message( "Warning " .. SpeedingWarnings .. "/3! Airbase traffic rule violation! Slow down now! Your speed is " ..
Velocity:ToString(), 5, "ATC" )
end end
end end
if IsOnGround then if IsOnGround then
local Speeding = false local Speeding = false