forked from mtcontrib/pipeworks
prevent being able to place "loaded" and "on" items
(forces them to "empty" and "off")
This commit is contained in:
parent
1bfc2d4e5b
commit
64b2611d8a
24
devices.lua
24
devices.lua
@ -65,7 +65,9 @@ function pipeworks.rotate_on_place(itemstack, placer, pointed_thing)
|
|||||||
if minetest.registered_nodes[minetest.get_node(pos1).name]
|
if minetest.registered_nodes[minetest.get_node(pos1).name]
|
||||||
and not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end
|
and not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end
|
||||||
|
|
||||||
local placednode = itemstack:get_name()
|
local placednode = string.gsub(itemstack:get_name(), "_loaded", "_empty")
|
||||||
|
placednode = string.gsub(placednode, "_on", "_off")
|
||||||
|
|
||||||
minetest.add_node(pos1, {name = placednode, param2 = fdir })
|
minetest.add_node(pos1, {name = placednode, param2 = fdir })
|
||||||
pipeworks.scan_for_pipe_objects(pos1)
|
pipeworks.scan_for_pipe_objects(pos1)
|
||||||
|
|
||||||
@ -179,9 +181,6 @@ for s in ipairs(states) do
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_place_node = function(pos)
|
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
@ -222,9 +221,6 @@ minetest.register_node("pipeworks:valve_on_loaded", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_place_node = function(pos)
|
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
@ -323,6 +319,7 @@ minetest.register_node("pipeworks:spigot_pouring", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
|
minetest.set_node(pos, { name = "pipeworks:spigot", param2 = minetest.get_node(pos).param2 })
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
@ -362,9 +359,6 @@ minetest.register_node("pipeworks:entry_panel_empty", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_place_node = function(pos)
|
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
@ -384,9 +378,6 @@ minetest.register_node("pipeworks:entry_panel_loaded", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_place_node = function(pos)
|
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
@ -408,9 +399,6 @@ minetest.register_node("pipeworks:flow_sensor_empty", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_place_node = function(pos)
|
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
@ -449,9 +437,6 @@ minetest.register_node("pipeworks:flow_sensor_loaded", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
on_place = pipeworks.rotate_on_place,
|
on_place = pipeworks.rotate_on_place,
|
||||||
after_place_node = function(pos)
|
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
|
||||||
end,
|
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
@ -592,6 +577,7 @@ minetest.register_node("pipeworks:fountainhead_pouring", {
|
|||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
walkable = true,
|
walkable = true,
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
|
minetest.set_node(pos, { name = "pipeworks:fountainhead", param2 = minetest.get_node(pos).param2 })
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
|
@ -107,6 +107,7 @@ for index, connects in ipairs(cconnects) do
|
|||||||
walkable = true,
|
walkable = true,
|
||||||
drop = "pipeworks:pipe_1_empty",
|
drop = "pipeworks:pipe_1_empty",
|
||||||
after_place_node = function(pos)
|
after_place_node = function(pos)
|
||||||
|
minetest.set_node(pos, { name = "pipeworks:pipe_"..index.."_empty" })
|
||||||
pipeworks.scan_for_pipe_objects(pos)
|
pipeworks.scan_for_pipe_objects(pos)
|
||||||
end,
|
end,
|
||||||
after_dig_node = function(pos)
|
after_dig_node = function(pos)
|
||||||
|
Loading…
Reference in New Issue
Block a user