Add clientside translations.
[oweals/minetest.git] / src / server.h
1 /*
2 Minetest
3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #pragma once
21
22 #include "irr_v3d.h"
23 #include "map.h"
24 #include "hud.h"
25 #include "gamedef.h"
26 #include "serialization.h" // For SER_FMT_VER_INVALID
27 #include "mods.h"
28 #include "inventorymanager.h"
29 #include "subgame.h"
30 #include "tileanimation.h" // struct TileAnimationParams
31 #include "network/peerhandler.h"
32 #include "network/address.h"
33 #include "util/numeric.h"
34 #include "util/thread.h"
35 #include "util/basic_macros.h"
36 #include "serverenvironment.h"
37 #include "clientiface.h"
38 #include "chatmessage.h"
39 #include <string>
40 #include <list>
41 #include <map>
42 #include <vector>
43
44 class ChatEvent;
45 struct ChatEventChat;
46 struct ChatInterface;
47 class IWritableItemDefManager;
48 class IWritableNodeDefManager;
49 class IWritableCraftDefManager;
50 class BanManager;
51 class EventManager;
52 class Inventory;
53 class RemotePlayer;
54 class PlayerSAO;
55 class IRollbackManager;
56 struct RollbackAction;
57 class EmergeManager;
58 class ServerScripting;
59 class ServerEnvironment;
60 struct SimpleSoundSpec;
61 class ServerThread;
62
63 enum ClientDeletionReason {
64         CDR_LEAVE,
65         CDR_TIMEOUT,
66         CDR_DENY
67 };
68
69 struct MediaInfo
70 {
71         std::string path;
72         std::string sha1_digest;
73
74         MediaInfo(const std::string &path_="",
75                   const std::string &sha1_digest_=""):
76                 path(path_),
77                 sha1_digest(sha1_digest_)
78         {
79         }
80 };
81
82 struct ServerSoundParams
83 {
84         enum Type {
85                 SSP_LOCAL,
86                 SSP_POSITIONAL,
87                 SSP_OBJECT
88         } type = SSP_LOCAL;
89         float gain = 1.0f;
90         float fade = 0.0f;
91         float pitch = 1.0f;
92         bool loop = false;
93         float max_hear_distance = 32 * BS;
94         v3f pos;
95         u16 object = 0;
96         std::string to_player = "";
97
98         v3f getPos(ServerEnvironment *env, bool *pos_exists) const;
99 };
100
101 struct ServerPlayingSound
102 {
103         ServerSoundParams params;
104         SimpleSoundSpec spec;
105         std::unordered_set<u16> clients; // peer ids
106 };
107
108 class Server : public con::PeerHandler, public MapEventReceiver,
109                 public InventoryManager, public IGameDef
110 {
111 public:
112         /*
113                 NOTE: Every public method should be thread-safe
114         */
115
116         Server(
117                 const std::string &path_world,
118                 const SubgameSpec &gamespec,
119                 bool simple_singleplayer_mode,
120                 bool ipv6,
121                 bool dedicated,
122                 ChatInterface *iface = nullptr
123         );
124         ~Server();
125         DISABLE_CLASS_COPY(Server);
126
127         void start(Address bind_addr);
128         void stop();
129         // This is mainly a way to pass the time to the server.
130         // Actual processing is done in an another thread.
131         void step(float dtime);
132         // This is run by ServerThread and does the actual processing
133         void AsyncRunStep(bool initial_step=false);
134         void Receive();
135         PlayerSAO* StageTwoClientInit(u16 peer_id);
136
137         /*
138          * Command Handlers
139          */
140
141         void handleCommand(NetworkPacket* pkt);
142
143         void handleCommand_Null(NetworkPacket* pkt) {};
144         void handleCommand_Deprecated(NetworkPacket* pkt);
145         void handleCommand_Init(NetworkPacket* pkt);
146         void handleCommand_Init_Legacy(NetworkPacket* pkt);
147         void handleCommand_Init2(NetworkPacket* pkt);
148         void handleCommand_RequestMedia(NetworkPacket* pkt);
149         void handleCommand_ClientReady(NetworkPacket* pkt);
150         void handleCommand_GotBlocks(NetworkPacket* pkt);
151         void handleCommand_PlayerPos(NetworkPacket* pkt);
152         void handleCommand_DeletedBlocks(NetworkPacket* pkt);
153         void handleCommand_InventoryAction(NetworkPacket* pkt);
154         void handleCommand_ChatMessage(NetworkPacket* pkt);
155         void handleCommand_Damage(NetworkPacket* pkt);
156         void handleCommand_Password(NetworkPacket* pkt);
157         void handleCommand_PlayerItem(NetworkPacket* pkt);
158         void handleCommand_Respawn(NetworkPacket* pkt);
159         void handleCommand_Interact(NetworkPacket* pkt);
160         void handleCommand_RemovedSounds(NetworkPacket* pkt);
161         void handleCommand_NodeMetaFields(NetworkPacket* pkt);
162         void handleCommand_InventoryFields(NetworkPacket* pkt);
163         void handleCommand_FirstSrp(NetworkPacket* pkt);
164         void handleCommand_SrpBytesA(NetworkPacket* pkt);
165         void handleCommand_SrpBytesM(NetworkPacket* pkt);
166
167         void ProcessData(NetworkPacket *pkt);
168
169         void Send(NetworkPacket* pkt);
170
171         // Helper for handleCommand_PlayerPos and handleCommand_Interact
172         void process_PlayerPos(RemotePlayer *player, PlayerSAO *playersao,
173                 NetworkPacket *pkt);
174
175         // Both setter and getter need no envlock,
176         // can be called freely from threads
177         void setTimeOfDay(u32 time);
178
179         /*
180                 Shall be called with the environment locked.
181                 This is accessed by the map, which is inside the environment,
182                 so it shouldn't be a problem.
183         */
184         void onMapEditEvent(MapEditEvent *event);
185
186         /*
187                 Shall be called with the environment and the connection locked.
188         */
189         Inventory* getInventory(const InventoryLocation &loc);
190         void setInventoryModified(const InventoryLocation &loc, bool playerSend = true);
191
192         // Connection must be locked when called
193         std::wstring getStatusString();
194         inline double getUptime() const { return m_uptime.m_value; }
195
196         // read shutdown state
197         inline bool getShutdownRequested() const { return m_shutdown_requested; }
198
199         // request server to shutdown
200         void requestShutdown(const std::string &msg, bool reconnect, float delay = 0.0f);
201
202         // Returns -1 if failed, sound handle on success
203         // Envlock
204         s32 playSound(const SimpleSoundSpec &spec, const ServerSoundParams &params);
205         void stopSound(s32 handle);
206         void fadeSound(s32 handle, float step, float gain);
207
208         // Envlock
209         std::set<std::string> getPlayerEffectivePrivs(const std::string &name);
210         bool checkPriv(const std::string &name, const std::string &priv);
211         void reportPrivsModified(const std::string &name=""); // ""=all
212         void reportInventoryFormspecModified(const std::string &name);
213
214         void setIpBanned(const std::string &ip, const std::string &name);
215         void unsetIpBanned(const std::string &ip_or_name);
216         std::string getBanDescription(const std::string &ip_or_name);
217
218         void notifyPlayer(const char *name, const std::wstring &msg);
219         void notifyPlayers(const std::wstring &msg);
220         void spawnParticle(const std::string &playername,
221                 v3f pos, v3f velocity, v3f acceleration,
222                 float expirationtime, float size,
223                 bool collisiondetection, bool collision_removal,
224                 bool vertical, const std::string &texture,
225                 const struct TileAnimationParams &animation, u8 glow);
226
227         u32 addParticleSpawner(u16 amount, float spawntime,
228                 v3f minpos, v3f maxpos,
229                 v3f minvel, v3f maxvel,
230                 v3f minacc, v3f maxacc,
231                 float minexptime, float maxexptime,
232                 float minsize, float maxsize,
233                 bool collisiondetection, bool collision_removal,
234                 ServerActiveObject *attached,
235                 bool vertical, const std::string &texture,
236                 const std::string &playername, const struct TileAnimationParams &animation,
237                 u8 glow);
238
239         void deleteParticleSpawner(const std::string &playername, u32 id);
240
241         // Creates or resets inventory
242         Inventory* createDetachedInventory(const std::string &name, const std::string &player="");
243
244         // Envlock and conlock should be locked when using scriptapi
245         ServerScripting *getScriptIface(){ return m_script; }
246
247         // actions: time-reversed list
248         // Return value: success/failure
249         bool rollbackRevertActions(const std::list<RollbackAction> &actions,
250                         std::list<std::string> *log);
251
252         // IGameDef interface
253         // Under envlock
254         virtual IItemDefManager* getItemDefManager();
255         virtual INodeDefManager* getNodeDefManager();
256         virtual ICraftDefManager* getCraftDefManager();
257         virtual u16 allocateUnknownNodeId(const std::string &name);
258         virtual MtEventManager* getEventManager();
259         IRollbackManager *getRollbackManager() { return m_rollback; }
260         virtual EmergeManager *getEmergeManager() { return m_emerge; }
261
262         IWritableItemDefManager* getWritableItemDefManager();
263         IWritableNodeDefManager* getWritableNodeDefManager();
264         IWritableCraftDefManager* getWritableCraftDefManager();
265
266         virtual const std::vector<ModSpec> &getMods() const { return m_mods; }
267         virtual const ModSpec* getModSpec(const std::string &modname) const;
268         void getModNames(std::vector<std::string> &modlist);
269         std::string getBuiltinLuaPath();
270         virtual std::string getWorldPath() const { return m_path_world; }
271         virtual std::string getModStoragePath() const;
272
273         inline bool isSingleplayer()
274                         { return m_simple_singleplayer_mode; }
275
276         inline void setAsyncFatalError(const std::string &error)
277                         { m_async_fatal_error.set(error); }
278
279         bool showFormspec(const char *name, const std::string &formspec, const std::string &formname);
280         Map & getMap() { return m_env->getMap(); }
281         ServerEnvironment & getEnv() { return *m_env; }
282         v3f findSpawnPos();
283
284         u32 hudAdd(RemotePlayer *player, HudElement *element);
285         bool hudRemove(RemotePlayer *player, u32 id);
286         bool hudChange(RemotePlayer *player, u32 id, HudElementStat stat, void *value);
287         bool hudSetFlags(RemotePlayer *player, u32 flags, u32 mask);
288         bool hudSetHotbarItemcount(RemotePlayer *player, s32 hotbar_itemcount);
289         s32 hudGetHotbarItemcount(RemotePlayer *player) const;
290         void hudSetHotbarImage(RemotePlayer *player, std::string name);
291         std::string hudGetHotbarImage(RemotePlayer *player);
292         void hudSetHotbarSelectedImage(RemotePlayer *player, std::string name);
293         const std::string &hudGetHotbarSelectedImage(RemotePlayer *player) const;
294
295         Address getPeerAddress(u16 peer_id);
296
297         bool setLocalPlayerAnimations(RemotePlayer *player, v2s32 animation_frames[4],
298                         f32 frame_speed);
299         bool setPlayerEyeOffset(RemotePlayer *player, v3f first, v3f third);
300
301         bool setSky(RemotePlayer *player, const video::SColor &bgcolor,
302                         const std::string &type, const std::vector<std::string> &params,
303                         bool &clouds);
304         bool setClouds(RemotePlayer *player, float density,
305                         const video::SColor &color_bright,
306                         const video::SColor &color_ambient,
307                         float height,
308                         float thickness,
309                         const v2f &speed);
310
311         bool overrideDayNightRatio(RemotePlayer *player, bool do_override, float brightness);
312
313         /* con::PeerHandler implementation. */
314         void peerAdded(con::Peer *peer);
315         void deletingPeer(con::Peer *peer, bool timeout);
316
317         void DenySudoAccess(u16 peer_id);
318         void DenyAccessVerCompliant(u16 peer_id, u16 proto_ver, AccessDeniedCode reason,
319                 const std::string &str_reason = "", bool reconnect = false);
320         void DenyAccess(u16 peer_id, AccessDeniedCode reason, const std::string &custom_reason="");
321         void acceptAuth(u16 peer_id, bool forSudoMode);
322         void DenyAccess_Legacy(u16 peer_id, const std::wstring &reason);
323         bool getClientConInfo(u16 peer_id, con::rtt_stat_type type, float* retval);
324         bool getClientInfo(u16 peer_id,ClientState* state, u32* uptime,
325                         u8* ser_vers, u16* prot_vers, u8* major, u8* minor, u8* patch,
326                         std::string* vers_string);
327
328         void printToConsoleOnly(const std::string &text);
329
330         void SendPlayerHPOrDie(PlayerSAO *player);
331         void SendPlayerBreath(PlayerSAO *sao);
332         void SendInventory(PlayerSAO* playerSAO);
333         void SendMovePlayer(u16 peer_id);
334
335         virtual bool registerModStorage(ModMetadata *storage);
336         virtual void unregisterModStorage(const std::string &name);
337
338         // Bind address
339         Address m_bind_addr;
340
341         // Environment mutex (envlock)
342         std::mutex m_env_mutex;
343
344 private:
345
346         friend class EmergeThread;
347         friend class RemoteClient;
348
349         void SendMovement(u16 peer_id);
350         void SendHP(u16 peer_id, u8 hp);
351         void SendBreath(u16 peer_id, u16 breath);
352         void SendAccessDenied(u16 peer_id, AccessDeniedCode reason,
353                 const std::string &custom_reason, bool reconnect = false);
354         void SendAccessDenied_Legacy(u16 peer_id, const std::wstring &reason);
355         void SendDeathscreen(u16 peer_id,bool set_camera_point_target, v3f camera_point_target);
356         void SendItemDef(u16 peer_id,IItemDefManager *itemdef, u16 protocol_version);
357         void SendNodeDef(u16 peer_id,INodeDefManager *nodedef, u16 protocol_version);
358
359         /* mark blocks not sent for all clients */
360         void SetBlocksNotSent(std::map<v3s16, MapBlock *>& block);
361
362
363         void SendChatMessage(u16 peer_id, const ChatMessage &message);
364         void SendTimeOfDay(u16 peer_id, u16 time, f32 time_speed);
365         void SendPlayerHP(u16 peer_id);
366
367         void SendLocalPlayerAnimations(u16 peer_id, v2s32 animation_frames[4], f32 animation_speed);
368         void SendEyeOffset(u16 peer_id, v3f first, v3f third);
369         void SendPlayerPrivileges(u16 peer_id);
370         void SendPlayerInventoryFormspec(u16 peer_id);
371         void SendShowFormspecMessage(u16 peer_id, const std::string &formspec, const std::string &formname);
372         void SendHUDAdd(u16 peer_id, u32 id, HudElement *form);
373         void SendHUDRemove(u16 peer_id, u32 id);
374         void SendHUDChange(u16 peer_id, u32 id, HudElementStat stat, void *value);
375         void SendHUDSetFlags(u16 peer_id, u32 flags, u32 mask);
376         void SendHUDSetParam(u16 peer_id, u16 param, const std::string &value);
377         void SendSetSky(u16 peer_id, const video::SColor &bgcolor,
378                         const std::string &type, const std::vector<std::string> &params,
379                         bool &clouds);
380         void SendCloudParams(u16 peer_id, float density,
381                         const video::SColor &color_bright,
382                         const video::SColor &color_ambient,
383                         float height,
384                         float thickness,
385                         const v2f &speed);
386         void SendOverrideDayNightRatio(u16 peer_id, bool do_override, float ratio);
387
388         /*
389                 Send a node removal/addition event to all clients except ignore_id.
390                 Additionally, if far_players!=NULL, players further away than
391                 far_d_nodes are ignored and their peer_ids are added to far_players
392         */
393         // Envlock and conlock should be locked when calling these
394         void sendRemoveNode(v3s16 p, u16 ignore_id=0,
395                         std::vector<u16> *far_players=NULL, float far_d_nodes=100);
396         void sendAddNode(v3s16 p, MapNode n, u16 ignore_id=0,
397                         std::vector<u16> *far_players=NULL, float far_d_nodes=100,
398                         bool remove_metadata=true);
399         void setBlockNotSent(v3s16 p);
400
401         // Environment and Connection must be locked when called
402         void SendBlockNoLock(u16 peer_id, MapBlock *block, u8 ver, u16 net_proto_version);
403
404         // Sends blocks to clients (locks env and con on its own)
405         void SendBlocks(float dtime);
406
407         void fillMediaCache();
408         void sendMediaAnnouncement(u16 peer_id, const std::string &lang_code);
409         void sendRequestedMedia(u16 peer_id,
410                         const std::vector<std::string> &tosend);
411
412         void sendDetachedInventory(const std::string &name, u16 peer_id);
413         void sendDetachedInventories(u16 peer_id);
414
415         // Adds a ParticleSpawner on peer with peer_id (PEER_ID_INEXISTENT == all)
416         void SendAddParticleSpawner(u16 peer_id, u16 protocol_version,
417                 u16 amount, float spawntime,
418                 v3f minpos, v3f maxpos,
419                 v3f minvel, v3f maxvel,
420                 v3f minacc, v3f maxacc,
421                 float minexptime, float maxexptime,
422                 float minsize, float maxsize,
423                 bool collisiondetection, bool collision_removal,
424                 u16 attached_id,
425                 bool vertical, const std::string &texture, u32 id,
426                 const struct TileAnimationParams &animation, u8 glow);
427
428         void SendDeleteParticleSpawner(u16 peer_id, u32 id);
429
430         // Spawns particle on peer with peer_id (PEER_ID_INEXISTENT == all)
431         void SendSpawnParticle(u16 peer_id, u16 protocol_version,
432                 v3f pos, v3f velocity, v3f acceleration,
433                 float expirationtime, float size,
434                 bool collisiondetection, bool collision_removal,
435                 bool vertical, const std::string &texture,
436                 const struct TileAnimationParams &animation, u8 glow);
437
438         u32 SendActiveObjectRemoveAdd(u16 peer_id, const std::string &datas);
439         void SendActiveObjectMessages(u16 peer_id, const std::string &datas, bool reliable = true);
440         void SendCSMFlavourLimits(u16 peer_id);
441
442         /*
443                 Something random
444         */
445
446         void DiePlayer(u16 peer_id);
447         void RespawnPlayer(u16 peer_id);
448         void DeleteClient(u16 peer_id, ClientDeletionReason reason);
449         void UpdateCrafting(RemotePlayer *player);
450
451         void handleChatInterfaceEvent(ChatEvent *evt);
452
453         // This returns the answer to the sender of wmessage, or "" if there is none
454         std::wstring handleChat(const std::string &name, const std::wstring &wname,
455                 std::wstring wmessage_input,
456                 bool check_shout_priv = false,
457                 RemotePlayer *player = NULL);
458         void handleAdminChat(const ChatEventChat *evt);
459
460         // When called, connection mutex should be locked
461         RemoteClient* getClient(u16 peer_id,ClientState state_min=CS_Active);
462         RemoteClient* getClientNoEx(u16 peer_id,ClientState state_min=CS_Active);
463
464         // When called, environment mutex should be locked
465         std::string getPlayerName(u16 peer_id);
466         PlayerSAO* getPlayerSAO(u16 peer_id);
467
468         /*
469                 Get a player from memory or creates one.
470                 If player is already connected, return NULL
471                 Does not verify/modify auth info and password.
472
473                 Call with env and con locked.
474         */
475         PlayerSAO *emergePlayer(const char *name, u16 peer_id, u16 proto_version);
476
477         void handlePeerChanges();
478
479         /*
480                 Variables
481         */
482
483         // World directory
484         std::string m_path_world;
485         // Subgame specification
486         SubgameSpec m_gamespec;
487         // If true, do not allow multiple players and hide some multiplayer
488         // functionality
489         bool m_simple_singleplayer_mode;
490         u16 m_max_chatmessage_length;
491         // For "dedicated" server list flag
492         bool m_dedicated;
493
494         // Thread can set; step() will throw as ServerError
495         MutexedVariable<std::string> m_async_fatal_error;
496
497         // Some timers
498         float m_liquid_transform_timer = 0.0f;
499         float m_liquid_transform_every = 1.0f;
500         float m_masterserver_timer = 0.0f;
501         float m_emergethread_trigger_timer = 0.0f;
502         float m_savemap_timer = 0.0f;
503         IntervalLimiter m_map_timer_and_unload_interval;
504
505         // Environment
506         ServerEnvironment *m_env = nullptr;
507
508         // server connection
509         std::shared_ptr<con::Connection> m_con;
510
511         // Ban checking
512         BanManager *m_banmanager = nullptr;
513
514         // Rollback manager (behind m_env_mutex)
515         IRollbackManager *m_rollback = nullptr;
516         bool m_enable_rollback_recording = false; // Updated once in a while
517
518         // Emerge manager
519         EmergeManager *m_emerge = nullptr;
520
521         // Scripting
522         // Envlock and conlock should be locked when using Lua
523         ServerScripting *m_script = nullptr;
524
525         // Item definition manager
526         IWritableItemDefManager *m_itemdef;
527
528         // Node definition manager
529         IWritableNodeDefManager *m_nodedef;
530
531         // Craft definition manager
532         IWritableCraftDefManager *m_craftdef;
533
534         // Event manager
535         EventManager *m_event;
536
537         // Mods
538         std::vector<ModSpec> m_mods;
539
540         /*
541                 Threads
542         */
543
544         // A buffer for time steps
545         // step() increments and AsyncRunStep() run by m_thread reads it.
546         float m_step_dtime = 0.0f;
547         std::mutex m_step_dtime_mutex;
548
549         // current server step lag counter
550         float m_lag;
551
552         // The server mainly operates in this thread
553         ServerThread *m_thread = nullptr;
554
555         /*
556                 Time related stuff
557         */
558
559         // Timer for sending time of day over network
560         float m_time_of_day_send_timer = 0.0f;
561         // Uptime of server in seconds
562         MutexedVariable<double> m_uptime;
563         /*
564          Client interface
565          */
566         ClientInterface m_clients;
567
568         /*
569                 Peer change queue.
570                 Queues stuff from peerAdded() and deletingPeer() to
571                 handlePeerChanges()
572         */
573         std::queue<con::PeerChange> m_peer_change_queue;
574
575         /*
576                 Random stuff
577         */
578
579         bool m_shutdown_requested = false;
580         std::string m_shutdown_msg;
581         bool m_shutdown_ask_reconnect = false;
582         float m_shutdown_timer = 0.0f;
583
584         ChatInterface *m_admin_chat;
585         std::string m_admin_nick;
586
587         /*
588                 Map edit event queue. Automatically receives all map edits.
589                 The constructor of this class registers us to receive them through
590                 onMapEditEvent
591
592                 NOTE: Should these be moved to actually be members of
593                 ServerEnvironment?
594         */
595
596         /*
597                 Queue of map edits from the environment for sending to the clients
598                 This is behind m_env_mutex
599         */
600         std::queue<MapEditEvent*> m_unsent_map_edit_queue;
601         /*
602                 Set to true when the server itself is modifying the map and does
603                 all sending of information by itself.
604                 This is behind m_env_mutex
605         */
606         bool m_ignore_map_edit_events = false;
607         /*
608                 If a non-empty area, map edit events contained within are left
609                 unsent. Done at map generation time to speed up editing of the
610                 generated area, as it will be sent anyway.
611                 This is behind m_env_mutex
612         */
613         VoxelArea m_ignore_map_edit_events_area;
614         /*
615                 If set to !=0, the incoming MapEditEvents are modified to have
616                 this peed id as the disabled recipient
617                 This is behind m_env_mutex
618         */
619         u16 m_ignore_map_edit_events_peer_id = 0;
620
621         // media files known to server
622         std::unordered_map<std::string, MediaInfo> m_media;
623
624         /*
625                 Sounds
626         */
627         std::unordered_map<s32, ServerPlayingSound> m_playing_sounds;
628         s32 m_next_sound_id = 0;
629
630         /*
631                 Detached inventories (behind m_env_mutex)
632         */
633         // key = name
634         std::map<std::string, Inventory*> m_detached_inventories;
635         // value = "" (visible to all players) or player name
636         std::map<std::string, std::string> m_detached_inventories_player;
637
638         std::unordered_map<std::string, ModMetadata *> m_mod_storages;
639         float m_mod_storage_save_timer = 10.0f;
640
641         // CSM flavour limits byteflag
642         u64 m_csm_flavour_limits = CSMFlavourLimit::CSM_FL_NONE;
643         u32 m_csm_noderange_limit = 8;
644 };
645
646 /*
647         Runs a simple dedicated server loop.
648
649         Shuts down when kill is set to true.
650 */
651 void dedicated_server_loop(Server &server, bool &kill);