Added Grapple Toggle

This commit is contained in:
Jonny_Bro (Nikita) 2023-07-21 20:40:04 +05:00
parent 814cb766a9
commit 23e50e7088
2 changed files with 8 additions and 1 deletions

View file

@ -137,13 +137,16 @@ hook.Add("PopulateToolMenu", "Beatrun_ToolMenu", function()
spawnmenu.AddToolMenuOption("Beatrun", "Client", "beatrun_gameplay", "Gameplay", "", "", function(panel) spawnmenu.AddToolMenuOption("Beatrun", "Client", "beatrun_gameplay", "Gameplay", "", "", function(panel)
panel:ClearControls() panel:ClearControls()
panel:SetName("Gameplaye Settings") panel:SetName("Gameplay Settings")
panel:CheckBox("Quickturn", "Beatrun_QuickturnGround") panel:CheckBox("Quickturn", "Beatrun_QuickturnGround")
panel:ControlHelp("Enables quickturning with secondary attack while on the ground") panel:ControlHelp("Enables quickturning with secondary attack while on the ground")
panel:CheckBox("Purist Mode", "Beatrun_PuristMode") panel:CheckBox("Purist Mode", "Beatrun_PuristMode")
panel:ControlHelp("Purist mode is a clientside preference that severely weakens the ability to strafe while in the air, which is how Mirror's Edge games handle this.\nDisabled = No restrictions\nEnabled = Reduced move speed in the air") panel:ControlHelp("Purist mode is a clientside preference that severely weakens the ability to strafe while in the air, which is how Mirror's Edge games handle this.\nDisabled = No restrictions\nEnabled = Reduced move speed in the air")
panel:CheckBox("Disable Grapple Ability", "Beatrun_DisableGrapple")
panel:ControlHelp("Disables grapple ability")
end) end)
spawnmenu.AddToolMenuOption("Beatrun", "Server", "beatrun_main", "Main", "", "", function(panel) spawnmenu.AddToolMenuOption("Beatrun", "Server", "beatrun_main", "Main", "", "", function(panel)

View file

@ -1,9 +1,12 @@
local disable_grapple = CreateClientConVar("Beatrun_DisableGrapple", 0, true, true, "Disables grapple ability", 0, 1)
if CLIENT then if CLIENT then
local circle = Material("circlesmooth.png", "nocull smooth") local circle = Material("circlesmooth.png", "nocull smooth")
hook.Add("HUDPaint", "grappleicon", function() hook.Add("HUDPaint", "grappleicon", function()
local ply = LocalPlayer() local ply = LocalPlayer()
if disable_grapple:GetBool() then return end
if ply:GetMantle() ~= 0 or ply:GetClimbing() ~= 0 then return end if ply:GetMantle() ~= 0 or ply:GetClimbing() ~= 0 then return end
if not ply:Alive() or Course_Name ~= "" then return end if not ply:Alive() or Course_Name ~= "" then return end
@ -52,6 +55,7 @@ end
local zpunchstart = Angle(2, 0, 0) local zpunchstart = Angle(2, 0, 0)
hook.Add("SetupMove", "Grapple", function(ply, mv, cmd) hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
if ply:GetInfoNum("Beatrun_DisableGrapple", 0) == 1 then return end
if ply:GetMantle() ~= 0 or ply:GetClimbing() ~= 0 then return end if ply:GetMantle() ~= 0 or ply:GetClimbing() ~= 0 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 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) and not ply:GetNW2Entity("Swingrope"):IsValid() then return end if GetGlobalBool(GM_INFECTION) or GetGlobalBool(GM_DATATHEFT) and not ply:GetNW2Entity("Swingrope"):IsValid() then return end