1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2024-12-26 19:00:24 +01:00

Extended storage tank to show fill level in 10% steps (0% to 100%).

This commit is contained in:
Vanessa Ezekowitz 2012-08-22 08:24:42 -04:00
parent a66d9a8564
commit 70ea341bf5
15 changed files with 85 additions and 66 deletions

View File

@ -105,15 +105,15 @@ pipes_scansurroundings = function(pos)
-- storage tanks and intake grates have vertical connections -- storage tanks and intake grates have vertical connections
-- also, so they require a special case -- also, so they require a special case
if (string.find(nym.name, "pipeworks:storage_tank_x") ~= nil) or if (string.find(nym.name, "pipeworks:storage_tank_") ~= nil) or
(string.find(nym.name, "pipeworks:storage_tank_z") ~= 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
if (string.find(nyp.name, "pipeworks:storage_tank_x") ~= nil) or if (string.find(nyp.name, "pipeworks:storage_tank_") ~= nil) or
(string.find(nyp.name, "pipeworks:storage_tank_z") ~= nil) then (string.find(nyp.name, "pipeworks:storage_tank_") ~= nil) then
pyp=1 pyp=1
end end

View File

@ -1,7 +1,8 @@
Changelog 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%).
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

@ -3,15 +3,24 @@
pipes_devicelist = { pipes_devicelist = {
"pump", "pump",
"valve", "valve",
"storage_tank" "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"
} }
-- tables -- tables
minetest.register_alias("pipeworks:pump", "pipeworks:pump_off_x") minetest.register_alias("pipeworks:pump", "pipeworks:pump_off_x")
minetest.register_alias("pipeworks:pump_off", "pipeworks:pump_off_x")
minetest.register_alias("pipeworks:valve", "pipeworks:valve_off_x") minetest.register_alias("pipeworks:valve", "pipeworks:valve_off_x")
minetest.register_alias("pipeworks:valve_off", "pipeworks:valve_off_x") minetest.register_alias("pipeworks:storage_tank", "pipeworks:storage_tank_0_x")
pipe_pumpbody_x = { pipe_pumpbody_x = {
{ -6/16, -8/16, -6/16, 6/16, 8/16, 6/16 } { -6/16, -8/16, -6/16, 6/16, 8/16, 6/16 }
@ -319,65 +328,74 @@ minetest.register_node("pipeworks:outlet", {
}) })
-- tank -- tank
for fill = 0, 10 do
if fill == 0 then
filldesc=""
sgroups = {snappy=3, pipe=1, tankfill=fill+1}
else
filldesc=fill
sgroups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1}
end
minetest.register_node("pipeworks:storage_tank_x", { minetest.register_node("pipeworks:storage_tank_"..fill.."_x", {
description = "Fluid Storage Tank", description = "Fluid Storage Tank ("..filldesc.."0% full)",
tiles = { tiles = {
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_sides.png", "pipeworks_storage_tank_back.png",
"pipeworks_storage_tank_sides.png" "pipeworks_storage_tank_front_"..fill..".png"
}, },
paramtype = "light", paramtype = "light",
groups = {snappy=3, pipe=1}, groups = sgroups,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
stack_max = 99, stack_max = 99,
after_place_node = function(pos) after_place_node = function(pos)
pipe_device_autorotate(pos, nil, "pipeworks:storage_tank") pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill)
pipe_scanforobjects(pos) pipe_scanforobjects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipe_scanforobjects(pos)
end, end,
pipelike=1, pipelike=1,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.env:get_meta(pos) local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1) meta:set_int("pipelike",1)
end, end,
}) })
minetest.register_node("pipeworks:storage_tank_z", { minetest.register_node("pipeworks:storage_tank_"..fill.."_z", {
description = "Fluid Storage Tank (Z axis)... You hacker, you.", description = "Fluid Storage Tank (Z axis, "..filldesc.."0% full)... You hacker, you.",
tiles = { tiles = {
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_fittings.png", "pipeworks_storage_tank_fittings.png",
"pipeworks_storage_tank_sides.png", "pipeworks_storage_tank_front_"..fill..".png",
"pipeworks_storage_tank_sides.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"
}, },
paramtype = "light", paramtype = "light",
groups = {snappy=3, pipe=1, not_in_creative_inventory=1}, groups = {snappy=3, pipe=1, tankfill=fill+1, not_in_creative_inventory=1},
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
walkable = true, walkable = true,
stack_max = 99, stack_max = 99,
drop = "pipeworks:storage_tank_x", drop = "pipeworks:storage_tank_"..fill.."_x",
after_place_node = function(pos) after_place_node = function(pos)
pipe_device_autorotate(pos, nil, "pipeworks:storage_tank") pipe_device_autorotate(pos, nil, "pipeworks:storage_tank_"..fill)
pipe_scanforobjects(pos) pipe_scanforobjects(pos)
end, end,
after_dig_node = function(pos) after_dig_node = function(pos)
pipe_scanforobjects(pos) pipe_scanforobjects(pos)
end, end,
pipelike=1, pipelike=1,
on_construct = function(pos) on_construct = function(pos)
local meta = minetest.env:get_meta(pos) local meta = minetest.env:get_meta(pos)
meta:set_int("pipelike",1) meta:set_int("pipelike",1)
end, end,
}) })
end
-- various actions -- various actions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB