![]() |
Cuberite
A lightweight, fast and extensible game server for Minecraft
|
#include <FloodyFluidSimulator.h>
Public Member Functions | |
cFloodyFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, NIBBLETYPE a_Falloff, int a_TickDelay, int a_NumNeighborsForSource) | |
![]() | |
virtual void | AddBlock (Vector3i a_Block, cChunk *a_Chunk) override |
Called to simulate a new block. More... | |
cDelayedFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, int a_TickDelay) | |
virtual cFluidSimulatorData * | CreateChunkData (void) override |
Creates a ChunkData object for the simulator to use. More... | |
virtual void | Simulate (float a_Dt) override |
Called in each tick, a_Dt is the time passed since the last tick, in msec. More... | |
virtual void | SimulateChunk (std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk *a_Chunk) override |
Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available. More... | |
![]() | |
cFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid) | |
virtual Vector3f | GetFlowingDirection (int a_X, int a_Y, int a_Z) |
Returns a unit vector in the direction the fluid is flowing or a zero-vector if not flowing. More... | |
virtual bool | IsAllowedBlock (BLOCKTYPE a_BlockType) override |
Returns true if the specified block type is "interesting" for this simulator. More... | |
bool | IsAnyFluidBlock (BLOCKTYPE a_BlockType) const |
bool | IsFluidBlock (BLOCKTYPE a_BlockType) const |
bool | IsHigherMeta (NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2) |
Returns true if a_Meta1 is a higher fluid than a_Meta2. More... | |
bool | IsPassableForFluid (BLOCKTYPE a_BlockType) |
bool | IsSolidBlock (BLOCKTYPE a_BlockType) |
bool | IsStationaryFluidBlock (BLOCKTYPE a_BlockType) const |
![]() | |
cSimulator (cWorld &a_World) | |
void | WakeUp (Vector3i a_Block, cChunk *a_Chunk) |
Called when a block changes. More... | |
void | WakeUpArea (const cCuboid &a_Area) |
Does the same processing as WakeUp, but for all blocks within the specified area. More... | |
virtual | ~cSimulator () |
Protected Member Functions | |
bool | CheckNeighborsForSource (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ) |
Checks if there are enough neighbors to create a source at the coords specified; turns into source and returns true if so. More... | |
bool | CheckTributaries (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_MyMeta) |
Checks tributaries, if not fed, decreases the block's level and returns true. More... | |
bool | HardenBlock (cChunk *a_Chunk, Vector3i a_RelPos, BLOCKTYPE a_BlockType, NIBBLETYPE a_Meta) |
Checks if the specified block should harden (Water / Lava interaction) and if so, converts it to a suitable block. More... | |
virtual void | SimulateBlock (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ) override |
Called from SimulateChunk() to simulate each block in one slot of blocks. More... | |
void | SpreadToNeighbor (cChunk *a_NearChunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_NewMeta) |
Spreads into the specified block, if the blocktype there allows. More... | |
virtual void | SpreadXZ (cChunk *a_Chunk, int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE a_NewMeta) |
Spread fluid to XZ neighbors. More... | |
Protected Attributes | |
NIBBLETYPE | m_Falloff |
int | m_NumNeighborsForSource |
![]() | |
int | m_AddSlotNum |
int | m_SimSlotNum |
int | m_TickDelay |
int | m_TotalBlocks |
![]() | |
BLOCKTYPE | m_FluidBlock |
BLOCKTYPE | m_StationaryFluidBlock |
![]() | |
cWorld & | m_World |
Private Types | |
typedef cDelayedFluidSimulator | super |
Additional Inherited Members | |
![]() | |
static bool | CanWashAway (BLOCKTYPE a_BlockType) |
Definition at line 19 of file FloodyFluidSimulator.h.
|
private |
Definition at line 22 of file FloodyFluidSimulator.h.
cFloodyFluidSimulator::cFloodyFluidSimulator | ( | cWorld & | a_World, |
BLOCKTYPE | a_Fluid, | ||
BLOCKTYPE | a_StationaryFluid, | ||
NIBBLETYPE | a_Falloff, | ||
int | a_TickDelay, | ||
int | a_NumNeighborsForSource | ||
) |
Definition at line 32 of file FloodyFluidSimulator.cpp.
|
protected |
Checks if there are enough neighbors to create a source at the coords specified; turns into source and returns true if so.
Definition at line 320 of file FloodyFluidSimulator.cpp.
|
protected |
Checks tributaries, if not fed, decreases the block's level and returns true.
Definition at line 149 of file FloodyFluidSimulator.cpp.
|
protected |
Checks if the specified block should harden (Water / Lava interaction) and if so, converts it to a suitable block.
Returns whether the block was changed or not.
Definition at line 367 of file FloodyFluidSimulator.cpp.
|
overrideprotectedvirtual |
Called from SimulateChunk() to simulate each block in one slot of blocks.
Descendants override this method to provide custom simulation.
Implements cDelayedFluidSimulator.
Definition at line 50 of file FloodyFluidSimulator.cpp.
|
protected |
Spreads into the specified block, if the blocktype there allows.
a_Area is for checking.
Definition at line 219 of file FloodyFluidSimulator.cpp.
|
protectedvirtual |
Spread fluid to XZ neighbors.
The coords are of the block currently being processed; a_NewMeta is the new meta for the new fluid block. Descendants may overridde to provide more sophisticated algorithms.
Reimplemented in cVanillaFluidSimulator.
Definition at line 137 of file FloodyFluidSimulator.cpp.
|
protected |
Definition at line 28 of file FloodyFluidSimulator.h.
|
protected |
Definition at line 29 of file FloodyFluidSimulator.h.