From 442f46a3f75d6e4bdd9a6c6f16b887d6a8d2fd25 Mon Sep 17 00:00:00 2001 From: JetBoom Date: Tue, 4 Nov 2014 15:41:19 -0500 Subject: [PATCH] Fixed logic_pickups not restarting on round change. Fixed logic_pickups not restarting on round change. Fixed rare heal dart Lua error. Fixed zombie class unlock messages being wrong on some maps (moved messages to server side). --- .../entities/projectile_healdart/init.lua | 3 ++- gamemodes/zombiesurvival/gamemode/cl_init.lua | 15 +++-------- gamemodes/zombiesurvival/gamemode/init.lua | 25 +++++++++++++++++++ 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/gamemodes/zombiesurvival/entities/entities/projectile_healdart/init.lua b/gamemodes/zombiesurvival/entities/entities/projectile_healdart/init.lua index 624a424..a641336 100644 --- a/gamemodes/zombiesurvival/entities/entities/projectile_healdart/init.lua +++ b/gamemodes/zombiesurvival/entities/entities/projectile_healdart/init.lua @@ -54,7 +54,8 @@ function ENT:Explode(vHitPos, vHitNormal, eHitEntity, vOldVelocity) self:AddEFlags(EFL_SETTING_UP_BONES) local followed = false - if eHitEntity:GetBoneCount() > 1 then + local bonecount = eHitEntity:GetBoneCount() + if bonecount and bonecount > 1 then local boneindex = eHitEntity:NearestBone(vHitPos) if boneindex and boneindex > 0 then self:FollowBone(eHitEntity, boneindex) diff --git a/gamemodes/zombiesurvival/gamemode/cl_init.lua b/gamemodes/zombiesurvival/gamemode/cl_init.lua index 0b0eb50..39b333e 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_init.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_init.lua @@ -1700,23 +1700,16 @@ net.Receive("zs_wavestart", function(length) GAMEMODE:CenterNotify({killicon = "default"}, {font = "ZSHUDFont"}, " ", COLOR_RED, translate.Get("final_wave"), {killicon = "default"}) GAMEMODE:CenterNotify(translate.Get("final_wave_sub")) else - local UnlockedClasses = {} - for i, tab in ipairs(GAMEMODE.ZombieClasses) do - if tab.Wave <= wave and not tab.Unlocked then - tab.Unlocked = true - UnlockedClasses[#UnlockedClasses + 1] = translate.Get(tab.TranslationName) - end - end - GAMEMODE:CenterNotify({killicon = "default"}, {font = "ZSHUDFont"}, " ", COLOR_RED, translate.Format("wave_x_has_begun", wave), {killicon = "default"}) - if #UnlockedClasses > 0 then - GAMEMODE:CenterNotify(COLOR_GREEN, translate.Format("x_unlocked", string.AndSeparate(UnlockedClasses))) - end end surface_PlaySound("ambient/creatures/town_zombie_call1.wav") end) +net.Receive("zs_classunlock", function(length) + GAMEMODE:CenterNotify(COLOR_GREEN, net.ReadString()) +end) + net.Receive("zs_waveend", function(length) local wave = net.ReadInt(16) local time = net.ReadFloat() diff --git a/gamemodes/zombiesurvival/gamemode/init.lua b/gamemodes/zombiesurvival/gamemode/init.lua index 21984a7..673afa9 100644 --- a/gamemodes/zombiesurvival/gamemode/init.lua +++ b/gamemodes/zombiesurvival/gamemode/init.lua @@ -377,6 +377,7 @@ function GM:AddNetworkStrings() util.AddNetworkString("zs_centernotify") util.AddNetworkString("zs_topnotify") util.AddNetworkString("zs_zvols") + util.AddNetworkString("zs_classunlock") util.AddNetworkString("zs_playerredeemed") util.AddNetworkString("zs_dohulls") @@ -1231,6 +1232,16 @@ function GM:RestartLua() self.LastBossZombieSpawned = nil self.UseSigils = nil + -- logic_pickups + self.MaxWeaponPickups = nil + self.MaxAmmoPickups = nil + self.MaxFlashlightPickups = nil + self.WeaponRequiredForAmmo = nil + for _, pl in pairs(player.GetAll()) do + pl.AmmoPickups = nil + pl.WeaponPickups = nil + end + self.OverrideEndSlomo = nil if type(GetGlobalBool("endcamera", 1)) ~= "number" then SetGlobalBool("endcamera", nil) @@ -3523,6 +3534,7 @@ end function GM:SetWave(wave) local previouslylocked = {} + local UnlockedClasses = {} for i, classtab in ipairs(GAMEMODE.ZombieClasses) do if not gamemode.Call("IsClassUnlocked", classid) then previouslylocked[i] = true @@ -3533,6 +3545,7 @@ function GM:SetWave(wave) for classid in pairs(previouslylocked) do if gamemode.Call("IsClassUnlocked", classid) then + table.insert(UnlockedClasses, classid) for _, ent in pairs(ents.FindByClass("logic_classunlock")) do local classname = GAMEMODE.ZombieClasses[classid].Name if ent.Class == string.lower(classname) then @@ -3541,6 +3554,18 @@ function GM:SetWave(wave) end end end + + if #UnlockedClasses > 0 then + for _, pl in pairs(player.GetAll()) do + local classnames = {} + for __, classid in pairs(UnlockedClasses) do + table.insert(classnames, translate.ClientGet(pl, self.ZombieClasses[classid].TranslationName)) + end + net.Start("zs_classunlock") + net.WriteString(string.AndSeparate(classnames)) + net.Send(pl) + end + end end GM.NextEscapeDamage = 0