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).
This commit is contained in:
JetBoom 2014-11-04 15:41:19 -05:00
parent e9bd9ce748
commit 442f46a3f7
3 changed files with 31 additions and 12 deletions

View file

@ -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)

View file

@ -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()

View file

@ -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