From 3d19cca557b3f0f176412dada60a98d256687438 Mon Sep 17 00:00:00 2001 From: Vanessa Ezekowitz Date: Sun, 27 Oct 2013 22:38:19 -0400 Subject: [PATCH] Add fountainhead (vertical spigot, basically). --- autoplace.lua | 6 ++ devices.lua | 93 ++++++++++++++++++++++++ flowing_logic.lua | 22 ++++++ pipes.lua | 10 +++ textures/pipeworks_fountainhead_top.png | Bin 0 -> 1814 bytes 5 files changed, 131 insertions(+) create mode 100644 textures/pipeworks_fountainhead_top.png diff --git a/autoplace.lua b/autoplace.lua index 7801305..4a7d378 100644 --- a/autoplace.lua +++ b/autoplace.lua @@ -479,6 +479,12 @@ function pipes_scansurroundings(pos) pym=1 end +-- ...fountainheads... + + if (string.find(nyp.name, "pipeworks:fountainhead") ~= nil) then + pyp=1 + end + -- ... and storage tanks. if (string.find(nym.name, "pipeworks:storage_tank_") ~= nil) then diff --git a/devices.lua b/devices.lua index b29ae19..6101a4d 100644 --- a/devices.lua +++ b/devices.lua @@ -75,6 +75,28 @@ spigot_stream = { entry_panel = { { -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 } } + + + +fountainhead_model = { + { -2/64, -32/64, -6/64, 2/64, 21/64, 6/64 }, -- main segment + { -4/64, -32/64, -5/64, 4/64, 21/64, 5/64 }, + { -5/64, -32/64, -4/64, 5/64, 21/64, 4/64 }, + { -6/64, -32/64, -2/64, 6/64, 21/64, 2/64 }, + + { -3/64, -32/64, -8/64, 3/64, -30/64, 8/64 }, -- bottom flange + { -5/64, -32/64, -7/64, 5/64, -30/64, 7/64 }, + { -6/64, -32/64, -6/64, 6/64, -30/64, 6/64 }, + { -7/64, -32/64, -5/64, 7/64, -30/64, 5/64 }, + { -8/64, -32/64, -3/64, 8/64, -30/64, 3/64 }, + + { -3/64, 20/64, -8/64, 3/64, 32/64, 8/64 }, -- top flange/outlet + { -5/64, 20/64, -7/64, 5/64, 32/64, 7/64 }, + { -6/64, 20/64, -6/64, 6/64, 32/64, 6/64 }, + { -7/64, 20/64, -5/64, 7/64, 32/64, 5/64 }, + { -8/64, 20/64, -3/64, 8/64, 32/64, 3/64 } +} + -- Now define the nodes. local states = { "on", "off" } @@ -652,6 +674,77 @@ for fill = 0, 10 do }) end +-- fountainhead + +minetest.register_node("pipeworks:fountainhead", { + description = "Fountainhead", + drawtype = "nodebox", + tiles = { + "pipeworks_fountainhead_top.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png", + }, + sunlight_propagates = true, + paramtype = "light", + groups = {snappy=3, pipe=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + after_place_node = function(pos) + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + on_construct = function(pos) + if mesecon then + mesecon:receptor_on(pos, rules) + end + end, + node_box = { + type = "fixed", + fixed = fountainhead_model , + }, + selection_box = { + type = "fixed", + fixed = { -2/16, -8/16, -2/16, 2/16, 8/16, 2/16 } + }, +}) + +minetest.register_node("pipeworks:fountainhead_pouring", { + description = "Fountainhead", + drawtype = "nodebox", + tiles = { + "pipeworks_fountainhead_top.png", + "pipeworks_pipe_end.png", + "pipeworks_plain.png", + }, + sunlight_propagates = true, + paramtype = "light", + groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, + sounds = default.node_sound_wood_defaults(), + walkable = true, + after_place_node = function(pos) + pipe_scanforobjects(pos) + end, + after_dig_node = function(pos) + pipe_scanforobjects(pos) + end, + on_construct = function(pos) + if mesecon then + mesecon:receptor_on(pos, rules) + end + end, + node_box = { + type = "fixed", + fixed = fountainhead_model, + }, + selection_box = { + type = "fixed", + fixed = { -2/16, -8/16, -2/16, 2/16, 8/16, 2/16 }, + }, + drop = "pipeworks:fountainhead" +}) + -- various actions minetest.register_on_punchnode(function (pos, node) diff --git a/flowing_logic.lua b/flowing_logic.lua index cd1102d..14af75a 100644 --- a/flowing_logic.lua +++ b/flowing_logic.lua @@ -97,3 +97,25 @@ pipeworks_spigot_check = function(pos, node) end end +pipeworks_fountainhead_check = function(pos, node) + local abovename = minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name + if abovename and (abovename == "air" or abovename == "default:water_flowing" or abovename == "default:water_source") then + local fountainhead_name = minetest.get_node(pos).name + local near_node = minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + if near_node and string.find(near_node.name, "_loaded") then + if fountainhead_name and fountainhead_name == "pipeworks:fountainhead" then + minetest.add_node(pos,{name = "pipeworks:fountainhead_pouring"}) + if finitewater or abovename ~= "default:water_source" then + minetest.add_node({x=pos.x,y=pos.y+1,z=pos.z},{name = "default:water_source"}) + end + end + else + if fountainhead_name == "pipeworks:fountainhead_pouring" then + minetest.add_node({x=pos.x,y=pos.y,z=pos.z},{name = "pipeworks:fountainhead"}) + if abovename == "default:water_source" and not finitewater then + minetest.remove_node({x=pos.x,y=pos.y+1,z=pos.z}) + end + end + end + end +end diff --git a/pipes.lua b/pipes.lua index 15561f8..fb8e69e 100644 --- a/pipes.lua +++ b/pipes.lua @@ -312,3 +312,13 @@ minetest.register_abm({ pipeworks_spigot_check(pos,node) end }) + +minetest.register_abm({ + nodenames = {"pipeworks:fountainhead","pipeworks:fountainhead_pouring"}, + interval = 1, + chance = 1, + action = function(pos, node, active_object_count, active_object_count_wider) + pipeworks_fountainhead_check(pos,node) + end +}) + diff --git a/textures/pipeworks_fountainhead_top.png b/textures/pipeworks_fountainhead_top.png new file mode 100644 index 0000000000000000000000000000000000000000..503d051732caac58f90808860e4dd570a710d70a GIT binary patch literal 1814 zcmV+x2kH2UP){qAq>d)_`{O3eT;o_U7G7ebT?-~uiNuqfs>m!e!>-tXf= z=pDAtm{PO*P2k?fm4g>Tpy#8O{Xw5f_$FUBnL5#|`<7*H~@aIt8!&;I+;-t>qHW4ZW=t>Pb1+SZf&s#+WI0C2xCWg=8 z`M?uVRRWY!wef$9Tk2Z;V`BRt=P959907t8-x72)q9`cEeBTr9@|>5Dk_ri^c!8}X zpmUw~M1mghQV0ksA*D?Os&KzTfWN^2#)$njcq-{VSws+0Kne+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