]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/script/cpp_api/s_node.cpp
Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu
[dragonfireclient.git] / src / script / cpp_api / s_node.cpp
index 969e2f4d92bfc05ffb820f8b5a5fbf85a07fe506..92fd00a7477f68e5a74390faa3bc5fae90be488f 100644 (file)
@@ -18,10 +18,12 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 #include "cpp_api/s_node.h"
+#include "cpp_api/s_internal.h"
 #include "common/c_converter.h"
 #include "common/c_content.h"
 #include "nodedef.h"
 #include "server.h"
+#include "environment.h"
 
 
 struct EnumString ScriptApiNode::es_DrawType[] =
@@ -50,6 +52,7 @@ struct EnumString ScriptApiNode::es_ContentParamType2[] =
                {CPT2_FLOWINGLIQUID, "flowingliquid"},
                {CPT2_FACEDIR, "facedir"},
                {CPT2_WALLMOUNTED, "wallmounted"},
+               {CPT2_LEVELED, "leveled"},
                {0, NULL},
        };
 
@@ -73,6 +76,7 @@ struct EnumString ScriptApiNode::es_NodeBoxType[] =
                {NODEBOX_REGULAR, "regular"},
                {NODEBOX_FIXED, "fixed"},
                {NODEBOX_WALLMOUNTED, "wallmounted"},
+               {NODEBOX_LEVELED, "leveled"},
                {0, NULL},
        };
 
@@ -231,3 +235,20 @@ void ScriptApiNode::node_on_receive_fields(v3s16 p,
                scriptError("error: %s", lua_tostring(L, -1));
 }
 
+void ScriptApiNode::node_falling_update(v3s16 p)
+{
+       SCRIPTAPI_PRECHECKHEADER
+       lua_getglobal(L, "nodeupdate");
+       push_v3s16(L, p);
+       if(lua_pcall(L, 1, 0, 0))
+               scriptError("error: %s", lua_tostring(L, -1));
+}
+
+void ScriptApiNode::node_falling_update_single(v3s16 p)
+{
+       SCRIPTAPI_PRECHECKHEADER
+       lua_getglobal(L, "nodeupdate_single");
+       push_v3s16(L, p);
+       if(lua_pcall(L, 1, 0, 0))
+               scriptError("error: %s", lua_tostring(L, -1));
+}