Added a little stub to the bottom of the spigot, showing the water texture,
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Mon, 14 Jan 2013 19:17:07 +0000 (14:17 -0500)
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>
Mon, 14 Jan 2013 19:34:55 +0000 (14:34 -0500)
so that when a spigot is flowing, it looks like water is actually pouring out
of it.

devices.lua
flowing_logic.lua
textures/pipeworks_spigot_bottom2.png [new file with mode: 0644]
textures/pipeworks_spigot_sides.png
textures/pipeworks_spigot_sides2.png [new file with mode: 0644]

index 9d6a6d81f031665c720b3f57b95cc4b248f4eefc..faa1b86df200c979819038ccf6bc43f0fb937568 100644 (file)
@@ -48,6 +48,12 @@ spigot_bottomstub = {
        { -8/64, -16/64, -3/64, 8/64, -14/64, 3/64 }
 }
 
+spigot_stream = { 
+       { -3/64, -48/64, -5/64, 3/64, -16/64, 5/64 },
+       { -4/64, -48/64, -4/64, 4/64, -16/64, 4/64 },
+       { -5/64, -48/64, -3/64, 5/64, -16/64, 3/64 }
+}
+
 entry_panel = {
        { -8/16, -8/16, -1/16, 8/16, 8/16, 1/16 }
 }
@@ -194,12 +200,18 @@ minetest.register_node("pipeworks:grating", {
        pipe_addbox(spigotboxes, spigot_bottomstub)
        pipe_addbox(spigotboxes, pipe_bendsphere)
 
+       local spigotboxes_pouring = {}
+       pipe_addbox(spigotboxes_pouring, spigot_stream)
+       pipe_addbox(spigotboxes_pouring, pipe_backstub)
+       pipe_addbox(spigotboxes_pouring, spigot_bottomstub)
+       pipe_addbox(spigotboxes_pouring, pipe_bendsphere)
+
 minetest.register_node("pipeworks:spigot", {
        description = "Spigot outlet",
        drawtype = "nodebox",
        tiles = {
                "pipeworks_spigot_sides.png",
-               "pipeworks_pipe_end_empty.png",
+               "pipeworks_spigot_sides.png",
                "pipeworks_spigot_sides.png",
                "pipeworks_spigot_sides.png",
                "pipeworks_pipe_end_empty.png",
@@ -231,6 +243,45 @@ minetest.register_node("pipeworks:spigot", {
        }
 })
 
+minetest.register_node("pipeworks:spigot_pouring", {
+       description = "Spigot outlet",
+       drawtype = "nodebox",
+       tiles = {
+               "pipeworks_spigot_sides.png",
+               "pipeworks_spigot_sides.png",
+               "default_water.png^pipeworks_spigot_sides2.png",
+               "default_water.png^pipeworks_spigot_sides2.png",
+               "default_water.png^pipeworks_spigot_sides2.png",
+               "default_water.png^pipeworks_spigot_sides2.png"
+       },
+       paramtype = "light",
+       paramtype2 = "facedir",
+       groups = {snappy=3, pipe=1},
+       sounds = default.node_sound_wood_defaults(),
+       walkable = true,
+       pipelike=1,
+       on_construct = function(pos)
+               local meta = minetest.env:get_meta(pos)
+               meta:set_int("pipelike",1)
+       end,
+       after_place_node = function(pos)
+               pipe_scanforobjects(pos)
+       end,
+       after_dig_node = function(pos)
+               pipe_scanforobjects(pos)
+       end,
+       node_box = {
+               type = "fixed",
+               fixed = spigotboxes_pouring,
+       },
+       selection_box = {
+               type = "fixed",
+               fixed = { -2/16, -6/16, -2/16, 2/16, 2/16, 8/16 }
+       },
+       drop = "pipeworks:spigot",
+})
+
+
 -- sealed pipe entry/exit (decorative horizontal pipe passing through a metal
 -- wall, for use in places where walls should look like they're airtight)
 
index d58d124adb20ee4a9b2e3986d64113fbbe20de02..dffdabf11c99ecb1aea093eba3b3c7c936adcd6a 100644 (file)
@@ -79,8 +79,10 @@ local spigot_check = function(pos,node)
        local top = minetest.env:get_node(check[node.param2+1]).name
        dbg('found '..top)
        if string.find(top,'_loaded') then
+               minetest.env:add_node({x=pos.x,y=pos.y,z=pos.z},{name='pipeworks:spigot_pouring'}) 
                minetest.env:add_node({x=pos.x,y=pos.y-1,z=pos.z},{name='default:water_source'}) 
        elseif minetest.env:get_node({x=pos.x,y=pos.y-1,z=pos.z}).name == 'default:water_source' then
+               minetest.env:add_node({x=pos.x,y=pos.y,z=pos.z},{name='pipeworks:spigot'}) 
                minetest.env:remove_node({x=pos.x,y=pos.y-1,z=pos.z})
        end
 end
@@ -100,11 +102,11 @@ minetest.register_abm({
 })
 
 minetest.register_abm({
-       nodenames = {'pipeworks:outlet','pipeworks:spigot'},
+       nodenames = {'pipeworks:outlet','pipeworks:spigot','pipeworks:spigot_pouring'},
        interval = 1,
        chance = 1,
        action = function(pos, node, active_object_count, active_object_count_wider) 
                if node.name == 'pipeworks:outlet' then update_outlet(pos)
-               elseif node.name == 'pipeworks:spigot' then spigot_check(pos,node) end
+               elseif node.name == 'pipeworks:spigot' or node.name == 'pipeworks:spigot_pouring' then spigot_check(pos,node) end
        end
 })
diff --git a/textures/pipeworks_spigot_bottom2.png b/textures/pipeworks_spigot_bottom2.png
new file mode 100644 (file)
index 0000000..3d4435b
Binary files /dev/null and b/textures/pipeworks_spigot_bottom2.png differ
index e41599f1cb7c9d2684f976cefd97a10f92e94523..ce7d90a2510cf3f323ca3139a1eb5af24f248c94 100644 (file)
Binary files a/textures/pipeworks_spigot_sides.png and b/textures/pipeworks_spigot_sides.png differ
diff --git a/textures/pipeworks_spigot_sides2.png b/textures/pipeworks_spigot_sides2.png
new file mode 100644 (file)
index 0000000..6533204
Binary files /dev/null and b/textures/pipeworks_spigot_sides2.png differ