Rename Scripting API files for consistency
authorShadowNinja <shadowninja@minetest.net>
Tue, 25 Apr 2017 17:38:08 +0000 (13:38 -0400)
committerShadowNinja <shadowninja@minetest.net>
Tue, 25 Apr 2017 17:41:36 +0000 (13:41 -0400)
25 files changed:
src/client.cpp
src/clientenvironment.cpp
src/content_abm.cpp
src/content_sao.cpp
src/emerge.cpp
src/environment.cpp
src/game.cpp
src/guiFormSpecMenu.cpp
src/inventorymanager.cpp
src/map.cpp
src/network/clientpackethandler.cpp
src/network/serverpackethandler.cpp
src/script/CMakeLists.txt
src/script/clientscripting.cpp [deleted file]
src/script/clientscripting.h [deleted file]
src/script/lua_api/l_env.cpp
src/script/lua_api/l_object.cpp
src/script/scripting_client.cpp [new file with mode: 0644]
src/script/scripting_client.h [new file with mode: 0644]
src/script/scripting_server.cpp [new file with mode: 0644]
src/script/scripting_server.h [new file with mode: 0644]
src/script/serverscripting.cpp [deleted file]
src/script/serverscripting.h [deleted file]
src/server.cpp
src/serverenvironment.cpp

index 94c808a57823683e346fc4f09a951294c7335b59..19fe9b0ba39e12c9d1536fab7cf7da465bd9974c 100644 (file)
@@ -45,7 +45,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "database-sqlite3.h"
 #include "serialization.h"
 #include "guiscalingfilter.h"
-#include "script/clientscripting.h"
+#include "script/scripting_client.h"
 #include "game.h"
 
 extern gui::IGUIEnvironment* guienv;
index 4a8bbb06651431c5f47f44b9f5c8ad8a88a0d41a..cc75fd2d639fde2c8a297b0f015d8eb8c7d241a7 100644 (file)
@@ -22,7 +22,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "clientenvironment.h"
 #include "clientsimpleobject.h"
 #include "clientmap.h"
-#include "clientscripting.h"
+#include "scripting_client.h"
 #include "mapblock_mesh.h"
 #include "event.h"
 #include "collision.h"
index 1e175c64fdb99a0e0c6c9f772d470cf709dcb39e..162f93364d9133a8660c768d694c863d9b67aad9 100644 (file)
@@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "settings.h"
 #include "mapblock.h" // For getNodeBlockPos
 #include "map.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "log.h"
 
 void add_legacy_abms(ServerEnvironment *env, INodeDefManager *nodedef)
index caf6dcbab4c0f82d76e4dbde0ae7f2c94acff0c0..81c6902f58b4c2b438ac38b157fa3122d0ea8e49 100644 (file)
@@ -26,7 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "nodedef.h"
 #include "remoteplayer.h"
 #include "server.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "genericobject.h"
 
 std::map<u16, ServerActiveObject::Factory> ServerActiveObject::m_types;
index 4c3a83f7eb59aae4da576d9eb899db2eebbcf5c2..d24971e44a099490dfaeca4938d7c618e0c3343d 100644 (file)
@@ -40,7 +40,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "mg_schematic.h"
 #include "nodedef.h"
 #include "profiler.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "server.h"
 #include "serverobject.h"
 #include "settings.h"
index c1aeeec604c328c96e2e07aaf859fcff4dd570fa..4e782db81447f053261a1c32506862295a8837ba 100644 (file)
@@ -21,7 +21,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "environment.h"
 #include "collision.h"
 #include "serverobject.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "server.h"
 #include "daynightratio.h"
 #include "emerge.h"
index 31a48531ce1cf985662317fd2ade7f905ffd5cc4..97dc8c064e2d4367e8cc50088951376280481445 100644 (file)
@@ -60,7 +60,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "version.h"
 #include "minimap.h"
 #include "mapblock_mesh.h"
-#include "script/clientscripting.h"
+#include "script/scripting_client.h"
 
 #include "sound.h"
 
