diff options
author | Jeija <norrepli@gmail.com> | 2016-02-14 21:00:37 +0100 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2016-02-14 21:00:37 +0100 |
commit | 7865d428348e64b4aa2877830fd97a283b0ae44e (patch) | |
tree | 20642b272930ab2d94042a800b9015dac6581715 | |
parent | 809192f353af2faeb779df85104d4d7ed8d8943d (diff) | |
download | mesecons-7865d428348e64b4aa2877830fd97a283b0ae44e.tar mesecons-7865d428348e64b4aa2877830fd97a283b0ae44e.tar.gz mesecons-7865d428348e64b4aa2877830fd97a283b0ae44e.tar.bz2 mesecons-7865d428348e64b4aa2877830fd97a283b0ae44e.tar.xz mesecons-7865d428348e64b4aa2877830fd97a283b0ae44e.zip |
Always use minetest.set_node instead of minetest.add_node for consistency
-rw-r--r-- | mesecons/util.lua | 2 | ||||
-rw-r--r-- | mesecons_extrawires/vertical.lua | 8 | ||||
-rw-r--r-- | mesecons_hydroturbine/init.lua | 4 | ||||
-rw-r--r-- | mesecons_mvps/init.lua | 2 | ||||
-rw-r--r-- | mesecons_noteblock/init.lua | 2 | ||||
-rw-r--r-- | mesecons_pistons/init.lua | 10 | ||||
-rw-r--r-- | mesecons_pressureplates/init.lua | 4 | ||||
-rw-r--r-- | mesecons_receiver/init.lua | 6 |
8 files changed, 19 insertions, 19 deletions
diff --git a/mesecons/util.lua b/mesecons/util.lua index 24acfcf..e7b6866 100644 --- a/mesecons/util.lua +++ b/mesecons/util.lua @@ -2,7 +2,7 @@ function mesecon.move_node(pos, newpos) local node = minetest.get_node(pos) local meta = minetest.get_meta(pos):to_table() minetest.remove_node(pos) - minetest.add_node(newpos, node) + minetest.set_node(newpos, node) minetest.get_meta(pos):from_table(meta) end diff --git a/mesecons_extrawires/vertical.lua b/mesecons_extrawires/vertical.lua index b1d0405..91d8e6b 100644 --- a/mesecons_extrawires/vertical.lua +++ b/mesecons_extrawires/vertical.lua @@ -53,13 +53,13 @@ local vertical_updatepos = function (pos) local basename = "mesecons_extrawires:vertical_" if above and below then -- above and below: vertical mesecon - minetest.add_node(pos, {name = basename .. namestate}) + minetest.set_node(pos, {name = basename .. namestate}) elseif above and not below then -- above only: bottom - minetest.add_node(pos, {name = basename .. "bottom_" .. namestate}) + minetest.set_node(pos, {name = basename .. "bottom_" .. namestate}) elseif not above and below then -- below only: top - minetest.add_node(pos, {name = basename .. "top_" .. namestate}) + minetest.set_node(pos, {name = basename .. "top_" .. namestate}) else -- no vertical wire above, no vertical wire below: use bottom - minetest.add_node(pos, {name = basename .. "bottom_" .. namestate}) + minetest.set_node(pos, {name = basename .. "bottom_" .. namestate}) end mesecon.update_autoconnect(pos) end diff --git a/mesecons_hydroturbine/init.lua b/mesecons_hydroturbine/init.lua index d1c08f7..f1292e9 100644 --- a/mesecons_hydroturbine/init.lua +++ b/mesecons_hydroturbine/init.lua @@ -60,7 +60,7 @@ nodenames = {"mesecons_hydroturbine:hydro_turbine_off"}, action = function(pos, node, active_object_count, active_object_count_wider) local waterpos={x=pos.x, y=pos.y+1, z=pos.z} if minetest.get_node(waterpos).name=="default:water_flowing" then - minetest.add_node(pos, {name="mesecons_hydroturbine:hydro_turbine_on"}) + minetest.set_node(pos, {name="mesecons_hydroturbine:hydro_turbine_on"}) nodeupdate(pos) mesecon.receptor_on(pos) end @@ -74,7 +74,7 @@ nodenames = {"mesecons_hydroturbine:hydro_turbine_on"}, action = function(pos, node, active_object_count, active_object_count_wider) local waterpos={x=pos.x, y=pos.y+1, z=pos.z} if minetest.get_node(waterpos).name~="default:water_flowing" then - minetest.add_node(pos, {name="mesecons_hydroturbine:hydro_turbine_off"}) + minetest.set_node(pos, {name="mesecons_hydroturbine:hydro_turbine_off"}) nodeupdate(pos) mesecon.receptor_off(pos) end diff --git a/mesecons_mvps/init.lua b/mesecons_mvps/init.lua index 3a3ff29..1707408 100644 --- a/mesecons_mvps/init.lua +++ b/mesecons_mvps/init.lua @@ -177,7 +177,7 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sti for _, n in ipairs(nodes) do local np = vector.add(n.pos, movedir) - minetest.add_node(np, n.node) + minetest.set_node(np, n.node) minetest.get_meta(np):from_table(n.meta) end diff --git a/mesecons_noteblock/init.lua b/mesecons_noteblock/init.lua index d5e49ff..d5e365c 100644 --- a/mesecons_noteblock/init.lua +++ b/mesecons_noteblock/init.lua @@ -5,7 +5,7 @@ minetest.register_node("mesecons_noteblock:noteblock", { on_punch = function(pos, node) -- change sound when punched node.param2 = (node.param2+1)%12 mesecon.noteblock_play(pos, node.param2) - minetest.add_node(pos, node) + minetest.set_node(pos, node) end, sounds = default.node_sound_wood_defaults(), mesecons = {effector = { -- play sound when activated diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index 5bf380c..49710d3 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -82,8 +82,8 @@ local piston_on = function(pos, node) local maxpush = mesecon.setting("piston_max_push", 15) local success, stack, oldstack = mesecon.mvps_push(np, dir, maxpush) if success then - minetest.add_node(pos, {param2 = node.param2, name = pistonspec.onname}) - minetest.add_node(np, {param2 = node.param2, name = pistonspec.pusher}) + minetest.set_node(pos, {param2 = node.param2, name = pistonspec.onname}) + minetest.set_node(np, {param2 = node.param2, name = pistonspec.pusher}) minetest.sound_play("piston_extend", { pos = pos, max_hear_distance = 20, @@ -96,7 +96,7 @@ end local piston_off = function(pos, node) local pistonspec = minetest.registered_nodes[node.name].mesecons_piston - minetest.add_node(pos, {param2 = node.param2, name = pistonspec.offname}) + minetest.set_node(pos, {param2 = node.param2, name = pistonspec.offname}) piston_remove_pusher(pos, node) if pistonspec.sticky then @@ -118,9 +118,9 @@ local piston_orientate = function(pos, placer) local node = minetest.get_node(pos) local pistonspec = minetest.registered_nodes[node.name].mesecons_piston if pitch > 55 then --looking upwards - minetest.add_node(pos, {name=pistonspec.piston_down}) + minetest.set_node(pos, {name=pistonspec.piston_down}) elseif pitch < -55 then --looking downwards - minetest.add_node(pos, {name=pistonspec.piston_up}) + minetest.set_node(pos, {name=pistonspec.piston_up}) end end diff --git a/mesecons_pressureplates/init.lua b/mesecons_pressureplates/init.lua index 1ca7cd8..858f6ab 100644 --- a/mesecons_pressureplates/init.lua +++ b/mesecons_pressureplates/init.lua @@ -20,13 +20,13 @@ pp_on_timer = function (pos, elapsed) local two_below = vector.add(pos, vector.new(0, -2, 0)) if objs[1] == nil and node.name == basename .. "_on" then - minetest.add_node(pos, {name = basename .. "_off"}) + minetest.set_node(pos, {name = basename .. "_off"}) mesecon.receptor_off(pos, mesecon.rules.pplate) elseif node.name == basename .. "_off" then for k, obj in pairs(objs) do local objpos = obj:getpos() if objpos.y > pos.y-1 and objpos.y < pos.y then - minetest.add_node(pos, {name = basename .. "_on"}) + minetest.set_node(pos, {name = basename .. "_on"}) mesecon.receptor_on(pos, mesecon.rules.pplate ) end end diff --git a/mesecons_receiver/init.lua b/mesecons_receiver/init.lua index 4d60365..36f4659 100644 --- a/mesecons_receiver/init.lua +++ b/mesecons_receiver/init.lua @@ -105,10 +105,10 @@ function mesecon.receiver_place(rcpt_pos) if string.find(nn.name, "mesecons:wire_") ~= nil then minetest.dig_node(pos) if mesecon.is_power_on(rcpt_pos) then - minetest.add_node(pos, {name = "mesecons_receiver:receiver_on", param2 = node.param2}) + minetest.set_node(pos, {name = "mesecons_receiver:receiver_on", param2 = node.param2}) mesecon.receptor_on(pos, receiver_get_rules(node)) else - minetest.add_node(pos, {name = "mesecons_receiver:receiver_off", param2 = node.param2}) + minetest.set_node(pos, {name = "mesecons_receiver:receiver_off", param2 = node.param2}) end mesecon.update_autoconnect(pos) end @@ -120,7 +120,7 @@ function mesecon.receiver_remove(rcpt_pos, dugnode) if string.find(nn.name, "mesecons_receiver:receiver_") ~=nil then minetest.dig_node(pos) local node = {name = "mesecons:wire_00000000_off"} - minetest.add_node(pos, node) + minetest.set_node(pos, node) mesecon.update_autoconnect(pos) mesecon.on_placenode(pos, node) end |