summaryrefslogtreecommitdiffstats
path: root/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-09-02 18:36:24 +0200
committerLogicParrot <LogicParrot@users.noreply.github.com>2017-09-02 18:36:24 +0200
commit2523af8f9a6f712dc6cc4007437349557b0bdfe1 (patch)
treedcd08777ca9672c331ff6b3503a899e59e2584fc /src/Mobs/Behaviors/BehaviorAttackerMelee.cpp
parentReimplemented creepers using Behaviors (diff)
downloadcuberite-2523af8f9a6f712dc6cc4007437349557b0bdfe1.tar
cuberite-2523af8f9a6f712dc6cc4007437349557b0bdfe1.tar.gz
cuberite-2523af8f9a6f712dc6cc4007437349557b0bdfe1.tar.bz2
cuberite-2523af8f9a6f712dc6cc4007437349557b0bdfe1.tar.lz
cuberite-2523af8f9a6f712dc6cc4007437349557b0bdfe1.tar.xz
cuberite-2523af8f9a6f712dc6cc4007437349557b0bdfe1.tar.zst
cuberite-2523af8f9a6f712dc6cc4007437349557b0bdfe1.zip
Diffstat (limited to 'src/Mobs/Behaviors/BehaviorAttackerMelee.cpp')
-rw-r--r--src/Mobs/Behaviors/BehaviorAttackerMelee.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp b/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp
index 2bc0ef29d..3d25f34b4 100644
--- a/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp
+++ b/src/Mobs/Behaviors/BehaviorAttackerMelee.cpp
@@ -5,9 +5,23 @@
#include "../../Entities/Pawn.h"
#include "../../BlockID.h"
+cBehaviorAttackerMelee::cBehaviorAttackerMelee(PostAttackFunction a_PostAttackFunction)
+ : m_PostAttackFunction(a_PostAttackFunction)
+{
+
+}
+
+
+
+
+
bool cBehaviorAttackerMelee::DoStrike(int a_StrikeTickCnt)
{
UNUSED(a_StrikeTickCnt);
GetTarget()->TakeDamage(dtMobAttack, m_Parent, m_AttackDamage, 0);
+ if (m_PostAttackFunction != nullptr)
+ {
+ m_PostAttackFunction(*this, *m_Parent, *GetTarget());
+ }
return true; // Finish the strike. It only takes 1 tick.
}