summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Behaviors
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-08-31 12:53:10 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-08-31 12:53:10 +0200
commit0b288fefcccc8c228044ae8319f053f5408264a1 (patch)
treee0d1bf0accec2149d5c1ece32a7b26adbdb7ac58 /src/Mobs/Behaviors
parentRemoved BehaviorStriker, and some doc (diff)
downloadcuberite-0b288fefcccc8c228044ae8319f053f5408264a1.tar
cuberite-0b288fefcccc8c228044ae8319f053f5408264a1.tar.gz
cuberite-0b288fefcccc8c228044ae8319f053f5408264a1.tar.bz2
cuberite-0b288fefcccc8c228044ae8319f053f5408264a1.tar.lz
cuberite-0b288fefcccc8c228044ae8319f053f5408264a1.tar.xz
cuberite-0b288fefcccc8c228044ae8319f053f5408264a1.tar.zst
cuberite-0b288fefcccc8c228044ae8319f053f5408264a1.zip
Diffstat (limited to 'src/Mobs/Behaviors')
-rw-r--r--src/Mobs/Behaviors/BehaviorAttacker.cpp1
-rw-r--r--src/Mobs/Behaviors/BehaviorDayLightBurner.cpp5
-rw-r--r--src/Mobs/Behaviors/BehaviorWanderer.cpp18
-rw-r--r--src/Mobs/Behaviors/BehaviorWanderer.h4
4 files changed, 22 insertions, 6 deletions
diff --git a/src/Mobs/Behaviors/BehaviorAttacker.cpp b/src/Mobs/Behaviors/BehaviorAttacker.cpp
index 67a27a277..031b5ddf9 100644
--- a/src/Mobs/Behaviors/BehaviorAttacker.cpp
+++ b/src/Mobs/Behaviors/BehaviorAttacker.cpp
@@ -2,7 +2,6 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "BehaviorAttacker.h"
-#include "BehaviorStriker.h"
#include "../Monster.h"
#include "../../Entities/Pawn.h"
#include "../../Entities/Player.h"
diff --git a/src/Mobs/Behaviors/BehaviorDayLightBurner.cpp b/src/Mobs/Behaviors/BehaviorDayLightBurner.cpp
index ab234e56f..0b0faed08 100644
--- a/src/Mobs/Behaviors/BehaviorDayLightBurner.cpp
+++ b/src/Mobs/Behaviors/BehaviorDayLightBurner.cpp
@@ -23,9 +23,6 @@ void cBehaviorDayLightBurner::AttachToMonster(cMonster & a_Parent)
void cBehaviorDayLightBurner::PostTick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
- // mobTodo WouldBurn
- bool WouldBurn = false; // TEMP
-
int RelY = static_cast<int>(m_Parent->GetPosY());
if ((RelY < 0) || (RelY >= cChunkDef::Height))
{
@@ -38,7 +35,7 @@ void cBehaviorDayLightBurner::PostTick(std::chrono::milliseconds a_Dt, cChunk &
return;
}
- if (!m_Parent->IsOnFire() && WouldBurn)
+ if (!m_Parent->IsOnFire() && WouldBurnAt(m_Parent->GetPosition(), a_Chunk))
{
// Burn for 100 ticks, then decide again
m_Parent->StartBurning(100);
diff --git a/src/Mobs/Behaviors/BehaviorWanderer.cpp b/src/Mobs/Behaviors/BehaviorWanderer.cpp
index b57d5f033..309883c01 100644
--- a/src/Mobs/Behaviors/BehaviorWanderer.cpp
+++ b/src/Mobs/Behaviors/BehaviorWanderer.cpp
@@ -35,6 +35,24 @@ bool cBehaviorWanderer::IsControlDesired(std::chrono::milliseconds a_Dt, cChunk
+bool cBehaviorWanderer::ControlStarting(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
+{
+ UNUSED(a_Dt);
+ UNUSED(a_Chunk);
+ m_OldDontCare = m_Parent->GetPathFinder().getDontCare(true);
+ m_Parent->GetPathFinder().setDontCare(true); // We don't care we're we are going when
+ // wandering. If a path is not found, the pathfinder just modifies our destination.
+ return true;
+}
+
+
+bool cBehaviorWanderer::ControlEnding(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
+{
+ UNUSED(a_Dt);
+ UNUSED(a_Chunk);
+ m_Parent->GetPathFinder().setDontCare(m_OldDontCare);
+ return true;
+}
void cBehaviorWanderer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
diff --git a/src/Mobs/Behaviors/BehaviorWanderer.h b/src/Mobs/Behaviors/BehaviorWanderer.h
index c694eb331..219ad32c3 100644
--- a/src/Mobs/Behaviors/BehaviorWanderer.h
+++ b/src/Mobs/Behaviors/BehaviorWanderer.h
@@ -13,11 +13,13 @@ public:
// Functions our host Monster should invoke:
bool IsControlDesired(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
+ bool ControlStarting(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
+ bool ControlEnding(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
private:
cMonster * m_Parent; // Our Parent
-
std::chrono::milliseconds m_IdleInterval;
+ bool m_OldDontCare;
};