diff options
author | cedeel@gmail.com <cedeel@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-14 15:06:06 +0200 |
---|---|---|
committer | cedeel@gmail.com <cedeel@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-06-14 15:06:06 +0200 |
commit | 92c59963f82f81aa3202657e7fdbb2592924ede3 (patch) | |
tree | b7eb2474528a4998fa102e3ec9119b908cee08b4 /source/cPlayer.h | |
parent | Added HOOK_WEATHER_CHANGE. (diff) | |
download | cuberite-92c59963f82f81aa3202657e7fdbb2592924ede3.tar cuberite-92c59963f82f81aa3202657e7fdbb2592924ede3.tar.gz cuberite-92c59963f82f81aa3202657e7fdbb2592924ede3.tar.bz2 cuberite-92c59963f82f81aa3202657e7fdbb2592924ede3.tar.lz cuberite-92c59963f82f81aa3202657e7fdbb2592924ede3.tar.xz cuberite-92c59963f82f81aa3202657e7fdbb2592924ede3.tar.zst cuberite-92c59963f82f81aa3202657e7fdbb2592924ede3.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cPlayer.h | 292 |
1 files changed, 146 insertions, 146 deletions
diff --git a/source/cPlayer.h b/source/cPlayer.h index 815c31316..ef85a1d4e 100644 --- a/source/cPlayer.h +++ b/source/cPlayer.h @@ -1,146 +1,146 @@ -
-#pragma once
-
-#include "cPawn.h"
-#include "cSurvivalInventory.h"
-#include "cCreativeInventory.h"
-#include "Defines.h"
-
-
-
-
-
-class cGroup;
-class cWindow;
-class cInventory;
-class cClientHandle;
-
-
-
-
-
-class cPlayer : public cPawn //tolua_export
-{ //tolua_export
-public:
- typedef cPawn super;
- CLASS_PROTOTYPE();
-
- cPlayer(cClientHandle * a_Client, const AString & a_PlayerName);
- virtual ~cPlayer();
-
- virtual void Initialize( cWorld* a_World ); //tolua_export
-
- virtual cPacket * GetSpawnPacket(void) const override;
- virtual void Tick(float a_Dt) override;
-
- void SetTouchGround( bool a_bTouchGround );
- inline void SetStance( const double & a_Stance ) { m_Stance = a_Stance; }
- double GetEyeHeight(); //tolua_export
- Vector3d GetEyePosition(); //tolua_export
- inline bool GetFlying() { return m_bTouchGround; } //tolua_export
- inline const double & GetStance() { return m_Stance; } //tolua_export
- inline cInventory & GetInventory() { if(GetGameMode() == eGameMode_Survival) return *m_Inventory; else return *m_CreativeInventory; } //tolua_export
-
- virtual void TeleportTo( const double & a_PosX, const double & a_PosY, const double & a_PosZ ); //tolua_export
-
- eGameMode GetGameMode() { return m_GameMode; } //tolua_export
- std::string GetIP() { return m_IP; } //tolua_export
- float GetLastBlockActionTime() { return m_LastBlockActionTime; } //tolua_export
- int GetLastBlockActionCnt() { return m_LastBlockActionCnt; } //tolua_export
- void SetLastBlockActionCnt( int ); //tolua_export
- void SetLastBlockActionTime(); //tolua_export
- void SetGameMode( eGameMode a_GameMode ); //tolua_export
- void LoginSetGameMode( eGameMode a_GameMode );
- void SetIP( std::string a_IP );
-
- // Tries to move to a new position, with collision checks and stuff
- virtual void MoveTo( const Vector3d & a_NewPos ); //tolua_export
-
- cWindow* GetWindow() { return m_CurrentWindow; }
- void OpenWindow( cWindow* a_Window );
- void CloseWindow(char a_WindowType);
-
- cClientHandle * GetClientHandle() { return m_ClientHandle; } //tolua_export
-
- void SendMessage( const char* a_Message ); //tolua_export
-
- const AString & GetName(void) const { return m_PlayerName; } //tolua_export
- void SetName(const AString & a_Name) { m_PlayerName = a_Name; } //tolua_export
-
- typedef std::list< cGroup* > GroupList;
- typedef std::list< std::string > StringList;
- void AddToGroup( const char* a_GroupName ); //tolua_export
- bool CanUseCommand( const char* a_Command ); //tolua_export
- bool HasPermission( const char* a_Permission ); //tolua_export
- const GroupList & GetGroups() { return m_Groups; } // >> EXPORTED IN MANUALBINDINGS <<
- StringList GetResolvedPermissions(); // >> EXPORTED IN MANUALBINDINGS <<
- bool IsInGroup( const char* a_Group ); //tolua_export
-
- AString GetColor(void) const; //tolua_export
-
- void TossItem( bool a_bDraggingItem, int a_Amount = 1 ); //tolua_export
-
- void Heal( int a_Health ); //tolua_export
-
- /// Returns true if any food has been consumed, false if player "full"
- bool Feed(short a_Food);
-
- void TakeDamage( int a_Damage, cEntity* a_Instigator ); //tolua_export
- void KilledBy( cEntity* a_Killer ); //tolua_export
- void Respawn(); //tolua_export
-
- void SetVisible( bool a_bVisible ); //tolua_export
- bool IsVisible() { return m_bVisible; } //tolua_export
-
- bool MoveToWorld( const char* a_WorldName ); //tolua_export
-
- bool SaveToDisk();
- bool LoadFromDisk();
- void LoadPermissionsFromDisk(); //tolua_export
-
- const AString & GetLoadedWorldName() { return m_LoadedWorldName; }
-
- void UseEquippedItem(void);
-
- /// Returns true if the item type is edible && it has been consumed, false otherwise
- bool EatItem(int a_ItemType);
-
-protected:
- virtual void Destroyed();
-
- typedef std::map< std::string, bool > PermissionMap;
- PermissionMap m_ResolvedPermissions;
- PermissionMap m_Permissions;
-
- GroupList m_ResolvedGroups;
- GroupList m_Groups;
-
- std::string m_PlayerName;
- std::string m_LoadedWorldName;
-
- bool m_bVisible;
-
- float m_LastGroundHeight;
- bool m_bTouchGround;
- double m_Stance;
- cSurvivalInventory* m_Inventory;
- cCreativeInventory* m_CreativeInventory;
- cWindow* m_CurrentWindow;
-
- float m_TimeLastPickupCheck;
-
- void ResolvePermissions();
-
- void ResolveGroups();
- char m_Color;
-
- float m_LastBlockActionTime;
- int m_LastBlockActionCnt;
- eGameMode m_GameMode;
- std::string m_IP;
-
- long long m_LastPlayerListTime;
- static const unsigned short PLAYER_LIST_TIME_MS = 1000; // 1000 = once per second
-
- cClientHandle* m_ClientHandle;
-}; //tolua_export
+ +#pragma once + +#include "cPawn.h" +#include "cSurvivalInventory.h" +#include "cCreativeInventory.h" +#include "Defines.h" + + + + + +class cGroup; +class cWindow; +class cInventory; +class cClientHandle; + + + + + +class cPlayer : public cPawn //tolua_export +{ //tolua_export +public: + typedef cPawn super; + CLASS_PROTOTYPE(); + + cPlayer(cClientHandle * a_Client, const AString & a_PlayerName); + virtual ~cPlayer(); + + virtual void Initialize( cWorld* a_World ); //tolua_export + + virtual cPacket * GetSpawnPacket(void) const override; + virtual void Tick(float a_Dt) override; + + void SetTouchGround( bool a_bTouchGround ); + inline void SetStance( const double & a_Stance ) { m_Stance = a_Stance; } + double GetEyeHeight(); //tolua_export + Vector3d GetEyePosition(); //tolua_export + inline bool GetFlying() { return m_bTouchGround; } //tolua_export + inline const double & GetStance() { return m_Stance; } //tolua_export + inline cInventory & GetInventory() { if(GetGameMode() == eGameMode_Survival) return *m_Inventory; else return *m_CreativeInventory; } //tolua_export + + virtual void TeleportTo( const double & a_PosX, const double & a_PosY, const double & a_PosZ ); //tolua_export + + eGameMode GetGameMode() { return m_GameMode; } //tolua_export + std::string GetIP() { return m_IP; } //tolua_export + float GetLastBlockActionTime() { return m_LastBlockActionTime; } //tolua_export + int GetLastBlockActionCnt() { return m_LastBlockActionCnt; } //tolua_export + void SetLastBlockActionCnt( int ); //tolua_export + void SetLastBlockActionTime(); //tolua_export + void SetGameMode( eGameMode a_GameMode ); //tolua_export + void LoginSetGameMode( eGameMode a_GameMode ); + void SetIP( std::string a_IP ); + + // Tries to move to a new position, with collision checks and stuff + virtual void MoveTo( const Vector3d & a_NewPos ); //tolua_export + + cWindow* GetWindow() { return m_CurrentWindow; } + void OpenWindow( cWindow* a_Window ); + void CloseWindow(char a_WindowType); + + cClientHandle * GetClientHandle() { return m_ClientHandle; } //tolua_export + + void SendMessage( const char* a_Message ); //tolua_export + + const AString & GetName(void) const { return m_PlayerName; } //tolua_export + void SetName(const AString & a_Name) { m_PlayerName = a_Name; } //tolua_export + + typedef std::list< cGroup* > GroupList; + typedef std::list< std::string > StringList; + void AddToGroup( const char* a_GroupName ); //tolua_export + bool CanUseCommand( const char* a_Command ); //tolua_export + bool HasPermission( const char* a_Permission ); //tolua_export + const GroupList & GetGroups() { return m_Groups; } // >> EXPORTED IN MANUALBINDINGS << + StringList GetResolvedPermissions(); // >> EXPORTED IN MANUALBINDINGS << + bool IsInGroup( const char* a_Group ); //tolua_export + + AString GetColor(void) const; //tolua_export + + void TossItem( bool a_bDraggingItem, int a_Amount = 1 ); //tolua_export + + void Heal( int a_Health ); //tolua_export + + /// Returns true if any food has been consumed, false if player "full" + bool Feed(short a_Food); + + void TakeDamage( int a_Damage, cEntity* a_Instigator ); //tolua_export + void KilledBy( cEntity* a_Killer ); //tolua_export + void Respawn(); //tolua_export + + void SetVisible( bool a_bVisible ); //tolua_export + bool IsVisible() { return m_bVisible; } //tolua_export + + bool MoveToWorld( const char* a_WorldName ); //tolua_export + + bool SaveToDisk(); + bool LoadFromDisk(); + void LoadPermissionsFromDisk(); //tolua_export + + const AString & GetLoadedWorldName() { return m_LoadedWorldName; } + + void UseEquippedItem(void); + + /// Returns true if the item type is edible && it has been consumed, false otherwise + bool EatItem(int a_ItemType); + +protected: + virtual void Destroyed(); + + typedef std::map< std::string, bool > PermissionMap; + PermissionMap m_ResolvedPermissions; + PermissionMap m_Permissions; + + GroupList m_ResolvedGroups; + GroupList m_Groups; + + std::string m_PlayerName; + std::string m_LoadedWorldName; + + bool m_bVisible; + + float m_LastGroundHeight; + bool m_bTouchGround; + double m_Stance; + cSurvivalInventory* m_Inventory; + cCreativeInventory* m_CreativeInventory; + cWindow* m_CurrentWindow; + + float m_TimeLastPickupCheck; + + void ResolvePermissions(); + + void ResolveGroups(); + char m_Color; + + float m_LastBlockActionTime; + int m_LastBlockActionCnt; + eGameMode m_GameMode; + std::string m_IP; + + long long m_LastPlayerListTime; + static const unsigned short PLAYER_LIST_TIME_MS = 1000; // 1000 = once per second + + cClientHandle* m_ClientHandle; +}; //tolua_export |