1
0

Adding an Empty shell that would launch mob spawner - not called yet

This commit is contained in:
mgueydan
2013-09-08 00:11:38 +02:00
parent d2eb58f277
commit bf1fb0aa3d
5 changed files with 109 additions and 3 deletions

View File

@@ -13,6 +13,7 @@
#include "PluginManager.h"
#include "Entities/TNTEntity.h"
#include "MobCensus.h"
#include "MobSpawner.h"
#ifndef _WIN32
#include <cstdlib> // abs
@@ -2167,6 +2168,19 @@ void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill)
void cChunkMap::SpawnMobs(cMobSpawner& a_MobSpawner)
{
cCSLock Lock(m_CSLayers);
for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr)
{
(*itr)->SpawnMobs(a_MobSpawner);
} // for itr - m_Layers
}
void cChunkMap::Tick(float a_Dt)
{
cCSLock Lock(m_CSLayers);
@@ -2343,6 +2357,20 @@ void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill)
void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner& a_MobSpawner)
{
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
{
// We only spawn close to players
if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients())
{
m_Chunks[i]->SpawnMobs(a_MobSpawner);
}
} // for i - m_Chunks[]
}
void cChunkMap::cChunkLayer::Tick(float a_Dt)
{
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)