Added HUD display to show who will become a boss.

Shows to any Zombie as they are waiting for a new wave to start.

(Need new translations for this)
This commit is contained in:
Ben 2015-02-04 01:50:25 +00:00
parent 1e089a84e3
commit 69a4e5a03d
3 changed files with 45 additions and 18 deletions

View file

@ -776,8 +776,14 @@ function GM:ZombieHUD()
if obsmode ~= OBS_MODE_NONE then if obsmode ~= OBS_MODE_NONE then
self:ZombieObserverHUD(obsmode) self:ZombieObserverHUD(obsmode)
elseif not self:GetWaveActive() and not MySelf:Alive() then elseif not self:GetWaveActive() and not MySelf:Alive() then
draw_SimpleTextBlur(translate.Get("waiting_for_next_wave"), "ZSHUDFont", ScrW() * 0.5, ScrH() * 0.3, COLOR_DARKRED, TEXT_ALIGN_CENTER) local th = draw_GetFontHeight("ZSHUDFont")
local x = ScrW() * 0.5
local y = ScrH() * 0.3
draw_SimpleTextBlur(translate.Get("waiting_for_next_wave"), "ZSHUDFont", x, y, COLOR_DARKRED, TEXT_ALIGN_CENTER)
local pl = GAMEMODE.NextBossZombie
if pl and pl:IsValid() then
draw_SimpleTextBlur(translate.Format("x_will_be_next_boss_zombie", pl:Name()), "ZSHUDFont", x, y+th, pl == MySelf and COLOR_RED or COLOR_GREY, TEXT_ALIGN_CENTER)
end
if MySelf:GetZombieClassTable().NeverAlive then if MySelf:GetZombieClassTable().NeverAlive then
for _, ent in pairs(ents.FindByClass("prop_thrownbaby")) do for _, ent in pairs(ents.FindByClass("prop_thrownbaby")) do
if ent:GetSettled() then if ent:GetSettled() then
@ -1632,6 +1638,10 @@ net.Receive("zs_legdamage", function(length)
LocalPlayer().LegDamage = net.ReadFloat() LocalPlayer().LegDamage = net.ReadFloat()
end) end)
net.Receive("zs_nextboss", function(length)
GAMEMODE.NextBossZombie = net.ReadEntity()
end)
net.Receive("zs_zvols", function(length) net.Receive("zs_zvols", function(length)
local volunteers = {} local volunteers = {}
local count = net.ReadUInt(8) local count = net.ReadUInt(8)

View file

@ -379,6 +379,7 @@ function GM:AddNetworkStrings()
util.AddNetworkString("zs_centernotify") util.AddNetworkString("zs_centernotify")
util.AddNetworkString("zs_topnotify") util.AddNetworkString("zs_topnotify")
util.AddNetworkString("zs_zvols") util.AddNetworkString("zs_zvols")
util.AddNetworkString("zs_nextboss")
util.AddNetworkString("zs_classunlock") util.AddNetworkString("zs_classunlock")
util.AddNetworkString("zs_playerredeemed") util.AddNetworkString("zs_playerredeemed")
@ -829,22 +830,10 @@ local function BossZombieSort(a, b)
return ascore > bscore return ascore > bscore
end end
function GM:SpawnBossZombie(bossplayer, silent) function GM:SpawnBossZombie(bossplayer, silent)
if not bossplayer then if not bossplayer then
local livingbosses = 0 bossplayer = self:CalculateNextBoss()
local zombies = {}
for _, ent in pairs(team.GetPlayers(TEAM_UNDEAD)) do
if ent:GetZombieClassTable().Boss and ent:Alive() then
livingbosses = livingbosses + 1
if livingbosses >= 3 then return end
else
if ent:GetInfo("zs_nobosspick") == "0" then
table.insert(zombies, ent)
end
end
end
table.sort(zombies, BossZombieSort)
bossplayer = zombies[1]
end end
if not bossplayer then return end if not bossplayer then return end
@ -899,9 +888,13 @@ function GM:Think()
if self:GetWaveStart() <= time then if self:GetWaveStart() <= time then
gamemode.Call("SetWaveActive", true) gamemode.Call("SetWaveActive", true)
elseif self.BossZombies and not self.PantsMode and not self:IsClassicMode() and not self.ZombieEscape elseif self.BossZombies and not self.PantsMode and not self:IsClassicMode() and not self.ZombieEscape
and self.LastBossZombieSpawned ~= wave and wave > 0 and self:GetWaveStart() - 10 <= time and not self.RoundEnded and self.LastBossZombieSpawned ~= wave and wave > 0 and not self.RoundEnded
and (self.BossZombiePlayersRequired <= 0 or #player.GetAll() >= self.BossZombiePlayersRequired) then and (self.BossZombiePlayersRequired <= 0 or #player.GetAll() >= self.BossZombiePlayersRequired) then
if self:GetWaveStart() - 10 <= time then
self:SpawnBossZombie() self:SpawnBossZombie()
else
self:CalculateNextBoss()
end
end end
end end
end end
@ -990,6 +983,29 @@ function GM:CalculateZombieVolunteers()
end end
end end
function GM:CalculateNextBoss()
local livingbosses = 0
local zombies = {}
for _, ent in pairs(team.GetPlayers(TEAM_UNDEAD)) do
if ent:GetZombieClassTable().Boss and ent:Alive() then
livingbosses = livingbosses + 1
if livingbosses >= 3 then return end
else
if ent:GetInfo("zs_nobosspick") == "0" then
table.insert(zombies, ent)
end
end
end
table.sort(zombies, BossZombieSort)
local newboss = zombies[1]
if not newboss or newboss ~= GAMEMODE.NextBossZombie then
net.Start("zs_nextboss")
net.WriteEntity(newboss)
net.Broadcast()
end
return newboss
end
function GM:LastBite(victim, attacker) function GM:LastBite(victim, attacker)
LAST_BITE = attacker LAST_BITE = attacker
end end

View file

@ -103,6 +103,7 @@ LANGUAGE.intermission = "Intermission"
LANGUAGE.press_f2_for_the_points_shop = "Press F2 for the Points Shop!" LANGUAGE.press_f2_for_the_points_shop = "Press F2 for the Points Shop!"
LANGUAGE.breath = "Breath" LANGUAGE.breath = "Breath"
LANGUAGE.zombie_volunteers = "Zombie Volunteers" LANGUAGE.zombie_volunteers = "Zombie Volunteers"
LANGUAGE.x_will_be_next_boss_zombie = "%s will become a boss zombie soon!"
LANGUAGE.x_discount_for_buying_between_waves = "%d%% discount for buying between waves!" LANGUAGE.x_discount_for_buying_between_waves = "%d%% discount for buying between waves!"
LANGUAGE.number_of_initial_zombies_this_game = "Number of initial zombies this game (%d%%): %d" LANGUAGE.number_of_initial_zombies_this_game = "Number of initial zombies this game (%d%%): %d"
LANGUAGE.humans_closest_to_spawns_are_zombies = "The humans closest to the zombie spawns will start as zombies." LANGUAGE.humans_closest_to_spawns_are_zombies = "The humans closest to the zombie spawns will start as zombies."