From ad22922393c7982b885840960222de64ff96ad36 Mon Sep 17 00:00:00 2001 From: Alexander Harkness Date: Sun, 14 Jan 2018 18:44:45 +0000 Subject: Rename cEntity swim states (#3996) * Replace cEntity:m_IsSubmerged with m_IsHeadInWater * Replace cEntity:m_IsSwimming with m_IsInWater * Add API documentation for new symbols * Apply SetSwimState to all entities, not just mobs and players * Pickups now use IsOnFire to check if they are on fire before destruction Fixes #3987 --- src/Entities/Entity.h | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index fae296ab4..5b993ac96 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -481,11 +481,17 @@ public: virtual bool IsRclking (void) const {return false; } virtual bool IsInvisible(void) const { return false; } - /** Returns whether the player is swimming or not */ - virtual bool IsSwimming(void) const{ return m_IsSwimming; } + /** Returns true if any part of the entity is in a fire block */ + virtual bool IsInFire(void) const { return m_IsInFire; } - /** Return whether the player is under water or not */ - virtual bool IsSubmerged(void) const{ return m_IsSubmerged; } + /** Returns true if any part of the entity is in a lava block */ + virtual bool IsInLava(void) const { return m_IsInLava; } + + /** Returns true if any part of the entity is in a water block */ + virtual bool IsInWater(void) const { return m_IsInWater; } + + /** Returns true if any part of the entity is in a water block */ + virtual bool IsHeadInWater(void) const { return m_IsHeadInWater; } /** Gets remaining air of a monster */ int GetAirLevel(void) const { return m_AirLevel; } @@ -619,8 +625,17 @@ protected: /** Time, in ticks, since the last damage dealt by the void. Reset to zero when moving out of the void. */ int m_TicksSinceLastVoidDamage; - /** If an entity is currently swimming in or submerged under water */ - bool m_IsSwimming, m_IsSubmerged; + /** If any part of the entity is in a fire block */ + bool m_IsInFire; + + /** If any part of the entity is in a lava block */ + bool m_IsInLava; + + /** If any part of the entity is in a water block */ + bool m_IsInWater; + + /** If the entity's head is in a water block */ + bool m_IsHeadInWater; /** Air level of a mobile */ int m_AirLevel; @@ -647,7 +662,8 @@ protected: /** Called in each tick to handle air-related processing i.e. drowning */ virtual void HandleAir(void); - /** Called once per tick to set IsSwimming and IsSubmerged */ + /** Called once per tick to set m_IsInFire, m_IsInLava, m_IsInWater and + m_IsHeadInWater */ virtual void SetSwimState(cChunk & a_Chunk); private: @@ -693,7 +709,3 @@ private: cMonsterList m_LeashedMobs; } ; // tolua_export - - - - -- cgit v1.2.3