disabling tnt only disabled tnt:tnt and craft

When enable_tnt = false then tnt:tnt node and it's craft are both disabled while tnt:tnt_burning and tnt:boom are available for other mods that require them but not in creative inventory.
This commit is contained in:
tenplus1 2016-03-28 21:32:36 +01:00
parent 14334a1d89
commit 1b67056c55

View file

@ -4,7 +4,7 @@ local singleplayer = minetest.is_singleplayer()
local setting = minetest.setting_getbool("enable_tnt")
if (not singleplayer and setting ~= true) or
(singleplayer and setting == false) then
return
setting = nil -- disabled tnt:tnt and craft recipe further on
end
-- loss probabilities array (one in X will be lost)
@ -224,6 +224,8 @@ local function boom(pos)
add_effects(pos, radius)
end
-- if nil then tnt:tnt and crafting recipe disabled
if setting then
minetest.register_node("tnt:tnt", {
description = "TNT",
tiles = {"tnt_top.png", "tnt_bottom.png", "tnt_side.png"},
@ -242,6 +244,16 @@ minetest.register_node("tnt:tnt", {
mesecons = {effector = {action_on = boom}},
})
minetest.register_craft({
output = "tnt:tnt",
recipe = {
{"", "group:wood", ""},
{"group:wood", "tnt:gunpowder", "group:wood"},
{"", "group:wood", ""}
}
})
end
minetest.register_node("tnt:tnt_burning", {
tiles = {
{
@ -256,6 +268,7 @@ minetest.register_node("tnt:tnt_burning", {
"tnt_bottom.png", "tnt_side.png"},
light_source = 5,
drop = "",
groups = {not_in_crafting_guide = 1},
sounds = default.node_sound_wood_defaults(),
on_construct = function(pos)
minetest.get_node_timer(pos):start(4)
@ -271,7 +284,7 @@ minetest.register_node("tnt:boom", {
light_source = default.LIGHT_MAX,
walkable = false,
drop = "",
groups = {dig_immediate=3},
groups = {dig_immediate = 3, not_in_crafting_guide = 1},
on_timer = function(pos, elapsed)
minetest.remove_node(pos)
end,
@ -388,12 +401,3 @@ minetest.register_craft({
type = "shapeless",
recipe = {"default:coal_lump", "default:gravel"}
})
minetest.register_craft({
output = "tnt:tnt",
recipe = {
{"", "group:wood", ""},
{"group:wood", "tnt:gunpowder", "group:wood"},
{"", "group:wood", ""}
}
})