Changes based on madmaxoft's nitpicker notes.
This commit is contained in:
parent
e1a06153b2
commit
e94307c292
@ -329,7 +329,7 @@ public:
|
|||||||
/// Same as QueueTickBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s in such a case), ignores unsuccessful attempts
|
/// Same as QueueTickBlock(), but relative coords needn't be in this chunk (uses m_Neighbor-s in such a case), ignores unsuccessful attempts
|
||||||
void UnboundedQueueTickBlock(int a_RelX, int a_RelY, int a_RelZ);
|
void UnboundedQueueTickBlock(int a_RelX, int a_RelY, int a_RelZ);
|
||||||
|
|
||||||
// Light alterations based on time
|
/// Light alterations based on time
|
||||||
NIBBLETYPE GetTimeAlteredLight(NIBBLETYPE a_Skylight) const;
|
NIBBLETYPE GetTimeAlteredLight(NIBBLETYPE a_Skylight) const;
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,20 +124,15 @@ cMonster::eType cMobSpawner::ChooseMobType(EMCSBiome a_Biome)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool cMobSpawner::CanSpawnHere(const cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, cMonster::eType a_MobType, EMCSBiome a_Biome)
|
bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, cMonster::eType a_MobType, EMCSBiome a_Biome)
|
||||||
{
|
{
|
||||||
BLOCKTYPE TargetBlock;
|
BLOCKTYPE TargetBlock;
|
||||||
BLOCKTYPE BlockAbove;
|
|
||||||
BLOCKTYPE BlockBelow;
|
|
||||||
NIBBLETYPE BlockLight;
|
|
||||||
NIBBLETYPE SkyLight;
|
|
||||||
if (m_AllowedTypes.find(a_MobType) != m_AllowedTypes.end() && a_Chunk->UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, TargetBlock))
|
if (m_AllowedTypes.find(a_MobType) != m_AllowedTypes.end() && a_Chunk->UnboundedRelGetBlockType(a_RelX, a_RelY, a_RelZ, TargetBlock))
|
||||||
{
|
{
|
||||||
|
NIBBLETYPE BlockLight = a_Chunk->GetBlockLight(a_RelX, a_RelY, a_RelZ);
|
||||||
a_Chunk->UnboundedRelGetBlockBlockLight(a_RelX, a_RelY, a_RelZ, BlockLight);
|
NIBBLETYPE SkyLight = a_Chunk->GetSkyLight(a_RelX, a_RelY, a_RelZ);
|
||||||
a_Chunk->UnboundedRelGetBlockSkyLight(a_RelX, a_RelY, a_RelZ, SkyLight);
|
BLOCKTYPE BlockAbove = a_Chunk->GetBlock(a_RelX, a_RelY + 1, a_RelZ);
|
||||||
a_Chunk->UnboundedRelGetBlockType(a_RelX, a_RelY + 1, a_RelZ, BlockAbove);
|
BLOCKTYPE BlockBelow = a_Chunk->GetBlock(a_RelX, a_RelY - 1, a_RelZ);
|
||||||
a_Chunk->UnboundedRelGetBlockType(a_RelX, a_RelY - 1, a_RelZ, BlockBelow);
|
|
||||||
|
|
||||||
SkyLight = a_Chunk->GetTimeAlteredLight(SkyLight);
|
SkyLight = a_Chunk->GetTimeAlteredLight(SkyLight);
|
||||||
|
|
||||||
@ -168,11 +163,10 @@ bool cMobSpawner::CanSpawnHere(const cChunk * a_Chunk, int a_RelX, int a_RelY, i
|
|||||||
{
|
{
|
||||||
if (a_RelY < 250)
|
if (a_RelY < 250)
|
||||||
{
|
{
|
||||||
BLOCKTYPE BlockTop;
|
BLOCKTYPE BlockTop = a_Chunk->GetBlock(a_RelX, a_RelY + 2, a_RelZ);
|
||||||
a_Chunk->UnboundedRelGetBlockType(a_RelX, a_RelY + 2, a_RelZ, BlockTop);
|
|
||||||
if (BlockTop == E_BLOCK_AIR)
|
if (BlockTop == E_BLOCK_AIR)
|
||||||
{
|
{
|
||||||
a_Chunk->UnboundedRelGetBlockType(a_RelX, a_RelY + 3, a_RelZ, BlockTop);
|
BlockTop = a_Chunk->GetBlock(a_RelX, a_RelY + 3, a_RelZ);
|
||||||
return (TargetBlock == E_BLOCK_AIR) && (BlockAbove == E_BLOCK_AIR) && (BlockTop == E_BLOCK_AIR) && (!g_BlockTransparent[BlockBelow]) &&
|
return (TargetBlock == E_BLOCK_AIR) && (BlockAbove == E_BLOCK_AIR) && (BlockTop == E_BLOCK_AIR) && (!g_BlockTransparent[BlockBelow]) &&
|
||||||
(SkyLight <= 7) && (BlockLight <= 7);
|
(SkyLight <= 7) && (BlockLight <= 7);
|
||||||
}
|
}
|
||||||
@ -227,7 +221,7 @@ bool cMobSpawner::CanSpawnHere(const cChunk * a_Chunk, int a_RelX, int a_RelY, i
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cMonster* cMobSpawner::TryToSpawnHere(const cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize)
|
cMonster* cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize)
|
||||||
{
|
{
|
||||||
cMonster* toReturn = NULL;
|
cMonster* toReturn = NULL;
|
||||||
if (m_NewPack)
|
if (m_NewPack)
|
||||||
@ -248,6 +242,8 @@ cMonster* cMobSpawner::TryToSpawnHere(const cChunk * a_Chunk, int a_RelX, int a_
|
|||||||
m_NewPack = false;
|
m_NewPack = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make sure we are looking at the right chunk to spawn in
|
||||||
|
a_Chunk = a_Chunk->GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ);
|
||||||
|
|
||||||
if (CanSpawnHere(a_Chunk, a_RelX, a_RelY, a_RelZ, m_MobType, a_Biome))
|
if (CanSpawnHere(a_Chunk, a_RelX, a_RelY, a_RelZ, m_MobType, a_Biome))
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ public :
|
|||||||
// if this is the first of a Pack : determine the type of monster
|
// if this is the first of a Pack : determine the type of monster
|
||||||
// BlockType & BlockMeta are used to decide what kind of Mob can Spawn here
|
// BlockType & BlockMeta are used to decide what kind of Mob can Spawn here
|
||||||
// MaxPackSize is set to the maximal size for a pack this type of mob
|
// MaxPackSize is set to the maximal size for a pack this type of mob
|
||||||
cMonster * TryToSpawnHere(const cChunk * a_Chunk, int A_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize);
|
cMonster * TryToSpawnHere(cChunk * a_Chunk, int A_RelX, int a_RelY, int a_RelZ, EMCSBiome a_Biome, int& a_MaxPackSize);
|
||||||
|
|
||||||
// mark the beginning of a new Pack
|
// mark the beginning of a new Pack
|
||||||
// all mobs of the same Pack are the same type
|
// all mobs of the same Pack are the same type
|
||||||
@ -53,7 +53,7 @@ public :
|
|||||||
|
|
||||||
protected :
|
protected :
|
||||||
// return true if specified type of mob can spawn on specified block
|
// return true if specified type of mob can spawn on specified block
|
||||||
bool CanSpawnHere(const cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, cMonster::eType a_MobType, EMCSBiome a_Biome);
|
bool CanSpawnHere(cChunk * a_Chunk, int a_RelX, int a_RelY, int a_RelZ, cMonster::eType a_MobType, EMCSBiome a_Biome);
|
||||||
|
|
||||||
// return a random type that can spawn on specified biome.
|
// return a random type that can spawn on specified biome.
|
||||||
// returns E_ENTITY_TYPE_DONOTUSE if none is possible
|
// returns E_ENTITY_TYPE_DONOTUSE if none is possible
|
||||||
|
@ -609,6 +609,7 @@ void cWorld::Tick(float a_Dt)
|
|||||||
m_WorldAge = (Int64)(m_WorldAgeSecs * 20.0);
|
m_WorldAge = (Int64)(m_WorldAgeSecs * 20.0);
|
||||||
m_TimeOfDay = (Int64)(m_TimeOfDaySecs * 20.0);
|
m_TimeOfDay = (Int64)(m_TimeOfDaySecs * 20.0);
|
||||||
|
|
||||||
|
// Updates the sky darkness based on current time of day
|
||||||
UpdateSkyDarkness();
|
UpdateSkyDarkness();
|
||||||
|
|
||||||
// Broadcast time update every 40 ticks (2 seconds)
|
// Broadcast time update every 40 ticks (2 seconds)
|
||||||
|
@ -593,7 +593,7 @@ public:
|
|||||||
void TabCompleteUserName(const AString & a_Text, AStringVector & a_Results);
|
void TabCompleteUserName(const AString & a_Text, AStringVector & a_Results);
|
||||||
|
|
||||||
/// Get the current darkness level based on the time
|
/// Get the current darkness level based on the time
|
||||||
Int64 GetSkyDarkness() { return m_SkyDarkness; }
|
NIBBLETYPE GetSkyDarkness() { return m_SkyDarkness; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ private:
|
|||||||
Int64 m_LastSave; // The last WorldAge (in ticks) in which save-all was triggerred
|
Int64 m_LastSave; // The last WorldAge (in ticks) in which save-all was triggerred
|
||||||
std::map<cMonster::eFamily,Int64> m_LastSpawnMonster; // The last WorldAge (in ticks) in which a monster was spawned (for each megatype of monster) // MG TODO : find a way to optimize without creating unmaintenability (if mob IDs are becoming unrowed)
|
std::map<cMonster::eFamily,Int64> m_LastSpawnMonster; // The last WorldAge (in ticks) in which a monster was spawned (for each megatype of monster) // MG TODO : find a way to optimize without creating unmaintenability (if mob IDs are becoming unrowed)
|
||||||
|
|
||||||
Int64 m_SkyDarkness;
|
NIBBLETYPE m_SkyDarkness;
|
||||||
|
|
||||||
eGameMode m_GameMode;
|
eGameMode m_GameMode;
|
||||||
bool m_bEnabledPVP;
|
bool m_bEnabledPVP;
|
||||||
|
Loading…
Reference in New Issue
Block a user