index 5861e9a8138d6f9695470697310a83f7339cb20e..14d576f8f5de36940454491d8371b07941ca27ab 100644 (file)
@@ -42,7 +42,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "filesys.h"
 #include "gettime.h"
 #include "gettext.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "porting.h"
 #include "settings.h"
 #include "client.h"
index 6ebc2994bcf79f36e901b01453379d4379b92158..c976bd037e557a5676c0642b2c7dcc3153084cf9 100644 (file)
@@ -20,7 +20,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "inventorymanager.h"
 #include "log.h"
 #include "serverenvironment.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "serverobject.h"
 #include "settings.h"
 #include "craftdef.h"
index c148c51f1af02458ef53ab32d811b42226cc3cf9..9e8823f84de5cafb630a97c9941f3acf671e4389 100644 (file)
@@ -44,7 +44,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "database.h"
 #include "database-dummy.h"
 #include "database-sqlite3.h"
-#include "script/serverscripting.h"
+#include "script/scripting_server.h"
 #include <deque>
 #include <queue>
 #if USE_LEVELDB
index 42c49be3cb6ef4dd75034f3a17e2b9bcb83a6756..772ffe905a2c183542d2ba80830d76093899c74c 100644 (file)
@@ -30,7 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "server.h"
 #include "util/strfnd.h"
 #include "network/clientopcodes.h"
-#include "script/clientscripting.h"
+#include "script/scripting_client.h"
 #include "util/serialize.h"
 #include "util/srp.h"
 #include "tileanimation.h"
index c284cb6c8b0a20fb6298013bc57192e8d60aa7ac..5b026bbdb03dffb3d27fcdaf60866efe8b07fe94 100644 (file)
@@ -27,7 +27,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "nodedef.h"
 #include "player.h"
 #include "rollback_interface.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "settings.h"
 #include "tool.h"
 #include "version.h"
