Skip to content

Commit

Permalink
Merge branch 'master' of github.com:timmybo5/simple-weapon-base
Browse files Browse the repository at this point in the history
  • Loading branch information
timmybo5 committed Aug 8, 2022
2 parents 18bb8c8 + c30a3f7 commit 7db8e26
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions code/swb_base/obsolete/controllers/PlayerWalkController.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


using Sandbox;

/* Result from Pain Day 4, this will be here temporarily until it is clear how templates work */
Expand Down Expand Up @@ -155,7 +155,7 @@ public override void Simulate()

// if ( underwater ) do underwater movement

if (AutoJump ? Input.Down(InputButton.Jump) : Input.Pressed(InputButton.Jump))
if ((AutoJump || Swimming) ? Input.Down(InputButton.Jump) : Input.Pressed(InputButton.Jump))
{
CheckJumpButton();
}
Expand Down Expand Up @@ -436,7 +436,19 @@ public virtual void CheckJumpButton()
// swimming, not jumping
ClearGroundEntity();

Velocity = Velocity.WithZ(100);
var jumpLedge = false;

var startPos = Pawn.EyePosition;

var tr = Trace.Ray( startPos, startPos + Pawn.EyeRotation.Forward * 1000 )
.Ignore(Pawn)
.Run();


if ( tr.Entity == null || tr.Entity.ClassName != "func_water" )
jumpLedge = true;

Velocity = Velocity.WithZ( jumpLedge ? 350 : 100 );

// play swimming sound
// if ( player->m_flSwimSoundTime <= 0 )
Expand Down

0 comments on commit 7db8e26

Please sign in to comment.