2017-10-01 18:36:03 +02:00
|
|
|
local new_flow_logic_register = pipeworks.flowables.register
|
2017-03-17 14:02:34 +01:00
|
|
|
|
2017-03-17 14:36:17 +01:00
|
|
|
-- rotation handlers
|
|
|
|
|
2017-03-17 14:02:34 +01:00
|
|
|
function pipeworks.fix_after_rotation(pos, node, user, mode, new_param2)
|
|
|
|
|
|
|
|
if string.find(node.name, "spigot") then new_param2 = new_param2 % 4 end
|
|
|
|
|
|
|
|
newnode = string.gsub(node.name, "_on", "_off")
|
|
|
|
minetest.swap_node(pos, { name = newnode, param2 = new_param2 })
|
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
|
|
|
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2017-03-17 14:36:17 +01:00
|
|
|
function pipeworks.rotate_on_place(itemstack, placer, pointed_thing)
|
|
|
|
|
|
|
|
local playername = placer:get_player_name()
|
|
|
|
if not minetest.is_protected(pointed_thing.under, playername)
|
|
|
|
and not minetest.is_protected(pointed_thing.above, playername) then
|
|
|
|
|
|
|
|
local node = minetest.get_node(pointed_thing.under)
|
|
|
|
|
|
|
|
if (not placer:get_player_control().sneak)
|
|
|
|
and minetest.registered_nodes[node.name]
|
|
|
|
and minetest.registered_nodes[node.name].on_rightclick then
|
|
|
|
minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack)
|
|
|
|
else
|
|
|
|
|
|
|
|
local pitch = placer:get_look_pitch()
|
|
|
|
local above = pointed_thing.above
|
|
|
|
local under = pointed_thing.under
|
|
|
|
local fdir = minetest.dir_to_facedir(placer:get_look_dir())
|
|
|
|
local undernode = minetest.get_node(under)
|
|
|
|
local abovenode = minetest.get_node(above)
|
|
|
|
local uname = undernode.name
|
|
|
|
local aname = abovenode.name
|
|
|
|
local isabove = (above.x == under.x) and (above.z == under.z) and (pitch > 0)
|
|
|
|
local pos1 = above
|
|
|
|
|
|
|
|
-- check if the object should be turned vertically
|
|
|
|
if above.x == under.x
|
|
|
|
and above.z == under.z
|
|
|
|
and (
|
|
|
|
string.find(uname, "pipeworks:pipe_")
|
|
|
|
or string.find(uname, "pipeworks:storage_")
|
|
|
|
or string.find(uname, "pipeworks:expansion_")
|
|
|
|
or ( string.find(uname, "pipeworks:grating") and not isabove )
|
|
|
|
or ( string.find(uname, "pipeworks:pump_") and not isabove )
|
|
|
|
|
|
|
|
or (
|
|
|
|
( string.find(uname, "pipeworks:valve")
|
|
|
|
or string.find(uname, "pipeworks:entry_panel")
|
|
|
|
or string.find(uname, "pipeworks:flow_sensor") )
|
|
|
|
and minetest.facedir_to_dir(undernode.param2).y ~= 0 )
|
|
|
|
)
|
|
|
|
then
|
|
|
|
fdir = 17
|
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.registered_nodes[uname]
|
|
|
|
and minetest.registered_nodes[uname]["buildable_to"] then
|
|
|
|
pos1 = under
|
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.registered_nodes[minetest.get_node(pos1).name]
|
|
|
|
and not minetest.registered_nodes[minetest.get_node(pos1).name]["buildable_to"] then return end
|
|
|
|
|
2017-03-17 16:04:59 +01:00
|
|
|
local placednode = string.gsub(itemstack:get_name(), "_loaded", "_empty")
|
|
|
|
placednode = string.gsub(placednode, "_on", "_off")
|
|
|
|
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos1, {name = placednode, param2 = fdir })
|
2017-03-17 14:36:17 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos1)
|
|
|
|
|
|
|
|
if not pipeworks.expect_infinite_stacks then
|
|
|
|
itemstack:take_item()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return itemstack
|
|
|
|
end
|
|
|
|
|
2012-08-22 15:56:45 +02:00
|
|
|
-- List of devices that should participate in the autoplace algorithm
|
2012-08-21 19:52:25 +02:00
|
|
|
|
2013-12-15 08:53:10 +01:00
|
|
|
local pipereceptor_on = nil
|
|
|
|
local pipereceptor_off = nil
|
|
|
|
|
2016-04-15 07:24:43 +02:00
|
|
|
if minetest.get_modpath("mesecons") then
|
2013-05-11 00:28:57 +02:00
|
|
|
pipereceptor_on = {
|
|
|
|
receptor = {
|
2013-11-09 19:17:56 +01:00
|
|
|
state = mesecon.state.on,
|
2013-12-21 09:33:06 +01:00
|
|
|
rules = pipeworks.mesecons_rules
|
2013-05-11 00:28:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pipereceptor_off = {
|
|
|
|
receptor = {
|
2013-11-09 19:17:56 +01:00
|
|
|
state = mesecon.state.off,
|
2013-12-21 09:33:06 +01:00
|
|
|
rules = pipeworks.mesecons_rules
|
2013-05-11 00:28:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
2013-11-26 05:58:51 +01:00
|
|
|
|
2013-12-15 08:53:10 +01:00
|
|
|
local pipes_devicelist = {
|
2012-08-21 19:52:25 +02:00
|
|
|
"pump",
|
|
|
|
"valve",
|
2012-08-22 14:24:42 +02:00
|
|
|
"storage_tank_0",
|
|
|
|
"storage_tank_1",
|
|
|
|
"storage_tank_2",
|
|
|
|
"storage_tank_3",
|
|
|
|
"storage_tank_4",
|
|
|
|
"storage_tank_5",
|
|
|
|
"storage_tank_6",
|
|
|
|
"storage_tank_7",
|
|
|
|
"storage_tank_8",
|
|
|
|
"storage_tank_9",
|
|
|
|
"storage_tank_10"
|
2012-08-21 19:52:25 +02:00
|
|
|
}
|
|
|
|
|
2012-08-19 07:56:30 +02:00
|
|
|
-- Now define the nodes.
|
|
|
|
|
|
|
|
local states = { "on", "off" }
|
|
|
|
local dgroups = ""
|
|
|
|
|
|
|
|
for s in ipairs(states) do
|
|
|
|
|
2012-08-20 09:38:38 +02:00
|
|
|
if states[s] == "off" then
|
2012-08-19 07:56:30 +02:00
|
|
|
dgroups = {snappy=3, pipe=1}
|
|
|
|
else
|
|
|
|
dgroups = {snappy=3, pipe=1, not_in_creative_inventory=1}
|
|
|
|
end
|
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local pumpname = "pipeworks:pump_"..states[s]
|
|
|
|
minetest.register_node(pumpname, {
|
2013-01-01 22:04:05 +01:00
|
|
|
description = "Pump/Intake Module",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_pump.obj",
|
|
|
|
tiles = { "pipeworks_pump_"..states[s]..".png" },
|
2012-08-19 07:56:30 +02:00
|
|
|
paramtype = "light",
|
2013-01-01 22:04:05 +01:00
|
|
|
paramtype2 = "facedir",
|
2012-08-19 07:56:30 +02:00
|
|
|
groups = dgroups,
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-04-12 09:39:43 +02:00
|
|
|
pipe_connections = { top = 1 },
|
2012-08-19 07:56:30 +02:00
|
|
|
after_place_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-19 07:56:30 +02:00
|
|
|
end,
|
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-19 07:56:30 +02:00
|
|
|
end,
|
2013-05-10 23:44:26 +02:00
|
|
|
drop = "pipeworks:pump_off",
|
|
|
|
mesecons = {effector = {
|
|
|
|
action_on = function (pos, node)
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos,{name="pipeworks:pump_on", param2 = node.param2})
|
2013-05-10 23:44:26 +02:00
|
|
|
end,
|
|
|
|
action_off = function (pos, node)
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos,{name="pipeworks:pump_off", param2 = node.param2})
|
2013-05-10 23:44:26 +02:00
|
|
|
end
|
2013-11-28 08:23:59 +01:00
|
|
|
}},
|
2017-03-17 10:26:10 +01:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
|
|
local fdir = node.param2
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos, { name = "pipeworks:pump_"..states[3-s], param2 = fdir })
|
2017-03-17 14:02:34 +01:00
|
|
|
end,
|
2017-09-27 17:42:15 +02:00
|
|
|
-- FIXME - does this preserve metadata? need to look at this
|
2017-03-17 14:02:34 +01:00
|
|
|
on_rotate = screwdriver.rotate_simple
|
2012-08-19 07:56:30 +02:00
|
|
|
})
|
2017-10-01 19:05:44 +02:00
|
|
|
-- FIXME: currently a simple flow device, but needs directionality checking
|
2017-10-01 18:36:03 +02:00
|
|
|
new_flow_logic_register.simple(pumpname)
|
|
|
|
if states[s] ~= "off" then
|
|
|
|
new_flow_logic_register.intake_simple(pumpname, 2)
|
|
|
|
end
|
2017-10-01 18:24:39 +02:00
|
|
|
|
|
|
|
local nodename_valve_empty = "pipeworks:valve_"..states[s].."_empty"
|
|
|
|
minetest.register_node(nodename_valve_empty, {
|
2013-01-01 22:04:05 +01:00
|
|
|
description = "Valve",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_valve_"..states[s]..".obj",
|
|
|
|
tiles = { "pipeworks_valve.png" },
|
2013-06-10 00:29:08 +02:00
|
|
|
sunlight_propagates = true,
|
2012-08-19 07:56:30 +02:00
|
|
|
paramtype = "light",
|
2013-01-01 22:04:05 +01:00
|
|
|
paramtype2 = "facedir",
|
2012-08-19 07:56:30 +02:00
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2017-03-17 14:02:34 +01:00
|
|
|
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
2012-08-19 07:56:30 +02:00
|
|
|
},
|
2015-01-15 12:25:41 +01:00
|
|
|
collision_box = {
|
|
|
|
type = "fixed",
|
2017-03-17 14:02:34 +01:00
|
|
|
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
2012-08-19 07:56:30 +02:00
|
|
|
},
|
|
|
|
groups = dgroups,
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-03-17 14:36:17 +01:00
|
|
|
on_place = pipeworks.rotate_on_place,
|
2012-08-19 07:56:30 +02:00
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-19 07:56:30 +02:00
|
|
|
end,
|
2017-03-17 10:26:10 +01:00
|
|
|
drop = "pipeworks:valve_off_empty",
|
2013-05-10 23:44:26 +02:00
|
|
|
mesecons = {effector = {
|
|
|
|
action_on = function (pos, node)
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
|
2013-05-10 23:44:26 +02:00
|
|
|
end,
|
|
|
|
action_off = function (pos, node)
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
|
2013-05-10 23:44:26 +02:00
|
|
|
end
|
2013-11-28 08:23:59 +01:00
|
|
|
}},
|
2017-03-17 10:26:10 +01:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
|
|
|
local fdir = node.param2
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos, { name = "pipeworks:valve_"..states[3-s].."_empty", param2 = fdir })
|
2017-03-17 14:02:34 +01:00
|
|
|
end,
|
|
|
|
on_rotate = pipeworks.fix_after_rotation
|
2012-08-19 07:56:30 +02:00
|
|
|
})
|
2017-10-01 19:05:44 +02:00
|
|
|
-- only register flow logic for the "on" ABM.
|
|
|
|
-- this means that the off state automatically blocks flow by not participating in the balancing operation.
|
|
|
|
if states[s] ~= "off" then
|
|
|
|
-- FIXME: this still a simple device, directionality not honoured
|
|
|
|
new_flow_logic_register.simple(nodename_valve_empty)
|
|
|
|
end
|
2012-08-19 07:56:30 +02:00
|
|
|
end
|
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local nodename_valve_loaded = "pipeworks:valve_on_loaded"
|
|
|
|
minetest.register_node(nodename_valve_loaded, {
|
2013-05-10 23:28:11 +02:00
|
|
|
description = "Valve",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_valve_on.obj",
|
|
|
|
tiles = { "pipeworks_valve.png" },
|
2013-06-10 00:29:08 +02:00
|
|
|
sunlight_propagates = true,
|
2013-05-10 23:28:11 +02:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
2017-03-17 14:02:34 +01:00
|
|
|
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
2013-05-10 23:28:11 +02:00
|
|
|
},
|
2015-01-15 12:25:41 +01:00
|
|
|
collision_box = {
|
|
|
|
type = "fixed",
|
2017-03-17 14:02:34 +01:00
|
|
|
fixed = { -5/16, -4/16, -8/16, 5/16, 5/16, 8/16 }
|
2013-05-10 23:28:11 +02:00
|
|
|
},
|
|
|
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-03-17 14:36:17 +01:00
|
|
|
on_place = pipeworks.rotate_on_place,
|
2013-05-10 23:28:11 +02:00
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-05-10 23:28:11 +02:00
|
|
|
end,
|
|
|
|
drop = "pipeworks:valve_off_empty",
|
2013-05-10 23:44:26 +02:00
|
|
|
mesecons = {effector = {
|
|
|
|
action_on = function (pos, node)
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos,{name="pipeworks:valve_on_empty", param2 = node.param2})
|
2013-05-10 23:44:26 +02:00
|
|
|
end,
|
|
|
|
action_off = function (pos, node)
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos,{name="pipeworks:valve_off_empty", param2 = node.param2})
|
2013-05-10 23:44:26 +02:00
|
|
|
end
|
2013-11-28 08:23:59 +01:00
|
|
|
}},
|
2017-03-17 14:02:34 +01:00
|
|
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
2017-03-17 10:26:10 +01:00
|
|
|
local fdir = node.param2
|
2017-09-27 17:42:15 +02:00
|
|
|
minetest.swap_node(pos, { name = "pipeworks:valve_off_empty", param2 = fdir })
|
2017-03-17 14:02:34 +01:00
|
|
|
end,
|
|
|
|
on_rotate = pipeworks.fix_after_rotation
|
2013-05-10 23:28:11 +02:00
|
|
|
})
|
2017-10-01 19:05:44 +02:00
|
|
|
-- register this the same as the on-but-empty variant, so existing nodes of this type work also.
|
|
|
|
-- note that as new_flow_logic code does not distinguish empty/full in node states,
|
|
|
|
-- right-clicking a "loaded" valve (becoming an off valve) then turning it on again will yield a on-but-empty valve,
|
|
|
|
-- but the flow logic will still function.
|
|
|
|
-- thus under new_flow_logic this serves as a kind of migration.
|
|
|
|
new_flow_logic_register.simple(nodename_valve_loaded)
|
2013-05-10 23:28:11 +02:00
|
|
|
|
2013-01-01 22:04:05 +01:00
|
|
|
-- grating
|
2012-08-20 07:49:01 +02:00
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
-- FIXME: should this do anything useful in the new flow logic?
|
2013-01-01 22:04:05 +01:00
|
|
|
minetest.register_node("pipeworks:grating", {
|
|
|
|
description = "Decorative grating",
|
2012-08-20 07:49:01 +02:00
|
|
|
tiles = {
|
2013-01-01 22:04:05 +01:00
|
|
|
"pipeworks_grating_top.png",
|
|
|
|
"pipeworks_grating_sides.png",
|
|
|
|
"pipeworks_grating_sides.png",
|
|
|
|
"pipeworks_grating_sides.png",
|
|
|
|
"pipeworks_grating_sides.png",
|
|
|
|
"pipeworks_grating_sides.png"
|
2012-08-20 07:49:01 +02:00
|
|
|
},
|
2017-04-12 09:39:43 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.49, -0.49, -0.49, 0.49, 0.5, 0.49 }
|
|
|
|
},
|
2013-06-10 00:29:08 +02:00
|
|
|
sunlight_propagates = true,
|
2012-08-20 07:49:01 +02:00
|
|
|
paramtype = "light",
|
2012-08-22 09:43:38 +02:00
|
|
|
groups = {snappy=3, pipe=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-04-12 09:39:43 +02:00
|
|
|
pipe_connections = { top = 1 },
|
2012-08-22 09:43:38 +02:00
|
|
|
after_place_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-22 09:43:38 +02:00
|
|
|
end,
|
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-22 09:43:38 +02:00
|
|
|
end,
|
2017-03-17 14:02:34 +01:00
|
|
|
on_rotate = false
|
2012-08-22 09:43:38 +02:00
|
|
|
})
|
|
|
|
|
2013-01-01 22:04:05 +01:00
|
|
|
-- outlet spigot
|
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local nodename_spigot_empty = "pipeworks:spigot"
|
|
|
|
minetest.register_node(nodename_spigot_empty, {
|
2013-01-01 22:04:05 +01:00
|
|
|
description = "Spigot outlet",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_spigot.obj",
|
2015-01-16 10:38:17 +01:00
|
|
|
tiles = { "pipeworks_spigot.png" },
|
2013-06-10 00:29:08 +02:00
|
|
|
sunlight_propagates = true,
|
2012-08-22 09:43:38 +02:00
|
|
|
paramtype = "light",
|
2013-01-01 22:04:05 +01:00
|
|
|
paramtype2 = "facedir",
|
2012-08-20 07:49:01 +02:00
|
|
|
groups = {snappy=3, pipe=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-04-12 09:39:43 +02:00
|
|
|
pipe_connections = { left=1, right=1, front=1, back=1,
|
|
|
|
left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
|
2012-08-21 19:52:25 +02:00
|
|
|
after_place_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-21 19:52:25 +02:00
|
|
|
end,
|
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-21 19:52:25 +02:00
|
|
|
end,
|
2015-01-15 12:25:41 +01:00
|
|
|
selection_box = {
|
2013-01-01 22:04:05 +01:00
|
|
|
type = "fixed",
|
2015-01-15 12:25:41 +01:00
|
|
|
fixed = { -2/16, -6/16, -2/16, 2/16, 2/16, 8/16 }
|
2013-01-01 22:04:05 +01:00
|
|
|
},
|
2015-01-15 12:25:41 +01:00
|
|
|
collision_box = {
|
2013-01-01 22:04:05 +01:00
|
|
|
type = "fixed",
|
2013-01-02 00:00:16 +01:00
|
|
|
fixed = { -2/16, -6/16, -2/16, 2/16, 2/16, 8/16 }
|
2017-03-17 14:02:34 +01:00
|
|
|
},
|
|
|
|
on_rotate = pipeworks.fix_after_rotation
|
2012-08-20 07:49:01 +02:00
|
|
|
})
|
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local nodename_spigot_loaded = "pipeworks:spigot_pouring"
|
|
|
|
minetest.register_node(nodename_spigot_loaded, {
|
2013-01-14 20:17:07 +01:00
|
|
|
description = "Spigot outlet",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_spigot_pouring.obj",
|
2015-01-16 10:38:17 +01:00
|
|
|
tiles = {
|
|
|
|
{
|
|
|
|
name = "default_water_flowing_animated.png",
|
|
|
|
animation = {
|
|
|
|
type = "vertical_frames",
|
|
|
|
aspect_w = 16,
|
|
|
|
aspect_h = 16,
|
|
|
|
length = 0.8,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{ name = "pipeworks_spigot.png" }
|
|
|
|
},
|
2013-06-10 00:29:08 +02:00
|
|
|
sunlight_propagates = true,
|
2013-01-14 20:17:07 +01:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
2013-05-10 23:28:11 +02:00
|
|
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
2013-01-14 20:17:07 +01:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-04-12 09:39:43 +02:00
|
|
|
pipe_connections = { left=1, right=1, front=1, back=1,
|
|
|
|
left_param2 = 3, right_param2 = 1, front_param2 = 2, back_param2 = 0 },
|
2013-01-14 20:17:07 +01:00
|
|
|
after_place_node = function(pos)
|
2017-03-17 16:04:59 +01:00
|
|
|
minetest.set_node(pos, { name = "pipeworks:spigot", param2 = minetest.get_node(pos).param2 })
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-01-14 20:17:07 +01:00
|
|
|
end,
|
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-01-14 20:17:07 +01:00
|
|
|
end,
|
2015-01-15 12:25:41 +01:00
|
|
|
selection_box = {
|
2013-01-14 20:17:07 +01:00
|
|
|
type = "fixed",
|
2015-01-15 12:25:41 +01:00
|
|
|
fixed = { -2/16, -6/16, -2/16, 2/16, 2/16, 8/16 }
|
2013-01-14 20:17:07 +01:00
|
|
|
},
|
2015-01-15 12:25:41 +01:00
|
|
|
collision_box = {
|
2013-01-14 20:17:07 +01:00
|
|
|
type = "fixed",
|
|
|
|
fixed = { -2/16, -6/16, -2/16, 2/16, 2/16, 8/16 }
|
|
|
|
},
|
|
|
|
drop = "pipeworks:spigot",
|
2017-03-17 14:02:34 +01:00
|
|
|
on_rotate = pipeworks.fix_after_rotation
|
2013-01-14 20:17:07 +01:00
|
|
|
})
|
2017-10-01 19:18:47 +02:00
|
|
|
-- new flow logic does not currently distinguish between these two visual states.
|
|
|
|
-- register both so existing flowing spigots continue to work (even if the visual doesn't match the spigot's behaviour).
|
|
|
|
new_flow_logic_register.simple(nodename_spigot_empty)
|
|
|
|
new_flow_logic_register.simple(nodename_spigot_loaded)
|
|
|
|
local spigot_min = 1
|
|
|
|
new_flow_logic_register.output(nodename_spigot_empty, spigot_min, pipeworks.flowlogic.helpers.output_spigot)
|
|
|
|
new_flow_logic_register.output(nodename_spigot_loaded, spigot_min, pipeworks.flowlogic.helpers.output_spigot)
|
|
|
|
|
|
|
|
|
2013-01-14 20:17:07 +01:00
|
|
|
|
2013-05-10 23:28:11 +02:00
|
|
|
-- sealed pipe entry/exit (horizontal pipe passing through a metal
|
2013-01-01 22:30:21 +01:00
|
|
|
-- wall, for use in places where walls should look like they're airtight)
|
|
|
|
|
2015-01-15 12:25:41 +01:00
|
|
|
local panel_cbox = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
{ -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 },
|
|
|
|
{ -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 }
|
|
|
|
}
|
|
|
|
}
|
2013-01-01 22:30:21 +01:00
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local nodename_panel_empty = "pipeworks:entry_panel_empty"
|
|
|
|
minetest.register_node(nodename_panel_empty, {
|
2013-01-01 22:30:21 +01:00
|
|
|
description = "Airtight Pipe entry/exit",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_entry_panel.obj",
|
|
|
|
tiles = { "pipeworks_entry_panel.png" },
|
2013-01-01 22:30:21 +01:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {snappy=3, pipe=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-03-17 14:36:17 +01:00
|
|
|
on_place = pipeworks.rotate_on_place,
|
2013-01-01 22:30:21 +01:00
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-01-01 22:30:21 +01:00
|
|
|
end,
|
2015-01-15 12:25:41 +01:00
|
|
|
selection_box = panel_cbox,
|
|
|
|
collision_box = panel_cbox,
|
2017-03-17 14:02:34 +01:00
|
|
|
on_rotate = pipeworks.fix_after_rotation
|
2013-05-10 23:28:11 +02:00
|
|
|
})
|
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local nodename_panel_loaded = "pipeworks:entry_panel_loaded"
|
|
|
|
minetest.register_node(nodename_panel_loaded, {
|
2013-05-10 23:28:11 +02:00
|
|
|
description = "Airtight Pipe entry/exit",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_entry_panel.obj",
|
|
|
|
tiles = { "pipeworks_entry_panel.png" },
|
2013-05-10 23:28:11 +02:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-03-17 14:36:17 +01:00
|
|
|
on_place = pipeworks.rotate_on_place,
|
2013-05-10 23:28:11 +02:00
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-05-10 23:28:11 +02:00
|
|
|
end,
|
2015-01-15 12:25:41 +01:00
|
|
|
selection_box = panel_cbox,
|
|
|
|
collision_box = panel_cbox,
|
2017-03-17 14:02:34 +01:00
|
|
|
drop = "pipeworks:entry_panel_empty",
|
|
|
|
on_rotate = pipeworks.fix_after_rotation
|
2013-01-01 22:30:21 +01:00
|
|
|
})
|
2017-10-01 19:30:32 +02:00
|
|
|
-- FIXME requires-directionality
|
|
|
|
-- TODO: AFAIK the two panels have no visual difference, so are redundant under new flow logic - alias?
|
|
|
|
new_flow_logic_register.simple(nodename_panel_empty)
|
|
|
|
new_flow_logic_register.simple(nodename_panel_loaded)
|
|
|
|
|
|
|
|
|
2013-01-01 22:30:21 +01:00
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local nodename_sensor_empty = "pipeworks:flow_sensor_empty"
|
|
|
|
minetest.register_node(nodename_sensor_empty, {
|
2013-05-11 00:28:57 +02:00
|
|
|
description = "Flow Sensor",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_flow_sensor.obj",
|
|
|
|
tiles = { "pipeworks_flow_sensor_off.png" },
|
2013-06-10 00:29:08 +02:00
|
|
|
sunlight_propagates = true,
|
2013-05-11 00:28:57 +02:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {snappy=3, pipe=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-03-17 14:36:17 +01:00
|
|
|
on_place = pipeworks.rotate_on_place,
|
2013-05-11 00:28:57 +02:00
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-05-11 00:28:57 +02:00
|
|
|
end,
|
|
|
|
on_construct = function(pos)
|
|
|
|
if mesecon then
|
2014-11-22 19:55:54 +01:00
|
|
|
mesecon.receptor_off(pos, rules)
|
2013-05-11 00:28:57 +02:00
|
|
|
end
|
|
|
|
end,
|
2015-01-15 12:25:41 +01:00
|
|
|
selection_box = {
|
2013-05-11 00:28:57 +02:00
|
|
|
type = "fixed",
|
2015-01-15 12:25:41 +01:00
|
|
|
fixed = {
|
2017-03-17 14:02:34 +01:00
|
|
|
{ -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 },
|
|
|
|
{ -3/16, -3/16, -4/16, 3/16, 3/16, 4/16 },
|
2015-01-15 12:25:41 +01:00
|
|
|
}
|
2013-05-11 00:28:57 +02:00
|
|
|
},
|
2015-01-15 12:25:41 +01:00
|
|
|
collision_box = {
|
2013-05-11 00:28:57 +02:00
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
2017-03-17 14:02:34 +01:00
|
|
|
{ -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 },
|
|
|
|
{ -3/16, -3/16, -4/16, 3/16, 3/16, 4/16 },
|
2013-05-11 00:28:57 +02:00
|
|
|
}
|
|
|
|
},
|
2017-03-17 14:02:34 +01:00
|
|
|
mesecons = pipereceptor_off,
|
|
|
|
on_rotate = pipeworks.fix_after_rotation
|
2013-05-11 00:28:57 +02:00
|
|
|
})
|
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local nodename_sensor_loaded = "pipeworks:flow_sensor_loaded"
|
|
|
|
minetest.register_node(nodename_sensor_loaded, {
|
2013-05-11 00:28:57 +02:00
|
|
|
description = "Flow sensor (on)",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_flow_sensor.obj",
|
|
|
|
tiles = { "pipeworks_flow_sensor_on.png" },
|
2013-06-10 00:29:08 +02:00
|
|
|
sunlight_propagates = true,
|
2013-05-11 00:28:57 +02:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-03-17 14:36:17 +01:00
|
|
|
on_place = pipeworks.rotate_on_place,
|
2013-05-11 00:28:57 +02:00
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-05-11 00:28:57 +02:00
|
|
|
end,
|
|
|
|
on_construct = function(pos)
|
|
|
|
if mesecon then
|
2014-11-22 19:55:54 +01:00
|
|
|
mesecon.receptor_on(pos, rules)
|
2013-05-11 00:28:57 +02:00
|
|
|
end
|
|
|
|
end,
|
2015-01-15 12:25:41 +01:00
|
|
|
selection_box = {
|
2013-05-11 00:28:57 +02:00
|
|
|
type = "fixed",
|
2015-01-15 12:25:41 +01:00
|
|
|
fixed = {
|
2017-03-17 14:02:34 +01:00
|
|
|
{ -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 },
|
|
|
|
{ -3/16, -3/16, -4/16, 3/16, 3/16, 4/16 },
|
2015-01-15 12:25:41 +01:00
|
|
|
}
|
2013-05-11 00:28:57 +02:00
|
|
|
},
|
2015-01-15 12:25:41 +01:00
|
|
|
collision_box = {
|
2013-05-11 00:28:57 +02:00
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
2017-03-17 14:02:34 +01:00
|
|
|
{ -2/16, -2/16, -8/16, 2/16, 2/16, 8/16 },
|
|
|
|
{ -3/16, -3/16, -4/16, 3/16, 3/16, 4/16 },
|
2013-05-11 00:28:57 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
drop = "pipeworks:flow_sensor_empty",
|
2017-03-17 14:02:34 +01:00
|
|
|
mesecons = pipereceptor_on,
|
|
|
|
on_rotate = pipeworks.fix_after_rotation
|
2013-05-11 00:28:57 +02:00
|
|
|
})
|
|
|
|
|
2012-08-22 15:56:45 +02:00
|
|
|
-- tanks
|
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
-- TODO: these don't currently do anything under the new flow logic.
|
2012-08-22 14:24:42 +02:00
|
|
|
for fill = 0, 10 do
|
2013-12-15 08:53:10 +01:00
|
|
|
local filldesc="empty"
|
|
|
|
local sgroups = {snappy=3, pipe=1, tankfill=fill+1}
|
|
|
|
local image = nil
|
|
|
|
|
|
|
|
if fill ~= 0 then
|
2012-08-22 14:32:20 +02:00
|
|
|
filldesc=fill.."0% full"
|
2012-08-22 14:24:42 +02:00
|
|
|
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}
|
2013-03-19 02:58:39 +01:00
|
|
|
image = "pipeworks_storage_tank_fittings.png"
|
2012-08-22 14:24:42 +02:00
|
|
|
end
|
2012-08-20 07:49:01 +02:00
|
|
|
|
2012-08-22 15:56:45 +02:00
|
|
|
minetest.register_node("pipeworks:expansion_tank_"..fill, {
|
|
|
|
description = "Expansion Tank ("..filldesc..")... You hacker, you.",
|
|
|
|
tiles = {
|
|
|
|
"pipeworks_storage_tank_fittings.png",
|
|
|
|
"pipeworks_storage_tank_fittings.png",
|
|
|
|
"pipeworks_storage_tank_back.png",
|
|
|
|
"pipeworks_storage_tank_back.png",
|
|
|
|
"pipeworks_storage_tank_back.png",
|
2013-12-15 10:35:59 +01:00
|
|
|
pipeworks.liquid_texture.."^pipeworks_storage_tank_front_"..fill..".png"
|
2012-08-22 15:56:45 +02:00
|
|
|
},
|
2013-03-19 02:58:39 +01:00
|
|
|
inventory_image = image,
|
2012-08-22 15:56:45 +02:00
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2014-07-03 03:00:24 +02:00
|
|
|
drop = "pipeworks:storage_tank_0",
|
2017-04-12 09:39:43 +02:00
|
|
|
pipe_connections = { top = 1, bottom = 1},
|
2012-08-22 15:56:45 +02:00
|
|
|
after_place_node = function(pos)
|
2013-12-21 09:38:08 +01:00
|
|
|
pipeworks.look_for_stackable_tanks(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-22 15:56:45 +02:00
|
|
|
end,
|
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-22 15:56:45 +02:00
|
|
|
end,
|
2017-03-17 14:02:34 +01:00
|
|
|
on_rotate = false
|
2012-08-22 15:56:45 +02:00
|
|
|
})
|
|
|
|
|
2013-01-01 22:04:05 +01:00
|
|
|
minetest.register_node("pipeworks:storage_tank_"..fill, {
|
2012-08-22 14:32:20 +02:00
|
|
|
description = "Fluid Storage Tank ("..filldesc..")",
|
2012-08-22 14:24:42 +02:00
|
|
|
tiles = {
|
2013-01-06 03:14:09 +01:00
|
|
|
"pipeworks_storage_tank_fittings.png",
|
2012-08-22 14:24:42 +02:00
|
|
|
"pipeworks_storage_tank_fittings.png",
|
2012-08-22 15:56:45 +02:00
|
|
|
"pipeworks_storage_tank_back.png",
|
2012-08-22 14:24:42 +02:00
|
|
|
"pipeworks_storage_tank_back.png",
|
2012-08-22 15:56:45 +02:00
|
|
|
"pipeworks_storage_tank_back.png",
|
2013-12-15 10:35:59 +01:00
|
|
|
pipeworks.liquid_texture.."^pipeworks_storage_tank_front_"..fill..".png"
|
2012-08-22 14:24:42 +02:00
|
|
|
},
|
2013-03-19 02:58:39 +01:00
|
|
|
inventory_image = image,
|
2012-08-22 14:24:42 +02:00
|
|
|
paramtype = "light",
|
2013-01-01 22:04:05 +01:00
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = sgroups,
|
2012-08-22 14:24:42 +02:00
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2014-07-03 03:00:24 +02:00
|
|
|
drop = "pipeworks:storage_tank_0",
|
2017-04-12 09:39:43 +02:00
|
|
|
pipe_connections = { top = 1, bottom = 1},
|
2012-08-22 14:24:42 +02:00
|
|
|
after_place_node = function(pos)
|
2013-12-21 09:38:08 +01:00
|
|
|
pipeworks.look_for_stackable_tanks(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-22 14:24:42 +02:00
|
|
|
end,
|
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2012-08-22 14:24:42 +02:00
|
|
|
end,
|
2017-03-17 14:02:34 +01:00
|
|
|
on_rotate = false
|
2012-08-22 14:24:42 +02:00
|
|
|
})
|
|
|
|
end
|
2012-08-20 07:49:01 +02:00
|
|
|
|
2013-10-28 03:38:19 +01:00
|
|
|
-- fountainhead
|
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local nodename_fountain_empty = "pipeworks:fountainhead"
|
|
|
|
minetest.register_node(nodename_fountain_empty, {
|
2013-10-28 03:38:19 +01:00
|
|
|
description = "Fountainhead",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_fountainhead.obj",
|
|
|
|
tiles = { "pipeworks_fountainhead.png" },
|
2013-10-28 03:38:19 +01:00
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype = "light",
|
|
|
|
groups = {snappy=3, pipe=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-04-12 09:39:43 +02:00
|
|
|
pipe_connections = { bottom = 1 },
|
2013-10-28 03:38:19 +01:00
|
|
|
after_place_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-10-28 03:38:19 +01:00
|
|
|
end,
|
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-10-28 03:38:19 +01:00
|
|
|
end,
|
|
|
|
on_construct = function(pos)
|
|
|
|
if mesecon then
|
2014-11-22 19:55:54 +01:00
|
|
|
mesecon.receptor_on(pos, rules)
|
2013-10-28 03:38:19 +01:00
|
|
|
end
|
|
|
|
end,
|
2015-01-15 12:25:41 +01:00
|
|
|
selection_box = {
|
2013-10-28 03:38:19 +01:00
|
|
|
type = "fixed",
|
2015-01-15 12:25:41 +01:00
|
|
|
fixed = { -2/16, -8/16, -2/16, 2/16, 8/16, 2/16 }
|
2013-10-28 03:38:19 +01:00
|
|
|
},
|
2015-01-15 12:25:41 +01:00
|
|
|
collision_box = {
|
2013-10-28 03:38:19 +01:00
|
|
|
type = "fixed",
|
|
|
|
fixed = { -2/16, -8/16, -2/16, 2/16, 8/16, 2/16 }
|
|
|
|
},
|
2017-03-17 14:02:34 +01:00
|
|
|
on_rotate = false
|
2013-10-28 03:38:19 +01:00
|
|
|
})
|
|
|
|
|
2017-10-01 18:24:39 +02:00
|
|
|
local nodename_fountain_loaded = "pipeworks:fountainhead_pouring"
|
|
|
|
minetest.register_node(nodename_fountain_loaded, {
|
2013-10-28 03:38:19 +01:00
|
|
|
description = "Fountainhead",
|
2015-01-15 12:25:41 +01:00
|
|
|
drawtype = "mesh",
|
|
|
|
mesh = "pipeworks_fountainhead.obj",
|
|
|
|
tiles = { "pipeworks_fountainhead.png" },
|
2013-10-28 03:38:19 +01:00
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype = "light",
|
|
|
|
groups = {snappy=3, pipe=1, not_in_creative_inventory=1},
|
|
|
|
sounds = default.node_sound_wood_defaults(),
|
|
|
|
walkable = true,
|
2017-04-12 09:39:43 +02:00
|
|
|
pipe_connections = { bottom = 1 },
|
2013-10-28 03:38:19 +01:00
|
|
|
after_place_node = function(pos)
|
2017-03-17 16:04:59 +01:00
|
|
|
minetest.set_node(pos, { name = "pipeworks:fountainhead", param2 = minetest.get_node(pos).param2 })
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-10-28 03:38:19 +01:00
|
|
|
end,
|
|
|
|
after_dig_node = function(pos)
|
2013-12-15 08:53:10 +01:00
|
|
|
pipeworks.scan_for_pipe_objects(pos)
|
2013-10-28 03:38:19 +01:00
|
|
|
end,
|
|
|
|
on_construct = function(pos)
|
|
|
|
if mesecon then
|
2014-11-22 19:55:54 +01:00
|
|
|
mesecon.receptor_on(pos, rules)
|
2013-10-28 03:38:19 +01:00
|
|
|
end
|
|
|
|
end,
|
2015-01-15 12:25:41 +01:00
|
|
|
selection_box = {
|
2013-10-28 03:38:19 +01:00
|
|
|
type = "fixed",
|
2015-01-15 12:25:41 +01:00
|
|
|
fixed = { -2/16, -8/16, -2/16, 2/16, 8/16, 2/16 }
|
2013-10-28 03:38:19 +01:00
|
|
|
},
|
2015-01-15 12:25:41 +01:00
|
|
|
collision_box = {
|
2013-10-28 03:38:19 +01:00
|
|
|
type = "fixed",
|
2015-01-15 12:25:41 +01:00
|
|
|
fixed = { -2/16, -8/16, -2/16, 2/16, 8/16, 2/16 }
|
2013-10-28 03:38:19 +01:00
|
|
|
},
|
2017-03-17 14:02:34 +01:00
|
|
|
drop = "pipeworks:fountainhead",
|
|
|
|
on_rotate = false
|
2013-10-28 03:38:19 +01:00
|
|
|
})
|
|
|
|
|
2013-05-10 23:28:11 +02:00
|
|
|
minetest.register_alias("pipeworks:valve_off_loaded", "pipeworks:valve_off_empty")
|
2015-03-12 15:21:55 +01:00
|
|
|
minetest.register_alias("pipeworks:entry_panel", "pipeworks:entry_panel_empty")
|
2012-08-20 07:49:01 +02:00
|
|
|
|
2017-03-17 14:02:34 +01:00
|
|
|
minetest.register_lbm({
|
|
|
|
name = "pipeworks:rotate_valves_flowsensors",
|
|
|
|
label = "Flip pipeworks valves and flow sensors around X/Z",
|
|
|
|
run_at_every_load = false,
|
|
|
|
nodenames = {
|
|
|
|
"pipeworks:flow_sensor_empty",
|
|
|
|
"pipeworks:flow_sensor_loaded",
|
|
|
|
"pipeworks:valve_off_empty",
|
|
|
|
"pipeworks:valve_on_empty",
|
|
|
|
"pipeworks:valve_off_loaded",
|
|
|
|
},
|
|
|
|
action = function(pos, node)
|
|
|
|
local dir = minetest.facedir_to_dir(node.param2)
|
|
|
|
local newdir = { x=dir.z, y=dir.y, z=dir.x }
|
|
|
|
local newfdir = minetest.dir_to_facedir(newdir)
|
|
|
|
minetest.swap_node(pos, { name = node.name, param2 = newfdir })
|
|
|
|
end
|
|
|
|
})
|