|
|
|
@ -6,6 +6,8 @@ armor.materials.reinforcedleather = "3d_armor:reinforcedleather"
|
|
|
|
|
armor.materials.hardenedleather = "3d_armor:hardenedleather"
|
|
|
|
|
armor.materials.blackmithril = "3d_armor:blackmithril_ingot"
|
|
|
|
|
|
|
|
|
|
local S = minetest.get_translator("3d_armor_classes")
|
|
|
|
|
|
|
|
|
|
-- Load Configuration
|
|
|
|
|
|
|
|
|
|
for name, config in pairs(armor.config) do
|
|
|
|
@ -26,10 +28,39 @@ for material, _ in pairs(armor.materials) do
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Function to change max stamina if hbsprint is present
|
|
|
|
|
local mod_hbsprint = minetest.get_modpath("hbsprint") ~= nil
|
|
|
|
|
local function change_stamina_max(player, value)
|
|
|
|
|
if mod_hbsprint then
|
|
|
|
|
local new_max = value + hb.get_hudtable("stamina").hudstate[player:get_player_name()].max
|
|
|
|
|
local val = player:get_meta():get_float("hbsprint:stamina")
|
|
|
|
|
if val > new_max then
|
|
|
|
|
player:get_meta():set_float("hbsprint:stamina", new_max)
|
|
|
|
|
hb.change_hudbar(player, "stamina", new_max, new_max)
|
|
|
|
|
elseif val <= new_max then
|
|
|
|
|
hb.unhide_hudbar(player, "stamina")
|
|
|
|
|
hb.change_hudbar(player, "stamina", nil, new_max)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local mod_hb = minetest.get_modpath("hudbars") ~= nil
|
|
|
|
|
local function change_hp_max(player, value)
|
|
|
|
|
local hp_max = player:get_properties().hp_max
|
|
|
|
|
local hp = player:get_hp()
|
|
|
|
|
local new_max = hp_max + value
|
|
|
|
|
if hp > new_max then
|
|
|
|
|
player:set_hp(new_max, {type="set_hp", from="mod"})
|
|
|
|
|
if mod_hb then
|
|
|
|
|
hb.change_hudbar(player, "health", new_max, new_max)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
player:set_properties({hp_max = new_max})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Reinforced Leather
|
|
|
|
|
minetest.register_craftitem(":3d_armor:reinforcedleather", {
|
|
|
|
|
description = "Reinforced Leather",
|
|
|
|
|
description = S("Reinforced Leather"),
|
|
|
|
|
inventory_image = "3d_armor_reinforcedleather.png",
|
|
|
|
|
stack_max = 99,
|
|
|
|
|
})
|
|
|
|
@ -46,45 +77,70 @@ minetest.register_craft({
|
|
|
|
|
if armor.materials.reinforcedleather then
|
|
|
|
|
-- Register helmets :
|
|
|
|
|
armor:register_armor(":3d_armor:helmet_reinforcedleather", {
|
|
|
|
|
description = "Reinforced Leather Helmet (Hunter)",
|
|
|
|
|
description = S("Reinforced Leather Helmet (@1)", S("Hunter")),
|
|
|
|
|
inventory_image = "3d_armor_inv_helmet_reinforcedleather.png",
|
|
|
|
|
groups = {armor_head=1, armor_use=40, physics_speed=0.02, physics_gravity=-0.02},
|
|
|
|
|
armor_groups = {fleshy=6},
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=2}
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=2},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, 2)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, -2)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register chestplates :
|
|
|
|
|
armor:register_armor(":3d_armor:chestplate_reinforcedleather", {
|
|
|
|
|
description = "Reinforced Leather Chestplate (Hunter)",
|
|
|
|
|
description = S("Reinforced Leather Chestplate (@1)", S("Hunter")),
|
|
|
|
|
inventory_image = "3d_armor_inv_chestplate_reinforcedleather.png",
|
|
|
|
|
groups = {armor_torso = 1, armor_use = 40, physics_speed=0.08, physics_gravity=-0.08},
|
|
|
|
|
armor_groups = {fleshy=11},
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=2}
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=2},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, 8)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, -8)
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register leggings :
|
|
|
|
|
armor:register_armor(":3d_armor:leggings_reinforcedleather", {
|
|
|
|
|
description = "Reinforced Leather Leggings (Hunter)",
|
|
|
|
|
description = S("Reinforced Leather Leggings (@1)", S("Hunter")),
|
|
|
|
|
inventory_image = "3d_armor_inv_leggings_reinforcedleather.png",
|
|
|
|
|
groups = {armor_legs = 1, armor_use = 40, physics_speed=0.06, physics_gravity=-0.06},
|
|
|
|
|
armor_groups = {fleshy=11},
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=2}
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=2},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, 6)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, -6)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register boots :
|
|
|
|
|
armor:register_armor(":3d_armor:boots_reinforcedleather", {
|
|
|
|
|
description = "Reinforced Leather Boots (Hunter)",
|
|
|
|
|
description = S("Reinforced Leather Boots (@1)", S("Hunter")),
|
|
|
|
|
inventory_image = "3d_armor_inv_boots_reinforcedleather.png",
|
|
|
|
|
groups = {armor_feet = 1, armor_use = 40, physics_speed=0.02, physics_gravity=-0.02},
|
|
|
|
|
armor_groups = {fleshy=6},
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=3}
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=3},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, 2)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, -2)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Hardened Leather
|
|
|
|
|
minetest.register_craftitem(":3d_armor:hardenedleather", {
|
|
|
|
|
description = "Hardened Leather",
|
|
|
|
|
description = S("Hardened Leather"),
|
|
|
|
|
inventory_image = "3d_armor_hardenedleather.png",
|
|
|
|
|
stack_max = 99,
|
|
|
|
|
})
|
|
|
|
@ -101,44 +157,68 @@ minetest.register_craft({
|
|
|
|
|
if armor.materials.hardenedleather then
|
|
|
|
|
-- Register helmets :
|
|
|
|
|
armor:register_armor(":3d_armor:helmet_hardenedleather", {
|
|
|
|
|
description = "Hardened Leather Helmet (Hunter)",
|
|
|
|
|
description = S("Hardened Leather Helmet (@1)", S("Hunter")),
|
|
|
|
|
inventory_image = "3d_armor_inv_helmet_hardenedleather.png",
|
|
|
|
|
groups = {armor_head = 1, armor_use = 250, physics_speed=0.01, physics_gravity=-0.01},
|
|
|
|
|
armor_groups = {fleshy=5},
|
|
|
|
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2}
|
|
|
|
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, 1)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, -1)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register chestplates :
|
|
|
|
|
armor:register_armor(":3d_armor:chestplate_hardenedleather", {
|
|
|
|
|
description = "Hardened Leather Chestplate (Hunter)",
|
|
|
|
|
description = S("Hardened Leather Chestplate (@1)", S("Hunter")),
|
|
|
|
|
inventory_image = "3d_armor_inv_chestplate_hardenedleather.png",
|
|
|
|
|
groups = {armor_torso = 1, armor_use = 250, physics_speed=0.04, physics_gravity=-0.04},
|
|
|
|
|
armor_groups = {fleshy=8},
|
|
|
|
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2}
|
|
|
|
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, 4)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, -4)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register leggings :
|
|
|
|
|
armor:register_armor(":3d_armor:leggings_hardenedleather", {
|
|
|
|
|
description = "Hardened Leather Leggings (Hunter)",
|
|
|
|
|
description = S("Hardened Leather Leggings (@1)", S("Hunter")),
|
|
|
|
|
inventory_image = "3d_armor_inv_leggings_hardenedleather.png",
|
|
|
|
|
groups = {armor_legs = 1, armor_use = 250, physics_speed=0.03, physics_gravity=-0.03},
|
|
|
|
|
armor_groups = {fleshy=8},
|
|
|
|
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2}
|
|
|
|
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, 3)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, -3)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register boots :
|
|
|
|
|
armor:register_armor(":3d_armor:boots_hardenedleather", {
|
|
|
|
|
description = "Hardened Leather Boots (Hunter)",
|
|
|
|
|
description = S("Hardened Leather Boots (@1)", S("Hunter")),
|
|
|
|
|
inventory_image = "3d_armor_inv_boots_hardenedleather.png",
|
|
|
|
|
groups = {armor_feet = 1, armor_use = 250, physics_speed=0.01, physics_gravity=-0.01},
|
|
|
|
|
armor_groups = {fleshy=5},
|
|
|
|
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2}
|
|
|
|
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, 1)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_stamina_max(player, -1)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- Black Mithril
|
|
|
|
|
minetest.register_craftitem(":3d_armor:blackmithril_ingot", {
|
|
|
|
|
description = "Black Mithril Ingot",
|
|
|
|
|
description = S("Black Mithril Ingot"),
|
|
|
|
|
inventory_image = "3d_armor_blackmithril_ingot.png",
|
|
|
|
|
stack_max = 99,
|
|
|
|
|
groups = {ingot = 1}
|
|
|
|
@ -156,49 +236,79 @@ minetest.register_craft({
|
|
|
|
|
if armor.materials.blackmithril then
|
|
|
|
|
-- Register helmets :
|
|
|
|
|
armor:register_armor(":3d_armor:helmet_blackmithril", {
|
|
|
|
|
description = "Black Mithril Helmet (Warrior)",
|
|
|
|
|
description = S("Black Mithril Helmet (@1)", S("Warrior")),
|
|
|
|
|
inventory_image = "3d_armor_inv_helmet_blackmithril.png",
|
|
|
|
|
groups = {armor_head = 1, armor_heal = 15, armor_use = 40},
|
|
|
|
|
armor_groups = {fleshy=16},
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, level=3}
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, level=3},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, 1)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, -1)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register chestplates :
|
|
|
|
|
armor:register_armor(":3d_armor:chestplate_blackmithril", {
|
|
|
|
|
description = "Black Mithril Chestplate (Warrior)",
|
|
|
|
|
description = S("Black Mithril Chestplate (@1)", S("Warrior")),
|
|
|
|
|
inventory_image = "3d_armor_inv_chestplate_blackmithril.png",
|
|
|
|
|
groups = {armor_torso = 1, armor_heal = 15, armor_use = 40},
|
|
|
|
|
armor_groups = {fleshy=22},
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, level=3}
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, level=3},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, 5)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, -5)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register leggings :
|
|
|
|
|
armor:register_armor(":3d_armor:leggings_blackmithril", {
|
|
|
|
|
description = "Black Mithril Leggings (Warrior)",
|
|
|
|
|
description = S("Black Mithril Leggings (@1)", S("Warrior")),
|
|
|
|
|
inventory_image = "3d_armor_inv_leggings_blackmithril.png",
|
|
|
|
|
groups = {armor_legs = 1, armor_heal = 15, armor_use = 40},
|
|
|
|
|
armor_groups = {fleshy=22},
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, level=3}
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, level=3},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, 3)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, -3)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register boots :
|
|
|
|
|
armor:register_armor(":3d_armor:boots_blackmithril", {
|
|
|
|
|
description = "Black Mithril Boots (Warrior)",
|
|
|
|
|
description = S("Black Mithril Boots (@1)", S("Warrior")),
|
|
|
|
|
inventory_image = "3d_armor_inv_boots_blackmithril.png",
|
|
|
|
|
groups = {armor_feet = 1, armor_heal = 15, armor_use = 40},
|
|
|
|
|
armor_groups = {fleshy=16},
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, level=3}
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, level=3},
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, 1)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, -1)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Register shield :
|
|
|
|
|
armor:register_armor(":shields:shield_blackmithril", {
|
|
|
|
|
description = "Black Mithril Shield (warrior)",
|
|
|
|
|
description = S("Black Mithril Shield (@1)", S("Warrior")),
|
|
|
|
|
inventory_image = "shields_inv_shield_black_mithril_warrior.png",
|
|
|
|
|
groups = {armor_shield=15, armor_heal=0, armor_use=50},
|
|
|
|
|
armor_groups = {fleshy=16},
|
|
|
|
|
damage_groups = {cracky=2, snappy=1, level=3},
|
|
|
|
|
reciprocate_damage = true,
|
|
|
|
|
})
|
|
|
|
|
on_equip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, 5)
|
|
|
|
|
end,
|
|
|
|
|
on_unequip = function(player, index, stack)
|
|
|
|
|
change_hp_max(player, -5)
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for k, v in pairs(armor.materials) do
|
|
|
|
|