Complaints appreciated. :-)
- Code: Select all
commit 9ba566da754b869b31348849ead22f0e19afa5d4
Author: Jonathan Neuschäfer <j.neuschaefer@gmx.net>
Date: Wed Jan 11 19:19:36 2012 +0100
content_abm: don't spawn oerkkis and DMs with only_peaceful_monsters set
diff --git a/src/content_abm.cpp b/src/content_abm.cpp
index 63867b7..5e6a6a4 100644
--- a/src/content_abm.cpp
+++ b/src/content_abm.cpp
@@ -26,6 +26,7 @@
#include "settings.h"
#include "mapblock.h" // For getNodeBlockPos
#include "mapgen.h" // For mapgen::make_tree
+#include "main.h" // For g_settings
#define PP(x) "("<<(x).X<<","<<(x).Y<<","<<(x).Z<<")"
@@ -173,7 +174,10 @@ class SpawnInCavesABM : public ActiveBlockModifier
{
v3f pos = intToFloat(p1, BS);
int i = myrand()%5;
- if(i == 0 || i == 1){
+ bool peaceful_only = g_settings
+ ->getBool("only_peaceful_mobs");
+
+ if((i == 0 || i == 1) && !peaceful_only){
actionstream<<"A dungeon master spawns at "
<<PP(p1)<<std::endl;
Settings properties;
@@ -181,7 +185,13 @@ class SpawnInCavesABM : public ActiveBlockModifier
ServerActiveObject *obj = new MobV2SAO(
env, pos, &properties);
env->addActiveObject(obj);
- } else if(i == 2 || i == 3){
+ } else if(i == 2 && !peaceful_only) {
+ actionstream<<"An oerkki spawns at "
+ <<PP(p1)<<std::endl;
+ ServerActiveObject *obj = new Oerkki1SAO(
+ env, pos);
+ env->addActiveObject(obj);
+ } else {
actionstream<<"Rats spawn at "
<<PP(p1)<<std::endl;
for(int j=0; j<3; j++){
@@ -189,12 +199,6 @@ class SpawnInCavesABM : public ActiveBlockModifier
env, pos);
env->addActiveObject(obj);
}
- } else {
- actionstream<<"An oerkki spawns at "
- <<PP(p1)<<std::endl;
- ServerActiveObject *obj = new Oerkki1SAO(
- env, pos);
- env->addActiveObject(obj);
}
}
}
Version 2: http://paste.opensuse.org/view/raw/57678777