summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/Entity.h')
-rw-r--r--src/Entities/Entity.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index 88f8528e9..8b6fc05f7 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -336,6 +336,9 @@ public:
/** Detects the time for application of cacti damage */
virtual void DetectCacti(void);
+
+ /** Detects whether we are in a portal block and begins teleportation procedures if so */
+ virtual void DetectPortal(void);
/// Handles when the entity is in the void
virtual void TickInVoid(cChunk & a_Chunk);
@@ -378,8 +381,17 @@ public:
/// Teleports to the coordinates specified
virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ);
+
+ /** Moves entity to specified world */
+ virtual bool MoveToWorld(const AString & a_WorldName, cWorld * a_World = NULL, bool a_ShouldSendRespawn = true);
// tolua_end
+
+ /** Returns if the entity is travelling through a portal. Set to true by MoveToWorld and to false when the entity is removed by the old chunk */
+ bool IsTravellingThroughPortal(void) const { return m_IsTravellingThroughPortal; }
+
+ /** Sets if the entity has begun travelling through a portal or not */
+ void SetIsTravellingThroughPortal(bool a_Flag) { m_IsTravellingThroughPortal = a_Flag; }
/// Updates clients of changes in the entity.
virtual void BroadcastMovementUpdate(const cClientHandle * a_Exclude = NULL);
@@ -479,6 +491,9 @@ protected:
/** True when entity is initialised (Initialize()) and false when destroyed pending deletion (Destroy()) */
bool m_IsInitialized;
+ /** True when entity is being moved across worlds, false anytime else */
+ bool m_IsTravellingThroughPortal;
+
eEntityType m_EntityType;
cWorld * m_World;
@@ -500,7 +515,6 @@ protected:
/// Time, in ticks, since the last damage dealt by the void. Reset to zero when moving out of the void.
int m_TicksSinceLastVoidDamage;
-
/** Does the actual speed-setting. The default implementation just sets the member variable value;
overrides can provide further processing, such as forcing players to move at the given speed. */
@@ -520,6 +534,12 @@ protected:
/** Air level of a mobile */
int m_AirLevel;
int m_AirTickTimer;
+
+ /** Portal delay timer and cooldown boolean
+ First value is to delay sending the respawn packet (which triggers the Entering the {Dimension} screen).
+ Second value is to prevent a teleportation loop by ensuring we do not reenter a portal that we came out of.
+ */
+ std::pair<unsigned short, bool> m_PortalCooldownData;
private:
/** Measured in degrees, [-180, +180) */