Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trim Redundant Item Name Strings #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 56 additions & 26 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,32 @@ 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",
})

--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 = {
Expand All @@ -67,17 +67,17 @@ 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, ""}
}
})


--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 = {
Expand All @@ -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",
Expand All @@ -129,17 +129,17 @@ 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, ""}
}
})


--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 = {
Expand All @@ -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, ""}
}
})
Expand All @@ -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"}
}
})

Expand All @@ -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,
Expand All @@ -196,3 +196,33 @@ 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",
-- xdecor nodes
"block_cube",
"block_doublepanel",
"block_halfstair",
"block_micropanel",
"block_microslab",
"block_nanoslab",
"block_panel",
"block_thinstair",
}

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
52 changes: 33 additions & 19 deletions rainbow_armor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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"},
},
})
})


-- 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
17 changes: 11 additions & 6 deletions rainbow_shield.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand All @@ -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", ""},
},
})
})


-- backward compatibility

core.register_alias("rainbow_ore:rainbow_ore_shield", "rainbow_ore:shield")