Skip to content

Commit

Permalink
Entity:IsVehicle returns true on Glide vehicles
Browse files Browse the repository at this point in the history
  • Loading branch information
StyledStrike committed Dec 27, 2024
1 parent 6967ce6 commit 0510d6e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lua/autorun/sh_glide.lua
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,17 @@ do
end
end

hook.Add( "Initialize", "Glide.OverrideIsVehicle", function()
local VehicleMeta = FindMetaTable( "Entity" )
local IsVehicle = VehicleMeta.IsVehicle

--- Override `Entity:IsVehicle` to return `true` on Glide vehicles.
--- Also keep compatibility with Simfphys.
function VehicleMeta:IsVehicle()
return ( self.IsSimfphyscar and self:IsSimfphyscar() ) or self.IsGlideVehicle or IsVehicle( self )
end
end )

local function IncludeDir( dirPath, doInclude, doTransfer )
local files = file.Find( dirPath .. "*.lua", "LUA" )
local path
Expand Down

0 comments on commit 0510d6e

Please sign in to comment.