]> git.lizzy.rs Git - minetest.git/blobdiff - src/client.h
Generic NodeMetadata text input
[minetest.git] / src / client.h
index 0150b687e9414dac1f19fa22ce8520ac852031b4..8585f6d4a6a7c8514a4bc0a1df2de175785b3a38 100644 (file)
@@ -113,7 +113,8 @@ enum ClientEventType
 {
        CE_NONE,
        CE_PLAYER_DAMAGE,
-       CE_PLAYER_FORCE_MOVE
+       CE_PLAYER_FORCE_MOVE,
+       CE_DEATHSCREEN,
 };
 
 struct ClientEvent
@@ -129,6 +130,12 @@ struct ClientEvent
                        f32 pitch;
                        f32 yaw;
                } player_force_move;
+               struct{
+                       bool set_camera_point_target;
+                       f32 camera_point_target_x;
+                       f32 camera_point_target_y;
+                       f32 camera_point_target_z;
+               } deathscreen;
        };
 };
 
@@ -183,33 +190,36 @@ class Client : public con::PeerHandler, public InventoryManager
 
        void groundAction(u8 action, v3s16 nodepos_undersurface,
                        v3s16 nodepos_oversurface, u16 item);
-       void clickObject(u8 button, v3s16 blockpos, s16 id, u16 item);
-       void clickActiveObject(u8 button, u16 id, u16 item);
+       void clickActiveObject(u8 button, u16 id, u16 item_i);
 
-       void sendSignText(v3s16 blockpos, s16 id, std::string text);
        void sendSignNodeText(v3s16 p, std::string text);
        void sendInventoryAction(InventoryAction *a);
        void sendChatMessage(const std::wstring &message);
        void sendChangePassword(const std::wstring oldpassword,
                const std::wstring newpassword);
        void sendDamage(u8 damage);
+       void sendRespawn();
        
        // locks envlock
        void removeNode(v3s16 p);
        // locks envlock
        void addNode(v3s16 p, MapNode n);
        
-       void updateCamera(v3f pos, v3f dir);
+       void updateCamera(v3f pos, v3f dir, f32 fov);
+       
+       void renderPostFx();
        
        // Returns InvalidPositionException if not found
        MapNode getNode(v3s16 p);
        // Wrapper to Map
        NodeMetadata* getNodeMetadata(v3s16 p);
 
-       v3f getPlayerPosition();
+       LocalPlayer* getLocalPlayer();
 
        void setPlayerControl(PlayerControl &control);
-       
+
+       void selectPlayerItem(u16 item);
+
        // Returns true if the inventory of the local player has been
        // updated from the server. If it is true, it is set to false.
        bool getLocalInventoryUpdated();
@@ -221,14 +231,6 @@ class Client : public con::PeerHandler, public InventoryManager
        Inventory* getInventory(InventoryContext *c, std::string id);
        void inventoryAction(InventoryAction *a);
 
-       // Gets closest object pointed by the shootline
-       // Returns NULL if not found
-       MapBlockObject * getSelectedObject(
-                       f32 max_d,
-                       v3f from_pos_f_on_map,
-                       core::line3d<f32> shootline_on_map
-       );
-
        // Gets closest object pointed by the shootline
        // Returns NULL if not found
        ClientActiveObject * getSelectedActiveObject(
@@ -249,11 +251,11 @@ class Client : public con::PeerHandler, public InventoryManager
 
        float getAvgRtt()
        {
-               //JMutexAutoLock lock(m_con_mutex); //bulk comment-out
-               con::Peer *peer = m_con.GetPeerNoEx(PEER_ID_SERVER);
-               if(peer == NULL)
-                       return 0.0;
-               return peer->avg_rtt;
+               try{
+                       return m_con.GetPeerAvgRTT(PEER_ID_SERVER);
+               } catch(con::PeerNotFoundException){
+                       return 1337;
+               }
        }
 
        bool getChatMessage(std::wstring &message)
@@ -266,6 +268,12 @@ class Client : public con::PeerHandler, public InventoryManager
 
        void addChatMessage(const std::wstring &message)
        {
+               if (message[0] == L'/') {
+                       m_chat_queue.push_back(
+                               (std::wstring)L"issued command: "+message);
+                       return;
+               }
+
                //JMutexAutoLock envlock(m_env_mutex); //bulk comment-out
                LocalPlayer *player = m_env.getLocalPlayer();
                assert(player != NULL);
@@ -292,15 +300,8 @@ class Client : public con::PeerHandler, public InventoryManager
        {
                return m_access_denied_reason;
        }
-       
-       /*
-               This should only be used for calling the special drawing stuff in
-               ClientEnvironment
-       */
-       ClientEnvironment * getEnv()
-       {
-               return &m_env;
-       }
+
+       float getRTT(void);
 
 private:
        
@@ -314,6 +315,8 @@ class Client : public con::PeerHandler, public InventoryManager
        void sendPlayerPos();
        // This sends the player's current name etc to the server
        void sendPlayerInfo();
+       // Send the item number 'item' as player item to the server
+       void sendPlayerItem(u16 item);
        
        float m_packetcounter_timer;
        float m_connection_reinit_timer;
@@ -330,9 +333,6 @@ class Client : public con::PeerHandler, public InventoryManager
 
        IrrlichtDevice *m_device;
 
-       v3f camera_position;
-       v3f camera_direction;
-       
        // Server serialization version
        u8 m_server_ser_ver;