1
0

Even more fixes [SEE DESC]

* Fixed minecarts breaking completely due to stuff
* Rails are now non solid again
+ Added IsRail inline bool
- Removed Herobrine
This commit is contained in:
Tiger Wang 2013-09-12 23:57:02 +01:00
parent a39564a46a
commit 22b8f3a2e0
4 changed files with 62 additions and 23 deletions

View File

@ -782,7 +782,7 @@ public:
g_BlockIsSolid[E_BLOCK_NETHER_PORTAL] = false; g_BlockIsSolid[E_BLOCK_NETHER_PORTAL] = false;
g_BlockIsSolid[E_BLOCK_PISTON] = false; g_BlockIsSolid[E_BLOCK_PISTON] = false;
g_BlockIsSolid[E_BLOCK_PISTON_EXTENSION] = false; g_BlockIsSolid[E_BLOCK_PISTON_EXTENSION] = false;
g_BlockIsSolid[E_BLOCK_RAIL] = true; g_BlockIsSolid[E_BLOCK_RAIL] = false;
g_BlockIsSolid[E_BLOCK_REDSTONE_REPEATER_OFF] = false; g_BlockIsSolid[E_BLOCK_REDSTONE_REPEATER_OFF] = false;
g_BlockIsSolid[E_BLOCK_REDSTONE_REPEATER_ON] = false; g_BlockIsSolid[E_BLOCK_REDSTONE_REPEATER_ON] = false;
g_BlockIsSolid[E_BLOCK_REDSTONE_TORCH_OFF] = false; g_BlockIsSolid[E_BLOCK_REDSTONE_TORCH_OFF] = false;

View File

@ -12,6 +12,7 @@
#include "../Simulator/FluidSimulator.h" #include "../Simulator/FluidSimulator.h"
#include "../PluginManager.h" #include "../PluginManager.h"
#include "../Tracer.h" #include "../Tracer.h"
#include "Minecart.h"
@ -553,6 +554,11 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
{ {
fallspeed = m_Gravity * a_Dt / 3; // Fall 3x slower in water. fallspeed = m_Gravity * a_Dt / 3; // Fall 3x slower in water.
} }
else if ((IsBlockRail(BlockBelow)) && (IsMinecart())) // Rails aren't solid, except for Minecarts
{
fallspeed = 0;
m_bOnGround = true;
}
else if (BlockIn == E_BLOCK_COBWEB) else if (BlockIn == E_BLOCK_COBWEB)
{ {
NextSpeed.y *= 0.05; // Reduce overall falling speed NextSpeed.y *= 0.05; // Reduce overall falling speed
@ -567,12 +573,26 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
} }
else else
{ {
if ( if (IsMinecart())
(BlockBelow != E_BLOCK_RAIL) && {
(BlockBelow != E_BLOCK_DETECTOR_RAIL) && if (!IsBlockRail(BlockBelow))
(BlockBelow != E_BLOCK_POWERED_RAIL) && {
(BlockBelow != E_BLOCK_ACTIVATOR_RAIL) // Friction if minecart is off track, otherwise, Minecart.cpp handles this
) if (NextSpeed.SqrLength() > 0.0004f)
{
NextSpeed.x *= 0.7f / (1 + a_Dt);
if (fabs(NextSpeed.x) < 0.05)
{
NextSpeed.x = 0;
}
NextSpeed.z *= 0.7f / (1 + a_Dt);
if (fabs(NextSpeed.z) < 0.05)
{
NextSpeed.z = 0;
}
}
}
else
{ {
// Friction // Friction
if (NextSpeed.SqrLength() > 0.0004f) if (NextSpeed.SqrLength() > 0.0004f)
@ -590,6 +610,7 @@ void cEntity::HandlePhysics(float a_Dt, cChunk & a_Chunk)
} }
} }
} }
}
// Adjust X and Z speed for COBWEB temporary. This speed modification should be handled inside block handlers since we // Adjust X and Z speed for COBWEB temporary. This speed modification should be handled inside block handlers since we
// might have different speed modifiers according to terrain. // might have different speed modifiers according to terrain.

View File

@ -54,22 +54,26 @@ void cMinecart::HandlePhysics(float a_Dt, cChunk & a_Chunk)
if ((GetPosY() > 0) && (GetPosY() < cChunkDef::Height)) if ((GetPosY() > 0) && (GetPosY() < cChunkDef::Height))
{ {
BLOCKTYPE BelowType = GetWorld()->GetBlock(floor(GetPosX()), floor(GetPosY() -1 ), floor(GetPosZ())); BLOCKTYPE BelowType = GetWorld()->GetBlock(floor(GetPosX()), floor(GetPosY() -1 ), floor(GetPosZ()));
BLOCKTYPE InsideType = GetWorld()->GetBlock(floor(GetPosX()), floor(GetPosY()), floor(GetPosZ()));
if ( if (IsBlockRail(BelowType))
(BelowType == E_BLOCK_RAIL) ||
(BelowType == E_BLOCK_POWERED_RAIL) ||
(BelowType == E_BLOCK_DETECTOR_RAIL) ||
(BelowType == E_BLOCK_ACTIVATOR_RAIL)
)
{ {
HandleRailPhysics(a_Dt, a_Chunk); HandleRailPhysics(a_Dt, a_Chunk);
} }
else else
{
if (IsBlockRail(InsideType))
{
SetPosY(ceil(GetPosY()));
HandleRailPhysics(a_Dt, a_Chunk);
}
else
{ {
super::HandlePhysics(a_Dt, a_Chunk); super::HandlePhysics(a_Dt, a_Chunk);
BroadcastMovementUpdate(); BroadcastMovementUpdate();
} }
} }
}
else else
{ {
super::HandlePhysics(a_Dt, a_Chunk); super::HandlePhysics(a_Dt, a_Chunk);

View File

@ -16,6 +16,20 @@
inline bool IsBlockRail(BLOCKTYPE a_BlockType)
{
return (
(a_BlockType == E_BLOCK_RAIL) ||
(a_BlockType == E_BLOCK_ACTIVATOR_RAIL) ||
(a_BlockType == E_BLOCK_DETECTOR_RAIL) ||
(a_BlockType == E_BLOCK_POWERED_RAIL)
) ;
}
class cMinecart : class cMinecart :
public cEntity public cEntity
{ {