index c96ccc8160c0db0c9fb346b8394d85f640b213a3..bebe2f037b0fa9825e4d5f5fbf6c2aae431dce67 100644 (file)
@@ -4,7 +4,7 @@ add_subdirectory(lua_api)
 
 # Used by server and client
 set(common_SCRIPT_SRCS
-       ${CMAKE_CURRENT_SOURCE_DIR}/serverscripting.cpp
+       ${CMAKE_CURRENT_SOURCE_DIR}/scripting_server.cpp
        ${common_SCRIPT_COMMON_SRCS}
        ${common_SCRIPT_CPP_API_SRCS}
        ${common_SCRIPT_LUA_API_SRCS}
@@ -13,7 +13,7 @@ set(common_SCRIPT_SRCS
 # Used by client only
 set(client_SCRIPT_SRCS
        ${CMAKE_CURRENT_SOURCE_DIR}/scripting_mainmenu.cpp
-       ${CMAKE_CURRENT_SOURCE_DIR}/clientscripting.cpp
+       ${CMAKE_CURRENT_SOURCE_DIR}/scripting_client.cpp
        ${client_SCRIPT_COMMON_SRCS}
        ${client_SCRIPT_CPP_API_SRCS}
        ${client_SCRIPT_LUA_API_SRCS}
diff --git a/src/script/clientscripting.cpp b/src/script/clientscripting.cpp
deleted file mode 100644 (file)
index ba3f910..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-Minetest
-Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#include "clientscripting.h"
-#include "client.h"
-#include "cpp_api/s_internal.h"
-#include "lua_api/l_client.h"
-#include "lua_api/l_env.h"
-#include "lua_api/l_minimap.h"
-#include "lua_api/l_storage.h"
-#include "lua_api/l_sound.h"
-#include "lua_api/l_util.h"
-#include "lua_api/l_item.h"
-#include "lua_api/l_nodemeta.h"
-#include "lua_api/l_localplayer.h"
-
-ClientScripting::ClientScripting(Client *client):
-       ScriptApiBase()
-{
-       setGameDef(client);
-
-       SCRIPTAPI_PRECHECKHEADER
-
-       // Security is mandatory client side
-       initializeSecurityClient();
-
-       lua_getglobal(L, "core");
-       int top = lua_gettop(L);
-
-       lua_newtable(L);
-       lua_setfield(L, -2, "ui");
-
-       InitializeModApi(L, top);
-       lua_pop(L, 1);
-
-       LuaMinimap::create(L, client->getMinimap());
-
-       // Push builtin initialization type
-       lua_pushstring(L, "client");
-       lua_setglobal(L, "INIT");
-
-       infostream << "SCRIPTAPI: Initialized client game modules" << std::endl;
-}
-
-void ClientScripting::InitializeModApi(lua_State *L, int top)
-{
-       ModApiUtil::InitializeClient(L, top);
-       ModApiClient::Initialize(L, top);
-       ModApiStorage::Initialize(L, top);
-       ModApiEnvMod::InitializeClient(L, top);
-
-       LuaItemStack::Register(L);
-       StorageRef::Register(L);
-       LuaMinimap::Register(L);
-       NodeMetaRef::RegisterClient(L);
-       LuaLocalPlayer::Register(L);
-}
-
-void ClientScripting::on_client_ready(LocalPlayer *localplayer)
-{
-       lua_State *L = getStack();
-       LuaLocalPlayer::create(L, localplayer);
-}
diff --git a/src/script/clientscripting.h b/src/script/clientscripting.h
deleted file mode 100644 (file)
index df94e8b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-Minetest
-Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
-Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#ifndef CLIENT_SCRIPTING_H_
-#define CLIENT_SCRIPTING_H_
-
-#include "cpp_api/s_base.h"
-#include "cpp_api/s_client.h"
-#include "cpp_api/s_security.h"
-
-class Client;
-class LocalPlayer;
-class ClientScripting:
-       virtual public ScriptApiBase,
-       public ScriptApiSecurity,
-       public ScriptApiClient
-{
-public:
-       ClientScripting(Client *client);
-       void on_client_ready(LocalPlayer *localplayer);
-
-private:
-       virtual void InitializeModApi(lua_State *L, int top);
-};
-#endif
index 75b07fa37236178502c3951d2b374c65e5926388..85791f90b0740366e4fc8bf81df0c686f05e5605 100644 (file)
@@ -25,7 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "lua_api/l_vmanip.h"
 #include "common/c_converter.h"
 #include "common/c_content.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "environment.h"
 #include "server.h"
 #include "nodedef.h"
index 95e977f9e5770532ab5891357dd98f9197c8251a..9668f76f799c2df71e48786b7c065286025aec4a 100644 (file)
@@ -29,7 +29,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "content_sao.h"
 #include "server.h"
 #include "hud.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 
 struct EnumString es_HudElementType[] =
 {
diff --git a/src/script/scripting_client.cpp b/src/script/scripting_client.cpp
new file mode 100644 (file)
index 0000000..8ff5abc
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include "scripting_client.h"
+#include "client.h"
+#include "cpp_api/s_internal.h"
+#include "lua_api/l_client.h"
+#include "lua_api/l_env.h"
+#include "lua_api/l_minimap.h"
+#include "lua_api/l_storage.h"
+#include "lua_api/l_sound.h"
+#include "lua_api/l_util.h"
+#include "lua_api/l_item.h"
+#include "lua_api/l_nodemeta.h"
+#include "lua_api/l_localplayer.h"
+
+ClientScripting::ClientScripting(Client *client):
+       ScriptApiBase()
+{
+       setGameDef(client);
+
+       SCRIPTAPI_PRECHECKHEADER
+
+       // Security is mandatory client side
+       initializeSecurityClient();
+
+       lua_getglobal(L, "core");
+       int top = lua_gettop(L);
+
+       lua_newtable(L);
+       lua_setfield(L, -2, "ui");
+
+       InitializeModApi(L, top);
+       lua_pop(L, 1);
+
+       LuaMinimap::create(L, client->getMinimap());
+
+       // Push builtin initialization type
+       lua_pushstring(L, "client");
+       lua_setglobal(L, "INIT");
+
+       infostream << "SCRIPTAPI: Initialized client game modules" << std::endl;
+}
+
+void ClientScripting::InitializeModApi(lua_State *L, int top)
+{
+       ModApiUtil::InitializeClient(L, top);
+       ModApiClient::Initialize(L, top);
+       ModApiStorage::Initialize(L, top);
+       ModApiEnvMod::InitializeClient(L, top);
+
+       LuaItemStack::Register(L);
+       StorageRef::Register(L);
+       LuaMinimap::Register(L);
+       NodeMetaRef::RegisterClient(L);
+       LuaLocalPlayer::Register(L);
+}
+
+void ClientScripting::on_client_ready(LocalPlayer *localplayer)
+{
+       lua_State *L = getStack();
+       LuaLocalPlayer::create(L, localplayer);
+}
diff --git a/src/script/scripting_client.h b/src/script/scripting_client.h
new file mode 100644 (file)
index 0000000..df94e8b
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#ifndef CLIENT_SCRIPTING_H_
+#define CLIENT_SCRIPTING_H_
+
+#include "cpp_api/s_base.h"
+#include "cpp_api/s_client.h"
+#include "cpp_api/s_security.h"
+
+class Client;
+class LocalPlayer;
+class ClientScripting:
+       virtual public ScriptApiBase,
+       public ScriptApiSecurity,
+       public ScriptApiClient
+{
+public:
+       ClientScripting(Client *client);
+       void on_client_ready(LocalPlayer *localplayer);
+
+private:
+       virtual void InitializeModApi(lua_State *L, int top);
+};
+#endif
diff --git a/src/script/scripting_server.cpp b/src/script/scripting_server.cpp
new file mode 100644 (file)
index 0000000..ce56fcf
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include "scripting_server.h"
+#include "server.h"
+#include "log.h"
+#include "settings.h"
+#include "cpp_api/s_internal.h"
+#include "lua_api/l_areastore.h"
+#include "lua_api/l_base.h"
+#include "lua_api/l_craft.h"
+#include "lua_api/l_env.h"
+#include "lua_api/l_inventory.h"
+#include "lua_api/l_item.h"
+#include "lua_api/l_itemstackmeta.h"
+#include "lua_api/l_mapgen.h"
+#include "lua_api/l_nodemeta.h"
+#include "lua_api/l_nodetimer.h"
+#include "lua_api/l_noise.h"
+#include "lua_api/l_object.h"
+#include "lua_api/l_particles.h"
+#include "lua_api/l_rollback.h"
+#include "lua_api/l_server.h"
+#include "lua_api/l_util.h"
+#include "lua_api/l_vmanip.h"
+#include "lua_api/l_settings.h"
+#include "lua_api/l_http.h"
+#include "lua_api/l_storage.h"
+
+extern "C" {
+#include "lualib.h"
+}
+
+ServerScripting::ServerScripting(Server* server)
+{
+       setGameDef(server);
+
+       // setEnv(env) is called by ScriptApiEnv::initializeEnvironment()
+       // once the environment has been created
+
+       SCRIPTAPI_PRECHECKHEADER
+
+       if (g_settings->getBool("secure.enable_security")) {
+               initializeSecurity();
+       }
+
+       lua_getglobal(L, "core");
+       int top = lua_gettop(L);
+
+       lua_newtable(L);
+       lua_setfield(L, -2, "object_refs");
+
+       lua_newtable(L);
+       lua_setfield(L, -2, "luaentities");
+
+       // Initialize our lua_api modules
+       InitializeModApi(L, top);
+       lua_pop(L, 1);
+
+       // Push builtin initialization type
+       lua_pushstring(L, "game");
+       lua_setglobal(L, "INIT");
+
+       infostream << "SCRIPTAPI: Initialized game modules" << std::endl;
+}
+
+void ServerScripting::InitializeModApi(lua_State *L, int top)
+{
+       // Initialize mod api modules
+       ModApiCraft::Initialize(L, top);
+       ModApiEnvMod::Initialize(L, top);
+       ModApiInventory::Initialize(L, top);
+       ModApiItemMod::Initialize(L, top);
+       ModApiMapgen::Initialize(L, top);
+       ModApiParticles::Initialize(L, top);
+       ModApiRollback::Initialize(L, top);
+       ModApiServer::Initialize(L, top);
+       ModApiUtil::Initialize(L, top);
+       ModApiHttp::Initialize(L, top);
+       ModApiStorage::Initialize(L, top);
+
+       // Register reference classes (userdata)
+       InvRef::Register(L);
+       ItemStackMetaRef::Register(L);
+       LuaAreaStore::Register(L);
+       LuaItemStack::Register(L);
+       LuaPerlinNoise::Register(L);
+       LuaPerlinNoiseMap::Register(L);
+       LuaPseudoRandom::Register(L);
+       LuaPcgRandom::Register(L);
+       LuaSecureRandom::Register(L);
+       LuaVoxelManip::Register(L);
+       NodeMetaRef::Register(L);
+       NodeTimerRef::Register(L);
+       ObjectRef::Register(L);
+       LuaSettings::Register(L);
+       StorageRef::Register(L);
+}
+
+void log_deprecated(const std::string &message)
+{
+       log_deprecated(NULL, message);
+}
diff --git a/src/script/scripting_server.h b/src/script/scripting_server.h
new file mode 100644 (file)
index 0000000..fd97ea4
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+Minetest
+Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#ifndef SERVER_SCRIPTING_H_
+#define SERVER_SCRIPTING_H_
+
+#include "cpp_api/s_base.h"
+#include "cpp_api/s_entity.h"
+#include "cpp_api/s_env.h"
+#include "cpp_api/s_inventory.h"
+#include "cpp_api/s_node.h"
+#include "cpp_api/s_player.h"
+#include "cpp_api/s_server.h"
+#include "cpp_api/s_security.h"
+
+/*****************************************************************************/
+/* Scripting <-> Server Game Interface                                       */
+/*****************************************************************************/
+
+class ServerScripting:
+               virtual public ScriptApiBase,
+               public ScriptApiDetached,
+               public ScriptApiEntity,
+               public ScriptApiEnv,
+               public ScriptApiNode,
+               public ScriptApiPlayer,
+               public ScriptApiServer,
+               public ScriptApiSecurity
+{
+public:
+       ServerScripting(Server* server);
+
+       // use ScriptApiBase::loadMod() to load mods
+
+private:
+       void InitializeModApi(lua_State *L, int top);
+};
+
+void log_deprecated(const std::string &message);
+
+#endif /* SCRIPTING_GAME_H_ */
diff --git a/src/script/serverscripting.cpp b/src/script/serverscripting.cpp
deleted file mode 100644 (file)
index 215b2cf..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
-Minetest
-Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#include "serverscripting.h"
-#include "server.h"
-#include "log.h"
-#include "settings.h"
-#include "cpp_api/s_internal.h"
-#include "lua_api/l_areastore.h"
-#include "lua_api/l_base.h"
-#include "lua_api/l_craft.h"
-#include "lua_api/l_env.h"
-#include "lua_api/l_inventory.h"
-#include "lua_api/l_item.h"
-#include "lua_api/l_itemstackmeta.h"
-#include "lua_api/l_mapgen.h"
-#include "lua_api/l_nodemeta.h"
-#include "lua_api/l_nodetimer.h"
-#include "lua_api/l_noise.h"
-#include "lua_api/l_object.h"
-#include "lua_api/l_particles.h"
-#include "lua_api/l_rollback.h"
-#include "lua_api/l_server.h"
-#include "lua_api/l_util.h"
-#include "lua_api/l_vmanip.h"
-#include "lua_api/l_settings.h"
-#include "lua_api/l_http.h"
-#include "lua_api/l_storage.h"
-
-extern "C" {
-#include "lualib.h"
-}
-
-ServerScripting::ServerScripting(Server* server)
-{
-       setGameDef(server);
-
-       // setEnv(env) is called by ScriptApiEnv::initializeEnvironment()
-       // once the environment has been created
-
-       SCRIPTAPI_PRECHECKHEADER
-
-       if (g_settings->getBool("secure.enable_security")) {
-               initializeSecurity();
-       }
-
-       lua_getglobal(L, "core");
-       int top = lua_gettop(L);
-
-       lua_newtable(L);
-       lua_setfield(L, -2, "object_refs");
-
-       lua_newtable(L);
-       lua_setfield(L, -2, "luaentities");
-
-       // Initialize our lua_api modules
-       InitializeModApi(L, top);
-       lua_pop(L, 1);
-
-       // Push builtin initialization type
-       lua_pushstring(L, "game");
-       lua_setglobal(L, "INIT");
-
-       infostream << "SCRIPTAPI: Initialized game modules" << std::endl;
-}
-
-void ServerScripting::InitializeModApi(lua_State *L, int top)
-{
-       // Initialize mod api modules
-       ModApiCraft::Initialize(L, top);
-       ModApiEnvMod::Initialize(L, top);
-       ModApiInventory::Initialize(L, top);
-       ModApiItemMod::Initialize(L, top);
-       ModApiMapgen::Initialize(L, top);
-       ModApiParticles::Initialize(L, top);
-       ModApiRollback::Initialize(L, top);
-       ModApiServer::Initialize(L, top);
-       ModApiUtil::Initialize(L, top);
-       ModApiHttp::Initialize(L, top);
-       ModApiStorage::Initialize(L, top);
-
-       // Register reference classes (userdata)
-       InvRef::Register(L);
-       ItemStackMetaRef::Register(L);
-       LuaAreaStore::Register(L);
-       LuaItemStack::Register(L);
-       LuaPerlinNoise::Register(L);
-       LuaPerlinNoiseMap::Register(L);
-       LuaPseudoRandom::Register(L);
-       LuaPcgRandom::Register(L);
-       LuaSecureRandom::Register(L);
-       LuaVoxelManip::Register(L);
-       NodeMetaRef::Register(L);
-       NodeTimerRef::Register(L);
-       ObjectRef::Register(L);
-       LuaSettings::Register(L);
-       StorageRef::Register(L);
-}
-
-void log_deprecated(const std::string &message)
-{
-       log_deprecated(NULL, message);
-}
diff --git a/src/script/serverscripting.h b/src/script/serverscripting.h
deleted file mode 100644 (file)
index fd97ea4..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-Minetest
-Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU Lesser General Public License as published by
-the Free Software Foundation; either version 2.1 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Lesser General Public License for more details.
-
-You should have received a copy of the GNU Lesser General Public License along
-with this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#ifndef SERVER_SCRIPTING_H_
-#define SERVER_SCRIPTING_H_
-
-#include "cpp_api/s_base.h"
-#include "cpp_api/s_entity.h"
-#include "cpp_api/s_env.h"
-#include "cpp_api/s_inventory.h"
-#include "cpp_api/s_node.h"
-#include "cpp_api/s_player.h"
-#include "cpp_api/s_server.h"
-#include "cpp_api/s_security.h"
-
-/*****************************************************************************/
-/* Scripting <-> Server Game Interface                                       */
-/*****************************************************************************/
-
-class ServerScripting:
-               virtual public ScriptApiBase,
-               public ScriptApiDetached,
-               public ScriptApiEntity,
-               public ScriptApiEnv,
-               public ScriptApiNode,
-               public ScriptApiPlayer,
-               public ScriptApiServer,
-               public ScriptApiSecurity
-{
-public:
-       ServerScripting(Server* server);
-
-       // use ScriptApiBase::loadMod() to load mods
-
-private:
-       void InitializeModApi(lua_State *L, int top);
-};
-
-void log_deprecated(const std::string &message);
-
-#endif /* SCRIPTING_GAME_H_ */
index 4c7e60286dba28424c5ee322faba5cc49feefa09..2edf83947ddc054e197a387e05928c8dfd23fd73 100644 (file)
@@ -38,7 +38,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "settings.h"
 #include "profiler.h"
 #include "log.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "nodedef.h"
 #include "itemdef.h"
 #include "craftdef.h"
index c0dc0e0eaf2ed0063ad1acd6301b8c3b59a970b1..4d2c87a4dfceb8297433580f5bb4941dc31b6dfb 100644 (file)
@@ -28,7 +28,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "profiler.h"
 #include "raycast.h"
 #include "remoteplayer.h"
-#include "serverscripting.h"
+#include "scripting_server.h"
 #include "server.h"
 #include "voxelalgorithms.h"
 #include "util/serialize.h"