summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.h
diff options
context:
space:
mode:
authorSafwat Halaby <safwat1995@gmail.com>2015-12-26 20:08:12 +0100
committerSafwat Halaby <safwat1995@gmail.com>2015-12-26 20:08:12 +0100
commitbfafc39576f4b6a2c0d5017795ba420fdd3625c4 (patch)
treee6998748c995d1a87cdc824d2a43fe764f1c6e12 /src/Entities/Player.h
parentMerge pull request #2820 from cuberite/UrlParser (diff)
parentFreeze player until chunk is loaded (diff)
downloadcuberite-bfafc39576f4b6a2c0d5017795ba420fdd3625c4.tar
cuberite-bfafc39576f4b6a2c0d5017795ba420fdd3625c4.tar.gz
cuberite-bfafc39576f4b6a2c0d5017795ba420fdd3625c4.tar.bz2
cuberite-bfafc39576f4b6a2c0d5017795ba420fdd3625c4.tar.lz
cuberite-bfafc39576f4b6a2c0d5017795ba420fdd3625c4.tar.xz
cuberite-bfafc39576f4b6a2c0d5017795ba420fdd3625c4.tar.zst
cuberite-bfafc39576f4b6a2c0d5017795ba420fdd3625c4.zip
Diffstat (limited to 'src/Entities/Player.h')
-rw-r--r--src/Entities/Player.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index bff9599f7..10c9106a3 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -138,6 +138,18 @@ public:
// tolua_begin
+ /** Prevent the player from moving and lock him into a_Location. */
+ void Freeze(const Vector3d & a_Location);
+
+ /** Is the player frozen? */
+ bool IsFrozen();
+
+ /** How long has the player been frozen? */
+ int GetFrozenDuration();
+
+ /** Cancels Freeze(...) and allows the player to move naturally. */
+ void Unfreeze();
+
/** Sends the "look" packet to the player, forcing them to set their rotation to the specified values.
a_YawDegrees is clipped to range [-180, +180),
a_PitchDegrees is clipped to range [-180, +180) but the client only uses [-90, +90]
@@ -240,7 +252,7 @@ public:
void SendMessageFatal (const AString & a_Message) { m_ClientHandle->SendChat(a_Message, mtFailure); }
void SendMessagePrivateMsg (const AString & a_Message, const AString & a_Sender) { m_ClientHandle->SendChat(a_Message, mtPrivateMessage, a_Sender); }
void SendMessage (const cCompositeChat & a_Message) { m_ClientHandle->SendChat(a_Message); }
-
+
void SendSystemMessage (const AString & a_Message) { m_ClientHandle->SendChatSystem(a_Message, mtCustom); }
void SendAboveActionBarMessage(const AString & a_Message) { m_ClientHandle->SendChatAboveActionBar(a_Message, mtCustom); }
void SendSystemMessage (const cCompositeChat & a_Message) { m_ClientHandle->SendChatSystem(a_Message); }
@@ -576,6 +588,18 @@ protected:
cSlotNums m_InventoryPaintSlots;
+ /** if m_IsFrozen is true, we lock m_Location to this position. */
+ Vector3d m_FrozenPosition;
+
+ /** If true, we are locking m_Position to m_FrozenPosition. */
+ bool m_IsFrozen;
+
+ /** */
+ int m_FreezeCounter;
+
+ /** Was the player frozen manually by a plugin or automatically by the server? */
+ bool m_IsManuallyFrozen;
+
/** Max speed, relative to the game default.
1 means regular speed, 2 means twice as fast, 0.5 means half-speed.
Default value is 1. */
@@ -661,6 +685,10 @@ protected:
/** Tosses a list of items. */
void TossItems(const cItems & a_Items);
+ /** Pins the player to a_Location until Unfreeze() is called.
+ If ManuallyFrozen is false, the player will unfreeze when the chunk is loaded. */
+ void FreezeInternal(const Vector3d & a_Location, bool a_ManuallyFrozen);
+
/** Returns the filename for the player data based on the UUID given.
This can be used both for online and offline UUIDs. */
AString GetUUIDFileName(const AString & a_UUID);