diff options
author | Anthony Zhang <azhang9@gmail.com> | 2012-06-21 20:32:48 -0400 |
---|---|---|
committer | Anthony Zhang <azhang9@gmail.com> | 2012-06-21 20:32:48 -0400 |
commit | 1e569782f52e48566da52e8a8c7e69c5acb1ee90 (patch) | |
tree | 772e01164a13bb96a76eef380024c50c81308f09 | |
parent | 87442f0c31dd4d4ae0d31ff9415f29502d5c1975 (diff) | |
download | mesecons-1e569782f52e48566da52e8a8c7e69c5acb1ee90.tar mesecons-1e569782f52e48566da52e8a8c7e69c5acb1ee90.tar.gz mesecons-1e569782f52e48566da52e8a8c7e69c5acb1ee90.tar.bz2 mesecons-1e569782f52e48566da52e8a8c7e69c5acb1ee90.tar.xz mesecons-1e569782f52e48566da52e8a8c7e69c5acb1ee90.zip |
Use minetest.env:place_node and minetest.env:dig_node to enable usage of the on_place and on_dig callbacks.
-rw-r--r-- | mesecons_movestones/init.lua | 20 | ||||
-rw-r--r-- | mesecons_pistons/init.lua | 8 |
2 files changed, 14 insertions, 14 deletions
diff --git a/mesecons_movestones/init.lua b/mesecons_movestones/init.lua index 0e497d2..4af892d 100644 --- a/mesecons_movestones/init.lua +++ b/mesecons_movestones/init.lua @@ -64,7 +64,7 @@ minetest.register_entity("mesecons_movestones:movestone_entity", { local direction=mesecon:get_movestone_direction(pos) if not direction then - minetest.env:add_node(pos, {name="mesecons_movestones:movestone"}) + minetest.env:place_node(pos, {name="mesecons_movestones:movestone"}) self.object:remove() return end @@ -75,13 +75,13 @@ minetest.register_entity("mesecons_movestones:movestone_entity", { if lnode.name ~= "ignore" and lnode.name ~= "air" and lnode.name ~= "default:water" and lnode.name ~= "default:water_flowing" then local newnode repeat - minetest.env:remove_node(pos) + minetest.env:dig_node(pos) pos.x=pos.x+direction.x pos.y=pos.y+direction.y pos.z=pos.z+direction.z newnode = {name=lnode.name} lnode = minetest.env:get_node(pos) - minetest.env:add_node(pos, newnode) + minetest.env:place_node(pos, newnode) nodeupdate(pos) until lnode.name == "ignore" or lnode.name == "air" or lnode.name == "default:water" or lnode.name == "default:water_flowing" end @@ -113,7 +113,7 @@ mesecon:register_on_signal_on(function (pos, node) or checknode.name=="ignore" or checknode.name=="default:water" or checknode.name=="default:water_flowing" - minetest.env:remove_node(pos) + minetest.env:dig_node(pos) nodeupdate(pos) minetest.env:add_entity(pos, "mesecons_movestones:movestone_entity") end @@ -160,7 +160,7 @@ minetest.register_entity("mesecons_movestones:sticky_movestone_entity", { if not direction then --or (minetest.env:get_node_or_nil(pos).name ~="air" --and minetest.env:get_node_or_nil(pos).name ~= nil) then - minetest.env:add_node(pos, {name="mesecons_movestones:sticky_movestone"}) + minetest.env:place_node(pos, {name="mesecons_movestones:sticky_movestone"}) self.object:remove() return end @@ -176,13 +176,13 @@ minetest.register_entity("mesecons_movestones:sticky_movestone_entity", { if lnode.name ~= "ignore" and lnode.name ~= "air" and lnode.name ~= "default:water" and lnode.name ~= "default:water_flowing" then local newnode repeat - minetest.env:remove_node(lpos) + minetest.env:dig_node(lpos) lpos.x=lpos.x+direction.x lpos.y=lpos.y+direction.y lpos.z=lpos.z+direction.z newnode = {name=lnode.name} lnode = minetest.env:get_node(lpos) - minetest.env:add_node(lpos, newnode) + minetest.env:place_node(lpos, newnode) nodeupdate(lpos) until lnode.name == "ignore" or lnode.name == "air" or lnode.name == "default:water" or lnode.name == "default:water_flowing" end @@ -198,7 +198,7 @@ minetest.register_entity("mesecons_movestones:sticky_movestone_entity", { local oldpos = {x=lpos2.x+direction.x, y=lpos2.y+direction.y, z=lpos2.z+direction.z} repeat - minetest.env:add_node(oldpos, {name=minetest.env:get_node(lpos2).name}) + minetest.env:place_node(oldpos, {name=minetest.env:get_node(lpos2).name}) nodeupdate(oldpos) oldpos = {x=lpos2.x, y=lpos2.y, z=lpos2.z} lpos2.x = lpos2.x-direction.x @@ -206,7 +206,7 @@ minetest.register_entity("mesecons_movestones:sticky_movestone_entity", { lpos2.z = lpos2.z-direction.z lnode = minetest.env:get_node(lpos2) until lnode.name=="air" or lnode.name=="ignore" or lnode.name=="default:water" or lnode.name=="default:water_flowing" - minetest.env:remove_node(oldpos) + minetest.env:dig_node(oldpos) end }) @@ -237,7 +237,7 @@ mesecon:register_on_signal_on(function (pos, node) or checknode.name=="default:water" or checknode.name=="default:water_flowing" - minetest.env:remove_node(pos) + minetest.env:dig_node(pos) nodeupdate(pos) minetest.env:add_entity(pos, "mesecons_movestones:sticky_movestone_entity") end diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index 87c3fc1..3175170 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -195,13 +195,13 @@ mesecon:register_on_signal_on(function (pos, node) local thisp= {x=np.x, y=np.y, z=np.z} local thisnode=minetest.env:get_node(thisp) local nextnode={} - minetest.env:remove_node(thisp) + minetest.env:dig_node(thisp) repeat thisp.x=thisp.x+direction.x thisp.y=thisp.y+direction.y thisp.z=thisp.z+direction.z nextnode=minetest.env:get_node(thisp) - minetest.env:add_node(thisp, {name=thisnode.name}) + minetest.env:place_node(thisp, {name=thisnode.name}) nodeupdate(thisp) thisnode=nextnode until thisnode.name=="air" @@ -233,8 +233,8 @@ mesecon:register_on_signal_off(function (pos, node) if thisnode.name~="air" and thisnode.name~="water" and not mesecon:is_mvps_stopper(thisnode.name) then local newpos={} local oldpos={} - minetest.env:add_node(np, {name=thisnode.name}) - minetest.env:remove_node(thisp) + minetest.env:place_node(np, {name=thisnode.name}) + minetest.env:dig_node(thisp) end end end |