diff --git a/gamemodes/zombiesurvival/gamemode/cl_init.lua b/gamemodes/zombiesurvival/gamemode/cl_init.lua index 1001aa7..5c66632 100644 --- a/gamemodes/zombiesurvival/gamemode/cl_init.lua +++ b/gamemodes/zombiesurvival/gamemode/cl_init.lua @@ -776,8 +776,18 @@ function GM:ZombieHUD() if obsmode ~= OBS_MODE_NONE then self:ZombieObserverHUD(obsmode) 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 + if pl == MySelf then + draw_SimpleTextBlur(translate.Get("you_will_be_next_boss_zombie"), "ZSHUDFont", x, y+th, COLOR_RED, TEXT_ALIGN_CENTER) + else + draw_SimpleTextBlur(translate.Format("x_will_be_next_boss_zombie", pl:Name()), "ZSHUDFont", x, y+th, COLOR_GRAY, TEXT_ALIGN_CENTER) + end + end if MySelf:GetZombieClassTable().NeverAlive then for _, ent in pairs(ents.FindByClass("prop_thrownbaby")) do if ent:GetSettled() then @@ -1632,6 +1642,10 @@ net.Receive("zs_legdamage", function(length) LocalPlayer().LegDamage = net.ReadFloat() end) +net.Receive("zs_nextboss", function(length) + GAMEMODE.NextBossZombie = net.ReadEntity() +end) + net.Receive("zs_zvols", function(length) local volunteers = {} local count = net.ReadUInt(8) diff --git a/gamemodes/zombiesurvival/gamemode/init.lua b/gamemodes/zombiesurvival/gamemode/init.lua index 2fd774d..dbd2fe3 100644 --- a/gamemodes/zombiesurvival/gamemode/init.lua +++ b/gamemodes/zombiesurvival/gamemode/init.lua @@ -379,6 +379,7 @@ function GM:AddNetworkStrings() util.AddNetworkString("zs_centernotify") util.AddNetworkString("zs_topnotify") util.AddNetworkString("zs_zvols") + util.AddNetworkString("zs_nextboss") util.AddNetworkString("zs_classunlock") util.AddNetworkString("zs_playerredeemed") @@ -829,22 +830,10 @@ local function BossZombieSort(a, b) return ascore > bscore end + function GM:SpawnBossZombie(bossplayer, silent) if not bossplayer then - 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) - bossplayer = zombies[1] + bossplayer = self:CalculateNextBoss() end if not bossplayer then return end @@ -899,9 +888,13 @@ function GM:Think() if self:GetWaveStart() <= time then gamemode.Call("SetWaveActive", true) 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 - self:SpawnBossZombie() + if self:GetWaveStart() - 10 <= time then + self:SpawnBossZombie() + else + self:CalculateNextBoss() + end end end end @@ -990,6 +983,29 @@ function GM:CalculateZombieVolunteers() 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) LAST_BITE = attacker end diff --git a/gamemodes/zombiesurvival/gamemode/languages/english.lua b/gamemodes/zombiesurvival/gamemode/languages/english.lua index 44d2f59..b36a4a0 100644 --- a/gamemodes/zombiesurvival/gamemode/languages/english.lua +++ b/gamemodes/zombiesurvival/gamemode/languages/english.lua @@ -103,6 +103,8 @@ LANGUAGE.intermission = "Intermission" LANGUAGE.press_f2_for_the_points_shop = "Press F2 for the Points Shop!" LANGUAGE.breath = "Breath" LANGUAGE.zombie_volunteers = "Zombie Volunteers" +LANGUAGE.x_will_be_next_boss_zombie = "%s will become a boss zombie soon!" +LANGUAGE.you_will_be_next_boss_zombie = "You will become a boss zombie soon!" 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.humans_closest_to_spawns_are_zombies = "The humans closest to the zombie spawns will start as zombies."