summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.h
diff options
context:
space:
mode:
authorPablo Beltrán <spekdrum@gmail.com>2017-08-21 10:46:41 +0200
committerMattes D <github@xoft.cz>2017-08-21 10:46:41 +0200
commitb18f6637b6c58db20353cd3e77584b646ab36b5c (patch)
tree77b1dcf42aec23ef4aa64a04c906282c5f61ba19 /src/Entities/Entity.h
parentChanged MoveToWorld to ScheduleMoveToWorld in cPlayer::Respawn (#3922) (diff)
downloadcuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.gz
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.bz2
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.lz
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.xz
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.tar.zst
cuberite-b18f6637b6c58db20353cd3e77584b646ab36b5c.zip
Diffstat (limited to 'src/Entities/Entity.h')
-rw-r--r--src/Entities/Entity.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 8f433b816..db147f3fc 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -45,6 +45,7 @@ class cWorld;
class cClientHandle;
class cPlayer;
class cChunk;
+class cMonster;
@@ -87,6 +88,7 @@ public:
etFloater,
etItemFrame,
etPainting,
+ etLeashKnot,
// Common variations
etMob = etMonster, // DEPRECATED, use etMonster instead!
@@ -176,6 +178,7 @@ public:
bool IsExpOrb (void) const { return (m_EntityType == etExpOrb); }
bool IsFloater (void) const { return (m_EntityType == etFloater); }
bool IsItemFrame (void) const { return (m_EntityType == etItemFrame); }
+ bool IsLeashKnot (void) const { return (m_EntityType == etLeashKnot); }
bool IsPainting (void) const { return (m_EntityType == etPainting); }
/** Returns true if the entity is of the specified class or a subclass (cPawn's IsA("cEntity") returns true) */
@@ -267,7 +270,7 @@ public:
bool IsTicking(void) const;
/** Destroys the entity and schedules it for memory freeing; if a_ShouldBroadcast is set to true, broadcasts the DestroyEntity packet */
- void Destroy(bool a_ShouldBroadcast = true);
+ virtual void Destroy(bool a_ShouldBroadcast = true);
/** Makes this pawn take damage from an attack by a_Attacker. Damage values are calculated automatically and DoTakeDamage() called */
void TakeDamage(cEntity & a_Attacker);
@@ -519,6 +522,15 @@ public:
/** Set the entity's status to either ticking or not ticking. */
void SetIsTicking(bool a_IsTicking);
+ /** Adds a mob to the leashed list of mobs */
+ void AddLeashedMob(cMonster * a_Monster);
+
+ /** Removes a mob from the leashed list of mobs */
+ void RemoveLeashedMob(cMonster * a_Monster);
+
+ /** Returs whether the entity has any mob leashed to */
+ bool HasAnyMobLeashed() const { return m_LeashedMobs.size() > 0; }
+
protected:
/** Structure storing the portal delay timer and cooldown boolean */
struct sPortalCooldownData
@@ -668,6 +680,12 @@ private:
/** If a player hit a entity, the entity receive a invulnerable of 10 ticks.
While this ticks, a player can't hit this entity. */
int m_InvulnerableTicks;
+
+ typedef std::list<cMonster *> cMonsterList;
+
+ /** List of leashed mobs to this entity */
+ cMonsterList m_LeashedMobs;
+
} ; // tolua_export