summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.h27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/Entities/Player.h b/src/Entities/Player.h
index 83b9ad593..99a0e601c 100644
--- a/src/Entities/Player.h
+++ b/src/Entities/Player.h
@@ -127,7 +127,7 @@ public:
inline const cItem & GetEquippedItem(void) const { return GetInventory().GetEquippedItem(); } // tolua_export
- /** Returns whether the player is climbing (ladders, vines e.t.c). */
+ /** Returns whether the player is climbing (ladders, vines etc.) */
bool IsClimbing(void) const;
virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) override;
@@ -330,10 +330,15 @@ public:
/** Moves the player to the specified world.
Returns true if successful, false on failure (world not found). */
- bool MoveToWorld(const char * a_WorldName); // tolua_export
+ virtual bool MoveToWorld(const AString & a_WorldName, cWorld * a_World = NULL) override; // tolua_export
+ /** Saves all player data, such as inventory, to JSON */
bool SaveToDisk(void);
- bool LoadFromDisk(void);
+
+ /** Loads player data from JSON to the object
+ Takes a (NULL) cWorld pointer which it will assign a value to based on either the loaded world or default world
+ */
+ bool LoadFromDisk(cWorld *& a_World);
void LoadPermissionsFromDisk(void); // tolua_export
const AString & GetLoadedWorldName() { return m_LoadedWorldName; }
@@ -344,8 +349,7 @@ public:
void SendExperience(void);
- // In UI windows, the item that the player is dragging:
- bool IsDraggingItem(void) const { return !m_DraggingItem.IsEmpty(); }
+ /** In UI windows, the item that the player is dragging */
cItem & GetDraggingItem(void) {return m_DraggingItem; }
// In UI windows, when inventory-painting:
@@ -393,11 +397,19 @@ public:
/** If true the player can fly even when he's not in creative. */
void SetCanFly(bool a_CanFly);
+ /** Gets the last position that the player slept in */
+ Vector3i GetLastBedPos(void) const { return m_LastBedPos; }
+
+ /** Sets the player's bed (home) position */
+ void SetBedPos(const Vector3i & a_Pos) { m_LastBedPos = a_Pos; }
+
/** Update movement-related statistics. */
void UpdateMovementStats(const Vector3d & a_DeltaPos);
/** Returns wheter the player can fly or not. */
virtual bool CanFly(void) const { return m_CanFly; }
+
+
// tolua_end
// cEntity overrides:
@@ -452,6 +464,9 @@ protected:
cWindow * m_CurrentWindow;
cWindow * m_InventoryWindow;
+ /** The player's last saved bed position */
+ Vector3i m_LastBedPos;
+
char m_Color;
eGameMode m_GameMode;
@@ -510,8 +525,6 @@ protected:
cStatManager m_Stats;
-
-
void ResolvePermissions(void);
void ResolveGroups(void);