Update shields to use the ARMOR_MATERIALS table

This commit is contained in:
stujones11 2015-02-19 19:18:34 +00:00
parent b17d8ea55a
commit 3dd43c7c6f

View File

@ -9,49 +9,89 @@ minetest.register_tool("shields:shield_admin", {
wear = 0, wear = 0,
}) })
minetest.register_tool("shields:shield_wood", { if ARMOR_MATERIALS.wood then
minetest.register_tool("shields:shield_wood", {
description = "Wooden Shield", description = "Wooden Shield",
inventory_image = "shields_inv_shield_wood.png", inventory_image = "shields_inv_shield_wood.png",
groups = {armor_shield=5, armor_heal=0, armor_use=2000}, groups = {armor_shield=5, armor_heal=0, armor_use=2000},
wear = 0, wear = 0,
}) })
minetest.register_tool("shields:shield_enhanced_wood", {
description = "Enhanced Wood Shield",
inventory_image = "shields_inv_shield_enhanced_wood.png",
groups = {armor_shield=8, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_craft({
output = "shields:shield_enhanced_wood",
recipe = {
{"default:steel_ingot"},
{"shields:shield_wood"},
{"default:steel_ingot"},
},
})
end
minetest.register_tool("shields:shield_cactus", { if ARMOR_MATERIALS.cactus then
minetest.register_tool("shields:shield_cactus", {
description = "Cactus Shield", description = "Cactus Shield",
inventory_image = "shields_inv_shield_cactus.png", inventory_image = "shields_inv_shield_cactus.png",
groups = {armor_shield=5, armor_heal=0, armor_use=2000}, groups = {armor_shield=5, armor_heal=0, armor_use=2000},
wear = 0, wear = 0,
}) })
minetest.register_tool("shields:shield_enhanced_cactus", {
description = "Enhanced Cactus Shield",
inventory_image = "shields_inv_shield_enhanced_cactus.png",
groups = {armor_shield=8, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_craft({
output = "shields:shield_enhanced_cactus",
recipe = {
{"default:steel_ingot"},
{"shields:shield_cactus"},
{"default:steel_ingot"},
},
})
end
minetest.register_tool("shields:shield_steel", { if ARMOR_MATERIALS.steel then
minetest.register_tool("shields:shield_steel", {
description = "Steel Shield", description = "Steel Shield",
inventory_image = "shields_inv_shield_steel.png", inventory_image = "shields_inv_shield_steel.png",
groups = {armor_shield=10, armor_heal=0, armor_use=500}, groups = {armor_shield=10, armor_heal=0, armor_use=500},
wear = 0, wear = 0,
}) })
end
minetest.register_tool("shields:shield_bronze", { if ARMOR_MATERIALS.bronze then
minetest.register_tool("shields:shield_bronze", {
description = "Bronze Shield", description = "Bronze Shield",
inventory_image = "shields_inv_shield_bronze.png", inventory_image = "shields_inv_shield_bronze.png",
groups = {armor_shield=10, armor_heal=6, armor_use=250}, groups = {armor_shield=10, armor_heal=6, armor_use=250},
wear = 0, wear = 0,
}) })
end
minetest.register_tool("shields:shield_diamond", { if ARMOR_MATERIALS.diamond then
minetest.register_tool("shields:shield_diamond", {
description = "Diamond Shield", description = "Diamond Shield",
inventory_image = "shields_inv_shield_diamond.png", inventory_image = "shields_inv_shield_diamond.png",
groups = {armor_shield=15, armor_heal=12, armor_use=100}, groups = {armor_shield=15, armor_heal=12, armor_use=100},
wear = 0, wear = 0,
}) })
end
minetest.register_tool("shields:shield_gold", { if ARMOR_MATERIALS.gold then
minetest.register_tool("shields:shield_gold", {
description = "Gold Shield", description = "Gold Shield",
inventory_image = "shields_inv_shield_gold.png", inventory_image = "shields_inv_shield_gold.png",
groups = {armor_shield=10, armor_heal=6, armor_use=250}, groups = {armor_shield=10, armor_heal=6, armor_use=250},
wear = 0, wear = 0,
}) })
end
if use_moreores then if ARMOR_MATERIALS.mithril then
minetest.register_tool("shields:shield_mithril", { minetest.register_tool("shields:shield_mithril", {
description = "Mithril Shield", description = "Mithril Shield",
inventory_image = "shields_inv_shield_mithril.png", inventory_image = "shields_inv_shield_mithril.png",
@ -60,20 +100,7 @@ if use_moreores then
}) })
end end
local craft_ingreds = { for k, v in pairs(ARMOR_MATERIALS) do
wood = "default:wood",
cactus = "default:cactus",
steel = "default:steel_ingot",
bronze = "default:bronze_ingot",
diamond = "default:diamond",
gold = "default:gold_ingot",
}
if use_moreores then
craft_ingreds.mithril = "moreores:mithril_ingot"
end
for k, v in pairs(craft_ingreds) do
minetest.register_craft({ minetest.register_craft({
output = "shields:shield_"..k, output = "shields:shield_"..k,
recipe = { recipe = {
@ -84,38 +111,7 @@ for k, v in pairs(craft_ingreds) do
}) })
end end
minetest.register_tool("shields:shield_enhanced_wood", {
description = "Enhanced Wood Shield",
inventory_image = "shields_inv_shield_enhanced_wood.png",
groups = {armor_shield=8, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("shields:shield_enhanced_cactus", {
description = "Enhanced Cactus Shield",
inventory_image = "shields_inv_shield_enhanced_cactus.png",
groups = {armor_shield=8, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_craft({
output = "shields:shield_enhanced_wood",
recipe = {
{"default:steel_ingot"},
{"shields:shield_wood"},
{"default:steel_ingot"},
},
})
minetest.register_craft({
output = "shields:shield_enhanced_cactus",
recipe = {
{"default:steel_ingot"},
{"shields:shield_cactus"},
{"default:steel_ingot"},
},
})
minetest.after(0, function() minetest.after(0, function()
table.insert(armor.elements, "shield") table.insert(armor.elements, "shield")
end) end)