summaryrefslogtreecommitdiffstats
path: root/src/Mobs
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-29 14:37:01 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-29 14:37:01 +0200
commit347402d20d7ecaab3daad691eb178c5a04447d44 (patch)
tree4a3188eef6087a3029b348cbbe8c93e5d365d158 /src/Mobs
parentFixed SetDefaultRank() return value. (diff)
parentMerge pull request #1479 from SphinxC0re/master (diff)
downloadcuberite-347402d20d7ecaab3daad691eb178c5a04447d44.tar
cuberite-347402d20d7ecaab3daad691eb178c5a04447d44.tar.gz
cuberite-347402d20d7ecaab3daad691eb178c5a04447d44.tar.bz2
cuberite-347402d20d7ecaab3daad691eb178c5a04447d44.tar.lz
cuberite-347402d20d7ecaab3daad691eb178c5a04447d44.tar.xz
cuberite-347402d20d7ecaab3daad691eb178c5a04447d44.tar.zst
cuberite-347402d20d7ecaab3daad691eb178c5a04447d44.zip
Diffstat (limited to 'src/Mobs')
-rw-r--r--src/Mobs/Enderman.cpp20
-rw-r--r--src/Mobs/Enderman.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/src/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp
index 51255beb3..567714382 100644
--- a/src/Mobs/Enderman.cpp
+++ b/src/Mobs/Enderman.cpp
@@ -181,3 +181,23 @@ bool cEnderman::CheckLight()
return true;
}
+
+
+
+
+
+void cEnderman::Tick(float a_Dt, cChunk & a_Chunk)
+{
+ super::Tick(a_Dt, a_Chunk);
+
+ // TODO take damage in rain
+
+ // Take damage when touching water, drowning damage seems to be most appropriate
+ if (IsSwimming())
+ {
+ EventLosePlayer();
+ TakeDamage(dtDrowning, NULL, 1, 0);
+ // TODO teleport to a safe location
+ }
+
+}
diff --git a/src/Mobs/Enderman.h b/src/Mobs/Enderman.h
index 4583746e7..947c32b96 100644
--- a/src/Mobs/Enderman.h
+++ b/src/Mobs/Enderman.h
@@ -21,6 +21,7 @@ public:
virtual void CheckEventSeePlayer(void) override;
virtual void CheckEventLostPlayer(void) override;
virtual void EventLosePlayer(void) override;
+ virtual void Tick(float a_Dt, cChunk & a_Chunk) override;
bool IsScreaming(void) const {return m_bIsScreaming; }
BLOCKTYPE GetCarriedBlock(void) const {return CarriedBlock; }