]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/scripting_client.cpp
Value copy / allocation optimizations mostly in server, SAO and serialize code
[dragonfireclient.git] / src / script / scripting_client.cpp
index b5a5085be8fe3a5211253ac7c1820876d4f3d482..6643a9509d93512ae939a3deba6978136827b620 100644 (file)
@@ -19,11 +19,15 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 #include "scripting_client.h"
-#include "client.h"
+#include "client/client.h"
 #include "cpp_api/s_internal.h"
 #include "lua_api/l_client.h"
 #include "lua_api/l_env.h"
+#include "lua_api/l_item.h"
+#include "lua_api/l_itemstackmeta.h"
 #include "lua_api/l_minimap.h"
+#include "lua_api/l_modchannels.h"
+#include "lua_api/l_particles_local.h"
 #include "lua_api/l_storage.h"
 #include "lua_api/l_sound.h"
 #include "lua_api/l_util.h"
@@ -33,7 +37,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "lua_api/l_camera.h"
 
 ClientScripting::ClientScripting(Client *client):
-       ScriptApiBase()
+       ScriptApiBase(ScriptingType::Client)
 {
        setGameDef(client);
 
@@ -51,8 +55,6 @@ ClientScripting::ClientScripting(Client *client):
        InitializeModApi(L, top);
        lua_pop(L, 1);
 
-       LuaMinimap::create(L, client->getMinimap());
-
        // Push builtin initialization type
        lua_pushstring(L, "client");
        lua_setglobal(L, "INIT");
@@ -62,26 +64,35 @@ ClientScripting::ClientScripting(Client *client):
 
 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);
+       ItemStackMetaRef::Register(L);
+       LuaRaycast::Register(L);
        StorageRef::Register(L);
        LuaMinimap::Register(L);
        NodeMetaRef::RegisterClient(L);
        LuaLocalPlayer::Register(L);
        LuaCamera::Register(L);
+       ModChannelRef::Register(L);
+
+       ModApiUtil::InitializeClient(L, top);
+       ModApiClient::Initialize(L, top);
+       ModApiStorage::Initialize(L, top);
+       ModApiEnvMod::InitializeClient(L, top);
+       ModApiChannels::Initialize(L, top);
+       ModApiParticlesLocal::Initialize(L, top);
 }
 
 void ClientScripting::on_client_ready(LocalPlayer *localplayer)
 {
-       lua_State *L = getStack();
-       LuaLocalPlayer::create(L, localplayer);
+       LuaLocalPlayer::create(getStack(), localplayer);
 }
 
 void ClientScripting::on_camera_ready(Camera *camera)
 {
        LuaCamera::create(getStack(), camera);
 }
+
+void ClientScripting::on_minimap_ready(Minimap *minimap)
+{
+       LuaMinimap::create(getStack(), minimap);
+}