Cuberite
A lightweight, fast and extensible game server for Minecraft
|
This class is used to determine which monster can be spawned in which place it is essentially static (eg. More...
#include <MobSpawner.h>
Public Member Functions | |
bool | CanSpawnAnything (void) |
bool | CheckPackCenter (BLOCKTYPE a_BlockType) |
Check if specified block can be a Pack center for this spawner. More... | |
cMobSpawner (cMonster::eFamily MobFamily, const std::set< eMonsterType > &a_AllowedTypes) | |
Constructor a_MobFamily is the Family of mobs that this spawner will spawn a_AllowedTypes is the set of types allowed for mobs it will spawn. More... | |
std::vector< std::unique_ptr< cMonster > > & | getSpawned (void) |
void | NewPack (void) |
Mark the beginning of a new Pack. More... | |
cMonster * | TryToSpawnHere (cChunk *a_Chunk, Vector3i a_RelPos, EMCSBiome a_Biome, int &a_MaxPackSize) |
Try to create a monster here If this is the first of a Pack, determine the type of monster a_Biome, BlockType & BlockMeta are used to decide what kind of Mob can Spawn here a_MaxPackSize is set to the maximum size for a pack this type of mob. More... | |
Static Public Member Functions | |
static bool | CanSpawnHere (cChunk *a_Chunk, Vector3i a_RelPos, eMonsterType a_MobType, EMCSBiome a_Biome, bool a_DisableSolidBelowCheck=false) |
Returns true if specified type of mob can spawn on specified block. More... | |
static std::set< eMonsterType > | GetAllowedMobTypes (EMCSBiome a_Biome) |
Returns all mob types that can spawn that biome. More... | |
Protected Member Functions | |
eMonsterType | ChooseMobType (EMCSBiome a_Biome) |
Returns a random type that can spawn in the specified biome. More... | |
Protected Attributes | |
std::set< eMonsterType > | m_AllowedTypes |
eMonsterType | m_MobType |
cMonster::eFamily | m_MonsterFamily |
bool | m_NewPack |
std::vector< std::unique_ptr< cMonster > > | m_Spawned |
This class is used to determine which monster can be spawned in which place it is essentially static (eg.
Squids spawn in water, Zombies spawn in dark places) but it also has dynamic part depending on the world.ini settings.
Definition at line 15 of file MobSpawner.h.
cMobSpawner::cMobSpawner | ( | cMonster::eFamily | MobFamily, |
const std::set< eMonsterType > & | a_AllowedTypes | ||
) |
Constructor a_MobFamily is the Family of mobs that this spawner will spawn a_AllowedTypes is the set of types allowed for mobs it will spawn.
Empty set would result in no spawn at all Allowed mobs thah are not of the right Family will not be include (no warning).
Definition at line 13 of file MobSpawner.cpp.
bool cMobSpawner::CanSpawnAnything | ( | void | ) |
Definition at line 548 of file MobSpawner.cpp.
|
static |
Returns true if specified type of mob can spawn on specified block.
Definition at line 75 of file MobSpawner.cpp.
bool cMobSpawner::CheckPackCenter | ( | BLOCKTYPE | a_BlockType | ) |
Check if specified block can be a Pack center for this spawner.
Definition at line 31 of file MobSpawner.cpp.
|
protected |
Returns a random type that can spawn in the specified biome.
Returns mtInvalidType if none is possible.
Definition at line 49 of file MobSpawner.cpp.
|
static |
Returns all mob types that can spawn that biome.
Definition at line 355 of file MobSpawner.cpp.
|
inline |
Definition at line 40 of file MobSpawner.h.
void cMobSpawner::NewPack | ( | void | ) |
Mark the beginning of a new Pack.
All mobs of the same Pack are the same type
Definition at line 539 of file MobSpawner.cpp.
cMonster * cMobSpawner::TryToSpawnHere | ( | cChunk * | a_Chunk, |
Vector3i | a_RelPos, | ||
EMCSBiome | a_Biome, | ||
int & | a_MaxPackSize | ||
) |
Try to create a monster here If this is the first of a Pack, determine the type of monster a_Biome, BlockType & BlockMeta are used to decide what kind of Mob can Spawn here a_MaxPackSize is set to the maximum size for a pack this type of mob.
Definition at line 480 of file MobSpawner.cpp.
|
protected |
Definition at line 59 of file MobSpawner.h.
|
protected |
Definition at line 61 of file MobSpawner.h.
|
protected |
Definition at line 58 of file MobSpawner.h.
|
protected |
Definition at line 60 of file MobSpawner.h.
|
protected |
Definition at line 62 of file MobSpawner.h.