]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
[CSM] storage + fixes
authorLoic Blot <loic.blot@unix-experience.fr>
Sat, 28 Jan 2017 17:31:23 +0000 (18:31 +0100)
committerLoïc Blot <nerzhul@users.noreply.github.com>
Mon, 13 Mar 2017 22:56:05 +0000 (23:56 +0100)
clientmods/preview/init.lua
src/script/clientscripting.cpp
src/script/lua_api/CMakeLists.txt
src/script/lua_api/l_client.h
src/script/lua_api/l_util.cpp
src/server.cpp
src/server.h

index 4c01d665fe4a31479177a1ed3cd4dad5918fb583..f03e8e112a5476118d8c5626a86d0fb35a94c3a3 100644 (file)
@@ -1,3 +1,5 @@
+local modname = core.get_current_modname() or "??"
+
 -- This is an example function to ensure it's working properly, should be removed before merge
 core.register_on_shutdown(function()
        print("[PREVIEW] shutdown client")
@@ -38,5 +40,5 @@ core.register_chatcommand("dump", {
 })
 
 core.after(2, function()
-       print("After 2")
+       print("[PREVIEW] loaded " .. modname .. " mod")
 end)
index 390d21a3acedd5a326595fe989c4c67df9748688..aaed2865dd0a03ff231dea891feafd6c7aa7abc4 100644 (file)
@@ -22,6 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "client.h"
 #include "cpp_api/s_internal.h"
 #include "lua_api/l_client.h"
+#include "lua_api/l_storage.h"
 #include "lua_api/l_sound.h"
 #include "lua_api/l_util.h"
 
@@ -53,4 +54,5 @@ void ClientScripting::InitializeModApi(lua_State *L, int top)
        ModApiUtil::InitializeClient(L, top);
        ModApiClient::Initialize(L, top);
        ModApiSound::Initialize(L, top);
+       ModApiStorage::Initialize(L, top);
 }
index 17bcdde4c42b8f148238f509f9632af811d58e58..2d25d845c5201ba2cef81de003734ebfa7c405fe 100644 (file)
@@ -25,5 +25,6 @@ set(common_SCRIPT_LUA_API_SRCS
 set(client_SCRIPT_LUA_API_SRCS
        ${CMAKE_CURRENT_SOURCE_DIR}/l_client.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/l_mainmenu.cpp
+       ${CMAKE_CURRENT_SOURCE_DIR}/l_storage.cpp
        ${CMAKE_CURRENT_SOURCE_DIR}/l_sound.cpp
        PARENT_SCOPE)
index 14ef5aecce942338454952e35e2935c87253f091..d0e230630c1cc54b9e3cd86f351296b16ef0d04a 100644 (file)
@@ -23,8 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 
 #include "lua_api/l_base.h"
 
-class ModApiClient:
-       public ModApiBase
+class ModApiClient: public ModApiBase
 {
 private:
        // get_current_modname()
index b9c334121d9ab58a1db4424659f79b1b868bac30..809a2eb685d65504fc311ddb1c726ecec2469d16 100644 (file)
@@ -532,12 +532,6 @@ void ModApiUtil::InitializeClient(lua_State *L, int top)
 
        API_FCT(get_us_time);
 
-       API_FCT(setting_set);
-       API_FCT(setting_get);
-       API_FCT(setting_setbool);
-       API_FCT(setting_getbool);
-       API_FCT(setting_save);
-
        API_FCT(parse_json);
        API_FCT(write_json);
 
index dd6c9a418f03ae86f08e8543afe348c18c14a098..293b32a81595403fa7c9c269f5efc6c52718fed8 100644 (file)
@@ -3400,7 +3400,7 @@ void Server::getModNames(std::vector<std::string> &modlist)
                modlist.push_back(it->name);
 }
 
-const std::string Server::getBuiltinLuaPath()
+std::string Server::getBuiltinLuaPath()
 {
        return porting::path_share + DIR_DELIM + "builtin";
 }
index 417d31bd82ffb344da8128629d0f73cfa332e53f..f0bab1bbff4389763341dd57c67b62201d639e74 100644 (file)
@@ -299,7 +299,7 @@ class Server : public con::PeerHandler, public MapEventReceiver,
        virtual const ModSpec* getModSpec(const std::string &modname) const;
        void getModNames(std::vector<std::string> &modlist);
        std::string getBuiltinLuaPath();
-       inline const std::string &getWorldPath() const { return m_path_world; }
+       std::string getWorldPath() const { return m_path_world; }
        std::string getModStoragePath() const;
 
        inline bool isSingleplayer()