From 9707b083db88b389e7eae2bd4ad765fb387f0375 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 22 Dec 2015 07:59:32 +1100 Subject: [PATCH] Can use air block models, also make noclip sliding configurable. --- ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs | 6 ++++++ ClassicalSharp/Entities/LocalPlayer.Physics.cs | 2 +- ClassicalSharp/Entities/LocalPlayer.cs | 4 ++++ ClassicalSharp/Game/Game.cs | 1 + ClassicalSharp/Model/ModelCache.cs | 2 -- ClassicalSharp/Utils/Options.cs | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs b/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs index 5437588aa..07f00a7a6 100644 --- a/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs +++ b/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs @@ -43,6 +43,11 @@ namespace ClassicalSharp { } }), + Make( 140, 0, "Noclip slide", OnWidgetClick, + g => g.LocalPlayer.NoclipSlide ? "yes" : "no", + (g, v) => { g.LocalPlayer.NoclipSlide = v == "yes"; + Options.Set( OptionsKey.NoclipSlide, v == "yes" ); } ), + MakeBack( false, titleFont, (g, w) => g.SetNewScreen( new PauseScreen( g ) ) ), null, @@ -54,6 +59,7 @@ namespace ClassicalSharp { new BooleanValidator(), new BooleanValidator(), + new BooleanValidator(), }; okayIndex = buttons.Length - 1; } diff --git a/ClassicalSharp/Entities/LocalPlayer.Physics.cs b/ClassicalSharp/Entities/LocalPlayer.Physics.cs index fdc02ff65..cf8c79f5c 100644 --- a/ClassicalSharp/Entities/LocalPlayer.Physics.cs +++ b/ClassicalSharp/Entities/LocalPlayer.Physics.cs @@ -11,7 +11,7 @@ namespace ClassicalSharp { bool useLiquidGravity = false; // used by BlockDefinitions. bool canLiquidJump = true; void UpdateVelocityState( float xMoving, float zMoving ) { - if( noClip && xMoving == 0 && zMoving == 0 ) + if( !NoclipSlide && (noClip && xMoving == 0 && zMoving == 0) ) Velocity = Vector3.Zero; if( flying || noClip ) { diff --git a/ClassicalSharp/Entities/LocalPlayer.cs b/ClassicalSharp/Entities/LocalPlayer.cs index f54f706d7..b6ddda249 100644 --- a/ClassicalSharp/Entities/LocalPlayer.cs +++ b/ClassicalSharp/Entities/LocalPlayer.cs @@ -53,6 +53,9 @@ namespace ClassicalSharp { /// Whether the player is allowed to see all entity name tags. public bool CanSeeAllNames = true; + /// Whether the player should slide after letting go of movement buttons in noclip. + public bool NoclipSlide = true; + float jumpVel = 0.42f; /// Returns the height that the client can currently jump up to.
/// Note that when speeding is enabled the client is able to jump much further.
@@ -69,6 +72,7 @@ namespace ClassicalSharp { SpeedMultiplier = Options.GetFloat( OptionsKey.Speed, 0.1f, 50, 7 ); PushbackPlacing = Options.GetBool( OptionsKey.PushbackPlacing, false ); + NoclipSlide = Options.GetBool( OptionsKey.NoclipSlide, true ); InitRenderingData(); } diff --git a/ClassicalSharp/Game/Game.cs b/ClassicalSharp/Game/Game.cs index adfa2fb80..f5b160bc1 100644 --- a/ClassicalSharp/Game/Game.cs +++ b/ClassicalSharp/Game/Game.cs @@ -63,6 +63,7 @@ namespace ClassicalSharp { ViewBobbing = Options.GetBool( OptionsKey.ViewBobbing, false ); ShowBlockInHand = Options.GetBool( OptionsKey.ShowBlockInHand, true ); InvertMouse = Options.GetBool( OptionsKey.InvertMouse, false ); + SimpleArmsAnim = Options.GetBool( OptionsKey.SimpleArmsAnim, false ); TerrainAtlas1D = new TerrainAtlas1D( Graphics ); TerrainAtlas = new TerrainAtlas2D( Graphics, Drawer2D ); diff --git a/ClassicalSharp/Model/ModelCache.cs b/ClassicalSharp/Model/ModelCache.cs index a7af49180..8c209292d 100644 --- a/ClassicalSharp/Model/ModelCache.cs +++ b/ClassicalSharp/Model/ModelCache.cs @@ -31,8 +31,6 @@ namespace ClassicalSharp.Model { byte blockId; if( Byte.TryParse( modelName, out blockId ) ) { modelName = "block"; - if( blockId == 0 ) - return cache["humanoid"]; } if( !cache.TryGetValue( modelName, out model ) ) { diff --git a/ClassicalSharp/Utils/Options.cs b/ClassicalSharp/Utils/Options.cs index 11118e241..8a307982d 100644 --- a/ClassicalSharp/Utils/Options.cs +++ b/ClassicalSharp/Utils/Options.cs @@ -34,6 +34,7 @@ namespace ClassicalSharp { public const string LiquidsBreakable = "liquidsbreakable"; public const string PushbackPlacing = "pushbackplacing"; public const string InvertMouse = "invertmouse"; + public const string NoclipSlide = "noclipslide"; } // TODO: implement this