make valve and pump turn on/off via on_rightclick

(instead of on_punch)
This commit is contained in:
Vanessa Ezekowitz 2017-03-17 05:26:10 -04:00
parent 3d845a3f28
commit bd4a27d172

View File

@ -73,8 +73,8 @@ for s in ipairs(states) do
minetest.add_node(pos,{name="pipeworks:pump_off", param2 = node.param2}) minetest.add_node(pos,{name="pipeworks:pump_off", param2 = node.param2})
end end
}}, }},
on_punch = function(pos, node, puncher) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local fdir = minetest.get_node(pos).param2 local fdir = node.param2
minetest.add_node(pos, { name = "pipeworks:pump_"..states[3-s], param2 = fdir }) minetest.add_node(pos, { name = "pipeworks:pump_"..states[3-s], param2 = fdir })
end end
}) })
@ -104,7 +104,7 @@ for s in ipairs(states) do
after_dig_node = function(pos) after_dig_node = function(pos)
pipeworks.scan_for_pipe_objects(pos) pipeworks.scan_for_pipe_objects(pos)
end, end,
drop = "pipeworks:valve_off_empty", drop = "pipeworks:valve_off_empty",
mesecons = {effector = { mesecons = {effector = {
action_on = function (pos, node) action_on = function (pos, node)
minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2}) minetest.add_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
@ -113,8 +113,8 @@ for s in ipairs(states) do
minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2}) minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
end end
}}, }},
on_punch = function(pos, node, puncher) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local fdir = minetest.get_node(pos).param2 local fdir = node.param2
minetest.add_node(pos, { name = "pipeworks:valve_"..states[3-s].."_empty", param2 = fdir }) minetest.add_node(pos, { name = "pipeworks:valve_"..states[3-s].."_empty", param2 = fdir })
end end
}) })
@ -154,8 +154,8 @@ minetest.register_node("pipeworks:valve_on_loaded", {
minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2}) minetest.add_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
end end
}}, }},
on_punch = function(pos, node, puncher) on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
local fdir = minetest.get_node(pos).param2 local fdir = node.param2
minetest.add_node(pos, { name = "pipeworks:valve_off_empty", param2 = fdir }) minetest.add_node(pos, { name = "pipeworks:valve_off_empty", param2 = fdir })
end end
}) })