Blackhole: Add support for liquids

Left side is used for items; right side is used for liquids.
As far as I know, there is no other way to get rid of liquids.
This commit is contained in:
Thomas--S 2020-07-17 20:00:10 +02:00
parent 96f8710980
commit 698eeb63a9
3 changed files with 44 additions and 8 deletions

View File

@ -8,11 +8,32 @@
GPL v3 GPL v3
See LICENSE.txt for more information See LICENSE.txt for more information
All items disappear. All items and liquids disappear.
]]-- ]]--
local S = techage.S local S = techage.S
local Pipe = techage.LiquidPipe
local liquid = techage.liquid
local function take_liquid(pos, indir, name, amount)
return 0, name
end
local function put_liquid(pos, indir, name, amount)
return 0
end
local function peek_liquid(pos, indir)
return nil
end
local networks_def = {
pipe2 = {
sides = {R=1}, -- Pipe connection sides
ntype = "tank",
},
}
minetest.register_node("techage:blackhole", { minetest.register_node("techage:blackhole", {
description = S("TechAge Black Hole"), description = S("TechAge Black Hole"),
@ -20,7 +41,7 @@ minetest.register_node("techage:blackhole", {
-- up, down, right, left, back, front -- up, down, right, left, back, front
"techage_filling_ta2.png^techage_frame_ta2.png", "techage_filling_ta2.png^techage_frame_ta2.png",
"techage_filling_ta2.png^techage_frame_ta2.png", "techage_filling_ta2.png^techage_frame_ta2.png",
"techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_blackhole.png", "techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_blackhole.png^techage_appl_hole_pipe.png",
"techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_blackhole.png^techage_appl_inp.png", "techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_blackhole.png^techage_appl_inp.png",
"techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_blackhole.png", "techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_blackhole.png",
"techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_blackhole.png", "techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_blackhole.png",
@ -30,7 +51,14 @@ minetest.register_node("techage:blackhole", {
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local node = minetest.get_node(pos) local node = minetest.get_node(pos)
meta:set_int("push_dir", techage.side_to_indir("L", node.param2)) meta:set_int("push_dir", techage.side_to_indir("L", node.param2))
meta:set_string("infotext", S("TechAge Black Hole (let items disappear)")) meta:set_string("infotext", S("TechAge Black Hole (let items and liquids disappear)"))
Pipe:after_place_node(pos)
end,
after_dig_node = function(pos, oldnode)
Pipe:after_dig_node(pos)
end,
tubelib2_on_update2 = function(pos, outdir, tlib2, node)
liquid.update_network(pos, outdir)
end, end,
on_rotate = screwdriver.disallow, on_rotate = screwdriver.disallow,
@ -38,13 +66,20 @@ minetest.register_node("techage:blackhole", {
groups = {choppy=2, cracky=2, crumbly=2}, groups = {choppy=2, cracky=2, crumbly=2},
is_ground_content = false, is_ground_content = false,
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
liquid = {
capa = 999999,
peek = peek_liquid,
put = put_liquid,
take = take_liquid,
},
networks = networks_def,
}) })
minetest.register_craft({ minetest.register_craft({
output = "techage:blackhole", output = "techage:blackhole",
recipe = { recipe = {
{"group:wood", "", "group:wood"}, {"group:wood", "", "group:wood"},
{"techage:tubeS", "default:coal_lump", ""}, {"techage:tubeS", "default:coal_lump", "techage:ta3_pipeS"},
{"group:wood", "techage:iron_ingot", "group:wood"}, {"group:wood", "techage:iron_ingot", "group:wood"},
}, },
}) })
@ -61,3 +96,4 @@ techage.register_node({"techage:blackhole"}, {
end, end,
}) })
Pipe:add_secondary_node_names({"techage:blackhole"})

View File

@ -355,7 +355,7 @@ TA4 Wind Turbine=TA4 Windkraftanlage
TA4 Wind Turbine Nacelle=TA4 Windkraftanlagengondel TA4 Wind Turbine Nacelle=TA4 Windkraftanlagengondel
TA4 Wind Turbine Signal Lamp=TA4 Windkraftanlagenlampe TA4 Wind Turbine Signal Lamp=TA4 Windkraftanlagenlampe
TechAge Black Hole=TechAge Schwarzes Loch TechAge Black Hole=TechAge Schwarzes Loch
TechAge Black Hole (let items disappear)=TechAge Schwarzes Loch (Gegenstände verschwinden) TechAge Black Hole (let items and liquids disappear)=TechAge Schwarzes Loch (Gegenstände und Flüssigkeiten verschwinden)
TechAge Door Block=TechAge Türblock TechAge Door Block=TechAge Türblock
TechAge Gate Block=TechAge Torblock TechAge Gate Block=TechAge Torblock
TechAge Gravel=TechAge Kies TechAge Gravel=TechAge Kies

View File

@ -353,7 +353,7 @@ TA4 Wind Turbine=
TA4 Wind Turbine Nacelle= TA4 Wind Turbine Nacelle=
TA4 Wind Turbine Signal Lamp= TA4 Wind Turbine Signal Lamp=
TechAge Black Hole= TechAge Black Hole=
TechAge Black Hole (let items disappear)= TechAge Black Hole (let items and liquids disappear)=
TechAge Door Block= TechAge Door Block=
TechAge Gate Block= TechAge Gate Block=
TechAge Gravel= TechAge Gravel=