summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Spider.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-09-02 18:51:32 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-09-02 18:51:32 +0200
commitafb65224879ccced98c5a3699f7732dc37fe3f40 (patch)
treee2b95d4acd2b4516f8244abd0e049a33aed6a293 /src/Mobs/Spider.cpp
parentd (diff)
downloadcuberite-afb65224879ccced98c5a3699f7732dc37fe3f40.tar
cuberite-afb65224879ccced98c5a3699f7732dc37fe3f40.tar.gz
cuberite-afb65224879ccced98c5a3699f7732dc37fe3f40.tar.bz2
cuberite-afb65224879ccced98c5a3699f7732dc37fe3f40.tar.lz
cuberite-afb65224879ccced98c5a3699f7732dc37fe3f40.tar.xz
cuberite-afb65224879ccced98c5a3699f7732dc37fe3f40.tar.zst
cuberite-afb65224879ccced98c5a3699f7732dc37fe3f40.zip
Diffstat (limited to 'src/Mobs/Spider.cpp')
-rw-r--r--src/Mobs/Spider.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/Mobs/Spider.cpp b/src/Mobs/Spider.cpp
index 845bc145b..0a824aca2 100644
--- a/src/Mobs/Spider.cpp
+++ b/src/Mobs/Spider.cpp
@@ -7,10 +7,26 @@
#include "../Entities/Player.h"
#include "../Chunk.h"
-bool AggressiveAtNightFunction(cBehaviorAggressive & a_Behavior, cMonster & a_Monster)
+bool AggressiveAtNightFunction(cBehaviorAggressive & a_Behavior, cMonster & a_Monster, cChunk & a_Chunk)
{
- return
- !((Chunk->GetSkyLightAltered(Rel.x, Rel.y, Rel.z) > 11) || (Chunk->GetBlockLight(Rel.x, Rel.y, Rel.z) > 11))
+ UNUSED(a_Behavior);
+ if (!a_Monster.GetWorld()->IsChunkLighted(a_Monster.GetChunkX(), a_Monster.GetChunkZ()))
+ {
+ return false;
+ }
+
+ PREPARE_REL_AND_CHUNK(a_Monster.GetPosition(), a_Chunk);
+ if (!RelSuccess)
+ {
+ return false;
+ }
+
+ if (
+ !((Chunk->GetSkyLightAltered(Rel.x, Rel.y, Rel.z) > 11) || (Chunk->GetBlockLight(Rel.x, Rel.y, Rel.z) > 11))
+ )
+ {
+ return true;
+ }
}
cSpider::cSpider(void) :