From 13352af352f9dbbc1897aa292ca91fe37605dda0 Mon Sep 17 00:00:00 2001 From: Freeman Date: Fri, 8 Sep 2023 02:08:43 +0200 Subject: [PATCH] MineClone Compatibility default is just required to register default tools --- depends.txt | 3 +- init.lua | 97 +++++++++++++++++++++++++++++++++++++---------------- mod.conf | 2 +- 3 files changed, 71 insertions(+), 31 deletions(-) diff --git a/depends.txt b/depends.txt index 4ad96d5..665d19f 100644 --- a/depends.txt +++ b/depends.txt @@ -1 +1,2 @@ -default +default? +mcl_tools? diff --git a/init.lua b/init.lua index e44aea8..758f941 100644 --- a/init.lua +++ b/init.lua @@ -154,34 +154,73 @@ function toolranks.add_tool(name) }) end --- Sword -toolranks.add_tool("default:sword_wood") -toolranks.add_tool("default:sword_stone") -toolranks.add_tool("default:sword_steel") -toolranks.add_tool("default:sword_bronze") -toolranks.add_tool("default:sword_mese") -toolranks.add_tool("default:sword_diamond") +if minetest.get_modpath("default") then + -- Sword + toolranks.add_tool("default:sword_wood") + toolranks.add_tool("default:sword_stone") + toolranks.add_tool("default:sword_steel") + toolranks.add_tool("default:sword_bronze") + toolranks.add_tool("default:sword_mese") + toolranks.add_tool("default:sword_diamond") + + -- Pickaxe + toolranks.add_tool("default:pick_wood") + toolranks.add_tool("default:pick_stone") + toolranks.add_tool("default:pick_steel") + toolranks.add_tool("default:pick_bronze") + toolranks.add_tool("default:pick_mese") + toolranks.add_tool("default:pick_diamond") + + -- Axe + toolranks.add_tool("default:axe_wood") + toolranks.add_tool("default:axe_stone") + toolranks.add_tool("default:axe_steel") + toolranks.add_tool("default:axe_bronze") + toolranks.add_tool("default:axe_mese") + toolranks.add_tool("default:axe_diamond") + + -- Shovel + toolranks.add_tool("default:shovel_wood") + toolranks.add_tool("default:shovel_stone") + toolranks.add_tool("default:shovel_steel") + toolranks.add_tool("default:shovel_bronze") + toolranks.add_tool("default:shovel_netherite") + toolranks.add_tool("default:shovel_diamond") +end --- Pickaxe -toolranks.add_tool("default:pick_wood") -toolranks.add_tool("default:pick_stone") -toolranks.add_tool("default:pick_steel") -toolranks.add_tool("default:pick_bronze") -toolranks.add_tool("default:pick_mese") -toolranks.add_tool("default:pick_diamond") +if minetest.get_modpath("mcl_tools") then + -- Sword + toolranks.add_tool("mcl_tools:sword_wood") + toolranks.add_tool("mcl_tools:sword_stone") + toolranks.add_tool("mcl_tools:sword_iron") + toolranks.add_tool("mcl_tools:sword_gold") + toolranks.add_tool("mcl_tools:sword_netherite") + toolranks.add_tool("mcl_tools:sword_diamond") + + -- Pickaxe + toolranks.add_tool("mcl_tools:pick_wood") + toolranks.add_tool("mcl_tools:pick_stone") + toolranks.add_tool("mcl_tools:pick_iron") + toolranks.add_tool("mcl_tools:pick_gold") + toolranks.add_tool("mcl_tools:pick_netherite") + toolranks.add_tool("mcl_tools:pick_diamond") + + -- Axe + toolranks.add_tool("mcl_tools:axe_wood") + toolranks.add_tool("mcl_tools:axe_stone") + toolranks.add_tool("mcl_tools:axe_iron") + toolranks.add_tool("mcl_tools:axe_gold") + toolranks.add_tool("mcl_tools:axe_netherite") + toolranks.add_tool("mcl_tools:axe_diamond") + + -- Shovel + toolranks.add_tool("mcl_tools:shovel_wood") + toolranks.add_tool("mcl_tools:shovel_stone") + toolranks.add_tool("mcl_tools:shovel_iron") + toolranks.add_tool("mcl_tools:shovel_gold") + toolranks.add_tool("mcl_tools:shovel_netherite") + toolranks.add_tool("mcl_tools:shovel_diamond") --- Axe -toolranks.add_tool("default:axe_wood") -toolranks.add_tool("default:axe_stone") -toolranks.add_tool("default:axe_steel") -toolranks.add_tool("default:axe_bronze") -toolranks.add_tool("default:axe_mese") -toolranks.add_tool("default:axe_diamond") - --- Shovel -toolranks.add_tool("default:shovel_wood") -toolranks.add_tool("default:shovel_stone") -toolranks.add_tool("default:shovel_steel") -toolranks.add_tool("default:shovel_bronze") -toolranks.add_tool("default:shovel_mese") -toolranks.add_tool("default:shovel_diamond") + -- shears + toolranks.add_tool("mcl_tools:shears") +end diff --git a/mod.conf b/mod.conf index 9b53588..2c19fad 100644 --- a/mod.conf +++ b/mod.conf @@ -1,2 +1,2 @@ name = toolranks -depends = default +optional_depends = default, mcl_tools