Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
cMobCensus Class Reference

This class is used to collect information, for each Mob, what is the distance of the closest player it was first being designed in order to make mobs spawn / despawn / act as the behaviour and even life of mobs depends on the distance to closest player. More...

#include <MobCensus.h>

Collaboration diagram for cMobCensus:
Collaboration graph
[legend]

Public Member Functions

void CollectMob (cMonster &a_Monster, cChunk &a_Chunk, double a_Distance)
 Collect a mob - its distance to player, its family ... More...
 
void CollectSpawnableChunk (cChunk &a_Chunk)
 
cMobProximityCounterGetProximityCounter (void)
 Returns the nested proximity counter. More...
 
bool IsCapped (cMonster::eFamily a_MobFamily)
 Returns true if the family is capped (i.e. More...
 
void Logd (void)
 log the results of census to server console More...
 

Protected Member Functions

int GetNumChunks ()
 Returns the number of chunks that are elligible for spawning (for now, the loaded, valid chunks) More...
 

Static Protected Member Functions

static int GetCapMultiplier (cMonster::eFamily a_MobFamily)
 Returns the cap multiplier value of the given monster family. More...
 

Protected Attributes

std::set< cChunk * > m_EligibleForSpawnChunks
 
cMobFamilyCollecter m_MobFamilyCollecter
 
cMobProximityCounter m_ProximityCounter
 

Detailed Description

This class is used to collect information, for each Mob, what is the distance of the closest player it was first being designed in order to make mobs spawn / despawn / act as the behaviour and even life of mobs depends on the distance to closest player.

as side effect : it also collect the chunks that are elligible for spawning as side effect 2 : it also know the caps for mobs number and can compare census to this numbers

Definition at line 25 of file MobCensus.h.

Member Function Documentation

◆ CollectMob()

void cMobCensus::CollectMob ( cMonster a_Monster,
cChunk a_Chunk,
double  a_Distance 
)

Collect a mob - its distance to player, its family ...

Definition at line 10 of file MobCensus.cpp.

◆ CollectSpawnableChunk()

void cMobCensus::CollectSpawnableChunk ( cChunk a_Chunk)

Definition at line 53 of file MobCensus.cpp.

◆ GetCapMultiplier()

int cMobCensus::GetCapMultiplier ( cMonster::eFamily  a_MobFamily)
staticprotected

Returns the cap multiplier value of the given monster family.

Definition at line 33 of file MobCensus.cpp.

◆ GetNumChunks()

int cMobCensus::GetNumChunks ( void  )
protected

Returns the number of chunks that are elligible for spawning (for now, the loaded, valid chunks)

Definition at line 62 of file MobCensus.cpp.

◆ GetProximityCounter()

cMobProximityCounter & cMobCensus::GetProximityCounter ( void  )

Returns the nested proximity counter.

Definition at line 71 of file MobCensus.cpp.

◆ IsCapped()

bool cMobCensus::IsCapped ( cMonster::eFamily  a_MobFamily)

Returns true if the family is capped (i.e.

there are more mobs of this family than max)

Definition at line 20 of file MobCensus.cpp.

◆ Logd()

void cMobCensus::Logd ( void  )

log the results of census to server console

Definition at line 80 of file MobCensus.cpp.

Member Data Documentation

◆ m_EligibleForSpawnChunks

std::set<cChunk *> cMobCensus::m_EligibleForSpawnChunks
protected

Definition at line 48 of file MobCensus.h.

◆ m_MobFamilyCollecter

cMobFamilyCollecter cMobCensus::m_MobFamilyCollecter
protected

Definition at line 46 of file MobCensus.h.

◆ m_ProximityCounter

cMobProximityCounter cMobCensus::m_ProximityCounter
protected

Definition at line 45 of file MobCensus.h.


The documentation for this class was generated from the following files: