diff --git a/beatrun/gamemodes/beatrun/entities/weapons/runnerhands/shared.lua b/beatrun/gamemodes/beatrun/entities/weapons/runnerhands/shared.lua index 0a81bb9..07d8f44 100644 --- a/beatrun/gamemodes/beatrun/entities/weapons/runnerhands/shared.lua +++ b/beatrun/gamemodes/beatrun/entities/weapons/runnerhands/shared.lua @@ -383,7 +383,7 @@ function SWEP:OnRemove() end function SWEP:Reload() - if GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) then return end + if GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") or GetGlobalBool("GM_INFECTION") then return end if not TUTORIALMODE and CurTime() > self.RespawnDelay and self:GetOwner():GetClimbing() == 0 and not IsValid(self:GetOwner():GetSwingbar()) and not self:GetOwner().BuildMode then self:GetOwner():Spawn() @@ -480,7 +480,7 @@ function SWEP:PrimaryAttack() local ent = tr_result.Entity if SERVER and IsValid(ent) then - if not ply:IsPlayer() or (Course_Name == "" and not GetGlobalBool(GM_INFECTION)) then + if not ply:IsPlayer() or (Course_Name == "" and not GetGlobalBool("GM_INFECTION")) then local d = DamageInfo() d:SetDamage((punch ~= 3 and 10) or 20) d:SetAttacker(ply) diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua b/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua index 3b4b1a4..a613443 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/HUD.lua @@ -281,7 +281,7 @@ local function sortleaderboard(a, b) local atime = a:GetNW2Float("PBTime") local btime = b:GetNW2Float("PBTime") - if GetGlobalBool(GM_INFECTION) then + if GetGlobalBool("GM_INFECTION") then if atime == 0 then atime = -1 end @@ -291,7 +291,7 @@ local function sortleaderboard(a, b) end return atime > btime - elseif GetGlobalBool(GM_DATATHEFT) then + elseif GetGlobalBool("GM_DATATHEFT") then atime = a:GetNW2Int("DataBanked", 0) btime = b:GetNW2Int("DataBanked", 0) @@ -304,7 +304,7 @@ local function sortleaderboard(a, b) end return atime > btime - elseif GetGlobalBool(GM_DEATHMATCH) then + elseif GetGlobalBool("GM_DEATHMATCH") then atime = a:GetNW2Int("DeathmatchKills", 0) btime = b:GetNW2Int("DeathmatchKills", 0) @@ -331,11 +331,11 @@ local function sortleaderboard(a, b) end function BeatrunLeaderboard(forced) - if not forced and Course_Name == "" and not GetGlobalBool(GM_INFECTION) and not GetGlobalBool(GM_DATATHEFT) and not GetGlobalBool(GM_DEATHMATCH) then return end + if not forced and Course_Name == "" and not GetGlobalBool("GM_INFECTION") and not GetGlobalBool("GM_DATATHEFT") and not GetGlobalBool("GM_DEATHMATCH") then return end - local isinfection = GetGlobalBool(GM_INFECTION) - local isdatatheft = GetGlobalBool(GM_DATATHEFT) - local isdeathmatch = GetGlobalBool(GM_DEATHMATCH) + local isinfection = GetGlobalBool("GM_INFECTION") + local isdatatheft = GetGlobalBool("GM_DATATHEFT") + local isdeathmatch = GetGlobalBool("GM_DEATHMATCH") local ply = LocalPlayer() local vp = ply:GetViewPunchAngles() local scrh = ScrH() diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/Nametags.lua b/beatrun/gamemodes/beatrun/gamemode/cl/Nametags.lua index ae2202a..b02a9bd 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/Nametags.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/Nametags.lua @@ -4,13 +4,13 @@ local enemy = Color(255, 0, 0) local function HideNearby(ply) if ply == LocalPlayer() then return end - if GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) then return end + if GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") then return end ply.distfromlocal = LocalPlayer():GetPos():Distance(ply:GetPos()) local Distance = ply.distfromlocal or 40000 if Distance < 20000 and NametagsEnable:GetBool() then - local infectionmode = GetGlobalBool(GM_INFECTION) + local infectionmode = GetGlobalBool("GM_INFECTION") local localinfected = LocalPlayer():GetNW2Bool("Infected") local plyinfected = ply:GetNW2Bool("Infected") local ang = LocalPlayer():EyeAngles() diff --git a/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua b/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua index 700bc9f..ed85aca 100644 --- a/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua +++ b/beatrun/gamemodes/beatrun/gamemode/cl/ToolMenuSettings.lua @@ -300,7 +300,7 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function() InfectionButton:SetText("Toggle Infection Gamemode") InfectionButton:SetSize(0, 20) InfectionButton.DoClick = function() - if GetGlobalBool(GM_DEATHMATCH) or GetGlobalBool(GM_DATATHEFT) then + if GetGlobalBool("GM_DEATHMATCH") or GetGlobalBool("GM_DATATHEFT") then InfectionButton:SetText("Another gamemode is running!") timer.Simple(2, function() InfectionButton:SetText("Toggle Infection Gamemode") @@ -316,7 +316,7 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function() DatatheftButton:SetText("Toggle Data Theft Gamemode") DatatheftButton:SetSize(0, 20) DatatheftButton.DoClick = function() - if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DEATHMATCH) then + if GetGlobalBool("GM_INFECTION") or GetGlobalBool("GM_DEATHMATCH") then DatatheftButton:SetText("Another gamemode is running!") timer.Simple(2, function() DatatheftButton:SetText("Toggle Data Theft Gamemode") @@ -332,7 +332,7 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function() DeathmatchButton:SetText("Toggle Deathmatch Gamemode") DeathmatchButton:SetSize(0, 20) DeathmatchButton.DoClick = function() - if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) then + if GetGlobalBool("GM_INFECTION") or GetGlobalBool("GM_DATATHEFT") then DeathmatchButton:SetText("Another gamemode is running!") timer.Simple(2, function() DeathmatchButton:SetText("Toggle Deathmatch Gamemode") diff --git a/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua b/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua index 9a0c1c1..5eac96a 100644 --- a/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua +++ b/beatrun/gamemodes/beatrun/gamemode/player_class/player_beatrun.lua @@ -11,23 +11,14 @@ end local PLAYER = {} -PLAYER.DuckSpeed = 0.01 -- How fast to go from not ducking, to ducking -PLAYER.UnDuckSpeed = 0.01 -- How fast to go from ducking, to not ducking +PLAYER.DuckSpeed = 0.01 -- How fast to go from not ducking, to ducking +PLAYER.UnDuckSpeed = 0.01 -- How fast to go from ducking, to not ducking --- --- Creates a Taunt Camera --- PLAYER.TauntCam = TauntCamera() --- --- See gamemodes/base/player_class/player_default.lua for all overridable variables --- PLAYER.WalkSpeed = 200 PLAYER.RunSpeed = 400 --- --- Set up the network table accessors --- function PLAYER:SetupDataTables() BaseClass.SetupDataTables(self) self.Player:NetworkVar("Float", 0, "MEMoveLimit") @@ -130,8 +121,8 @@ function PLAYER:SetupDataTables() end function PLAYER:Loadout() - if GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) then - for k, v in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do + if GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") then + for _, v in ipairs(DATATHEFT_LOADOUTS[math.random(#DATATHEFT_LOADOUTS)]) do local wep = self.Player:Give(v) self.Player:GiveAmmo(1000, wep:GetPrimaryAmmoType()) end @@ -174,9 +165,6 @@ function PLAYER:SetModel() end end --- --- Called when the player spawns --- if SERVER then util.AddNetworkString("BeatrunSpawn") end @@ -245,7 +233,7 @@ function PLAYER:Spawn() ply:SetCustomCollisionCheck(true) - if GetGlobalBool(GM_DATATHEFT) then + if GetGlobalBool("GM_DATATHEFT") then ply:DataTheft_Bank() end @@ -267,7 +255,7 @@ function PLAYER:Spawn() end hook.Add("IsSpawnpointSuitable", "CheckSpawnPoint", function(ply, spawnpointent, bMakeSuitable) - if not GetGlobalBool(GM_DATATHEFT) then return end + if not GetGlobalBool("GM_DATATHEFT") or not GetGlobalBool("GM_DEATHMATCH") then return end local pos = spawnpointent:GetPos() diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua b/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua index 6e51ca9..ee603a9 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/DataTheft.lua @@ -8,7 +8,7 @@ if SERVER then util.AddNetworkString("DataTheft_Sync") function Beatrun_StartDataTheft() - SetGlobalBool(GM_DATATHEFT, true) + SetGlobalBool("GM_DATATHEFT", true) net.Start("DataTheft_Start") net.Broadcast() @@ -32,9 +32,11 @@ if SERVER then end function Beatrun_StopDataTheft() - SetGlobalBool(GM_DATATHEFT, false) + SetGlobalBool("GM_DATATHEFT", false) for _, v in ipairs(player.GetAll()) do + v:SetNW2Int("DataCubes", 0) + v:StripWeapons() v:StripAmmo() v:Give("runnerhands") @@ -42,7 +44,7 @@ if SERVER then end local function DataTheftSync(ply) - if GetGlobalBool(GM_DATATHEFT) and not ply.DataTheftSynced then + if GetGlobalBool("GM_DATATHEFT") and not ply.DataTheftSynced then net.Start("DataTheft_Sync") net.Send(ply) @@ -53,7 +55,7 @@ if SERVER then hook.Add("PlayerSpawn", "DataTheftSync", DataTheftSync) local function DataTheftDeath(ply, inflictor, attacker) - if GetGlobalBool(GM_DATATHEFT) then + if GetGlobalBool("GM_DATATHEFT") then local datacount = ply:GetNW2Int("DataCubes", 0) if datacount > 0 then @@ -82,7 +84,7 @@ end if CLIENT then local function DataTheftHUDName() - if GetGlobalBool(GM_DATATHEFT) then + if GetGlobalBool("GM_DATATHEFT") then local datacubes = LocalPlayer():GetNW2Int("DataCubes", 0) return "Data Theft (" .. datacubes .. ")" diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua index fd05bc9..a2bb3fd 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Deathmatch.lua @@ -5,7 +5,7 @@ if SERVER then util.AddNetworkString("Deathmatch_Sync") function Beatrun_StartDeathmatch() - SetGlobalBool(GM_DEATHMATCH, true) + SetGlobalBool("GM_DEATHMATCH", true) net.Start("Deathmatch_Start") net.Broadcast() @@ -24,9 +24,11 @@ if SERVER then end function Beatrun_StopDeathmatch() - SetGlobalBool(GM_DEATHMATCH, false) + SetGlobalBool("GM_DEATHMATCH", false) for _, v in ipairs(player.GetAll()) do + v:SetNW2Int("DeathmatchKills", 0) + v:StripWeapons() v:StripAmmo() v:Give("runnerhands") @@ -34,7 +36,7 @@ if SERVER then end local function DeathmatchSync(ply) - if GetGlobalBool(GM_DEATHMATCH) and not ply.DeathmatchSynced then + if GetGlobalBool("GM_DEATHMATCH") and not ply.DeathmatchSynced then net.Start("Deathmatch_Sync") net.Send(ply) @@ -45,7 +47,7 @@ if SERVER then hook.Add("PlayerSpawn", "DeathmatchSync", DeathmatchSync) local function DeathmatchDeath(ply, inflictor, attacker) - if GetGlobalBool(GM_DEATHMATCH) then + if GetGlobalBool("GM_DEATHMATCH") then local plyKills = ply:GetNW2Int("DeathmatchKills", 0) if ply == attacker then @@ -63,7 +65,7 @@ end if CLIENT then local function DeathmatchHUDName() - if GetGlobalBool(GM_DEATHMATCH) then + if GetGlobalBool("GM_DEATHMATCH") then return "Deathmatch" else hook.Remove("BeatrunHUDCourse", "DeathmatchHUDName") diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua index 9e70fc3..54783e1 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Grapple.lua @@ -14,7 +14,7 @@ if CLIENT then if IsValid(activewep) and activewep:GetClass() ~= "runnerhands" then return end if ply:GetMoveType() == MOVETYPE_NOCLIP then return end - if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) then return end + if GetGlobalBool("GM_INFECTION") or GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") then return end if not ply.GrappleHUD_tr then ply.GrappleHUD_tr = {} @@ -58,7 +58,7 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd) if ply:GetMantle() ~= 0 or ply:GetClimbing() ~= 0 then return end if ply:GetInfoNum("Beatrun_DisableGrapple", 0) == 1 and Course_Name == "" then return end if not ply:Alive() or Course_Name ~= "" and ply:GetNW2Int("CPNum", 1) ~= -1 and not ply:GetNW2Entity("Swingrope"):IsValid() then return end - if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH) and not ply:GetNW2Entity("Swingrope"):IsValid() then return end + if GetGlobalBool("GM_INFECTION") or GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH") and not ply:GetNW2Entity("Swingrope"):IsValid() then return end local activewep = ply:GetActiveWeapon() local usingrh = IsValid(activewep) and activewep:GetClass() == "runnerhands" diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Infection.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Infection.lua index ce22039..a4b2bd8 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Infection.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Infection.lua @@ -84,7 +84,7 @@ if SERVER then ended = true timer.Simple(15, function() - if ended and GetGlobalBool(GM_INFECTION) then + if ended and GetGlobalBool("GM_INFECTION") then Beatrun_StartInfection() end end) @@ -95,7 +95,7 @@ if SERVER then end) local function InfectionSync(ply) - if GetGlobalBool(GM_INFECTION) and not ply.InfectionSynced then + if GetGlobalBool("GM_INFECTION") and not ply.InfectionSynced then net.Start("Infection_Sync") net.WriteFloat(Infection_StartTime) net.WriteFloat(Infection_EndTime) @@ -108,7 +108,7 @@ if SERVER then hook.Add("PlayerSpawn", "InfectionSync", InfectionSync) function Beatrun_StopInfection() - SetGlobalBool(GM_INFECTION, false) + SetGlobalBool("GM_INFECTION", false) local players = player.GetAll() @@ -154,7 +154,7 @@ if SERVER then end local function InfectionTimer() - if not GetGlobalBool(GM_INFECTION) then return end + if not GetGlobalBool("GM_INFECTION") then return end if player.GetCount() <= 1 then Beatrun_StopInfection() @@ -199,7 +199,7 @@ if SERVER then ended = true timer.Simple(15, function() - if ended and GetGlobalBool(GM_INFECTION) then + if ended and GetGlobalBool("GM_INFECTION") then Beatrun_StartInfection() end end) @@ -207,7 +207,7 @@ if SERVER then end function Beatrun_StartInfection() - if GetGlobalBool(GM_INFECTION) and not ended then return end + if GetGlobalBool("GM_INFECTION") and not ended then return end if Course_Name ~= "" then return end if player.GetCount() < 2 then return end @@ -215,7 +215,7 @@ if SERVER then net.WriteFloat(CurTime()) net.Broadcast() - SetGlobalBool(GM_INFECTION, true) + SetGlobalBool("GM_INFECTION", true) revealed = false ended = false @@ -247,7 +247,7 @@ if SERVER then end function InfectionDeath(ply) - if not GetGlobalBool(GM_INFECTION) then return end + if not GetGlobalBool("GM_INFECTION") then return end if revealed and Infection_StartTime < CurTime() and not ply:GetNW2Bool("Infected") then if ply.InfectionWuzHere then @@ -274,7 +274,7 @@ if SERVER then ended = true timer.Simple(15, function() - if ended and GetGlobalBool(GM_INFECTION) then + if ended and GetGlobalBool("GM_INFECTION") then Beatrun_StartInfection() end end) @@ -306,7 +306,7 @@ if CLIENT then local noclipkey = 0 local function InfectionHUDName() - if GetGlobalBool(GM_INFECTION) then + if GetGlobalBool("GM_INFECTION") then local team = LocalPlayer():GetNW2Bool("Infected") and "(Infected)" or "(Human)" return "Infection " .. team @@ -322,7 +322,7 @@ if CLIENT then end local function InfectionCalcView(ply, pos, ang) - if GetGlobalBool(GM_INFECTION) then + if GetGlobalBool("GM_INFECTION") then local keydown = input.IsKeyDown(noclipkey) if keydown then @@ -447,7 +447,7 @@ if CLIENT then end) local function InfectionHUD() - if not GetGlobalBool(GM_INFECTION) then return end + if not GetGlobalBool("GM_INFECTION") then return end surface.SetTextColor(color_white) surface.SetFont("BeatrunHUD") @@ -484,7 +484,7 @@ if CLIENT then end) local function BeatrunInfectedVision() - if GetGlobalBool(GM_INFECTION) and LocalPlayer():GetNW2Bool("Infected") then + if GetGlobalBool("GM_INFECTION") and LocalPlayer():GetNW2Bool("Infected") then tab["$pp_colour_colour"] = CurTime() > (LocalPlayer().InfectionTouchDelay or 0) and 0.91 or 0.1 DrawColorModify(tab) end diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Melee.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Melee.lua index b7e32fc..6ac01af 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Melee.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Melee.lua @@ -189,7 +189,7 @@ local function MeleeThink(ply, mv, cmd) local ent = tr_result.Entity - if SERVER and IsValid(ent) and (not ent:IsPlayer() or Course_Name == "" and not GetGlobalBool(GM_INFECTION) and GetConVar("sbox_playershurtplayers"):GetBool()) then + if SERVER and IsValid(ent) and (not ent:IsPlayer() or Course_Name == "" and not GetGlobalBool("GM_INFECTION") and GetConVar("sbox_playershurtplayers"):GetBool()) then local d = DamageInfo() d:SetDamage(meleedata[ply:GetMelee()][6]) d:SetAttacker(ply) diff --git a/beatrun/gamemodes/beatrun/gamemode/sh/Misc.lua b/beatrun/gamemodes/beatrun/gamemode/sh/Misc.lua index 9f9f221..d6d78f4 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sh/Misc.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sh/Misc.lua @@ -36,7 +36,7 @@ hook.Add("PlayerNoClip", "BlockNoClip", function(ply, enabled) end end - if enabled and (GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) or GetGlobalBool(GM_DEATHMATCH)) then return false end + if enabled and (GetGlobalBool("GM_INFECTION") or GetGlobalBool("GM_DATATHEFT") or GetGlobalBool("GM_DEATHMATCH")) then return false end end) function ParkourEvent(event, ply, ignorepred) diff --git a/beatrun/gamemodes/beatrun/gamemode/sv/ToggleGamemodes.lua b/beatrun/gamemodes/beatrun/gamemode/sv/ToggleGamemodes.lua index 6606287..57a6a85 100644 --- a/beatrun/gamemodes/beatrun/gamemode/sv/ToggleGamemodes.lua +++ b/beatrun/gamemodes/beatrun/gamemode/sv/ToggleGamemodes.lua @@ -6,19 +6,19 @@ net.Receive("Beatrun_ToggleGamemode", function(_, ply) local gm = net.ReadString() if gm == "datatheft" then - if not GetGlobalBool(GM_DATATHEFT) then + if not GetGlobalBool("GM_DATATHEFT") then Beatrun_StartDataTheft() else Beatrun_StopDataTheft() end elseif gm == "infection" then - if not GetGlobalBool(GM_INFECTION) then + if not GetGlobalBool("GM_INFECTION") then Beatrun_StartInfection() else Beatrun_StopInfection() end elseif gm == "deathmatch" then - if not GetGlobalBool(GM_DEATHMATCH) then + if not GetGlobalBool("GM_DEATHMATCH") then Beatrun_StartDeathmatch() else Beatrun_StopDeathmatch()