diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-02-08 00:15:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-08 00:15:55 +0100 |
commit | ef6feca501fcf0d5a1fd2021f1d4df96a4533f65 (patch) | |
tree | 58361be1085c91222ab9c0cad507ca70a87dfe8e /src/server.h | |
parent | 0680c47d6c7d3e98e2b96b823f8cc9ca76d5e7f8 (diff) | |
download | hax-minetest-server-ef6feca501fcf0d5a1fd2021f1d4df96a4533f65.tar.gz hax-minetest-server-ef6feca501fcf0d5a1fd2021f1d4df96a4533f65.zip |
Add ModMetadata API (#5131)
* mod can create a ModMetadata object where store its values and retrieve it.
* Modmetadata object can only be fetched at mod loading
* Save when modified using same time as map interval or at server stop
* add helper function to get mod storage path
* ModMetadata has exactly same calls than all every other Metadata
Diffstat (limited to '')
-rw-r--r-- | src/server.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/server.h b/src/server.h index 8f553ce38..3eee67b78 100644 --- a/src/server.h +++ b/src/server.h @@ -299,7 +299,8 @@ public: const ModSpec* getModSpec(const std::string &modname) const; void getModNames(std::vector<std::string> &modlist); std::string getBuiltinLuaPath(); - inline std::string getWorldPath() const { return m_path_world; } + inline const std::string &getWorldPath() const { return m_path_world; } + std::string getModStoragePath() const; inline bool isSingleplayer() { return m_simple_singleplayer_mode; } @@ -360,6 +361,9 @@ public: void SendInventory(PlayerSAO* playerSAO); void SendMovePlayer(u16 peer_id); + bool registerModStorage(ModMetadata *storage); + void unregisterModStorage(const std::string &name); + // Bind address Address m_bind_addr; @@ -650,6 +654,9 @@ private: // value = "" (visible to all players) or player name std::map<std::string, std::string> m_detached_inventories_player; + UNORDERED_MAP<std::string, ModMetadata *> m_mod_storages; + float m_mod_storage_save_timer; + DISABLE_CLASS_COPY(Server); }; |