diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2021-09-30 00:17:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-30 00:17:03 +0200 |
commit | 028a5735c5f98aa10718c94de07d2f4b4c1fa6b3 (patch) | |
tree | 53d4bdd7c5c3f9abd6416b27ba893341a042ffea /src/Entities/Entity.h | |
parent | Permission-based player chat message formatting (#5304) (diff) | |
download | cuberite-028a5735c5f98aa10718c94de07d2f4b4c1fa6b3.tar cuberite-028a5735c5f98aa10718c94de07d2f4b4c1fa6b3.tar.gz cuberite-028a5735c5f98aa10718c94de07d2f4b4c1fa6b3.tar.bz2 cuberite-028a5735c5f98aa10718c94de07d2f4b4c1fa6b3.tar.lz cuberite-028a5735c5f98aa10718c94de07d2f4b4c1fa6b3.tar.xz cuberite-028a5735c5f98aa10718c94de07d2f4b4c1fa6b3.tar.zst cuberite-028a5735c5f98aa10718c94de07d2f4b4c1fa6b3.zip |
Diffstat (limited to 'src/Entities/Entity.h')
-rw-r--r-- | src/Entities/Entity.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 1384870b8..285ae8fac 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -452,11 +452,11 @@ public: /** Gets entity (vehicle) attached to this entity */ cEntity * GetAttached(); - /** Attaches to the specified entity; detaches from any previous one first */ - virtual void AttachTo(cEntity * a_AttachTo); + /** Attaches to the specified entity; detaches from any previous one first. */ + void AttachTo(cEntity & a_AttachTo); - /** Detaches from the currently attached entity, if any */ - virtual void Detach(void); + /** Detaches from the currently attached entity, if any. */ + void Detach(void); /** Returns true if this entity is attached to the specified entity */ bool IsAttachedTo(const cEntity * a_Entity) const; @@ -578,10 +578,10 @@ protected: float m_Health; float m_MaxHealth; - /** The entity to which this entity is attached (vehicle), nullptr if none */ + /** The entity to which this entity is attached (vehicle), nullptr if none. */ cEntity * m_AttachedTo; - /** The entity which is attached to this entity (rider), nullptr if none */ + /** The entity which is attached to this entity (rider), nullptr if none. */ cEntity * m_Attachee; /** Stores whether head yaw has been set manually */ @@ -683,6 +683,9 @@ protected: /** If has any mobs are leashed, broadcasts every leashed entity to this. */ void BroadcastLeashedMobs(); + /** Called when this entity dismounts from m_AttachedTo. */ + virtual void OnDetach(); + private: /** Whether the entity is ticking or not. If not, it is scheduled for removal or world-teleportation. */ |