Skip to content

Commit

Permalink
GetInternalVariable instead of GetSaveTable
Browse files Browse the repository at this point in the history
Use GetInternalVariable instead of GetSaveTable for performance reasons
  • Loading branch information
Winkarst-cpu committed Jun 14, 2024
1 parent 8aa8c9b commit 18da0a0
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions gamemode/core/meta/sh_entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,9 @@ if (SERVER) then
-- (e.g not a button or door)
function meta:IsLocked()
if (self:IsVehicle()) then
local datatable = self:GetSaveTable()

if (datatable) then
return datatable.VehicleLocked
end
return self:GetInternalVariable("VehicleLocked")
else
local datatable = self:GetSaveTable()

if (datatable) then
return datatable.m_bLocked
end
return self:GetInternalVariable("m_bLocked")
end

return false
Expand All @@ -71,9 +63,7 @@ if (SERVER) then
-- @treturn[1] Entity Entity that is blocking this door
-- @treturn[2] nil If this entity is not a door, or there is no blocking entity
function meta:GetBlocker()
local datatable = self:GetSaveTable()

return datatable.pBlocker
return self:GetInternalVariable("pBlocker")
end

--- Blasts a door off its hinges. Internally, this hides the door entity, spawns a physics prop with the same model, and
Expand Down

0 comments on commit 18da0a0

Please sign in to comment.