summaryrefslogtreecommitdiffstats
path: root/src/Mobs
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
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')
-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
-rw-r--r--src/Mobs/Monster.cpp3
-rw-r--r--src/Mobs/Monster.h2
7 files changed, 29 insertions, 7 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
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 4ea80dee4..be240d55c 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -417,7 +417,7 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
// mobToDo fix dont care
// Note that m_NextWayPointPosition is actually returned by GetNextWayPoint)
- switch (m_PathFinder.GetNextWayPoint(*Chunk, GetPosition(), &m_FinalDestination, &m_NextWayPointPosition, false))
+ switch (m_PathFinder.GetNextWayPoint(*Chunk, GetPosition(), &m_FinalDestination, &m_NextWayPointPosition, true))
{
case ePathFinderStatus::PATH_FOUND:
{
@@ -477,7 +477,6 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
m_World->BroadcastEntityMetadata(*this);
}
}
- LOGD("mobDebug - Monster tick ends");
}
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index 5db7ddee4..a2e16080b 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -210,7 +210,7 @@ public:
virtual cBehaviorChaser * GetBehaviorChaser();
virtual cBehaviorDayLightBurner * GetBehaviorDayLightBurner(); // mobTodo this is probably temporary
- // Polymorphic behavior functions ("Skin-specific")
+ // Polymorphic behavior functions
virtual void InheritFromParents(cMonster * a_Parent1, cMonster * a_Parent2);
virtual void GetFollowedItems(cItems & a_Items);
virtual void GetBreedingItems(cItems & a_Items);