Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
-- basic empty tank
minetest.register_node("tanks:level_0", {
description = "Tank",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tankgaugetop.png", "tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
-- tank crafting
minetest.register_craft({
output = 'tanks:level_0',
recipe = {
{'deco:glass', '', 'deco:glass'},
{'deco:glass', '', 'deco:glass'},
{'deco:glass', '', 'deco:glass'},
}
})
-- water tanks
minetest.register_node("tanks:w_level_1", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_water_level_8.png^tankgaugetop.png", "tank_water_level_1.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:w_level_2", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_water_level_8.png^tankgaugetop.png", "tank_water_level_2.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:w_level_3", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_water_level_8.png^tankgaugetop.png", "tank_water_level_3.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:w_level_4", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_water_level_8.png^tankgaugetop.png", "tank_water_level_4.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:w_level_5", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_water_level_8.png^tankgaugetop.png", "tank_water_level_5.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:w_level_6", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_water_level_8.png^tankgaugetop.png", "tank_water_level_6.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:w_level_7", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_water_level_8.png^tankgaugetop.png", "tank_water_level_7.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:w_level_8", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_water_level_8.png^tankgaugetop.png", "tank_water_level_8.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
-- lava tanks
minetest.register_node("tanks:l_level_1", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_lava_level_8.png^tankgaugetop.png", "tank_lava_level_1.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:l_level_2", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_lava_level_8.png^tankgaugetop.png", "tank_lava_level_2.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:l_level_3", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_lava_level_8.png^tankgaugetop.png", "tank_lava_level_3.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:l_level_4", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_lava_level_8.png^tankgaugetop.png", "tank_lava_level_4.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:l_level_5", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_lava_level_8.png^tankgaugetop.png", "tank_lava_level_5.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:l_level_6", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_lava_level_8.png^tankgaugetop.png", "tank_lava_level_6.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:l_level_7", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_lava_level_8.png^tankgaugetop.png", "tank_lava_level_7.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:l_level_8", {
description = "Impossible Node ;)",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_lava_level_8.png^tankgaugetop.png", "tank_lava_level_8.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
-- oil tanks
minetest.register_node("tanks:o_level_1", {
description = "Impossible node - good try",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_oil_level_8.png^tankgaugetop.png", "tank_oil_level_2.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:o_level_2", {
description = "Impossible node - good try",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_oil_level_8.png^tankgaugetop.png", "tank_oil_level_1.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:o_level_3", {
description = "Impossible node - good try",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_oil_level_8.png^tankgaugetop.png", "tank_oil_level_3.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:o_level_4", {
description = "Impossible node - good try",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_oil_level_8.png^tankgaugetop.png", "tank_oil_level_4.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:o_level_5", {
description = "Impossible node - good try",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_oil_level_8.png^tankgaugetop.png", "tank_oil_level_5.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:o_level_6", {
description = "Impossible node - good try",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_oil_level_8.png^tankgaugetop.png", "tank_oil_level_6.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:o_level_7", {
description = "Impossible node - good try",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_oil_level_8.png^tankgaugetop.png", "tank_oil_level_7.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
minetest.register_node("tanks:o_level_8", {
description = "Impossible node - good try",
drawtype = "glasslike",
tiles = {"tankgaugetop.png", "tank_oil_level_8.png^tankgaugetop.png", "tank_oil_level_8.png^tankgauge.png"},
groups = {oddly_breakable_by_hand=1},
})
-- black magic here
minetest.register_on_punchnode(function(pos, node, puncher)
if not puncher then return end
tnodename = minetest.get_node(pos)
bname = puncher:get_wielded_item():get_name()
if tnodename.name == "tanks:level_0" then
if bname == "bucket:oil" then -- this line causes the bug in question
puncher:set_wielded_item("bucket:bucket_empty 1")
minetest.set_node(pos, "tanks:o_level_1")
elseif bname == "bucket:bucket_lava" then
puncher:set_wielded_item("bucket:bucket_empty 1")
minetest.set_node(pos, "tanks:l_level_1")
elseif bname == "bucket:bucket_lava" then
puncher:set_wielded_item("bucket:bucket_empty 1")
minetest.set_node(pos, "tanks:w_level_1")
else
return
end
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment