mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Make hacks more consistent, can place blocks through yourself in noclip, alow cycling fog up to 1024, 2048 and 4096.
This commit is contained in:
parent
30ea4c9429
commit
30a70638e1
@ -61,8 +61,10 @@ namespace ClassicalSharp {
|
||||
g => ((SinglePlayerServer)network).physics.Enabled ? "yes" : "no",
|
||||
(g, v) => ((SinglePlayerServer)network).physics.Enabled = (v == "yes") ),
|
||||
Make( 140, -150, "Pushback block placing", Anchor.Centre, OnWidgetClick,
|
||||
g => g.PushbackBlockPlacing ? "yes" : "no",
|
||||
(g, v) => g.PushbackBlockPlacing = (v == "yes" ) ),
|
||||
g => g.LocalPlayer.PushbackBlockPlacing
|
||||
&& g.LocalPlayer.CanPushbackBlocks ? "yes" : "no",
|
||||
(g, v) => { if( g.LocalPlayer.CanPushbackBlocks)
|
||||
g.LocalPlayer.PushbackBlockPlacing = v == "yes"; }),
|
||||
|
||||
Make( 0, 5, "Back to menu", Anchor.BottomOrRight,
|
||||
(g, w) => g.SetNewScreen( new PauseScreen( g ) ), null, null ),
|
||||
|
@ -14,28 +14,23 @@ namespace ClassicalSharp {
|
||||
public int SpeedMultiplier = 10;
|
||||
|
||||
public byte UserType;
|
||||
public bool PushbackBlockPlacing;
|
||||
bool canSpeed = true, canFly = true, canRespawn = true, canNoclip = true;
|
||||
|
||||
/// <summary> Whether the player has permission to increase its speed beyond the normal walking speed. </summary>
|
||||
public bool CanSpeed {
|
||||
get { return canSpeed; }
|
||||
set { canSpeed = value; }
|
||||
}
|
||||
/// <summary> Whether the player is allowed to increase its speed beyond the normal walking speed. </summary>
|
||||
public bool CanSpeed = true;
|
||||
|
||||
public bool CanFly {
|
||||
get { return canFly; }
|
||||
set { canFly = value; if( !value ) flying = false; }
|
||||
}
|
||||
/// <summary> Whether the player is allowed to fly in the world. </summary>
|
||||
public bool CanFly = true;
|
||||
|
||||
public bool CanRespawn {
|
||||
get { return canRespawn; }
|
||||
set { canRespawn = value; }
|
||||
}
|
||||
/// <summary> Whether the player is allowed to teleport to their respawn point. </summary>
|
||||
public bool CanRespawn = true;
|
||||
|
||||
public bool CanNoclip {
|
||||
get { return canNoclip; }
|
||||
set { canNoclip = value; if( !value ) noClip = false; }
|
||||
}
|
||||
/// <summary> Whether the player is allowed to pass through all blocks. </summary>
|
||||
public bool CanNoclip = true;
|
||||
|
||||
/// <summary> Whether the player is allowed to use pushback block placing. </summary>
|
||||
public bool CanPushbackBlocks = true;
|
||||
|
||||
float jumpVel = 0.42f;
|
||||
/// <summary> Returns the height that the client can currently jump up to.<br/>
|
||||
@ -214,12 +209,11 @@ namespace ClassicalSharp {
|
||||
public void ParseHackFlags( string name, string motd ) {
|
||||
string joined = name + motd;
|
||||
if( joined.Contains( "-hax" ) ) {
|
||||
CanFly = CanNoclip = CanSpeed = CanRespawn = false;
|
||||
game.CanUseThirdPersonCamera = false;
|
||||
game.SetCamera( false );
|
||||
CanFly = CanNoclip = CanRespawn = CanSpeed =
|
||||
CanPushbackBlocks = game.CanUseThirdPersonCamera = false;
|
||||
} else { // By default (this is also the case with WoM), we can use hacks.
|
||||
CanFly = CanNoclip = CanSpeed = CanRespawn = true;
|
||||
game.CanUseThirdPersonCamera = true;
|
||||
CanFly = CanNoclip = CanRespawn = CanSpeed =
|
||||
CanPushbackBlocks = game.CanUseThirdPersonCamera = true;
|
||||
}
|
||||
|
||||
ParseFlag( b => CanFly = b, joined, "fly" );
|
||||
@ -228,7 +222,9 @@ namespace ClassicalSharp {
|
||||
ParseFlag( b => CanRespawn = b, joined, "respawn" );
|
||||
|
||||
if( UserType == 0x64 )
|
||||
ParseFlag( b => CanFly = CanNoclip = CanRespawn = CanSpeed = b, joined, "ophax" );
|
||||
ParseFlag( b => CanFly = CanNoclip = CanRespawn =
|
||||
CanSpeed = CanPushbackBlocks = b, joined, "ophax" );
|
||||
CheckHacksConsistency();
|
||||
}
|
||||
|
||||
static void ParseFlag( Action<bool> action, string joined, string flag ) {
|
||||
@ -239,6 +235,17 @@ namespace ClassicalSharp {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Disables any hacks if their respective CanHackX value is set to false. </summary>
|
||||
public void CheckHacksConsistency() {
|
||||
if( !CanFly ) flying = false;
|
||||
if( !CanNoclip ) noClip = false;
|
||||
if( !CanSpeed) canSpeed = false;
|
||||
if( !CanPushbackBlocks ) PushbackBlockPlacing = false;
|
||||
|
||||
if( !game.CanUseThirdPersonCamera )
|
||||
game.SetCamera( false );
|
||||
}
|
||||
|
||||
/// <summary> Sets the user type of this user. This is used to control permissions for grass,
|
||||
/// bedrock, water and lava blocks on servers that don't support CPE block permissions. </summary>
|
||||
public void SetUserType( byte value ) {
|
||||
|
@ -69,7 +69,7 @@ namespace ClassicalSharp {
|
||||
public int MouseSensitivity = 30;
|
||||
public int ChatLines = 12;
|
||||
public bool HideGui = false, ShowFPS = true;
|
||||
public bool PushbackBlockPlacing;
|
||||
|
||||
public Animations Animations;
|
||||
internal int CloudsTextureId, RainTextureId, SnowTextureId;
|
||||
internal bool screenshotRequested;
|
||||
|
@ -116,9 +116,9 @@ namespace ClassicalSharp {
|
||||
pos.X + 1, pos.Y + height, pos.Z + 1 );
|
||||
BoundingBox localBB = game.LocalPlayer.CollisionBounds;
|
||||
|
||||
if( !localBB.Intersects( blockBB ) ) return true;
|
||||
if( game.LocalPlayer.noClip || !localBB.Intersects( blockBB ) ) return true;
|
||||
|
||||
if( game.PushbackBlockPlacing ) {
|
||||
if( game.LocalPlayer.PushbackBlockPlacing ) {
|
||||
return PushbackPlace( selected, blockBB );
|
||||
} else {
|
||||
localBB.Min.Y += 0.25f + Entity.Adjustment;
|
||||
@ -263,7 +263,7 @@ namespace ClassicalSharp {
|
||||
}
|
||||
}
|
||||
|
||||
static int[] viewDistances = { 16, 32, 64, 128, 256, 512 };
|
||||
static int[] viewDistances = { 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 };
|
||||
void KeyDownHandler( object sender, KeyboardKeyEventArgs e ) {
|
||||
Key key = e.Key;
|
||||
if( SimulateMouse( key, true ) ) return;
|
||||
|
@ -308,10 +308,8 @@ namespace ClassicalSharp {
|
||||
game.LocalPlayer.CanSpeed = reader.ReadUInt8() != 0;
|
||||
game.LocalPlayer.CanRespawn = reader.ReadUInt8() != 0;
|
||||
game.CanUseThirdPersonCamera = reader.ReadUInt8() != 0;
|
||||
game.LocalPlayer.CheckHacksConsistency();
|
||||
|
||||
if( !game.CanUseThirdPersonCamera ) {
|
||||
game.SetCamera( false );
|
||||
}
|
||||
float jumpHeight = reader.ReadInt16() / 32f;
|
||||
if( jumpHeight < 0 ) jumpHeight = 1.4f;
|
||||
game.LocalPlayer.CalculateJumpVelocity( jumpHeight );
|
||||
|
Loading…
x
Reference in New Issue
Block a user