diff options
author | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-09-02 18:51:32 +0200 |
---|---|---|
committer | LogicParrot <LogicParrot@users.noreply.github.com> | 2017-09-02 18:51:32 +0200 |
commit | afb65224879ccced98c5a3699f7732dc37fe3f40 (patch) | |
tree | e2b95d4acd2b4516f8244abd0e049a33aed6a293 /src/Mobs/Spider.cpp | |
parent | d (diff) | |
download | cuberite-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.cpp | 22 |
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) : |