Work-in-progress Cruelty Parkour™

This commit is contained in:
LostTrackpad 2024-06-16 16:10:50 +07:00
parent 865b2b9e28
commit 2a9e7a01bd
10 changed files with 66 additions and 22 deletions

View file

@ -6,6 +6,10 @@ for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/cl/*.lua", "GAME")) do
AddCSLuaFile("cl/" .. v)
end
if SERVER then
include("preexecute/server.lua")
end
for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/sh/*.lua", "GAME")) do
AddCSLuaFile("sh/" .. v)
include("sh/" .. v)

View file

@ -0,0 +1 @@
-- This file does nothing for now.

View file

@ -0,0 +1 @@
RunnerHandsOnly = CreateConVar("Beatrun_RunnerHandsOnly", 0, {FCVAR_ARCHIVE, FCVAR_REPLICATED}, "Also known as \"Cruelty Mode\".\nDisables some Beatrun parkour abilities using anything but the Beatrun hands when enabled.", 0, 1)

View file

@ -785,3 +785,9 @@ hook.Add("SetupMove", "Climbing", function(ply, mv, cmd)
ClimbingThink(ply, mv, cmd)
end
end)
hook.Add("PlayerSwitchWeapon", "NoSwitchForClimbers", function(ply)
if ply:GetClimbing() != 0 then
return true
end
end)

View file

@ -73,29 +73,32 @@ hook.Add("SetupMove", "Grapple", function(ply, mv, cmd)
local dist = trout.HitPos:DistToSqr(mv:GetOrigin())
if trout.Fraction > 0 and dist < 2750000 and dist > 90000 and mv:KeyPressed(IN_JUMP) then
local vel = mv:GetVelocity()
vel.z = -math.abs(vel.z)
if RunnerHandsOnly:GetBool() and !ply:UsingRH() then
else
local vel = mv:GetVelocity()
vel.z = -math.abs(vel.z)
mv:SetVelocity(vel)
mv:SetVelocity(vel)
ply:SetGrapplePos(trout.HitPos)
ply:SetGrappling(true)
ply:SetGrappleLength(mv:GetOrigin():Distance(trout.HitPos))
ply:SetWallrunCount(0)
ply:SetJumpTurn(false)
ply:SetCrouchJumpBlocked(false)
ply:SetNW2Entity("grappleEntity", trout.Entity)
ply:SetNW2Bool("grappledNonCourse", true)
ply:SetGrapplePos(trout.HitPos)
ply:SetGrappling(true)
ply:SetGrappleLength(mv:GetOrigin():Distance(trout.HitPos))
ply:SetWallrunCount(0)
ply:SetJumpTurn(false)
ply:SetCrouchJumpBlocked(false)
ply:SetNW2Entity("grappleEntity", trout.Entity)
ply:SetNW2Bool("grappledNonCourse", true)
if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("mirrorsedge/Gadgets/ME_Magrope_Fire.wav", 40, 100 + math.random(-25, 10))
if CLIENT and IsFirstTimePredicted() or game.SinglePlayer() then
ply:EmitSound("mirrorsedge/Gadgets/ME_Magrope_Fire.wav", 40, 100 + math.random(-25, 10))
end
ply:ViewPunch(zpunchstart)
grappled = true
ply.GrappleLengthOld = ply:GetGrappleLength()
end
ply:ViewPunch(zpunchstart)
grappled = true
ply.GrappleLengthOld = ply:GetGrappleLength()
end
end

View file

@ -138,6 +138,7 @@ local function SwingbarThink(ply, mv, cmd)
offset = ply:GetSBOffset()
if mv:KeyPressed(IN_JUMP) or mv:KeyDown(IN_JUMP) and offset > 90 then
print("ONE")
ParkourEvent("swingjump", ply)
if mv:KeyPressed(IN_JUMP) and offset > 90 then
@ -188,6 +189,21 @@ local function Swingbar(ply, mv, cmd)
if IsValid(ply:GetSwingbar()) then
SwingbarThink(ply, mv, cmd)
end
if RunnerHandsOnly:GetBool() and !ply:UsingRH() then
ParkourEvent("swingjump", ply)
local ang = cmd:GetViewAngles()
ang.x = 0
ply:SetMoveType(MOVETYPE_WALK)
ply:SetSwingbarLast(ply:GetSwingbar())
ply:SetSwingbar(nil)
ply:SetWallrunDir(dummyvec)
ply:SetMEMoveLimit(GetConVar("Beatrun_SpeedLimit"):GetInt())
ply:SetMESprintDelay(-1)
end
end
hook.Add("SetupMove", "Swingbar", Swingbar)

View file

@ -775,3 +775,11 @@ hook.Add("SetupMove", "BeatrunVaulting", function(ply, mv, cmd)
end
end
end)
hook.Add("PlayerSwitchWeapon", "NoWeaponWhileMantling", function(ply)
if ply:GetMantle() == 5 then
-- You are still mantling at this state, don't pull an SMG
-- out of your back pocket
return true
end
end)

View file

@ -522,12 +522,15 @@ end
local vecdir = Vector(1000, 1000, 1000)
hook.Add("SetupMove", "Wallrunning", function(ply, mv, cmd)
if ply:GetWallrun() == nil or not ply:Alive() then
if ply:GetWallrun() == nil or not ply:Alive() or (RunnerHandsOnly:GetBool() and !(ply:UsingRH())) then
ply:SetWallrun(0)
end
if ply:GetWallrun() == 0 and mv:GetVelocity().z > -450 and not ply:OnGround() and mv:KeyDown(IN_FORWARD) and not ply:Crouching() and not mv:KeyDown(IN_DUCK) and ply:GetMoveType() ~= MOVETYPE_NOCLIP and ply:WaterLevel() < 1 then
WallrunningCheck(ply, mv, cmd)
if (RunnerHandsOnly:GetBool() and (ply:GetActiveWeapon():GetClass() != "runnerhands")) then
else
WallrunningCheck(ply, mv, cmd)
end
end
if ply:GetWallrun() ~= 0 then

View file

@ -138,7 +138,7 @@ local function ZiplineThink(ply, mv, cmd, zipline)
dir:Mul(-1)
end
if fraction >= 1 or cmd:KeyDown(IN_DUCK) then
if fraction >= 1 or cmd:KeyDown(IN_DUCK) or (RunnerHandsOnly:GetBool() and !ply:UsingRH()) then
ply:SetZipline(nil)
ply:SetMoveType(MOVETYPE_WALK)
ply:SetCrouchJumpBlocked(true)

View file

@ -9,6 +9,8 @@ GM.Website = "www.mirrorsedge.com xd"
include("player_class/player_beatrun.lua")
include("preexecute/shared.lua")
for _, v in ipairs(file.Find("gamemodes/beatrun/gamemode/sh/*.lua", "GAME", "nameasc")) do
AddCSLuaFile("sh/" .. v)
include("sh/" .. v)