summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-12-14 21:31:33 +0100
committerworktycho <work.tycho@gmail.com>2015-12-14 21:31:33 +0100
commit1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84 (patch)
tree8adc41d291bdac3c83eb0c56933e7a29cd1c3942 /src/Mobs
parentMerge pull request #2744 from cuberite/HopperMetaStrip (diff)
parentblockheight mechanism (diff)
downloadcuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.gz
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.bz2
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.lz
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.xz
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.tar.zst
cuberite-1e5ba8a1bb887808961e9c17dfd44af6bbbd2a84.zip
Diffstat (limited to '')
-rw-r--r--src/Mobs/Monster.cpp18
-rw-r--r--src/Mobs/Monster.h4
2 files changed, 4 insertions, 18 deletions
diff --git a/src/Mobs/Monster.cpp b/src/Mobs/Monster.cpp
index 2e365e987..fa36285ba 100644
--- a/src/Mobs/Monster.cpp
+++ b/src/Mobs/Monster.cpp
@@ -77,7 +77,6 @@ cMonster::cMonster(const AString & a_ConfigName, eMonsterType a_MobType, const A
, m_Target(nullptr)
, m_PathFinder(a_Width, a_Height)
, m_PathfinderActivated(false)
- , m_LastGroundHeight(POSY_TOINT)
, m_JumpCoolDown(0)
, m_IdleInterval(0)
, m_DestroyTimer(0)
@@ -298,7 +297,6 @@ void cMonster::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
}
SetPitchAndYawFromDestination(a_IsFollowingPath);
- HandleFalling();
switch (m_EMState)
{
@@ -397,20 +395,8 @@ void cMonster::SetPitchAndYawFromDestination(bool a_IsFollowingPath)
void cMonster::HandleFalling()
{
- if (m_bOnGround)
- {
- int Damage = (m_LastGroundHeight - POSY_TOINT) - 3;
-
- if (Damage > 0)
- {
- TakeDamage(dtFalling, nullptr, Damage, Damage, 0);
-
- // Fall particles
- GetWorld()->BroadcastSoundParticleEffect(EffectID::PARTICLE_FALL_PARTICLES, POSX_TOINT, POSY_TOINT - 1, POSZ_TOINT, Damage /* Used as particle effect speed modifier */);
- }
-
- m_LastGroundHeight = POSY_TOINT;
- }
+ m_bTouchGround = IsOnGround();
+ super::HandleFalling();
}
diff --git a/src/Mobs/Monster.h b/src/Mobs/Monster.h
index 1e1012f57..98b67f343 100644
--- a/src/Mobs/Monster.h
+++ b/src/Mobs/Monster.h
@@ -56,6 +56,8 @@ public:
virtual void OnRightClicked(cPlayer & a_Player) override;
+ virtual void HandleFalling(void) override;
+
/** Engage pathfinder and tell it to calculate a path to a given position, and move the mobile accordingly
Currently, the mob will only start moving to a new position after the position it is currently going to is reached. */
virtual void MoveToPosition(const Vector3d & a_Position); // tolua_export
@@ -203,8 +205,6 @@ protected:
/** Sets the body yaw and head yaw */
void SetPitchAndYawFromDestination(bool a_IsFollowingPath);
- virtual void HandleFalling(void);
- int m_LastGroundHeight;
int m_JumpCoolDown;
std::chrono::milliseconds m_IdleInterval;