Fix no-clip being faster than after flying (thanks azmi2299) compared to just no-clip, also fixes noclip being faster after jump with speed (thanks 123DontMessWitme) compared to just normal vertical noclip.

This commit is contained in:
UnknownShadow200 2015-12-17 22:20:20 +11:00
parent dfa5662f99
commit 9da349f9fe
2 changed files with 3 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<ProjectGuid>{BEB1C785-5CAD-48FF-A886-876BF0A318D4}</ProjectGuid> <ProjectGuid>{BEB1C785-5CAD-48FF-A886-876BF0A318D4}</ProjectGuid>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<OutputType>Exe</OutputType> <OutputType>WinExe</OutputType>
<RootNamespace>ClassicalSharp</RootNamespace> <RootNamespace>ClassicalSharp</RootNamespace>
<AssemblyName>ClassicalSharp</AssemblyName> <AssemblyName>ClassicalSharp</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion> <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>

View File

@ -170,7 +170,6 @@ namespace ClassicalSharp {
bool touchWater = TouchesAnyWater(); bool touchWater = TouchesAnyWater();
bool touchLava = TouchesAnyLava(); bool touchLava = TouchesAnyLava();
Console.WriteLine( touchWater );
if( touchWater || touchLava ) { if( touchWater || touchLava ) {
BoundingBox bounds = CollisionBounds; BoundingBox bounds = CollisionBounds;
int feetY = Utils.Floor( bounds.Min.Y ), bodyY = feetY + 1; int feetY = Utils.Floor( bounds.Min.Y ), bodyY = feetY + 1;
@ -216,16 +215,15 @@ namespace ClassicalSharp {
normalDrag = new Vector3( 0.91f, 0.98f, 0.91f ), normalDrag = new Vector3( 0.91f, 0.98f, 0.91f ),
airDrag = new Vector3( 0.6f, 1f, 0.6f ); airDrag = new Vector3( 0.6f, 1f, 0.6f );
const float liquidGrav = 0.02f, ropeGrav = 0.034f, normalGrav = 0.08f; const float liquidGrav = 0.02f, ropeGrav = 0.034f, normalGrav = 0.08f;
float curMovementSpeed;
void PhysicsTick( float xMoving, float zMoving ) { void PhysicsTick( float xMoving, float zMoving ) {
onGround = false;
float multiply = (flying || noClip) ? float multiply = (flying || noClip) ?
(speeding ? SpeedMultiplier * 9 : SpeedMultiplier * 1.5f) : (speeding ? SpeedMultiplier * 9 : SpeedMultiplier * 1.5f) :
(speeding ? SpeedMultiplier : 1); (speeding ? SpeedMultiplier : 1);
float modifier = LowestSpeedModifier(); float modifier = LowestSpeedModifier();
float horMul = multiply * modifier; float horMul = multiply * modifier;
float yMul = Math.Max( 1f, multiply / 5 ) * modifier; float yMul = Math.Max( 1f, multiply / 5 ) * modifier;
curMovementSpeed = horMul;
if( TouchesAnyWater() && !flying && !noClip ) { if( TouchesAnyWater() && !flying && !noClip ) {
Move( xMoving, zMoving, 0.02f * horMul, waterDrag, liquidGrav, 1 ); Move( xMoving, zMoving, 0.02f * horMul, waterDrag, liquidGrav, 1 );
@ -237,7 +235,7 @@ namespace ClassicalSharp {
float factor = !(flying || noClip) && onGround ? 0.1f : 0.02f; float factor = !(flying || noClip) && onGround ? 0.1f : 0.02f;
float gravity = useLiquidGravity ? liquidGrav : normalGrav; float gravity = useLiquidGravity ? liquidGrav : normalGrav;
Move( xMoving, zMoving, factor * horMul, normalDrag, gravity, yMul ); Move( xMoving, zMoving, factor * horMul, normalDrag, gravity, yMul );
if( BlockUnderFeet == Block.Ice && !(flying || noClip) ) { if( BlockUnderFeet == Block.Ice && !(flying || noClip) ) {
// limit components to +-0.25f by rescaling vector to [-0.25, 0.25] // limit components to +-0.25f by rescaling vector to [-0.25, 0.25]
if( Math.Abs( Velocity.X ) > 0.25f || Math.Abs( Velocity.Z ) > 0.25f ) { if( Math.Abs( Velocity.X ) > 0.25f || Math.Abs( Velocity.Z ) > 0.25f ) {