Adding mobtype filter inside world.ini

master
mgueydan 2013-09-08 03:30:09 +02:00
parent 7a5e3592ff
commit d67e8dcca5
2 changed files with 15 additions and 9 deletions

View File

@ -6,6 +6,7 @@
#include "Mobs/Monster.h"
#include "Mobs/IncludeAllMonsters.h"
#include <sstream>
cMobSpawner::tMobTypes& cMobSpawner::m_MobTypes()
{
@ -178,7 +179,7 @@ bool cMobSpawner::CanSpawnHere(cMonster::eType a_MobType, BLOCKTYPE a_BlockType,
{
if (a_MobType == cMonster::mtChicken || a_MobType == cMonster::mtPig || a_MobType == cMonster::mtCow || a_MobType == cMonster::mtSheep)
{
LOGD("Trying to spawn an animal");
LOGD(oss.str().c_str());
toReturn = (
a_BlockType_below == E_BLOCK_GRASS /*&& // MG TODO
a_LightLevel >= 9 */

View File

@ -491,14 +491,19 @@ void cWorld::Start(void)
m_GameMode = (eGameMode)IniFile.GetValueSetI("GameMode", "GameMode", m_GameMode);
m_bAnimals = true;
m_bAnimals = IniFile.GetValueB("Monsters", "AnimalsOn", true);
AString sAllMonsters = IniFile.GetValue("Monsters", "Types");
AStringVector SplitList = StringSplit(sAllMonsters, ",");
for (unsigned int i = 0; i < SplitList.size(); ++i)
{
cMonster::eType ToAdd = cMobTypesManager::fromStringToMobType(SplitList[i]);
if (ToAdd != cMonster::mtInvalidType)
{
m_AllowedMobs.insert(ToAdd);
LOGD("Allowed mob: %s",cMobTypesManager::fromMobTypeToString(ToAdd).c_str()); // a bit reverse working, but very few ressources wasted
}
};
m_AllowedMobs.insert(cMonster::mtCow); // MG TODO : temporary
m_AllowedMobs.insert(cMonster::mtZombie);
m_AllowedMobs.insert(cMonster::mtZombiePigman);
m_AllowedMobs.insert(cMonster::mtBat);
m_AllowedMobs.insert(cMonster::mtSpider);
m_AllowedMobs.insert(cMonster::mtGhast);
m_ChunkMap = new cChunkMap(this);