1
0

Initial Floody fluid simulator.

Can spread, cannot dry.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@963 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com
2012-10-14 17:06:21 +00:00
parent dd554175a4
commit 5b7de82a79
13 changed files with 446 additions and 54 deletions

View File

@@ -19,14 +19,9 @@ cFluidSimulator::cFluidSimulator(cWorld * a_World, BLOCKTYPE a_Fluid, BLOCKTYPE
bool cFluidSimulator::IsPassableForFluid(BLOCKTYPE a_BlockType)
bool cFluidSimulator::IsAllowedBlock(BLOCKTYPE a_BlockType)
{
return (
(a_BlockType == E_BLOCK_AIR) ||
(a_BlockType == E_BLOCK_FIRE) ||
IsAllowedBlock(a_BlockType) ||
CanWashAway(a_BlockType)
);
return ((a_BlockType == m_FluidBlock) || (a_BlockType == m_StationaryFluidBlock));
}
@@ -65,6 +60,52 @@ bool cFluidSimulator::IsSolidBlock(BLOCKTYPE a_BlockType)
bool cFluidSimulator::IsPassableForFluid(BLOCKTYPE a_BlockType)
{
return (
(a_BlockType == E_BLOCK_AIR) ||
(a_BlockType == E_BLOCK_FIRE) ||
IsAllowedBlock(a_BlockType) ||
CanWashAway(a_BlockType)
);
}
bool cFluidSimulator::IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2)
{
if (a_Meta1 == 0)
{
// Source block is higher than anything, even itself.
return true;
}
if ((a_Meta1 & 0x08) != 0)
{
// Falling fluid is higher than anything, including self
return true;
}
if (a_Meta2 == 0)
{
// Second block is a source and first block isn't
return false;
}
if ((a_Meta2 & 0x08) != 0)
{
// Second block is falling and the first one is neither a source nor falling
return false;
}
// All special cases have been handled, now it's just a raw comparison:
return (a_Meta1 < a_Meta2);
}
// TODO Not working very well yet :s
Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a_Over)
{