summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorproller <proller@github.com>2013-07-28 17:11:59 +0400
committerproller <proller@github.com>2013-07-28 17:14:31 +0400
commit037e84d377e91f37026cb5814145bdceac135534 (patch)
tree4e74e3d60e797605353d2539d2b2fbc399b684a9 /src/script
parent3aedfac9685c2d9ae8bac5a5b7e72e527f22c08d (diff)
downloadminetest-037e84d377e91f37026cb5814145bdceac135534.tar.gz
minetest-037e84d377e91f37026cb5814145bdceac135534.tar.bz2
minetest-037e84d377e91f37026cb5814145bdceac135534.zip
Better snow fall, finite liquid transform, leveled nodes api
Diffstat (limited to 'src/script')
-rw-r--r--src/script/lua_api/l_env.cpp20
-rw-r--r--src/script/lua_api/l_env.h4
2 files changed, 23 insertions, 1 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 52ea55717..47bc9baf7 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -287,9 +287,26 @@ int ModApiEnvMod::l_get_node_level(lua_State *L)
return 1;
}
+// minetest.set_node_level(pos, level)
+// pos = {x=num, y=num, z=num}
+// level: 0..63
+int ModApiEnvMod::l_set_node_level(lua_State *L)
+{
+ GET_ENV_PTR;
+
+ v3s16 pos = read_v3s16(L, 1);
+ u8 level = 1;
+ if(lua_isnumber(L, 2))
+ level = lua_tonumber(L, 2);
+ MapNode n = env->getMap().getNodeNoEx(pos);
+ lua_pushnumber(L, n.setLevel(env->getGameDef()->ndef(), level));
+ env->setNode(pos, n);
+ return 1;
+}
+
// minetest.add_node_level(pos, level)
// pos = {x=num, y=num, z=num}
-// level: 0..8
+// level: 0..63
int ModApiEnvMod::l_add_node_level(lua_State *L)
{
GET_ENV_PTR;
@@ -913,6 +930,7 @@ bool ModApiEnvMod::Initialize(lua_State *L,int top)
retval &= API_FCT(punch_node);
retval &= API_FCT(get_node_max_level);
retval &= API_FCT(get_node_level);
+ retval &= API_FCT(set_node_level);
retval &= API_FCT(add_node_level);
retval &= API_FCT(add_entity);
retval &= API_FCT(get_meta);
diff --git a/src/script/lua_api/l_env.h b/src/script/lua_api/l_env.h
index eaef16180..4122fd037 100644
--- a/src/script/lua_api/l_env.h
+++ b/src/script/lua_api/l_env.h
@@ -76,6 +76,10 @@ private:
// pos = {x=num, y=num, z=num}
static int l_get_node_level(lua_State *L);
+ // minetest.set_node_level(pos)
+ // pos = {x=num, y=num, z=num}
+ static int l_set_node_level(lua_State *L);
+
// minetest.add_node_level(pos)
// pos = {x=num, y=num, z=num}
static int l_add_node_level(lua_State *L);