Make the wool dependency optional

The mod needs the wool and default mods only for the crafting recipes.
By registering the recipes only if the required nodes exist,
the mod is installable even without minetest_game or a similar game.
This commit is contained in:
HybridDog 2024-09-08 10:58:59 +02:00
parent 3869e3f3cc
commit 6ba6493049
2 changed files with 18 additions and 13 deletions

View File

@ -31,14 +31,16 @@ for s,l in pairs(colours) do
groups = {oddly_breakable_by_hand=3,snappy=2,choppy=2},
sounds = dog_sounds,
})
minetest.register_craft({
output = name.." 6",
recipe = {
{"", "", ""},
{input, input, input},
{input, input, input},
}
})
if minetest.registered_nodes[input] then
minetest.register_craft({
output = name.." 6",
recipe = {
{"", "", ""},
{input, input, input},
{input, input, input},
}
})
end
end
@ -116,10 +118,13 @@ for dog,data in pairs(dogs) do
end
end,
})
minetest.register_craft({
output = name.." 6",
recipe = recipe
})
if minetest.registered_nodes["wool:white"]
and minetest.registered_nodes["default:torch"] then
minetest.register_craft({
output = name.." 6",
recipe = recipe
})
end
minetest.register_abm({
nodenames = {name},
interval = 1.5,

View File

@ -1,4 +1,4 @@
name = dogblocks
title = DogBlocks
description = Cute, adorable dog nodes
depends = wool
optional_depends = default,wool