mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-16 11:06:06 -04:00
Further simplify LocalPlayer.
This commit is contained in:
parent
512657e009
commit
dc2b67d538
@ -153,12 +153,7 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsTick( float xMoving, float zMoving ) {
|
void PhysicsTick( float xMoving, float zMoving ) {
|
||||||
float multiply = 1F;
|
float multiply = flying ? ( speeding ? 90 : 15 ) : ( speeding ? 10 : 1 );
|
||||||
if( !flying ) {
|
|
||||||
multiply = speeding ? 10 : 1;
|
|
||||||
} else {
|
|
||||||
multiply = speeding ? 90 : 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( TouchesAnyWater() && !flying && !noClip ) {
|
if( TouchesAnyWater() && !flying && !noClip ) {
|
||||||
AdjHorVelocity( zMoving * multiply, xMoving * multiply, 0.02f * multiply );
|
AdjHorVelocity( zMoving * multiply, xMoving * multiply, 0.02f * multiply );
|
||||||
@ -185,16 +180,13 @@ namespace ClassicalSharp {
|
|||||||
Velocity.Y *= multiply;
|
Velocity.Y *= multiply;
|
||||||
Move();
|
Move();
|
||||||
Velocity.Y /= multiply;
|
Velocity.Y /= multiply;
|
||||||
Vector3I blockCoords = Vector3I.Floor( Position.X , Position.Y - 0.01f, Position.Z );
|
// Apply general drag and gravity
|
||||||
byte blockUnder = GetPhysicsBlockId( blockCoords.X, blockCoords.Y, blockCoords.Z );
|
|
||||||
|
|
||||||
// Apply general drag
|
|
||||||
Velocity.X *= 0.91f;
|
Velocity.X *= 0.91f;
|
||||||
Velocity.Y *= 0.98f;
|
Velocity.Y *= 0.98f;
|
||||||
Velocity.Z *= 0.91f;
|
Velocity.Z *= 0.91f;
|
||||||
Velocity.Y -= 0.08f;
|
Velocity.Y -= 0.08f;
|
||||||
|
|
||||||
if( blockUnder == (byte)Block.Ice ) {
|
if( BlockUnderFeet == Block.Ice ) {
|
||||||
// Limit velocity while travelling on ice.
|
// Limit velocity while travelling on ice.
|
||||||
if( Velocity.X > 0.25f ) Velocity.X = 0.25f;
|
if( Velocity.X > 0.25f ) Velocity.X = 0.25f;
|
||||||
if( Velocity.X < -0.25f ) Velocity.X = -0.25f;
|
if( Velocity.X < -0.25f ) Velocity.X = -0.25f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user