Add fountainhead (vertical spigot, basically).
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Mon, 28 Oct 2013 02:38:19 +0000 (22:38 -0400)
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Mon, 28 Oct 2013 02:38:19 +0000 (22:38 -0400)
autoplace.lua
devices.lua
flowing_logic.lua
pipes.lua
textures/pipeworks_fountainhead_top.png [new file with mode: 0644]

index 7801305c2e21361b74156a7890d53532e723ca1b..4a7d37822ffa1eb9f25bb3426a7f6c52d006e807 100644 (file)
@@ -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
index b29ae19a1f417abfbd2b037fe84c0ef39ba54aab..6101a4dbb4292b78d97c76a46077308ec9e9dcd0 100644 (file)
@@ -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)
index cd1102d633b0025085fd1615daefa3c154a536b5..14af75ab03272f7b32644d1bab26a042e1d9356f 100644 (file)
@@ -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
index 15561f8db56bf5fe60b643f7922eef6d4afeac20..fb8e69ed1fa64c52b5b60dadfa0b6167d6e225c0 100644 (file)
--- 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 (file)
index 0000000..503d051
Binary files /dev/null and b/textures/pipeworks_fountainhead_top.png differ