summaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_node.cpp
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
committerShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
commitcaecdb681c428c1aab9c0f7eec2570c0460f995c (patch)
treee5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /src/script/cpp_api/s_node.cpp
parent81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff)
parent80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff)
downloadminetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.gz
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.bz2
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.zip
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'src/script/cpp_api/s_node.cpp')
-rw-r--r--src/script/cpp_api/s_node.cpp27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/script/cpp_api/s_node.cpp b/src/script/cpp_api/s_node.cpp
index 379ed773f..1ae8f58a5 100644
--- a/src/script/cpp_api/s_node.cpp
+++ b/src/script/cpp_api/s_node.cpp
@@ -59,6 +59,10 @@ struct EnumString ScriptApiNode::es_ContentParamType2[] =
{CPT2_LEVELED, "leveled"},
{CPT2_DEGROTATE, "degrotate"},
{CPT2_MESHOPTIONS, "meshoptions"},
+ {CPT2_COLOR, "color"},
+ {CPT2_COLORED_FACEDIR, "colorfacedir"},
+ {CPT2_COLORED_WALLMOUNTED, "colorwallmounted"},
+ {CPT2_GLASSLIKE_LIQUID_LEVEL, "glasslikeliquidlevel"},
{0, NULL},
};
@@ -174,6 +178,27 @@ void ScriptApiNode::node_on_destruct(v3s16 p, MapNode node)
lua_pop(L, 1); // Pop error handler
}
+bool ScriptApiNode::node_on_flood(v3s16 p, MapNode node, MapNode newnode)
+{
+ SCRIPTAPI_PRECHECKHEADER
+
+ int error_handler = PUSH_ERROR_HANDLER(L);
+
+ INodeDefManager *ndef = getServer()->ndef();
+
+ // Push callback function on stack
+ if (!getItemCallback(ndef->get(node).name.c_str(), "on_flood"))
+ return false;
+
+ // Call function
+ push_v3s16(L, p);
+ pushnode(L, node, ndef);
+ pushnode(L, newnode, ndef);
+ PCALL_RES(lua_pcall(L, 3, 1, error_handler));
+ lua_remove(L, error_handler);
+ return (bool) lua_isboolean(L, -1) && (bool) lua_toboolean(L, -1) == true;
+}
+
void ScriptApiNode::node_after_destruct(v3s16 p, MapNode node)
{
SCRIPTAPI_PRECHECKHEADER
@@ -238,7 +263,7 @@ void ScriptApiNode::node_on_receive_fields(v3s16 p,
lua_pushstring(L, formname.c_str()); // formname
lua_newtable(L); // fields
StringMap::const_iterator it;
- for (it = fields.begin(); it != fields.end(); it++) {
+ for (it = fields.begin(); it != fields.end(); ++it) {
const std::string &name = it->first;
const std::string &value = it->second;
lua_pushstring(L, name.c_str());