Added "expansion tank" that appears if the user stacks tanks upwards.

(Downwards is not checked).
This commit is contained in:
Vanessa Ezekowitz 2012-08-22 09:56:45 -04:00
parent 4a1dbe2a8e
commit 4597b1b59a
3 changed files with 56 additions and 14 deletions

View File

@ -106,16 +106,18 @@ pipes_scansurroundings = function(pos)
-- also, so they require a special case -- also, so they require a special case
if (string.find(nym.name, "pipeworks:storage_tank_") ~= nil) or if (string.find(nym.name, "pipeworks:storage_tank_") ~= nil) or
(string.find(nym.name, "pipeworks:storage_tank_") ~= nil) or
(string.find(nym.name, "pipeworks:intake") ~= nil) or (string.find(nym.name, "pipeworks:intake") ~= nil) or
(string.find(nym.name, "pipeworks:outlet") ~= nil) then (string.find(nym.name, "pipeworks:outlet") ~= nil) then
pym=1 pym=1
end end
end
if (string.find(nyp.name, "pipeworks:storage_tank_") ~= nil) or
(string.find(nyp.name, "pipeworks:storage_tank_") ~= nil) then function pipe_look_for_stackable_tanks(pos)
pyp=1 tym = minetest.env:get_node({ x=pos.x , y=pos.y-1, z=pos.z })
end
if string.find(tym.name, "pipeworks:storage_tank_") ~= nil or
string.find(tym.name, "pipeworks:expansion_tank_") ~= nil then
minetest.env:add_node(pos, { name = "pipeworks:expansion_tank_0"})
end
end end

View File

@ -2,7 +2,9 @@ Changelog
--------- ---------
2012-08-22: Added outlet grate, made it participate in autoplace algorithm. 2012-08-22: Added outlet grate, made it participate in autoplace algorithm.
Extended storage tank to show fill level in 10% steps (0% to 100%). Extended storage tank to show fill level in 10% steps (0% to 100%). Added
"expansion tank" that appears if the user stacks tanks upwards. (Downwards is
not checked).
2012-08-21: Made storage tank participate in autoplace algorithm. Tuned API a 2012-08-21: Made storage tank participate in autoplace algorithm. Tuned API a
little to allow for more flexible placement. Re-organized code a bit to allow little to allow for more flexible placement. Re-organized code a bit to allow

View File

@ -1,4 +1,4 @@
-- List of devices for use by the autoplace algorithm -- List of devices that should participate in the autoplace algorithm
pipes_devicelist = { pipes_devicelist = {
"pump", "pump",
@ -327,7 +327,8 @@ minetest.register_node("pipeworks:outlet", {
end, end,
}) })
-- tank -- tanks
for fill = 0, 10 do for fill = 0, 10 do
if fill == 0 then if fill == 0 then
filldesc="empty" filldesc="empty"
@ -337,11 +338,42 @@ for fill = 0, 10 do
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1} sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}
end end
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",
"pipeworks_storage_tank_front_"..fill..".png"
},
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,
stack_max = 99,
drop = "pipeworks:storage_tank_"..fill.."_x",
after_place_node = function(pos)
pipe_look_for_stackable_tanks(pos)
pipe_scanforobjects(pos)
end,
after_dig_node = function(pos)
pipe_scanforobjects(pos)
end,
pipelike=0,
on_construct = function(pos)
local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",0)
end,
})
minetest.register_node("pipeworks:storage_tank_"..fill.."_x", { minetest.register_node("pipeworks:storage_tank_"..fill.."_x", {
description = "Fluid Storage Tank ("..filldesc..")", description = "Fluid Storage Tank ("..filldesc..")",
tiles = { tiles = {
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_back.png", "pipeworks_storage_tank_back.png",
@ -353,7 +385,10 @@ for fill = 0, 10 do
walkable = true, walkable = true,
stack_max = 99, stack_max = 99,
after_place_node = function(pos) after_place_node = function(pos)
pipe_look_for_stackable_tanks(pos)
if string.find(minetest.env:get_node(pos).name, "pipeworks:storage_tank_") ~= nil then
pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill) pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill)
end
pipe_scanforobjects(pos) pipe_scanforobjects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
@ -370,7 +405,7 @@ for fill = 0, 10 do
description = "Fluid Storage Tank (Z axis, "..filldesc..")... You hacker, you.", description = "Fluid Storage Tank (Z axis, "..filldesc..")... You hacker, you.",
tiles = { tiles = {
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_front_"..fill..".png", "pipeworks_storage_tank_front_"..fill..".png",
"pipeworks_storage_tank_back.png", "pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
@ -383,7 +418,10 @@ for fill = 0, 10 do
stack_max = 99, stack_max = 99,
drop = "pipeworks:storage_tank_"..fill.."_x", drop = "pipeworks:storage_tank_"..fill.."_x",
after_place_node = function(pos) after_place_node = function(pos)
pipe_look_for_stackable_tanks(pos)
if string.find(minetest.env:get_node(pos).name, "pipeworks:storage_tank_") ~= nil then
pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill) pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill)
end
pipe_scanforobjects(pos) pipe_scanforobjects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)