1
0

Further refactored, Reverted Minecart change

Other small changes.
This commit is contained in:
archshift
2014-04-26 09:21:49 -07:00
parent 80b97fd9dd
commit aef2c8ec62
11 changed files with 62 additions and 90 deletions

View File

@@ -411,7 +411,7 @@ bool cEntity::ArmorCoversAgainst(eDamageType a_DamageType)
return true;
}
}
ASSERT("Invalid damage type!");
ASSERT(!"Invalid damage type!");
}

View File

@@ -270,7 +270,7 @@ public:
/// Returns the hitpoints that this pawn can deal to a_Receiver using its equipped items
virtual int GetRawDamageAgainst(const cEntity & a_Receiver);
// Returns whether armor will protect against the passed damage type
/** Returns whether armor will protect against the passed damage type **/
virtual bool ArmorCoversAgainst(eDamageType a_DamageType);
/// Returns the hitpoints out of a_RawDamage that the currently equipped armor would cover

View File

@@ -88,7 +88,7 @@ void cFallingBlock::Tick(float a_Dt, cChunk & a_Chunk)
AddPosition(GetSpeed() * MilliDt);
//If not static (One billionth precision) broadcast movement.
float epsilon = 0.000000001;
static const float epsilon = 0.000000001;
if ((fabs(GetSpeedX()) > epsilon) || (fabs(GetSpeedZ()) > epsilon))
{
BroadcastMovementUpdate();

View File

@@ -234,15 +234,18 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta);
if (EntCol || BlckCol) return;
if (GetSpeedZ() > 0)
if (GetSpeedZ() != 0) // Don't do anything if cart is stationary
{
// Going SOUTH, slow down
AddSpeedZ(-0.1);
}
else if (GetSpeedZ() < 0)
{
// Going NORTH, slow down
AddSpeedZ(0.1);
if (GetSpeedZ() > 0)
{
// Going SOUTH, slow down
AddSpeedZ(-0.1);
}
else
{
// Going NORTH, slow down
AddSpeedZ(0.1);
}
}
break;
}
@@ -256,13 +259,16 @@ void cMinecart::HandleRailPhysics(NIBBLETYPE a_RailMeta, float a_Dt)
bool BlckCol = TestBlockCollision(a_RailMeta), EntCol = TestEntityCollision(a_RailMeta);
if (EntCol || BlckCol) return;
if (GetSpeedX() > 0)
if (GetSpeedX() != 0)
{
AddSpeedX(-0.1);
}
else if (GetSpeedX() < 0)
{
AddSpeedX(0.1);
if (GetSpeedX() > 0)
{
AddSpeedX(-0.1);
}
else
{
AddSpeedX(0.1);
}
}
break;
}