From 0bba89a7858ce091f485e04284f853e1f7f304af Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Sun, 6 Aug 2023 17:21:45 +0100 Subject: Reformat --- code/pawn/Player.Use.cs | 48 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 14 deletions(-) (limited to 'code/pawn/Player.Use.cs') diff --git a/code/pawn/Player.Use.cs b/code/pawn/Player.Use.cs index 3f35052..8c3cce9 100644 --- a/code/pawn/Player.Use.cs +++ b/code/pawn/Player.Use.cs @@ -9,7 +9,10 @@ public partial class Player protected virtual void TickPlayerUse() { // This is serverside only - if ( !Game.IsServer ) return; + if ( !Game.IsServer ) + { + return; + } // Turn prediction off using ( Prediction.Off() ) @@ -32,7 +35,9 @@ public partial class Player } if ( !Using.IsValid() ) + { return; + } // If we move too far away or something we should probably ClearUse()? @@ -40,15 +45,17 @@ public partial class Player // If use returns true then we can keep using it // if ( Using is IUse use && use.OnUse( this ) ) + { return; + } StopUsing(); } } /// - /// Player tried to use something but there was nothing there. - /// Tradition is to give a disappointed boop. + /// Player tried to use something but there was nothing there. + /// Tradition is to give a disappointed boop. /// protected virtual void UseFail() { @@ -56,7 +63,7 @@ public partial class Player } /// - /// If we're using an entity, stop using it + /// If we're using an entity, stop using it /// protected virtual void StopUsing() { @@ -64,19 +71,30 @@ public partial class Player } /// - /// Returns if the entity is a valid usable entity + /// Returns if the entity is a valid usable entity /// protected bool IsValidUseEntity( Entity e ) { - if ( e == null ) return false; - if ( e is not IUse use ) return false; - if ( !use.IsUsable( this ) ) return false; + if ( e == null ) + { + return false; + } + + if ( e is not IUse use ) + { + return false; + } + + if ( !use.IsUsable( this ) ) + { + return false; + } return true; } /// - /// Find a usable entity for this player to use + /// Find a usable entity for this player to use /// protected virtual Entity FindUsable() { @@ -96,9 +114,9 @@ public partial class Player if ( !IsValidUseEntity( ent ) ) { tr = Trace.Ray( EyePosition, EyePosition + EyeRotation.Forward * 85 ) - .Radius( 2 ) - .Ignore( this ) - .Run(); + .Radius( 2 ) + .Ignore( this ) + .Run(); // See if any of the parent entities are usable if we ain't. ent = tr.Entity; @@ -109,9 +127,11 @@ public partial class Player } // Still no good? Bail. - if ( !IsValidUseEntity( ent ) ) return null; + if ( !IsValidUseEntity( ent ) ) + { + return null; + } return ent; } } - -- cgit v1.2.3-70-g09d2