]> git.lizzy.rs Git - minetest.git/blobdiff - src/server.h
Fix potential problem with core.get_connected_players()
[minetest.git] / src / server.h
index 0a3e48072b2fead374149cc3f04b066f6c9d510c..28d9c8fa1e9d5d5c9837051e092b73c30fd66aff 100644 (file)
@@ -98,6 +98,7 @@ struct ServerSoundParams
        v3f pos;
        u16 object = 0;
        std::string to_player = "";
+       std::string exclude_player = "";
 
        v3f getPos(ServerEnvironment *env, bool *pos_exists) const;
 };
@@ -189,13 +190,13 @@ class Server : public con::PeerHandler, public MapEventReceiver,
                This is accessed by the map, which is inside the environment,
                so it shouldn't be a problem.
        */
-       void onMapEditEvent(MapEditEvent *event);
+       void onMapEditEvent(const MapEditEvent &event);
 
        /*
                Shall be called with the environment and the connection locked.
        */
        Inventory* getInventory(const InventoryLocation &loc);
-       void setInventoryModified(const InventoryLocation &loc, bool playerSend = true);
+       void setInventoryModified(const InventoryLocation &loc);
 
        // Connection must be locked when called
        std::wstring getStatusString();
@@ -209,7 +210,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 
        // Returns -1 if failed, sound handle on success
        // Envlock
-       s32 playSound(const SimpleSoundSpec &spec, const ServerSoundParams &params);
+       s32 playSound(const SimpleSoundSpec &spec, const ServerSoundParams &params,
+                       bool ephemeral=false);
        void stopSound(s32 handle);
        void fadeSound(s32 handle, float step, float gain);
 
@@ -296,8 +298,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        bool hudChange(RemotePlayer *player, u32 id, HudElementStat stat, void *value);
        bool hudSetFlags(RemotePlayer *player, u32 flags, u32 mask);
        bool hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount);
-       void hudSetHotbarImage(RemotePlayer *player, std::string name);
-       void hudSetHotbarSelectedImage(RemotePlayer *player, std::string name);
+       void hudSetHotbarImage(RemotePlayer *player, const std::string &name);
+       void hudSetHotbarSelectedImage(RemotePlayer *player, const std::string &name);
 
        Address getPeerAddress(session_t peer_id);
 
@@ -333,8 +335,12 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 
        void SendPlayerHPOrDie(PlayerSAO *player, const PlayerHPChangeReason &reason);
        void SendPlayerBreath(PlayerSAO *sao);
-       void SendInventory(PlayerSAO* playerSAO);
+       void SendInventory(PlayerSAO *playerSAO, bool incremental);
        void SendMovePlayer(session_t peer_id);
+       void SendPlayerSpeed(session_t peer_id, const v3f &added_vel);
+       void SendPlayerFov(session_t peer_id);
+
+       void sendDetachedInventories(session_t peer_id, bool incremental);
 
        virtual bool registerModStorage(ModMetadata *storage);
        virtual void unregisterModStorage(const std::string &name);
@@ -344,6 +350,9 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        bool sendModChannelMessage(const std::string &channel, const std::string &message);
        ModChannel *getModChannel(const std::string &channel);
 
+       // Send block to specific player only
+       bool SendBlock(session_t peer_id, const v3s16 &blockpos);
+
        // Bind address
        Address m_bind_addr;
 
@@ -439,7 +448,6 @@ class Server : public con::PeerHandler, public MapEventReceiver,
                        const std::vector<std::string> &tosend);
 
        void sendDetachedInventory(const std::string &name, session_t peer_id);
-       void sendDetachedInventories(session_t peer_id);
 
        // Adds a ParticleSpawner on peer with peer_id (PEER_ID_INEXISTENT == all)
        void SendAddParticleSpawner(session_t peer_id, u16 protocol_version,
@@ -464,7 +472,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
                bool vertical, const std::string &texture,
                const struct TileAnimationParams &animation, u8 glow);
 
-       u32 SendActiveObjectRemoveAdd(session_t peer_id, const std::string &datas);
+       void SendActiveObjectRemoveAdd(RemoteClient *client, PlayerSAO *playersao);
        void SendActiveObjectMessages(session_t peer_id, const std::string &datas,
                bool reliable = true);
        void SendCSMRestrictionFlags(session_t peer_id);
@@ -477,7 +485,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        void RespawnPlayer(session_t peer_id);
        void DeleteClient(session_t peer_id, ClientDeletionReason reason);
        void UpdateCrafting(RemotePlayer *player);
-       bool checkInteractDistance(RemotePlayer *player, const f32 d, const std::string what);
+       bool checkInteractDistance(RemotePlayer *player, const f32 d, const std::string &what);
 
        void handleChatInterfaceEvent(ChatEvent *evt);
 
@@ -510,7 +518,6 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        /*
                Variables
        */
-
        // World directory
        std::string m_path_world;
        // Subgame specification
@@ -570,7 +577,6 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        /*
                Threads
        */
-
        // A buffer for time steps
        // step() increments and AsyncRunStep() run by m_thread reads it.
        float m_step_dtime = 0.0f;
@@ -585,14 +591,14 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        /*
                Time related stuff
        */
-
        // Timer for sending time of day over network
        float m_time_of_day_send_timer = 0.0f;
        // Uptime of server in seconds
        MutexedVariable<double> m_uptime;
+
        /*
-        Client interface
-        */
+               Client interface
+       */
        ClientInterface m_clients;
 
        /*
@@ -642,7 +648,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
                Sounds
        */
        std::unordered_map<s32, ServerPlayingSound> m_playing_sounds;
-       s32 m_next_sound_id = 0;
+       s32 m_next_sound_id = 0; // positive values only
+       s32 nextSoundId();
 
        /*
                Detached inventories (behind m_env_mutex)