From 764bb94570fddfa5b6876339d31163d4ef21bc98 Mon Sep 17 00:00:00 2001 From: YUCLing Date: Tue, 12 Jul 2022 18:33:47 +0800 Subject: [PATCH] fix: stackoverflow when hot-reloading --- gamemodes/zombiesurvival/gamemode/obj_entity_extend_sv.lua | 2 +- gamemodes/zombiesurvival/gamemode/obj_player_extend.lua | 2 +- gamemodes/zombiesurvival/gamemode/obj_player_extend_cl.lua | 2 +- gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gamemodes/zombiesurvival/gamemode/obj_entity_extend_sv.lua b/gamemodes/zombiesurvival/gamemode/obj_entity_extend_sv.lua index 501436e..d502d8d 100644 --- a/gamemodes/zombiesurvival/gamemode/obj_entity_extend_sv.lua +++ b/gamemodes/zombiesurvival/gamemode/obj_entity_extend_sv.lua @@ -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 diff --git a/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua b/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua index eec6fe9..dfbbd4e 100644 --- a/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua +++ b/gamemodes/zombiesurvival/gamemode/obj_player_extend.lua @@ -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 diff --git a/gamemodes/zombiesurvival/gamemode/obj_player_extend_cl.lua b/gamemodes/zombiesurvival/gamemode/obj_player_extend_cl.lua index ce4f644..b32fb0e 100644 --- a/gamemodes/zombiesurvival/gamemode/obj_player_extend_cl.lua +++ b/gamemodes/zombiesurvival/gamemode/obj_player_extend_cl.lua @@ -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 diff --git a/gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua b/gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua index 533a1c0..fd75f30 100644 --- a/gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua +++ b/gamemodes/zombiesurvival/gamemode/obj_player_extend_sv.lua @@ -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)