From 0fcac41f4050530f53826df692622f9c1ce9c120 Mon Sep 17 00:00:00 2001 From: Fesiug Date: Wed, 3 Jan 2024 21:09:27 -0500 Subject: [PATCH] Specialists-style stunt move! --- .../benny/gamemode/modules/player/cl_hud.lua | 6 +-- .../gamemode/modules/player/sh_movement.lua | 14 +++--- .../modules/player/sh_movement_advanced.lua | 45 +++++++++++++++++++ .../modules/player/sh_player_class.lua | 20 +++++---- 4 files changed, 65 insertions(+), 20 deletions(-) diff --git a/gamemodes/benny/gamemode/modules/player/cl_hud.lua b/gamemodes/benny/gamemode/modules/player/cl_hud.lua index 9517095..d2bcc4e 100644 --- a/gamemodes/benny/gamemode/modules/player/cl_hud.lua +++ b/gamemodes/benny/gamemode/modules/player/cl_hud.lua @@ -246,7 +246,7 @@ local lonk = { Spacer = true, }, { - Glyph = "SPACE", + Glyph = "SHIFT", Text1 = "STUNT", Text2 = "Do a barrel roll", }, @@ -306,8 +306,8 @@ item_selected = item_selected or 1 hook.Add( "HUDPaint", "Benny_HUDPaint", function() local sw, sh = ScrW(), ScrH() - local Wb = ss(20) - local Hb = ss(20) + local Wb = sh*0.05--ss(20) + local Hb = sh*0.05--ss(20) -- Wb = (sh*(4/3)) -- Wb = (sw-Wb)/2 diff --git a/gamemodes/benny/gamemode/modules/player/sh_movement.lua b/gamemodes/benny/gamemode/modules/player/sh_movement.lua index 1be6736..9bcf2fb 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_movement.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_movement.lua @@ -1,12 +1,12 @@ -- Movement -local wa, wb = 0, 0 - local blop = Angle() -local lastmoveangle = 0 -local lastmoveangle_lerp -TPSOverride = TPSOverride or Angle() +if CLIENT then + lastmoveangle = lastmoveangle or 0 + lastmoveangle_lerp = lastmoveangle_lerp or nil + TPSOverride = TPSOverride or Angle() +end hook.Add( "PlayerNoClip", "Benny_PlayerNoClip", function( ply, desiredNoClipState ) if CLIENT then @@ -28,7 +28,7 @@ hook.Add( "InputMouseApply", "Benny_InputMouseApply", function( cmd, x, y, ang ) if w and w:bWepClass( true ) and w:bWepClass( true ).Custom_DisableSpecialMovement and w:bWepClass( true ).Custom_DisableSpecialMovement( w ) then cdis = true end if GetConVar("benny_cam_override"):GetString() != "" then cdis = true end if p:NoclippingAndNotVaulting() then cdis = true end - if w and !cdis then + if w and !cdis and (y!=0 or x!=0) then TPSOverride:Add( Angle( y*0.022, -x*0.022, 0 ) ) return true end @@ -50,8 +50,6 @@ hook.Add( "CreateMove", "Benny_CreateMove", function( cmd ) x, y = ly * -320, lx * 320 end - wa, wb = x, y - local ad = Vector( x, y, 0 ) local an = Angle() diff --git a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua b/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua index 712c141..cd20347 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_movement_advanced.lua @@ -38,6 +38,18 @@ local MAXVAULTHEIGHT = 64 local MAXVAULTHEIGHT_FUCKERY = MAXVAULTHEIGHT+1 local MAXVAULTHEIGHT_V = Vector( 0, 0, MAXVAULTHEIGHT_FUCKERY ) +if CLIENT then +hook.Add( "CreateMove", "Benny_ADV_CreateMove", function( cmd ) + local ply = LocalPlayer() + if ply:KeyDown( IN_SPEED ) then + cmd:AddKey( IN_ALT1 ) + end +end) +end + +hook.Add( "StartCommand", "Benny_StartCommand", function( ply, cmd ) +end) + hook.Add( "Move", "Benny_Move", function( ply, mv ) local ang = mv:GetMoveAngles() local pos = mv:GetOrigin() @@ -166,5 +178,38 @@ hook.Add( "Move", "Benny_Move", function( ply, mv ) mv:SetMaxSpeed( targetspeed ) mv:SetMaxClientSpeed( targetspeed ) end + + if ply:GetJumpBoost() == 0 then + if mv:KeyDown( IN_ALT1 ) then + local dig = Vector( mv:GetForwardSpeed()+0.01, mv:GetSideSpeed(), 0 ):GetNormalized() + local dug = Angle( 0, ply:EyeAngles().y, 0 ) + ply:SetGroundEntity( NULL ) + local upspeed = 100 + local movespeed = 200 + local pitch = ply:EyeAngles().p + if pitch < -15 then + upspeed = 250 + movespeed = 320 + elseif pitch < 15 then + upspeed = 150 + movespeed = 260 + end + dig:Mul( movespeed ) + mv:SetVelocity( dug:Forward()*dig.x + dug:Right()*dig.y + (vector_up*upspeed) ) + ply:AddFlags( FL_ANIMDUCKING ) + ply:SetJumpBoost( 1 ) + if CLIENT and IsFirstTimePredicted() then + ply:EmitSound( "weapons/slam/throw.wav", 70, 200, 0.5 ) + end + end + elseif ply:OnGround() then + if mv:KeyDown( IN_ALT1 ) then + ply:SetJumpBoost( -1 ) + else + ply:SetJumpBoost( 0 ) + end + ply:RemoveFlags( FL_ANIMDUCKING ) + end + --debugoverlay.Box( Target+(TargetNor*16), ba, bb, 0, CR ) end) \ No newline at end of file diff --git a/gamemodes/benny/gamemode/modules/player/sh_player_class.lua b/gamemodes/benny/gamemode/modules/player/sh_player_class.lua index f6fc9be..8b9fc96 100644 --- a/gamemodes/benny/gamemode/modules/player/sh_player_class.lua +++ b/gamemodes/benny/gamemode/modules/player/sh_player_class.lua @@ -23,17 +23,19 @@ PLAYER.AvoidPlayers = true PLAYER.UseVMHands = true function PLAYER:SetupDataTables() - self.Player:NetworkVar( "Bool", 0, "Shoulder" ) - self.Player:NetworkVar( "Float", 0, "VaultDebuff" ) + self.Player:NetworkVar( "Bool", 0, "Shoulder" ) - self.Player:NetworkVar( "Float", 1, "VaultTransition" ) - self.Player:NetworkVar( "Vector", 0, "VaultPos1") - self.Player:NetworkVar( "Vector", 1, "VaultPos2") - - self.Player:NetworkVar( "Float", 2, "Stamina" ) + self.Player:NetworkVar( "Int", 0, "JumpBoost" ) - self.Player:NetworkVar( "String", 0, "ReqID1") - self.Player:NetworkVar( "String", 1, "ReqID2") + self.Player:NetworkVar( "Float", 0, "VaultDebuff" ) + self.Player:NetworkVar( "Float", 1, "VaultTransition" ) + self.Player:NetworkVar( "Float", 2, "Stamina" ) + + self.Player:NetworkVar( "Vector", 0, "VaultPos1") + self.Player:NetworkVar( "Vector", 1, "VaultPos2") + + self.Player:NetworkVar( "String", 0, "ReqID1") + self.Player:NetworkVar( "String", 1, "ReqID2") end player_manager.RegisterClass( "player_benny", PLAYER, "player_default" )