Allow individual armor materials to be disabled via armor.conf

This commit is contained in:
stujones11 2015-02-19 18:53:31 +00:00
parent e6979e9409
commit b17d8ea55a
4 changed files with 184 additions and 198 deletions

1
.gitignore vendored
View File

@ -4,4 +4,5 @@
*bak* *bak*
tags tags
*.vim *.vim
armor.conf

View File

@ -1,5 +1,17 @@
-- Armor Configuration (defaults) -- Armor Configuration (defaults)
-- You can remove any unwanted armor materials from this table.
-- Note that existing armor that is removed will show up as an unknown item.
ARMOR_MATERIALS = {
wood = "default:wood",
cactus = "default:cactus",
steel = "default:steel_ingot",
bronze = "default:bronze_ingot",
diamond = "default:diamond",
gold = "default:gold_ingot",
mithril = "moreores:mithril_ingot",
}
-- Increase this if you get initialization glitches when a player first joins. -- Increase this if you get initialization glitches when a player first joins.
ARMOR_INIT_DELAY = 1 ARMOR_INIT_DELAY = 1

View File

@ -6,6 +6,15 @@ ARMOR_DROP = minetest.get_modpath("bones") ~= nil
ARMOR_DESTROY = false ARMOR_DESTROY = false
ARMOR_LEVEL_MULTIPLIER = 1 ARMOR_LEVEL_MULTIPLIER = 1
ARMOR_HEAL_MULTIPLIER = 1 ARMOR_HEAL_MULTIPLIER = 1
ARMOR_MATERIALS = {
wood = "default:wood",
cactus = "default:cactus",
steel = "default:steel_ingot",
bronze = "default:bronze_ingot",
diamond = "default:diamond",
gold = "default:gold_ingot",
mithril = "moreores:mithril_ingot",
}
local skin_mod = nil local skin_mod = nil
local inv_mod = nil local inv_mod = nil
@ -24,6 +33,10 @@ if input then
input:close() input:close()
input = nil input = nil
end end
if not minetest.get_modpath("moreores") then
ARMOR_MATERIALS.mithril = nil
end
local time = 0 local time = 0

View File

