summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Behaviors/BehaviorDayLightBurner.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-09-01 21:55:17 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-09-01 21:55:17 +0200
commitf8b9400713cbb96f61c1515132aa6af99c73d600 (patch)
tree7ec1ca42f4d23426b103ec89169c4dd57f7c6194 /src/Mobs/Behaviors/BehaviorDayLightBurner.cpp
parentmerge (diff)
downloadcuberite-f8b9400713cbb96f61c1515132aa6af99c73d600.tar
cuberite-f8b9400713cbb96f61c1515132aa6af99c73d600.tar.gz
cuberite-f8b9400713cbb96f61c1515132aa6af99c73d600.tar.bz2
cuberite-f8b9400713cbb96f61c1515132aa6af99c73d600.tar.lz
cuberite-f8b9400713cbb96f61c1515132aa6af99c73d600.tar.xz
cuberite-f8b9400713cbb96f61c1515132aa6af99c73d600.tar.zst
cuberite-f8b9400713cbb96f61c1515132aa6af99c73d600.zip
Diffstat (limited to 'src/Mobs/Behaviors/BehaviorDayLightBurner.cpp')
-rw-r--r--src/Mobs/Behaviors/BehaviorDayLightBurner.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Mobs/Behaviors/BehaviorDayLightBurner.cpp b/src/Mobs/Behaviors/BehaviorDayLightBurner.cpp
index 0b0faed08..1271574fe 100644
--- a/src/Mobs/Behaviors/BehaviorDayLightBurner.cpp
+++ b/src/Mobs/Behaviors/BehaviorDayLightBurner.cpp
@@ -4,7 +4,6 @@
#include "../Monster.h"
#include "../../Entities/Player.h"
#include "../../Entities/Entity.h"
-
#include "../../Chunk.h"
@@ -15,6 +14,7 @@ void cBehaviorDayLightBurner::AttachToMonster(cMonster & a_Parent)
{
m_Parent = &a_Parent;
m_Parent->AttachPostTickBehavior(this);
+ m_Parent->GetPathFinder().SetAvoidSunlight(true);
}
@@ -35,7 +35,7 @@ void cBehaviorDayLightBurner::PostTick(std::chrono::milliseconds a_Dt, cChunk &
return;
}
- if (!m_Parent->IsOnFire() && WouldBurnAt(m_Parent->GetPosition(), a_Chunk))
+ if (!m_Parent->IsOnFire() && WouldBurnAt(m_Parent->GetPosition(), a_Chunk, *m_Parent))
{
// Burn for 100 ticks, then decide again
m_Parent->StartBurning(100);
@@ -45,7 +45,7 @@ void cBehaviorDayLightBurner::PostTick(std::chrono::milliseconds a_Dt, cChunk &
-bool cBehaviorDayLightBurner::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
+bool cBehaviorDayLightBurner::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk, cMonster & a_Monster)
{
int RelY = FloorC(a_Location.y);
if (RelY <= 0)
@@ -67,11 +67,11 @@ bool cBehaviorDayLightBurner::WouldBurnAt(Vector3d a_Location, cChunk & a_Chunk)
if (
(Chunk->GetBlock(Rel.x, Rel.y, Rel.z) != E_BLOCK_SOULSAND) && // Not on soulsand
- (m_Parent->GetWorld()->GetTimeOfDay() < 12000 + 1000) && // Daytime
- m_Parent->GetWorld()->IsWeatherSunnyAt(static_cast<int>(m_Parent->GetPosX()), static_cast<int>(m_Parent->GetPosZ())) // Not raining
+ (a_Monster.GetWorld()->GetTimeOfDay() < 12000 + 1000) && // Daytime
+ a_Monster.GetWorld()->IsWeatherSunnyAt(static_cast<int>(a_Monster.GetPosX()), static_cast<int>(a_Monster.GetPosZ())) // Not raining
)
{
- int MobHeight = CeilC(a_Location.y + m_Parent->GetHeight()) - 1; // The height of the mob head
+ int MobHeight = CeilC(a_Location.y + a_Monster.GetHeight()) - 1; // The height of the mob head
if (MobHeight >= cChunkDef::Height)
{
return true;