Cuberite
A lightweight, fast and extensible game server for Minecraft
FireSimulator.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "Simulator.h"
5 #include "../IniFile.h"
6 
7 
8 
9 
10 
19  public cSimulator
20 {
21 public:
22 
23  cFireSimulator(cWorld & a_World, cIniFile & a_IniFile);
24 
25  static bool IsFuel (BLOCKTYPE a_BlockType);
26  static bool DoesBurnForever(BLOCKTYPE a_BlockType);
27 
28 private:
29 
30  virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) override;
31 
32  static bool IsAllowedBlock(BLOCKTYPE a_BlockType);
33 
36 
39 
42 
45 
46  virtual void AddBlock(cChunk & a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) override;
47 
49  int GetBurnStepTime(cChunk * a_Chunk, Vector3i a_RelPos);
50 
52  void TrySpreadFire(cChunk * a_Chunk, Vector3i a_RelPos);
53 
55  void RemoveFuelNeighbors(cChunk * a_Chunk, Vector3i a_RelPos);
56 
61  bool CanStartFireInBlock(cChunk * a_NearChunk, Vector3i a_RelPos);
62 } ;
63 
64 
65 
66 
67 
std::list< cCoordWithInt > cCoordWithIntList
Definition: ChunkDef.h:502
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
cCoordWithIntList cFireSimulatorChunkData
Stores individual fire blocks in the chunk; the int data is used as the time [msec] the fire takes to...
Definition: FireSimulator.h:69
Definition: Chunk.h:36
The fire simulator takes care of the fire blocks.
Definition: FireSimulator.h:20
unsigned m_BurnStepTimeNonfuel
Time (in msec) that a fire block takes to burn without a fuel block into the next step.
Definition: FireSimulator.h:38
void RemoveFuelNeighbors(cChunk *a_Chunk, Vector3i a_RelPos)
Removes all burnable blocks neighboring the specified block.
int m_ReplaceFuelChance
Chance [0..100000] of a fuel burning out being replaced by a new fire block instead of an air block.
Definition: FireSimulator.h:44
static bool IsFuel(BLOCKTYPE a_BlockType)
bool CanStartFireInBlock(cChunk *a_NearChunk, Vector3i a_RelPos)
Returns true if a fire can be started in the specified block, that is, it is an air block and has fue...
static bool IsAllowedBlock(BLOCKTYPE a_BlockType)
int m_Flammability
Chance [0..100000] of an adjacent fuel to catch fire on each tick.
Definition: FireSimulator.h:41
virtual void AddBlock(cChunk &a_Chunk, Vector3i a_Position, BLOCKTYPE a_Block) override
Called to simulate a new block.
void TrySpreadFire(cChunk *a_Chunk, Vector3i a_RelPos)
Tries to spread fire to a neighborhood of the specified block.
virtual void SimulateChunk(std::chrono::milliseconds a_Dt, int a_ChunkX, int a_ChunkZ, cChunk *a_Chunk) override
unsigned m_BurnStepTimeFuel
Time (in msec) that a fire block takes to burn with a fuel block into the next step.
Definition: FireSimulator.h:35
cFireSimulator(cWorld &a_World, cIniFile &a_IniFile)
int GetBurnStepTime(cChunk *a_Chunk, Vector3i a_RelPos)
Returns the time [msec] after which the specified fire block is stepped again; based on surrounding f...
static bool DoesBurnForever(BLOCKTYPE a_BlockType)
Base class for all block-based physics simulators (such as fluid, fire, falling blocks etc....
Definition: Simulator.h:22
Definition: World.h:53