@ -2,212 +2,187 @@ ARMOR_MOD_NAME = minetest.get_current_modname()
dofile(minetest.get_modpath(ARMOR_MOD_NAME).."/armor.lua") dofile(minetest.get_modpath(ARMOR_MOD_NAME).."/armor.lua")
dofile(minetest.get_modpath(ARMOR_MOD_NAME).."/admin.lua") dofile(minetest.get_modpath(ARMOR_MOD_NAME).."/admin.lua")
local use_moreores = minetest.get_modpath("moreores") if ARMOR_MATERIALS.wood then
minetest.register_tool("3d_armor:helmet_wood", {
description = "Wood Helmet",
inventory_image = "3d_armor_inv_helmet_wood.png",
groups = {armor_head=5, armor_heal=0, armor_use=2000},
wear = 0,
})
minetest.register_tool("3d_armor:chestplate_wood", {
description = "Wood Chestplate",
inventory_image = "3d_armor_inv_chestplate_wood.png",
groups = {armor_torso=10, armor_heal=0, armor_use=2000},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_wood", {
description = "Wood Leggings",
inventory_image = "3d_armor_inv_leggings_wood.png",
groups = {armor_legs=5, armor_heal=0, armor_use=2000},
wear = 0,
})
minetest.register_tool("3d_armor:boots_wood", {
description = "Wood Boots",
inventory_image = "3d_armor_inv_boots_wood.png",
groups = {armor_feet=5, armor_heal=0, armor_use=2000},
wear = 0,
})
end
-- Regisiter Head Armor if ARMOR_MATERIALS.cactus then
minetest.register_tool("3d_armor:helmet_cactus", {
description = "Cactuc Helmet",
inventory_image = "3d_armor_inv_helmet_cactus.png",
groups = {armor_head=5, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("3d_armor:chestplate_cactus", {
description = "Cactus Chestplate",
inventory_image = "3d_armor_inv_chestplate_cactus.png",
groups = {armor_torso=10, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_cactus", {
description = "Cactus Leggings",
inventory_image = "3d_armor_inv_leggings_cactus.png",
groups = {armor_legs=5, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("3d_armor:boots_cactus", {
description = "Cactus Boots",
inventory_image = "3d_armor_inv_boots_cactus.png",
groups = {armor_feet=5, armor_heal=0, armor_use=2000},
wear = 0,
})
end
minetest.register_tool("3d_armor:helmet_wood", { if ARMOR_MATERIALS.steel then
description = "Wood Helmet", minetest.register_tool("3d_armor:helmet_steel", {
inventory_image = "3d_armor_inv_helmet_wood.png", description = "Steel Helmet",
groups = {armor_head=5, armor_heal=0, armor_use=2000}, inventory_image = "3d_armor_inv_helmet_steel.png",
wear = 0, groups = {armor_head=10, armor_heal=0, armor_use=500},
}) wear = 0,
})
minetest.register_tool("3d_armor:chestplate_steel", {
description = "Steel Chestplate",
inventory_image = "3d_armor_inv_chestplate_steel.png",
groups = {armor_torso=15, armor_heal=0, armor_use=500},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_steel", {
description = "Steel Leggings",
inventory_image = "3d_armor_inv_leggings_steel.png",
groups = {armor_legs=15, armor_heal=0, armor_use=500},
wear = 0,
})
minetest.register_tool("3d_armor:boots_steel", {
description = "Steel Boots",
inventory_image = "3d_armor_inv_boots_steel.png",
groups = {armor_feet=10, armor_heal=0, armor_use=500},
wear = 0,
})
end
minetest.register_tool("3d_armor:helmet_cactus", { if ARMOR_MATERIALS.bronze then
description = "Cactuc Helmet", minetest.register_tool("3d_armor:helmet_bronze", {
inventory_image = "3d_armor_inv_helmet_cactus.png", description = "Bronze Helmet",
groups = {armor_head=5, armor_heal=0, armor_use=1000}, inventory_image = "3d_armor_inv_helmet_bronze.png",
wear = 0, groups = {armor_head=10, armor_heal=6, armor_use=250},
}) wear = 0,
})
minetest.register_tool("3d_armor:chestplate_bronze", {
description = "Bronze Chestplate",
inventory_image = "3d_armor_inv_chestplate_bronze.png",
groups = {armor_torso=15, armor_heal=6, armor_use=250},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_bronze", {
description = "Bronze Leggings",
inventory_image = "3d_armor_inv_leggings_bronze.png",
groups = {armor_legs=15, armor_heal=6, armor_use=250},
wear = 0,
})
minetest.register_tool("3d_armor:boots_bronze", {
description = "Bronze Boots",
inventory_image = "3d_armor_inv_boots_bronze.png",
groups = {armor_feet=10, armor_heal=6, armor_use=250},
wear = 0,
})
end
minetest.register_tool("3d_armor:helmet_steel", { if ARMOR_MATERIALS.diamond then
description = "Steel Helmet", minetest.register_tool("3d_armor:helmet_diamond", {
inventory_image = "3d_armor_inv_helmet_steel.png", description = "Diamond Helmet",
groups = {armor_head=10, armor_heal=0, armor_use=500}, inventory_image = "3d_armor_inv_helmet_diamond.png",
wear = 0, groups = {armor_head=15, armor_heal=12, armor_use=100},
}) wear = 0,
})
minetest.register_tool("3d_armor:chestplate_diamond", {
description = "Diamond Chestplate",
inventory_image = "3d_armor_inv_chestplate_diamond.png",
groups = {armor_torso=20, armor_heal=12, armor_use=100},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_diamond", {
description = "Diamond Leggings",
inventory_image = "3d_armor_inv_leggings_diamond.png",
groups = {armor_legs=20, armor_heal=12, armor_use=100},
wear = 0,
})
minetest.register_tool("3d_armor:boots_diamond", {
description = "Diamond Boots",
inventory_image = "3d_armor_inv_boots_diamond.png",
groups = {armor_feet=15, armor_heal=12, armor_use=100},
wear = 0,
})
end
minetest.register_tool("3d_armor:helmet_bronze", { if ARMOR_MATERIALS.gold then
description = "Bronze Helmet", minetest.register_tool("3d_armor:helmet_gold", {
inventory_image = "3d_armor_inv_helmet_bronze.png", description = "Gold Helmet",
groups = {armor_head=10, armor_heal=6, armor_use=250}, inventory_image = "3d_armor_inv_helmet_gold.png",
wear = 0, groups = {armor_head=10, armor_heal=6, armor_use=250},
}) wear = 0,
})
minetest.register_tool("3d_armor:chestplate_gold", {
description = "Gold Chestplate",
inventory_image = "3d_armor_inv_chestplate_gold.png",
groups = {armor_torso=15, armor_heal=6, armor_use=250},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_gold", {
description = "Gold Leggings",
inventory_image = "3d_armor_inv_leggings_gold.png",
groups = {armor_legs=15, armor_heal=6, armor_use=250},
wear = 0,
})
minetest.register_tool("3d_armor:boots_gold", {
description = "Gold Boots",
inventory_image = "3d_armor_inv_boots_gold.png",
groups = {armor_feet=10, armor_heal=6, armor_use=250},
wear = 0,
})
end
minetest.register_tool("3d_armor:helmet_diamond", { if ARMOR_MATERIALS.mithril then
description = "Diamond Helmet",
inventory_image = "3d_armor_inv_helmet_diamond.png",
groups = {armor_head=15, armor_heal=12, armor_use=100},
wear = 0,
})
minetest.register_tool("3d_armor:helmet_gold", {
description = "Gold Helmet",
inventory_image = "3d_armor_inv_helmet_gold.png",
groups = {armor_head=10, armor_heal=6, armor_use=250},
wear = 0,
})
if use_moreores then
minetest.register_tool("3d_armor:helmet_mithril", { minetest.register_tool("3d_armor:helmet_mithril", {
description = "Mithril Helmet", description = "Mithril Helmet",
inventory_image = "3d_armor_inv_helmet_mithril.png", inventory_image = "3d_armor_inv_helmet_mithril.png",
groups = {armor_head=15, armor_heal=12, armor_use=50}, groups = {armor_head=15, armor_heal=12, armor_use=50},
wear = 0, wear = 0,
}) })
end
-- Regisiter Torso Armor
minetest.register_tool("3d_armor:chestplate_wood", {
description = "Wood Chestplate",
inventory_image = "3d_armor_inv_chestplate_wood.png",
groups = {armor_torso=10, armor_heal=0, armor_use=2000},
wear = 0,
})
minetest.register_tool("3d_armor:chestplate_cactus", {
description = "Cactus Chestplate",
inventory_image = "3d_armor_inv_chestplate_cactus.png",
groups = {armor_torso=10, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("3d_armor:chestplate_steel", {
description = "Steel Chestplate",
inventory_image = "3d_armor_inv_chestplate_steel.png",
groups = {armor_torso=15, armor_heal=0, armor_use=500},
wear = 0,
})
minetest.register_tool("3d_armor:chestplate_bronze", {
description = "Bronze Chestplate",
inventory_image = "3d_armor_inv_chestplate_bronze.png",
groups = {armor_torso=15, armor_heal=6, armor_use=250},
wear = 0,
})
minetest.register_tool("3d_armor:chestplate_diamond", {
description = "Diamond Chestplate",
inventory_image = "3d_armor_inv_chestplate_diamond.png",
groups = {armor_torso=20, armor_heal=12, armor_use=100},
wear = 0,
})
minetest.register_tool("3d_armor:chestplate_gold", {
description = "Gold Chestplate",
inventory_image = "3d_armor_inv_chestplate_gold.png",
groups = {armor_torso=15, armor_heal=6, armor_use=250},
wear = 0,
})
if use_moreores then
minetest.register_tool("3d_armor:chestplate_mithril", { minetest.register_tool("3d_armor:chestplate_mithril", {
description = "Mithril Chestplate", description = "Mithril Chestplate",
inventory_image = "3d_armor_inv_chestplate_mithril.png", inventory_image = "3d_armor_inv_chestplate_mithril.png",
groups = {armor_torso=20, armor_heal=12, armor_use=50}, groups = {armor_torso=20, armor_heal=12, armor_use=50},
wear = 0, wear = 0,
}) })
end
-- Regisiter Leg Armor
minetest.register_tool("3d_armor:leggings_wood", {
description = "Wood Leggings",
inventory_image = "3d_armor_inv_leggings_wood.png",
groups = {armor_legs=5, armor_heal=0, armor_use=2000},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_cactus", {
description = "Cactus Leggings",
inventory_image = "3d_armor_inv_leggings_cactus.png",
groups = {armor_legs=5, armor_heal=0, armor_use=1000},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_steel", {
description = "Steel Leggings",
inventory_image = "3d_armor_inv_leggings_steel.png",
groups = {armor_legs=15, armor_heal=0, armor_use=500},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_bronze", {
description = "Bronze Leggings",
inventory_image = "3d_armor_inv_leggings_bronze.png",
groups = {armor_legs=15, armor_heal=6, armor_use=250},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_diamond", {
description = "Diamond Leggings",
inventory_image = "3d_armor_inv_leggings_diamond.png",
groups = {armor_legs=20, armor_heal=12, armor_use=100},
wear = 0,
})
minetest.register_tool("3d_armor:leggings_gold", {
description = "Gold Leggings",
inventory_image = "3d_armor_inv_leggings_gold.png",
groups = {armor_legs=15, armor_heal=6, armor_use=250},
wear = 0,
})
if use_moreores then
minetest.register_tool("3d_armor:leggings_mithril", { minetest.register_tool("3d_armor:leggings_mithril", {
description = "Mithril Leggings", description = "Mithril Leggings",
inventory_image = "3d_armor_inv_leggings_mithril.png", inventory_image = "3d_armor_inv_leggings_mithril.png",
groups = {armor_legs=20, armor_heal=12, armor_use=50}, groups = {armor_legs=20, armor_heal=12, armor_use=50},
wear = 0, wear = 0,
}) })
end
-- Regisiter Boots
minetest.register_tool("3d_armor:boots_wood", {
description = "Wood Boots",
inventory_image = "3d_armor_inv_boots_wood.png",
groups = {armor_feet=5, armor_heal=0, armor_use=2000},
wear = 0,
})
minetest.register_tool("3d_armor:boots_cactus", {
description = "Cactus Boots",
inventory_image = "3d_armor_inv_boots_cactus.png",
groups = {armor_feet=5, armor_heal=0, armor_use=2000},
wear = 0,
})
minetest.register_tool("3d_armor:boots_steel", {
description = "Steel Boots",
inventory_image = "3d_armor_inv_boots_steel.png",
groups = {armor_feet=10, armor_heal=0, armor_use=500},
wear = 0,
})
minetest.register_tool("3d_armor:boots_bronze", {
description = "Bronze Boots",
inventory_image = "3d_armor_inv_boots_bronze.png",
groups = {armor_feet=10, armor_heal=6, armor_use=250},
wear = 0,
})
minetest.register_tool("3d_armor:boots_diamond", {
description = "Diamond Boots",
inventory_image = "3d_armor_inv_boots_diamond.png",
groups = {armor_feet=15, armor_heal=12, armor_use=100},
wear = 0,
})
minetest.register_tool("3d_armor:boots_gold", {
description = "Gold Boots",
inventory_image = "3d_armor_inv_boots_gold.png",
groups = {armor_feet=10, armor_heal=6, armor_use=250},
wear = 0,
})
if use_moreores then
minetest.register_tool("3d_armor:boots_mithril", { minetest.register_tool("3d_armor:boots_mithril", {
description = "Mithril Boots", description = "Mithril Boots",
inventory_image = "3d_armor_inv_boots_mithril.png", inventory_image = "3d_armor_inv_boots_mithril.png",
@ -216,22 +191,7 @@ if use_moreores then
}) })
end end
-- Register Craft Recipies for k, v in pairs(ARMOR_MATERIALS) do
local craft_ingreds = {
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 = "3d_armor:helmet_"..k, output = "3d_armor:helmet_"..k,
recipe = { recipe = {