diff options
author | scribblemaniac <connor.deptuck@gmail.com> | 2015-07-16 06:47:51 +0200 |
---|---|---|
committer | scribblemaniac <connor.deptuck@gmail.com> | 2015-07-16 19:15:57 +0200 |
commit | 55aa438831b82695a5cce6d505592b421096629a (patch) | |
tree | b163cff25ab149a320379608c7f49fe331ad6d98 /src/Mobs/Spider.cpp | |
parent | Merge pull request #2350 from SamJBarney/PeonySnowFix (diff) | |
download | cuberite-55aa438831b82695a5cce6d505592b421096629a.tar cuberite-55aa438831b82695a5cce6d505592b421096629a.tar.gz cuberite-55aa438831b82695a5cce6d505592b421096629a.tar.bz2 cuberite-55aa438831b82695a5cce6d505592b421096629a.tar.lz cuberite-55aa438831b82695a5cce6d505592b421096629a.tar.xz cuberite-55aa438831b82695a5cce6d505592b421096629a.tar.zst cuberite-55aa438831b82695a5cce6d505592b421096629a.zip |
Diffstat (limited to 'src/Mobs/Spider.cpp')
-rw-r--r-- | src/Mobs/Spider.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/src/Mobs/Spider.cpp b/src/Mobs/Spider.cpp index 184a1d912..a9da28750 100644 --- a/src/Mobs/Spider.cpp +++ b/src/Mobs/Spider.cpp @@ -3,7 +3,8 @@ #include "Spider.h" - +#include "../World.h" +#include "../Entities/Player.h" @@ -33,3 +34,42 @@ void cSpider::GetDrops(cItems & a_Drops, cEntity * a_Killer) + +void cSpider::EventSeePlayer(cEntity * a_Entity) +{ + if (!GetWorld()->IsChunkLighted(GetChunkX(), GetChunkZ())) + { + GetWorld()->QueueLightChunk(GetChunkX(), GetChunkZ()); + return; + } + + if (!static_cast<cPlayer *>(a_Entity)->IsGameModeCreative() && (GetWorld()->GetBlockBlockLight(this->GetPosition()) <= 9)) + { + super::EventSeePlayer(a_Entity); + } +} + + + + + +bool cSpider::DoTakeDamage(TakeDamageInfo & a_TDI) +{ + if (!super::DoTakeDamage(a_TDI)) + { + return false; + } + + // If the source of the damage is not from an pawn entity, switch to idle + if ((a_TDI.Attacker == nullptr) || !a_TDI.Attacker->IsPawn()) + { + m_EMState = IDLE; + } + else + { + // If the source of the damage is from a pawn entity, chase that entity + m_EMState = CHASING; + } + + return true; +} |