From 3dd7a8599ddfc8b0a577e74e1b4bd5dee897d43f Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Tue, 24 May 2016 15:23:01 +1000 Subject: [PATCH] Allow using a full-block step instead of just slabs. (Thanks goodlyay) --- .../2D/Screens/Menu/HacksSettingsScreen.cs | 14 ++++++++++---- .../Entities/Components/HacksComponent.cs | 17 ++++++++++------- ClassicalSharp/Entities/LocalPlayer.cs | 3 +++ ClassicalSharp/Utils/Options.cs | 1 + 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs b/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs index 57950fe10..f01d664a3 100644 --- a/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs +++ b/ClassicalSharp/2D/Screens/Menu/HacksSettingsScreen.cs @@ -38,6 +38,10 @@ namespace ClassicalSharp.Gui { (g, v) => g.LocalPlayer.Hacks.DoubleJump = v ), // Column 2 + MakeBool( 1, -150, "Full block stepping", OptionsKey.FullBlockStep, + OnWidgetClick, g => g.LocalPlayer.Hacks.FullBlockStep, + (g, v) => g.LocalPlayer.Hacks.FullBlockStep = v ), + MakeBool( 1, -100, "Modifiable liquids", OptionsKey.ModifiableLiquids, OnWidgetClick, g => g.ModifiableLiquids, (g, v) => g.ModifiableLiquids = v ), @@ -77,7 +81,8 @@ namespace ClassicalSharp.Gui { bool noGlobalHacks = !p.Hacks.CanAnyHacks || !p.Hacks.Enabled; widgets[3].Disabled = noGlobalHacks || !p.Hacks.CanSpeed; widgets[4].Disabled = noGlobalHacks || !p.Hacks.CanSpeed; - widgets[6].Disabled = noGlobalHacks || !p.Hacks.CanPushbackBlocks; + widgets[5].Disabled = noGlobalHacks || !p.Hacks.CanSpeed; + widgets[7].Disabled = noGlobalHacks || !p.Hacks.CanPushbackBlocks; } public override void Dispose() { @@ -96,6 +101,7 @@ namespace ClassicalSharp.Gui { new BooleanValidator(), new BooleanValidator(), new BooleanValidator(), + new BooleanValidator(), new IntegerValidator( 1, 150 ), }; } @@ -110,16 +116,16 @@ namespace ClassicalSharp.Gui { "&eSets how many blocks high you can jump up.", "&eNote: You jump much higher when holding down the speed key binding.", }; - descriptions[5] = new [] { + descriptions[6] = new [] { "&eIf modifiable liquids is set to true, then water/lava can", "&ebe placed and deleted the same way as any other block.", }; - descriptions[6] = new [] { + descriptions[7] = new [] { "&eWhen this is active, placing blocks that intersect your own position", "&ecause the block to be placed, and you to be moved out of the way.", "&fThis is mainly useful for quick pillaring/towering.", }; - descriptions[7] = new [] { + descriptions[8] = new [] { "&eIf noclip sliding isn't used, you will immediately stop when", "&eyou are in noclip mode and no movement keys are held down.", }; diff --git a/ClassicalSharp/Entities/Components/HacksComponent.cs b/ClassicalSharp/Entities/Components/HacksComponent.cs index 22ad64052..ec1d1e742 100644 --- a/ClassicalSharp/Entities/Components/HacksComponent.cs +++ b/ClassicalSharp/Entities/Components/HacksComponent.cs @@ -25,21 +25,24 @@ namespace ClassicalSharp.Entities { /// should cause the player to be pushed back in the opposite direction of the placed block. public bool PushbackPlacing; + /// Whether the player should be able to step up whole blocks, instead of just slabs. + public bool FullBlockStep; + /// Whether the player has allowed hacks usage as an option. /// Note that all 'can use X' set by the server override this. - public bool Enabled = true; + public bool Enabled = true; /// Whether the player is allowed to use any type of hacks. - public bool CanAnyHacks = true; + public bool CanAnyHacks = true; /// Whether the player is allowed to use the types of cameras that use third person. - public bool CanUseThirdPersonCamera = true; + public bool CanUseThirdPersonCamera = true; /// Whether the player is allowed to increase its speed beyond the normal walking speed. - public bool CanSpeed = true; + public bool CanSpeed = true; /// Whether the player is allowed to fly in the world. - public bool CanFly = true; + public bool CanFly = true; /// Whether the player is allowed to teleport to their respawn coordinates. - public bool CanRespawn = true; + public bool CanRespawn = true; /// Whether the player is allowed to pass through all blocks. - public bool CanNoclip = true; + public bool CanNoclip = true; /// Whether the player is allowed to use pushback block placing. public bool CanPushbackBlocks = true; /// Whether the player is allowed to see all entity name tags. diff --git a/ClassicalSharp/Entities/LocalPlayer.cs b/ClassicalSharp/Entities/LocalPlayer.cs index 6cc179d8d..68bd83140 100644 --- a/ClassicalSharp/Entities/LocalPlayer.cs +++ b/ClassicalSharp/Entities/LocalPlayer.cs @@ -51,12 +51,15 @@ namespace ClassicalSharp.Entities { Hacks.NoclipSlide = Options.GetBool( OptionsKey.NoclipSlide, false ); Hacks.DoubleJump = !game.ClassicMode && Options.GetBool( OptionsKey.DoubleJump, false ); Hacks.Enabled = !game.ClassicMode && Options.GetBool( OptionsKey.HacksEnabled, true ); + Hacks.FullBlockStep = !game.ClassicMode && Options.GetBool( OptionsKey.FullBlockStep, false ); if( game.ClassicMode && game.ClassicHacks ) Hacks.Enabled = true; } Vector3 lastSoundPos = new Vector3( float.PositiveInfinity ); public override void Tick( double delta ) { if( game.World.IsNotLoaded ) return; + StepSize = Hacks.FullBlockStep && Hacks.Enabled && Hacks.CanAnyHacks + && Hacks.CanSpeed ? 1 : 0.5f; float xMoving = 0, zMoving = 0; lastPos = Position = nextPos; diff --git a/ClassicalSharp/Utils/Options.cs b/ClassicalSharp/Utils/Options.cs index 0b556fd33..7f1f8a7b5 100644 --- a/ClassicalSharp/Utils/Options.cs +++ b/ClassicalSharp/Utils/Options.cs @@ -31,6 +31,7 @@ namespace ClassicalSharp { public const string NoclipSlide = "hacks-noclipslide"; public const string CameraClipping = "hacks-cameraclipping"; public const string DoubleJump = "hacks-doublejump"; + public const string FullBlockStep = "hacks-fullblockstep"; public const string TabAutocomplete = "gui-tab-autocomplete"; public const string ShowBlockInHand = "gui-blockinhand";