-- This is a set of overrides and hook/concommand removals of things Fretta -- installs that are for whatever reason not wanted in TTT. -- Bring on the pain... DeriveGamemode( "fretta" ) AddCSLuaFile("cl_fretta_must_die.lua") AddCSLuaFile("vgui/continuevote.lua") -- Kill Fretta's class Thinks and end of game checks (doing our own) function GM:Think() end -- Do not freeze players and stuff function GM:OnEndOfGame() end -- FIXME: will we be using Fretta's GM:EndOfGame? if not, above not needed -- Any dmg limitations are handled in our EntityTakeDamage hook function GM:PlayerShouldTakeDamage(victim, attacker) return true end -- Don't see this called anywhere, nor does base gm have it, but hey function GM:PostPlayerDeath(ply) end -- Fretta has a timeleft command, but it's not very meaningful here, oh well function GM:GetGameTimeLeft() return math.max(0, (GetConVar("ttt_time_limit_minutes"):GetInt() * 60) - CurTime()) end -- The thing with Fretta's round handling is that it's all very nice and all -- but I already have something more appropriate in place. So I have to turn -- it all off with some ugly hacks. function GM:CheckPlayerDeathRoundEnd() end -- Not really necessary to remove these --hook.Remove("PlayerDisconnected", "RoundCheck_PlayerDisconnect") --hook.Remove("PostPlayerDeath", "RoundCheck_PostPlayerDeath") -- None of the other timer and round stuff should ever be started up because -- we override GM:Initialize -- And some spectator stuff we already have concommand.Remove("spec_mode") concommand.Remove("spec_next") concommand.Remove("spec_prev") -- We don't need all the CallClassFunction stuff Fretta does. function GM:Move(ply, mv) end function GM:KeyPress(ply, key) end function GM:KeyRelease(ply, key) end ---- End of round continue/change voting --- Copies some of the gamemode/mapvote structure because that works pretty --- well. -- The continue vote is basically a VoteForChange vote with a different hat function GM:StartContinueVote() if fretta_voting:GetBool() then BroadcastLua("GAMEMODE:ShowContinueChooser()") SetGlobalBool("InContinueVote", true) end end -- Start gamemode vote if necessary, else do nothing function GM:FinishContinueVote() if not fretta_voting:GetBool() then return end SetGlobalBool("InContinueVote", false) BroadcastLua("GAMEMODE:HideContinueChooser()") local frac = GAMEMODE:GetFractionOfPlayersThatWantChange() -- jesus h. if frac > fretta_votesneeded:GetFloat() then GAMEMODE:StartGamemodeVote() end end local function VoteForChangeSilent(ply, cmd, args) if not fretta_voting:GetBool() then return end if not IsValid(ply) then return end if not #args == 1 then return end local want = tonumber(args[1]) if want == 0 then ply:SetNWBool("WantsVote", false) elseif want == 1 then ply:SetNWBool("WantsVote", true) end end concommand.Add("votecontinue", VoteForChangeSilent)