fix: stackoverflow when hot-reloading
This commit is contained in:
parent
7d92caf327
commit
764bb94570
4 changed files with 6 additions and 6 deletions
|
@ -361,7 +361,7 @@ function meta:ResetLastBarricadeAttacker(attacker, dmginfo)
|
|||
end
|
||||
end
|
||||
|
||||
meta.OldSetPhysicsAttacker = meta.SetPhysicsAttacker
|
||||
meta.OldSetPhysicsAttacker = meta.OldSetPhysicsAttacker or meta.SetPhysicsAttacker
|
||||
function meta:SetPhysicsAttacker(ent)
|
||||
if string.sub(self:GetClass(), 1, 12) == "func_physbox" and ent:IsValid() then
|
||||
self.PBAttacker = ent
|
||||
|
|
|
@ -665,7 +665,7 @@ function meta:ShouldNotCollide(ent)
|
|||
return false
|
||||
end
|
||||
|
||||
meta.OldSetHealth = FindMetaTable("Entity").SetHealth
|
||||
meta.OldSetHealth = meta.OldSetHealth or FindMetaTable("Entity").SetHealth
|
||||
function meta:SetHealth(health)
|
||||
self:OldSetHealth(health)
|
||||
if P_Team(self) == TEAM_HUMAN and 1 <= health then
|
||||
|
|
|
@ -75,7 +75,7 @@ function meta:SetMaxHealth(num)
|
|||
self:SetDTInt(0, math.ceil(num))
|
||||
end
|
||||
|
||||
meta.OldGetMaxHealth = FindMetaTable("Entity").GetMaxHealth
|
||||
meta.OldGetMaxHealth = meta.OldGetMaxHealth or FindMetaTable("Entity").GetMaxHealth
|
||||
function meta:GetMaxHealth()
|
||||
return self:GetDTInt(0)
|
||||
end
|
||||
|
|
|
@ -808,7 +808,7 @@ local function SetModel(pl, mdl)
|
|||
end
|
||||
end
|
||||
|
||||
meta.OldCreateRagdoll = meta.CreateRagdoll
|
||||
meta.OldCreateRagdoll = meta.OldCreateRagdoll or meta.CreateRagdoll
|
||||
function meta:CreateRagdoll()
|
||||
local status = self.status_overridemodel
|
||||
if status and status:IsValid() then
|
||||
|
@ -974,7 +974,7 @@ function meta:Resupply(owner, obj)
|
|||
end
|
||||
|
||||
-- Lets other players know about our maximum health.
|
||||
meta.OldSetMaxHealth = FindMetaTable("Entity").SetMaxHealth
|
||||
meta.OldSetMaxHealth = meta.OldSetMaxHealth or FindMetaTable("Entity").SetMaxHealth
|
||||
function meta:SetMaxHealth(num)
|
||||
num = math.ceil(num)
|
||||
self:SetDTInt(0, num)
|
||||
|
@ -1462,7 +1462,7 @@ function meta:SetLastAttacker(ent)
|
|||
end
|
||||
end
|
||||
|
||||
meta.OldUnSpectate = meta.UnSpectate
|
||||
meta.OldUnSpectate = meta.OldUnSpectate or meta.UnSpectate
|
||||
function meta:UnSpectate()
|
||||
if self:GetObserverMode() ~= OBS_MODE_NONE then
|
||||
self:OldUnSpectate(obsm)
|
||||
|
|
Loading…
Reference in a new issue