Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/entities/base_glide/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ do

if blocked then
-- We're cooked...
pos = seat:GetPos()
pos = cvars.Bool( "glide_always_exit_vehicle", true ) and seat:GetPos() or false
else
-- Put the exit position on the ground
traceData.start = pos
Expand Down
29 changes: 28 additions & 1 deletion lua/glide/server/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,33 @@ hook.Add( "PlayerEnteredVehicle", "Glide.OnEnterSeat", function( ply, seat )
hook.Run( "Glide_OnEnterVehicle", ply, parent, seatIndex )
end )

local always_exit_vehicle = CreateConVar( "glide_always_exit_vehicle", "1", { FCVAR_ARCHIVE, FCVAR_REPLICATED }, "If this option is enabled, players always exit GLide vehicles at the most appropriate exit point, even if it is considered 'blocked.'" )
hook.Add( "CanExitVehicle", "Glide.CheckExitVehicle", function( seat, ply )
if not ply.IsUsingGlideVehicle then return end
if always_exit_vehicle:GetBool() then return end

local seatIndex = seat.GlideSeatIndex
if not seatIndex then return end

local vehicle = seat:GetParent()
if not IsValid( vehicle ) then return end
if not vehicle.IsGlideVehicle then return end

local exitPos = vehicle:GetSeatExitPos( seatIndex )
if not exitPos then
Glide.SendNotification( ply, {
text = "#glide.notify.exit_blocked",
icon = "materials/glide/icons/locked.png",
sound = "glide/ui/radar_alert.wav",
immediate = true
} )

return false
end

ply.exitPosGlide = exitPos
end )

-- Once a player leaves a Glide vehicle, cleanup network variables
-- and trigger the `Glide_OnExitVehicle` hook.
hook.Add( "PlayerLeaveVehicle", "Glide.OnExitSeat", function( ply, seat )
Expand All @@ -80,7 +107,7 @@ hook.Add( "PlayerLeaveVehicle", "Glide.OnExitSeat", function( ply, seat )
ply:SetAllowWeaponsInVehicle( false )

if IsValid( vehicle ) then
ply:SetPos( vehicle:GetSeatExitPos( seatIndex ) )
ply:SetPos( not always_exit_vehicle:GetBool() and istable( ply.exitPosGlide ) and ply.exitPosGlide or vehicle:GetSeatExitPos( seatIndex ) )
ply:SetVelocity( vehicle:GetPhysicsObject():GetVelocity() )
ply:SetEyeAngles( Angle( 0, vehicle:GetAngles().y, 0 ) )
end
Expand Down
1 change: 1 addition & 0 deletions resource/localization/en/glide_vehicles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ glide.swep.homing_launcher.desc=Hold right mouse to lock on Glide vehicles.

# Notifications

glide.notify.exit_blocked=You cannot exit the vehicle because the exit is blocked!
glide.notify.lock_denied=You do not have permission to lock/unlock this vehicle.
glide.notify.vehicle_locked=This vehicle has been locked, only the vehicle creator and friends can enter it.
glide.notify.vehicle_unlocked=This vehicle has been unlocked, anyone can enter it.
Expand Down
1 change: 1 addition & 0 deletions resource/localization/es-es/glide_vehicles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ glide.swep.homing_launcher.desc=Mantén presionado el botón derecho del ratón

# Notificaciones

glide.notify.exit_blocked=No puedes salir del vehículo porque la salida está bloqueada.
glide.notify.lock_denied=No tienes permiso para bloquear/desbloquear este vehículo.
glide.notify.vehicle_locked=Este vehículo ha sido bloqueado, solo el creador del vehículo y sus amigos pueden entrar.
glide.notify.vehicle_unlocked=Este vehículo ha sido desbloqueado, cualquiera puede entrar.
Expand Down
1 change: 1 addition & 0 deletions resource/localization/fr/glide_vehicles.properties
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ glide.swep.homing_launcher.desc=Maintenez le clic droit pour verrouiller les vé

# Notifications

glide.notify.exit_blocked=Vous ne pouvez pas sortir du véhicule car la sortie est bloquée !
glide.notify.lock_denied=Vous n'avez pas la permission de verrouiller/déverrouiller ce véhicule.
glide.notify.vehicle_locked=Ce véhicule a été verrouillé, seuls le créateur et ses amis peuvent y entrer.
glide.notify.vehicle_unlocked=Ce véhicule a été déverrouillé, tout le monde peut y entrer.
Expand Down
Loading