From 176649d01542dcc92702216fd03e7af471192f2a Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 2 Aug 2021 20:00:34 -0700 Subject: [PATCH 1/2] Simplify item names & add backward compatibility --- init.lua | 73 +++++++++++++++++++++++++++++----------------- rainbow_armor.lua | 52 +++++++++++++++++++++------------ rainbow_shield.lua | 17 +++++++---- 3 files changed, 91 insertions(+), 51 deletions(-) diff --git a/init.lua b/init.lua index 2d7bd6a..1f85dd1 100644 --- a/init.lua +++ b/init.lua @@ -17,17 +17,17 @@ end local S = minetest.get_translator(rainbow_ore.modname) -- Define Rainbow_Ore_Block node -minetest.register_node("rainbow_ore:rainbow_ore_block", { +minetest.register_node("rainbow_ore:block", { description = S("Rainbow Ore"), tiles = {"rainbow_ore_block.png"}, groups = {stone=2, cracky=3}, - drop = "rainbow_ore:rainbow_ore_block", + drop = "rainbow_ore:block", is_ground_content = true, }) --Define Rainbow_Ore_Ingot node -minetest.register_craftitem("rainbow_ore:rainbow_ore_ingot", { +minetest.register_craftitem("rainbow_ore:ingot", { description = S("Rainbow Ore Ingot"), inventory_image = "rainbow_ore_ingot.png", }) @@ -35,14 +35,14 @@ minetest.register_craftitem("rainbow_ore:rainbow_ore_ingot", { --Define Rainbow_Ore Smelt Recipe minetest.register_craft({ type = "cooking", - output = "rainbow_ore:rainbow_ore_ingot", - recipe = "rainbow_ore:rainbow_ore_block", + output = "rainbow_ore:ingot", + recipe = "rainbow_ore:block", cooktime = 10, }) --Register Rainbow Pickaxe -minetest.register_tool("rainbow_ore:rainbow_ore_pickaxe", { +minetest.register_tool("rainbow_ore:pick", { description = S("Rainbow Pickaxe"), inventory_image = "rainbow_ore_pickaxe.png", tool_capabilities = { @@ -67,9 +67,9 @@ end --Define Rainbow_Ore_Pickaxe crafting recipe minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_pickaxe", + output = "rainbow_ore:pick", recipe = { - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"}, {"", stick, ""}, {"", stick, ""} } @@ -77,7 +77,7 @@ minetest.register_craft({ --Register Rainbow Axe -minetest.register_tool("rainbow_ore:rainbow_ore_axe", { +minetest.register_tool("rainbow_ore:axe", { description = S("Rainbow Axe"), inventory_image = "rainbow_ore_axe.png", tool_capabilities = { @@ -93,26 +93,26 @@ minetest.register_tool("rainbow_ore:rainbow_ore_axe", { --Define Rainbow Axe crafting recipe minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_axe", + output = "rainbow_ore:axe", recipe = { - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", ""}, - {"rainbow_ore:rainbow_ore_ingot", stick, ""}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", ""}, + {"rainbow_ore:ingot", stick, ""}, {"", stick, ""} } }) minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_axe", + output = "rainbow_ore:axe", recipe = { - {"", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, - {"", stick, "rainbow_ore:rainbow_ore_ingot"}, + {"", "rainbow_ore:ingot", "rainbow_ore:ingot"}, + {"", stick, "rainbow_ore:ingot"}, {"", stick, ""} } }) --Register Rainbow shovel -minetest.register_tool("rainbow_ore:rainbow_ore_shovel", { +minetest.register_tool("rainbow_ore:shovel", { description = S("Rainbow Shovel"), inventory_image = "rainbow_ore_shovel.png", wield_image = "rainbow_ore_shovel.png^[transformR90", @@ -129,9 +129,9 @@ minetest.register_tool("rainbow_ore:rainbow_ore_shovel", { --Define Rainbow shovel crafting recipe minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_shovel", + output = "rainbow_ore:shovel", recipe = { - {"", "rainbow_ore:rainbow_ore_ingot", ""}, + {"", "rainbow_ore:ingot", ""}, {"", stick, ""}, {"", stick, ""} } @@ -139,7 +139,7 @@ minetest.register_craft({ --Register Rainbow sword -minetest.register_tool("rainbow_ore:rainbow_ore_sword", { +minetest.register_tool("rainbow_ore:sword", { description = S("Rainbow Sword"), inventory_image = "rainbow_ore_sword.png", tool_capabilities = { @@ -155,10 +155,10 @@ minetest.register_tool("rainbow_ore:rainbow_ore_sword", { --Define Rainbow sword crafting recipe minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_sword", + output = "rainbow_ore:sword", recipe = { - {"", "rainbow_ore:rainbow_ore_ingot", ""}, - {"", "rainbow_ore:rainbow_ore_ingot", ""}, + {"", "rainbow_ore:ingot", ""}, + {"", "rainbow_ore:ingot", ""}, {"", stick, ""} } }) @@ -168,9 +168,9 @@ minetest.register_craft({ minetest.register_craft({ output = "default:nyancat_rainbow", recipe = { - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"} + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"} } }) @@ -184,7 +184,7 @@ minetest.register_on_mods_loaded(function() if minetest.registered_nodes[spawn_within] then minetest.register_ore({ ore_type = "scatter", - ore = "rainbow_ore:rainbow_ore_block", + ore = "rainbow_ore:block", wherein = spawn_within, clust_scarcity = 17*17*17, clust_num_ores = 3, @@ -196,3 +196,24 @@ minetest.register_on_mods_loaded(function() minetest.log("warning", "[rainbow_ore] " .. spawn_within .. " is not a registered node, rainbow ore will not spawn") end end) + + +-- backward compatibility + +local aliases = { + "ingot", + "pickaxe", + "axe", + "shovel", + "sword", + "block", +} + +for _, al in ipairs(aliases) do + local tgt = al + if tgt == "pickaxe" then + tgt = "pick" + end + + minetest.register_alias("rainbow_ore:rainbow_ore_"..al, "rainbow_ore:"..tgt) +end diff --git a/rainbow_armor.lua b/rainbow_armor.lua index 02882e6..edcb688 100644 --- a/rainbow_armor.lua +++ b/rainbow_armor.lua @@ -3,25 +3,25 @@ local S = minetest.get_translator(rainbow_ore.modname) --Define Rainbow Armor -minetest.register_tool("rainbow_ore:rainbow_ore_helmet", { +minetest.register_tool("rainbow_ore:helmet", { description = S("Rainbow Helmet"), inventory_image = "rainbow_ore_helmet_inv.png", groups = {armor_head=20, armor_heal=17, armor_use=40}, wear = 0, }) -minetest.register_tool("rainbow_ore:rainbow_ore_chestplate", { +minetest.register_tool("rainbow_ore:chestplate", { description = S("Rainbow Chestplate"), inventory_image = "rainbow_ore_chestplate_inv.png", groups = {armor_torso=25, armor_heal=17, armor_use=40}, wear = 0, }) -minetest.register_tool("rainbow_ore:rainbow_ore_leggings", { +minetest.register_tool("rainbow_ore:leggings", { description = S("Rainbow Leggings"), inventory_image = "rainbow_ore_leggings_inv.png", groups = {armor_legs=25, armor_heal=17, armor_use=40}, wear = 0, }) -minetest.register_tool("rainbow_ore:rainbow_ore_boots", { +minetest.register_tool("rainbow_ore:boots", { description = S("Rainbow Boots"), inventory_image = "rainbow_ore_boots_inv.png", groups = {armor_feet=20, armor_heal=17, armor_use=40}, @@ -31,33 +31,47 @@ minetest.register_tool("rainbow_ore:rainbow_ore_boots", { --Define Rainbow Armor crafting recipe minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_helmet", + output = "rainbow_ore:helmet", recipe = { - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, - {"rainbow_ore:rainbow_ore_ingot", "", "rainbow_ore:rainbow_ore_ingot"}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"}, + {"rainbow_ore:ingot", "", "rainbow_ore:ingot"}, {"", "", ""}, }, }) minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_chestplate", + output = "rainbow_ore:chestplate", recipe = { - {"rainbow_ore:rainbow_ore_ingot", "", "rainbow_ore:rainbow_ore_ingot"}, - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, + {"rainbow_ore:ingot", "", "rainbow_ore:ingot"}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"}, }, }) minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_leggings", + output = "rainbow_ore:leggings", recipe = { - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, - {"rainbow_ore:rainbow_ore_ingot", "", "rainbow_ore:rainbow_ore_ingot"}, - {"rainbow_ore:rainbow_ore_ingot", "", "rainbow_ore:rainbow_ore_ingot"}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"}, + {"rainbow_ore:ingot", "", "rainbow_ore:ingot"}, + {"rainbow_ore:ingot", "", "rainbow_ore:ingot"}, }, }) minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_boots", + output = "rainbow_ore:boots", recipe = { - {"rainbow_ore:rainbow_ore_ingot", "", "rainbow_ore:rainbow_ore_ingot"}, - {"rainbow_ore:rainbow_ore_ingot", "", "rainbow_ore:rainbow_ore_ingot"}, + {"rainbow_ore:ingot", "", "rainbow_ore:ingot"}, + {"rainbow_ore:ingot", "", "rainbow_ore:ingot"}, }, -}) \ No newline at end of file +}) + + +-- backward compatibility + +local aliases = { + "helmet", + "chestplate", + "leggings", + "boots", +} + +for _, al in ipairs(aliases) do + minetest.register_alias("rainbow_ore:rainbow_ore_"..al, "rainbow_ore:"..al) +end diff --git a/rainbow_shield.lua b/rainbow_shield.lua index 11c8201..a660c8f 100644 --- a/rainbow_shield.lua +++ b/rainbow_shield.lua @@ -3,7 +3,7 @@ local S = minetest.get_translator(rainbow_ore.modname) --Define Rainbow shield -minetest.register_tool("rainbow_ore:rainbow_ore_shield", { +minetest.register_tool("rainbow_ore:shield", { description = S("Rainbow Shield"), inventory_image = "rainbow_ore_shield_inv.png", groups = {armor_shield=20, armor_heal=17, armor_use=40, armor_fire=1}, @@ -13,10 +13,15 @@ minetest.register_tool("rainbow_ore:rainbow_ore_shield", { --Define Rainbow shield crafting recipe minetest.register_craft({ - output = "rainbow_ore:rainbow_ore_shield", + output = "rainbow_ore:shield", recipe = { - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, - {"rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot", "rainbow_ore:rainbow_ore_ingot"}, - {"", "rainbow_ore:rainbow_ore_ingot", ""}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"}, + {"rainbow_ore:ingot", "rainbow_ore:ingot", "rainbow_ore:ingot"}, + {"", "rainbow_ore:ingot", ""}, }, -}) \ No newline at end of file +}) + + +-- backward compatibility + +core.register_alias("rainbow_ore:rainbow_ore_shield", "rainbow_ore:shield") From c447fbfcd94d8d452b4f66de375cf6b355213948 Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Wed, 4 Aug 2021 19:07:14 -0700 Subject: [PATCH 2/2] Add backward compatibility for rainbow nodes from xdecor --- init.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/init.lua b/init.lua index 1f85dd1..3969210 100644 --- a/init.lua +++ b/init.lua @@ -207,6 +207,15 @@ local aliases = { "shovel", "sword", "block", + -- xdecor nodes + "block_cube", + "block_doublepanel", + "block_halfstair", + "block_micropanel", + "block_microslab", + "block_nanoslab", + "block_panel", + "block_thinstair", } for _, al in ipairs(aliases) do