diff --git a/gamemode/cl_hud.lua b/gamemode/cl_hud.lua index 622e1bb..b92fab4 100644 --- a/gamemode/cl_hud.lua +++ b/gamemode/cl_hud.lua @@ -321,7 +321,7 @@ end function GM:DrawRoundTimer() if self:GetGameState() == 1 then - local time = math.ceil(5 - self:GetStateRunningTime()) + local time = math.ceil(GetGlobalInt( "mb_time_prep" ) - self:GetStateRunningTime()) if time > 0 then draw.ShadowText(time, "RobotoHUD-40", ScrW() / 2, ScrH() / 3, color_white, 1, 1) end diff --git a/gamemode/cl_rounds.lua b/gamemode/cl_rounds.lua index d449f60..2f8e2fd 100644 --- a/gamemode/cl_rounds.lua +++ b/gamemode/cl_rounds.lua @@ -19,7 +19,6 @@ net.Receive("gamestate", function (len) GAMEMODE.GameState = net.ReadUInt(32) GAMEMODE.StateStart = net.ReadDouble() - if GAMEMODE.GameState == 0 then GAMEMODE:ScoreboardHide() elseif GAMEMODE.GameState == 1 then diff --git a/gamemode/init.lua b/gamemode/init.lua index 2d1798b..5637ae5 100644 --- a/gamemode/init.lua +++ b/gamemode/init.lua @@ -42,6 +42,8 @@ resource.AddFile("materials/melonbomber/skull_license.txt") GM.MapScale = CreateConVar("mb_map_scale", 20, bit.bor(FCVAR_NOTIFY), "Size of map squared per player (default 20)" ) GM.MapMaxArea = CreateConVar("mb_map_maxarea", 500, bit.bor(FCVAR_NOTIFY), "Max area of map squared" ) +GM.PrepTime = CreateConVar("mb_time_prep", 5, bit.bor(FCVAR_REPLICATED), "Time to wait before round starts (default 5)" ) +GM.EndTime = CreateConVar("mb_time_end", 10, bit.bor(FCVAR_REPLICATED), "Time to show scoreboard at the end (default 10)" ) function GM:Initialize() self.DeathRagdolls = {} @@ -158,4 +160,4 @@ end function GM:ShowHelp(ply) net.Start("mb_openhelpmenu") net.Send(ply) -end \ No newline at end of file +end diff --git a/gamemode/sv_player.lua b/gamemode/sv_player.lua index 43200d7..ca03873 100644 --- a/gamemode/sv_player.lua +++ b/gamemode/sv_player.lua @@ -7,6 +7,9 @@ function GM:PlayerInitialSpawn(ply) ply:SetMoney(10000) ply:SetTeam(2) + + -- ConVar replication doesn't work with gmod currently + SetGlobalInt("mb_time_prep", GetConVarNumber("mb_time_prep")) if self:GetGameState() != 0 then timer.Simple(0, function () diff --git a/gamemode/sv_rounds.lua b/gamemode/sv_rounds.lua index eb4e11d..a8b4556 100644 --- a/gamemode/sv_rounds.lua +++ b/gamemode/sv_rounds.lua @@ -177,13 +177,13 @@ function GM:RoundsThink() self:SetupRound() end elseif self:GetGameState() == 1 then - if self:GetStateRunningTime() > 5 then + if self:GetStateRunningTime() > self.PrepTime:GetInt() then self:StartRound() end elseif self:GetGameState() == 2 then self:CheckForVictory() elseif self:GetGameState() == 3 then - if self:GetStateRunningTime() > 10 then + if self:GetStateRunningTime() > self.EndTime:GetInt() then self:SetupRound() end end