From c29fbb0154d225a11f80179296f45cdc75f6b305 Mon Sep 17 00:00:00 2001 From: James David Clarke Date: Thu, 21 Dec 2023 11:57:57 +0000 Subject: [PATCH] Fixed tools crash --- init.lua | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/init.lua b/init.lua index 30a6c5f..d1f51d3 100644 --- a/init.lua +++ b/init.lua @@ -240,22 +240,38 @@ local function add_ore(modname, description, mineral_name, oredef, extra_node_de if tool_name == "sword" then tdef.description = S("@1 Sword", S(description)) - tdef.groups = merge_tables(tdef.groups, {sword = 1}) + if tdef.groups then + tdef.groups = merge_tables(tdef.groups, {sword = 1}) + else + tdef.groups = {sword = 1} + end end if tool_name == "pick" then tdef.description = S("@1 Pickaxe", S(description)) - tdef.groups = merge_tables(tdef.groups,{pickaxe = 1, tool=1}) + if tdef.groups then + tdef.groups = merge_tables(tdef.groups, {pickaxe = 1, tool=1}) + else + tdef.groups = {pickaxe = 1, tool=1} + end end if tool_name == "axe" then tdef.description = S("@1 Axe", S(description)) - tdef.groups = merge_tables(tdef.groups,{axe = 1,tool=1}) + if tdef.groups then + tdef.groups = merge_tables(tdef.groups, {axe = 1, tool=1}) + else + tdef.groups = {axe = 1, tool=1} + end end if tool_name == "shovel" then tdef.description = S("@1 Shovel", S(description)) - tdef.groups = merge_tables(tdef.groups,{shovel = 1,tool=1}) + if tdef.groups then + tdef.groups = merge_tables(tdef.groups, {shovel = 1, tool=1}) + else + tdef.groups = {shovel = 1, tool=1} + end tdef.wield_image = toolimg_base .. tool_name .. ".png^[transformR90" end