summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Behaviors
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-08-25 06:38:56 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-08-25 06:38:56 +0200
commitfbf5163a75fd85cdef16f29792a11cd988c57667 (patch)
tree7258ff1fbaa384993d9abc36f9decba505bf597a /src/Mobs/Behaviors
parentFully working cows (diff)
downloadcuberite-fbf5163a75fd85cdef16f29792a11cd988c57667.tar
cuberite-fbf5163a75fd85cdef16f29792a11cd988c57667.tar.gz
cuberite-fbf5163a75fd85cdef16f29792a11cd988c57667.tar.bz2
cuberite-fbf5163a75fd85cdef16f29792a11cd988c57667.tar.lz
cuberite-fbf5163a75fd85cdef16f29792a11cd988c57667.tar.xz
cuberite-fbf5163a75fd85cdef16f29792a11cd988c57667.tar.zst
cuberite-fbf5163a75fd85cdef16f29792a11cd988c57667.zip
Diffstat (limited to 'src/Mobs/Behaviors')
-rw-r--r--src/Mobs/Behaviors/BehaviorBreeder.cpp1
-rw-r--r--src/Mobs/Behaviors/BehaviorCoward.cpp26
-rw-r--r--src/Mobs/Behaviors/BehaviorCoward.h2
-rw-r--r--src/Mobs/Behaviors/BehaviorItemFollower.cpp1
-rw-r--r--src/Mobs/Behaviors/BehaviorWanderer.cpp1
5 files changed, 27 insertions, 4 deletions
diff --git a/src/Mobs/Behaviors/BehaviorBreeder.cpp b/src/Mobs/Behaviors/BehaviorBreeder.cpp
index bc0c8d3ea..8d569ea03 100644
--- a/src/Mobs/Behaviors/BehaviorBreeder.cpp
+++ b/src/Mobs/Behaviors/BehaviorBreeder.cpp
@@ -90,7 +90,6 @@ void cBehaviorBreeder::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
void cBehaviorBreeder::PostTick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
- LOGD("mobDebug - Behavior Breeder: PostTick");
UNUSED(a_Dt);
UNUSED(a_Chunk);
if (m_MatingTimer > 0)
diff --git a/src/Mobs/Behaviors/BehaviorCoward.cpp b/src/Mobs/Behaviors/BehaviorCoward.cpp
index 94997f065..c3afec67a 100644
--- a/src/Mobs/Behaviors/BehaviorCoward.cpp
+++ b/src/Mobs/Behaviors/BehaviorCoward.cpp
@@ -37,9 +37,32 @@ bool cBehaviorCoward::IsControlDesired(std::chrono::milliseconds a_Dt, cChunk &
+bool cBehaviorCoward::ControlStarting(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
+{
+ UNUSED(a_Dt);
+ UNUSED(a_Chunk);
+ m_Parent->SetSpeed(m_Parent->GetSpeed() * 2);
+ return true;
+}
+
+
+
+
+
+bool cBehaviorCoward::ControlEnding(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
+{
+ UNUSED(a_Dt);
+ UNUSED(a_Chunk);
+ m_Parent->SetSpeed(m_Parent->GetSpeed() / 2);
+ return true;
+}
+
+
+
+
+
void cBehaviorCoward::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
- LOGD("mobDebug - Behavior Coward: Tick");
UNUSED(a_Dt);
UNUSED(a_Chunk);
if (m_Attacker == nullptr)
@@ -52,6 +75,7 @@ void cBehaviorCoward::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
// We lost the attacker
m_Attacker = nullptr;
+ return;
}
Vector3d newloc = m_Parent->GetPosition();
diff --git a/src/Mobs/Behaviors/BehaviorCoward.h b/src/Mobs/Behaviors/BehaviorCoward.h
index f33ab38c8..d5ffa4312 100644
--- a/src/Mobs/Behaviors/BehaviorCoward.h
+++ b/src/Mobs/Behaviors/BehaviorCoward.h
@@ -18,6 +18,8 @@ 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;
void DoTakeDamage(TakeDamageInfo & a_TDI) override;
diff --git a/src/Mobs/Behaviors/BehaviorItemFollower.cpp b/src/Mobs/Behaviors/BehaviorItemFollower.cpp
index 421334455..6978b2765 100644
--- a/src/Mobs/Behaviors/BehaviorItemFollower.cpp
+++ b/src/Mobs/Behaviors/BehaviorItemFollower.cpp
@@ -44,7 +44,6 @@ bool cBehaviorItemFollower::IsControlDesired(std::chrono::milliseconds a_Dt, cCh
void cBehaviorItemFollower::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
- LOGD("mobDebug - Behavior ItemFollower: Tick");
UNUSED(a_Dt);
UNUSED(a_Chunk);
cItems FollowedItems;
diff --git a/src/Mobs/Behaviors/BehaviorWanderer.cpp b/src/Mobs/Behaviors/BehaviorWanderer.cpp
index 39fde8373..b57d5f033 100644
--- a/src/Mobs/Behaviors/BehaviorWanderer.cpp
+++ b/src/Mobs/Behaviors/BehaviorWanderer.cpp
@@ -39,7 +39,6 @@ bool cBehaviorWanderer::IsControlDesired(std::chrono::milliseconds a_Dt, cChunk
void cBehaviorWanderer::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
- LOGD("mobDebug - Behavior Wanderer: Tick");
if (m_Parent->IsPathFinderActivated())
{
return; // Still getting there