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) | |
Public Member Functions inherited from cDelayedFluidSimulator | |
cDelayedFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid, int a_TickDelay) | |
Public Member Functions inherited from cFluidSimulator | |
cFluidSimulator (cWorld &a_World, BLOCKTYPE a_Fluid, BLOCKTYPE a_StationaryFluid) | |
virtual Vector3f | GetFlowingDirection (Vector3i a_Pos) |
Returns a unit vector in the direction the fluid is flowing or a zero-vector if not flowing. 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 |
Public Member Functions inherited from cSimulator | |
cSimulator (cWorld &a_World) | |
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 Member Functions inherited from cDelayedFluidSimulator | |
virtual void | AddBlock (cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) override |
Called to simulate a new block. More... | |
virtual cFluidSimulatorData * | CreateChunkData (void) override |
Creates a ChunkData object for the simulator to use. More... | |
virtual void | Simulate (float a_Dt) override |
virtual void | SimulateChunk (std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk *a_Chunk) override |
Protected Member Functions inherited from cFluidSimulator | |
bool | IsAllowedBlock (BLOCKTYPE a_BlockType) |
Protected Member Functions inherited from cSimulator | |
virtual void | WakeUp (cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) |
Called to simulate a single new block, typically as a result of a single block break or change. More... | |
virtual void | WakeUp (cChunk &a_Chunk, Vector3i a_Position, Vector3i a_Offset, BLOCKTYPE a_Block) |
Called to simulate a single block, synthesised by the simulator manager. More... | |
Protected Attributes | |
NIBBLETYPE | m_Falloff |
int | m_NumNeighborsForSource |
Protected Attributes inherited from cDelayedFluidSimulator | |
int | m_AddSlotNum |
int | m_SimSlotNum |
int | m_TickDelay |
int | m_TotalBlocks |
Protected Attributes inherited from cFluidSimulator | |
BLOCKTYPE | m_FluidBlock |
BLOCKTYPE | m_StationaryFluidBlock |
Protected Attributes inherited from cSimulator | |
cWorld & | m_World |
Private Types | |
using | Super = cDelayedFluidSimulator |
Additional Inherited Members | |
Static Public Member Functions inherited from cFluidSimulator | |
static bool | CanWashAway (BLOCKTYPE a_BlockType) |
Static Public Member Functions inherited from cSimulator | |
static std::array< Vector3i, 5 > | GetLinkedOffsets (Vector3i Offset) |
For a given offset from a position, return the offsets that represent the adjacents of the newly offset position, excluding the old position. More... | |
Static Public Attributes inherited from cSimulator | |
static constexpr std::array< Vector3i, 6 > | AdjacentOffsets |
Contains offsets for direct adjacents of any position. More... | |
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 33 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 317 of file FloodyFluidSimulator.cpp.
|
protected |
Checks tributaries, if not fed, decreases the block's level and returns true.
Definition at line 150 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 364 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 51 of file FloodyFluidSimulator.cpp.
|
protected |
Spreads into the specified block, if the blocktype there allows.
a_Area is for checking.
Definition at line 220 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 138 of file FloodyFluidSimulator.cpp.
|
protected |
Definition at line 30 of file FloodyFluidSimulator.h.
|
protected |
Definition at line 31 of file FloodyFluidSimulator.h.