]> git.lizzy.rs Git - minetest.git/blobdiff - src/server.h
GUIHyperText: Fix bug with UTF8 chars in action name + simplify UTF8 stringw conversi...
[minetest.git] / src / server.h
index aa7d6385a225806c9250993716d9a9ec4a24dc04..680de57b540f51027ad2fc13d66b5a8318ec329a 100644 (file)
@@ -61,6 +61,10 @@ class ServerScripting;
 class ServerEnvironment;
 struct SimpleSoundSpec;
 struct CloudParams;
+struct SkyboxParams;
+struct SunParams;
+struct MoonParams;
+struct StarParams;
 class ServerThread;
 class ServerModManager;
 
@@ -98,6 +102,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,7 +194,7 @@ 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.
@@ -209,7 +214,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);
 
@@ -305,9 +311,11 @@ class Server : public con::PeerHandler, public MapEventReceiver,
                        f32 frame_speed);
        void setPlayerEyeOffset(RemotePlayer *player, const v3f &first, const v3f &third);
 
-       void setSky(RemotePlayer *player, const video::SColor &bgcolor,
-                       const std::string &type, const std::vector<std::string> &params,
-                       bool &clouds);
+       void setSky(RemotePlayer *player, const SkyboxParams &params);
+       void setSun(RemotePlayer *player, const SunParams &params);
+       void setMoon(RemotePlayer *player, const MoonParams &params);
+       void setStars(RemotePlayer *player, const StarParams &params);
+
        void setClouds(RemotePlayer *player, const CloudParams &params);
 
        bool overrideDayNightRatio(RemotePlayer *player, bool do_override, float brightness);
@@ -336,6 +344,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        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);
 
@@ -410,9 +419,10 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        void SendHUDChange(session_t peer_id, u32 id, HudElementStat stat, void *value);
        void SendHUDSetFlags(session_t peer_id, u32 flags, u32 mask);
        void SendHUDSetParam(session_t peer_id, u16 param, const std::string &value);
-       void SendSetSky(session_t peer_id, const video::SColor &bgcolor,
-                       const std::string &type, const std::vector<std::string> &params,
-                       bool &clouds);
+       void SendSetSky(session_t peer_id, const SkyboxParams &params);
+       void SendSetSun(session_t peer_id, const SunParams &params);
+       void SendSetMoon(session_t peer_id, const MoonParams &params);
+       void SendSetStars(session_t peer_id, const StarParams &params);
        void SendCloudParams(session_t peer_id, const CloudParams &params);
        void SendOverrideDayNightRatio(session_t peer_id, bool do_override, float ratio);
        void broadcastModChannelMessage(const std::string &channel,
@@ -515,7 +525,6 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        /*
                Variables
        */
-
        // World directory
        std::string m_path_world;
        // Subgame specification
@@ -575,7 +584,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;
@@ -590,14 +598,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;
 
        /*
@@ -647,7 +655,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)