X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Fclient%2Fclient.h;h=e3c931837754eb0fba0b9b4a5824807321074d23;hb=47da640d7763ee1e00badb7476ac5afc4f864367;hp=68a832d8e2b3fc847d9dab2f8d0ea73a686c0e38;hpb=5f1cd555cd9d1c64426e173b30b5b792d211c835;p=dragonfireclient.git diff --git a/src/client/client.h b/src/client/client.h index 68a832d8e..e3c931837 100644 --- a/src/client/client.h +++ b/src/client/client.h @@ -185,6 +185,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef void handleCommand_AccessDenied(NetworkPacket* pkt); void handleCommand_RemoveNode(NetworkPacket* pkt); void handleCommand_AddNode(NetworkPacket* pkt); + void handleCommand_NodemetaChanged(NetworkPacket *pkt); void handleCommand_BlockData(NetworkPacket* pkt); void handleCommand_Inventory(NetworkPacket* pkt); void handleCommand_TimeOfDay(NetworkPacket* pkt); @@ -192,6 +193,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef void handleCommand_ActiveObjectRemoveAdd(NetworkPacket* pkt); void handleCommand_ActiveObjectMessages(NetworkPacket* pkt); void handleCommand_Movement(NetworkPacket* pkt); + void handleCommand_Fov(NetworkPacket *pkt); void handleCommand_HP(NetworkPacket* pkt); void handleCommand_Breath(NetworkPacket* pkt); void handleCommand_MovePlayer(NetworkPacket* pkt); @@ -226,12 +228,13 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef void handleCommand_SrpBytesSandB(NetworkPacket *pkt); void handleCommand_FormspecPrepend(NetworkPacket *pkt); void handleCommand_CSMRestrictionFlags(NetworkPacket *pkt); + void handleCommand_PlayerSpeed(NetworkPacket *pkt); void ProcessData(NetworkPacket *pkt); void Send(NetworkPacket* pkt); - void interact(u8 action, const PointedThing& pointed); + void interact(InteractAction action, const PointedThing &pointed); void sendNodemetaFields(v3s16 p, const std::string &formname, const StringMap &fields); @@ -242,7 +245,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef void clearOutChatQueue(); void sendChangePassword(const std::string &oldpassword, const std::string &newpassword); - void sendDamage(u8 damage); + void sendDamage(u16 damage); void sendRespawn(); void sendReady(); @@ -270,20 +273,17 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef void setPlayerControl(PlayerControl &control); - void selectPlayerItem(u16 item); - u16 getPlayerItem() const - { return m_playeritem; } - // 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(); - // Copies the inventory of the local player to parameter - void getLocalInventory(Inventory &dst); + bool updateWieldedItem(); /* InventoryManager interface */ Inventory* getInventory(const InventoryLocation &loc) override; void inventoryAction(InventoryAction *a) override; + // Send the item number 'item' as player item to the server + void setPlayerItem(u16 item); + const std::list &getConnectedPlayerNames() { return m_env.getPlayerNames(); @@ -334,14 +334,16 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef // disconnect client when CSM failed. const std::string &accessDeniedReason() const { return m_access_denied_reason; } - bool itemdefReceived() + const bool itemdefReceived() const { return m_itemdef_received; } - bool nodedefReceived() + const bool nodedefReceived() const { return m_nodedef_received; } - bool mediaReceived() + const bool mediaReceived() const { return !m_media_downloader; } + const bool activeObjectsReceived() const + { return m_activeobjects_received; } - u8 getProtoVersion() + u16 getProtoVersion() { return m_proto_ver; } bool connectedToServer(); @@ -398,7 +400,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef } ClientScripting *getScript() { return m_script; } - const bool moddingEnabled() const { return m_modding_enabled; } const bool modsLoaded() const { return m_mods_loaded; } void pushToEventQueue(ClientEvent *event); @@ -453,8 +454,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef void Receive(); void sendPlayerPos(); - // Send the item number 'item' as player item to the server - void sendPlayerItem(u16 item); void deleteAuthData(); // helper method shared with clientpackethandler @@ -464,7 +463,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef void promptConfirmRegistration(AuthMechanism chosen_auth_mechanism); void startAuth(AuthMechanism chosen_auth_mechanism); void sendDeletedBlocks(std::vector &blocks); - void sendGotBlocks(v3s16 block); + void sendGotBlocks(const std::vector &blocks); void sendRemovedSounds(std::vector &soundList); // Helper function @@ -503,10 +502,9 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef // and aren't accurate. We simply just don't know, because // the server didn't send the version back then. // If 0, server init hasn't been received yet. - u8 m_proto_ver = 0; + u16 m_proto_ver = 0; - u16 m_playeritem = 0; - bool m_inventory_updated = false; + bool m_update_wielded_item = false; Inventory *m_inventory_from_server = nullptr; float m_inventory_from_server_age = 0.0f; PacketCounter m_packetcounter; @@ -544,6 +542,7 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef std::queue m_client_event_queue; bool m_itemdef_received = false; bool m_nodedef_received = false; + bool m_activeobjects_received = false; bool m_mods_loaded = false; ClientMediaDownloader *m_media_downloader; @@ -564,9 +563,6 @@ class Client : public con::PeerHandler, public InventoryManager, public IGameDef // And relations to objects std::unordered_map m_sounds_to_objects; - // CSM/client IDs to SSM/server IDs Mapping - // Map server particle spawner IDs to client IDs - std::unordered_map m_particles_server_to_client; // Map server hud ids to client hud ids std::unordered_map m_hud_server_to_client;