]> git.lizzy.rs Git - minetest.git/blobdiff - src/server.h
Use numeric indices and raw table access with LUA_REGISTRYINDEX
[minetest.git] / src / server.h
index fbca05f265607beb24babfc64a775ccd6aee45a2..26ec3ab73a42e52c8adbdb6ed0b9eba237e7af91 100644 (file)
@@ -244,8 +244,13 @@ class Server : public con::PeerHandler, public MapEventReceiver,
                        { return m_shutdown_requested; }
 
        // request server to shutdown
-       inline void requestShutdown(void)
-                       { m_shutdown_requested = true; }
+       inline void requestShutdown() { m_shutdown_requested = true; }
+       void requestShutdown(const std::string &msg, bool reconnect)
+       {
+               m_shutdown_requested = true;
+               m_shutdown_msg = msg;
+               m_shutdown_ask_reconnect = reconnect;
+       }
 
        // Returns -1 if failed, sound handle on success
        // Envlock
@@ -264,34 +269,21 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 
        void notifyPlayer(const char *name, const std::wstring &msg);
        void notifyPlayers(const std::wstring &msg);
-       void spawnParticle(const char *playername,
+       void spawnParticle(const std::string &playername,
                v3f pos, v3f velocity, v3f acceleration,
                float expirationtime, float size,
                bool collisiondetection, bool vertical, const std::string &texture);
 
-       void spawnParticleAll(v3f pos, v3f velocity, v3f acceleration,
-               float expirationtime, float size,
-               bool collisiondetection, bool vertical, const std::string &texture);
-
-       u32 addParticleSpawner(const char *playername,
-               u16 amount, float spawntime,
+       u32 addParticleSpawner(u16 amount, float spawntime,
                v3f minpos, v3f maxpos,
                v3f minvel, v3f maxvel,
                v3f minacc, v3f maxacc,
                float minexptime, float maxexptime,
                float minsize, float maxsize,
-               bool collisiondetection, bool vertical, const std::string &texture);
-
-       u32 addParticleSpawnerAll(u16 amount, float spawntime,
-               v3f minpos, v3f maxpos,
-               v3f minvel, v3f maxvel,
-               v3f minacc, v3f maxacc,
-               float minexptime, float maxexptime,
-               float minsize, float maxsize,
-               bool collisiondetection, bool vertical, const std::string &texture);
+               bool collisiondetection, bool vertical, const std::string &texture,
+               const std::string &playername);
 
-       void deleteParticleSpawner(const char *playername, u32 id);
-       void deleteParticleSpawnerAll(u32 id);
+       void deleteParticleSpawner(const std::string &playername, u32 id);
 
        // Creates or resets inventory
        Inventory* createDetachedInventory(const std::string &name);
@@ -366,6 +358,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        void deletingPeer(con::Peer *peer, bool timeout);
 
        void DenySudoAccess(u16 peer_id);
+       void DenyAccessVerCompliant(u16 peer_id, u16 proto_ver, AccessDeniedCode reason,
+               const std::string &str_reason = "", bool reconnect = false);
        void DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason="");
        void acceptAuth(u16 peer_id, bool forSudoMode);
        void DenyAccess_Legacy(u16 peer_id, const std::wstring &reason);
@@ -390,7 +384,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        void SendMovement(u16 peer_id);
        void SendHP(u16 peer_id, u8 hp);
        void SendBreath(u16 peer_id, u16 breath);
-       void SendAccessDenied(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason);
+       void SendAccessDenied(u16 peer_id, AccessDeniedCode reason,
+               const std::string &custom_reason, bool reconnect = false);
        void SendAccessDenied_Legacy(u16 peer_id, const std::wstring &reason);
        void SendDeathscreen(u16 peer_id,bool set_camera_point_target, v3f camera_point_target);
        void SendItemDef(u16 peer_id,IItemDefManager *itemdef, u16 protocol_version);
@@ -490,7 +485,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 
                Call with env and con locked.
        */
-       PlayerSAO *emergePlayer(const char *name, u16 peer_id);
+       PlayerSAO *emergePlayer(const char *name, u16 peer_id, u16 proto_version);
 
        void handlePeerChanges();
 
@@ -521,7 +516,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 
        // Environment
        ServerEnvironment *m_env;
-       JMutex m_env_mutex;
+       Mutex m_env_mutex;
 
        // server connection
        con::Connection m_con;
@@ -562,7 +557,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        // A buffer for time steps
        // step() increments and AsyncRunStep() run by m_thread reads it.
        float m_step_dtime;
-       JMutex m_step_dtime_mutex;
+       Mutex m_step_dtime_mutex;
 
        // current server step lag counter
        float m_lag;
@@ -596,6 +591,8 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        */
 
        bool m_shutdown_requested;
+       std::string m_shutdown_msg;
+       bool m_shutdown_ask_reconnect;
 
        /*
                Map edit event queue. Automatically receives all map edits.
@@ -655,9 +652,9 @@ class Server : public con::PeerHandler, public MapEventReceiver,
 /*
        Runs a simple dedicated server loop.
 
-       Shuts down when run is set to false.
+       Shuts down when kill is set to true.
 */
-void dedicated_server_loop(Server &server, bool &run);
+void dedicated_server_loop(Server &server, bool &kill);
 
 #endif