forked from mtcontrib/3d_armor
Add punch damage groups and effects
This commit is contained in:
parent
1e059f2557
commit
0ec7858937
@ -69,12 +69,33 @@ armor_water_protect = true
|
|||||||
-- Enable fire protection (defaults true if using ethereal mod)
|
-- Enable fire protection (defaults true if using ethereal mod)
|
||||||
armor_fire_protect = false
|
armor_fire_protect = false
|
||||||
|
|
||||||
|
-- Enable punch damage effects (only works for armor with `damage_groups` table)
|
||||||
|
armor_punch_damage = true
|
||||||
|
|
||||||
API
|
API
|
||||||
---
|
---
|
||||||
|
|
||||||
Armor Registration:
|
Armor Registration:
|
||||||
|
|
||||||
armor:register_armor(name, def)
|
armor:register_armor(name, def)
|
||||||
|
|
||||||
|
Wrapper function for `minetest.register_tool`, while registering armor as
|
||||||
|
a tool item is still supported, this may be deprecated in future so new code
|
||||||
|
should use this method.
|
||||||
|
|
||||||
|
Additional fields supported by 3d_armor:
|
||||||
|
|
||||||
|
texture = <filename>
|
||||||
|
preview = <filename>
|
||||||
|
armor_groups = <table>
|
||||||
|
damage_groups = <table>
|
||||||
|
reciprocate_damage = <bool>
|
||||||
|
on_equip = <function>
|
||||||
|
on_unequip = <function>
|
||||||
|
on_destroy = <function>
|
||||||
|
on_damage = <function>
|
||||||
|
on_punch = <function>
|
||||||
|
|
||||||
armor:register_armor_group(group, base)
|
armor:register_armor_group(group, base)
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@ -86,12 +107,19 @@ armor:register_armor("mod_name:speed_boots", {
|
|||||||
inventory_image = "mod_name_speed_boots_inv.png",
|
inventory_image = "mod_name_speed_boots_inv.png",
|
||||||
texture = "mod_name_speed_boots.png",
|
texture = "mod_name_speed_boots.png",
|
||||||
preview = "mod_name_speed_boots_preview.png",
|
preview = "mod_name_speed_boots_preview.png",
|
||||||
|
groups = {armor_feet=1, armor_use=500},
|
||||||
armor_groups = {fleshy=10, radiation=10},
|
armor_groups = {fleshy=10, radiation=10},
|
||||||
groups = {armor_feet=1, physics_speed=0.5, armor_use=2000},
|
damage_groups = {cracky=3, snappy=3, choppy=3, crumbly=3, level=1},
|
||||||
|
reciprocate_damage = true,
|
||||||
on_destroy = function(player, item_name)
|
on_destroy = function(player, item_name)
|
||||||
minetest.sound_play("mod_name_break_sound", {
|
local pos = player:get_pos()
|
||||||
to_player = player:get_player_name(),
|
if pos then
|
||||||
|
minetest.sound_play({
|
||||||
|
name = "mod_name_break_sound",
|
||||||
|
pos = pos,
|
||||||
|
gain = 0.5,
|
||||||
})
|
})
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -109,13 +137,23 @@ Notes:
|
|||||||
Elements may be modified by dependent mods, eg shields adds armor_shield.
|
Elements may be modified by dependent mods, eg shields adds armor_shield.
|
||||||
Attributes and physics values are 'stackable', durability is determined
|
Attributes and physics values are 'stackable', durability is determined
|
||||||
by the level of armor_use, total uses == approx (65535/armor_use), non-fleshy
|
by the level of armor_use, total uses == approx (65535/armor_use), non-fleshy
|
||||||
damage groups need to be defined in the tool/weapon used against the player
|
damage groups need to be defined in the tool/weapon used against the player.
|
||||||
|
|
||||||
|
Reciprocal tool damage will be done only by the first armor inventory item
|
||||||
|
with `reciprocate_damage = true`
|
||||||
|
|
||||||
Item Callbacks:
|
Item Callbacks:
|
||||||
|
|
||||||
on_equip = func(player, stack)
|
on_equip = func(player, stack)
|
||||||
on_unequip = func(player, stack)
|
on_unequip = func(player, stack)
|
||||||
on_destroy = func(player, stack)
|
on_destroy = func(player, stack)
|
||||||
|
on_damage = func(player, stack)
|
||||||
|
on_punch = func(player, hitter, time_from_last_punch, tool_capabilities)
|
||||||
|
|
||||||
|
Notes: on_punch is called every time the player takes damage, `hitter`,
|
||||||
|
`time_from_last_punch` and `tool_capabilities` can be `nil` and will be in the
|
||||||
|
case of fall damage, etc. Return `false` to override armor damage effects.
|
||||||
|
When armor is destroyed `stack` will contain a copy of the previous stack.
|
||||||
|
|
||||||
Global Callbacks:
|
Global Callbacks:
|
||||||
|
|
||||||
|
@ -43,6 +43,7 @@ armor = {
|
|||||||
on_update = {},
|
on_update = {},
|
||||||
on_equip = {},
|
on_equip = {},
|
||||||
on_unequip = {},
|
on_unequip = {},
|
||||||
|
on_damage = {},
|
||||||
on_destroy = {},
|
on_destroy = {},
|
||||||
},
|
},
|
||||||
version = "0.4.8",
|
version = "0.4.8",
|
||||||
@ -67,7 +68,8 @@ armor.config = {
|
|||||||
material_mithril = true,
|
material_mithril = true,
|
||||||
material_crystal = true,
|
material_crystal = true,
|
||||||
water_protect = true,
|
water_protect = true,
|
||||||
fire_protect = minetest.get_modpath("ethereal") ~= nil
|
fire_protect = minetest.get_modpath("ethereal") ~= nil,
|
||||||
|
punch_damage = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Armor Registration
|
-- Armor Registration
|
||||||
@ -104,6 +106,12 @@ armor.register_on_unequip = function(self, func)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
armor.register_on_damage = function(self, func)
|
||||||
|
if type(func) == "function" then
|
||||||
|
table.insert(self.registered_callbacks.on_damage, func)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
armor.register_on_destroy = function(self, func)
|
armor.register_on_destroy = function(self, func)
|
||||||
if type(func) == "function" then
|
if type(func) == "function" then
|
||||||
table.insert(self.registered_callbacks.on_destroy, func)
|
table.insert(self.registered_callbacks.on_destroy, func)
|
||||||
@ -259,6 +267,84 @@ armor.set_player_armor = function(self, player)
|
|||||||
self:run_callbacks("on_update", player)
|
self:run_callbacks("on_update", player)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabilities)
|
||||||
|
local name, player_inv = self:get_valid_player(player, "[punch]")
|
||||||
|
if not name then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local state = 0
|
||||||
|
local count = 0
|
||||||
|
local recip = true
|
||||||
|
local default_groups = {cracky=3, snappy=3, choppy=3, crumbly=3, level=1}
|
||||||
|
local list = player_inv:get_list("armor")
|
||||||
|
for i, stack in pairs(list) do
|
||||||
|
if stack:get_count() == 1 then
|
||||||
|
local name = stack:get_name()
|
||||||
|
local use = minetest.get_item_group(name, "armor_use") or 0
|
||||||
|
local damage = use > 0
|
||||||
|
local def = stack:get_definition() or {}
|
||||||
|
if type(def.on_punch) == "function" then
|
||||||
|
damage = def.on_punch(player, hitter, time_from_last_punch,
|
||||||
|
tool_capabilities) ~= false
|
||||||
|
end
|
||||||
|
if damage == true and tool_capabilities then
|
||||||
|
local damage_groups = def.damage_groups or default_groups
|
||||||
|
local level = damage_groups.level or 0
|
||||||
|
local groupcaps = tool_capabilities.groupcaps or {}
|
||||||
|
local uses = 0
|
||||||
|
damage = false
|
||||||
|
for group, caps in pairs(groupcaps) do
|
||||||
|
local maxlevel = caps.maxlevel or 0
|
||||||
|
local diff = maxlevel - level
|
||||||
|
if diff == 0 then
|
||||||
|
diff = 1
|
||||||
|
end
|
||||||
|
if diff > 0 and caps.times then
|
||||||
|
local group_level = damage_groups[group]
|
||||||
|
if group_level then
|
||||||
|
local time = caps.times[group_level]
|
||||||
|
if time then
|
||||||
|
local dt = time_from_last_punch or 0
|
||||||
|
if dt > time / diff then
|
||||||
|
if caps.uses then
|
||||||
|
uses = caps.uses * math.pow(3, diff)
|
||||||
|
end
|
||||||
|
damage = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if damage == true and recip == true and hitter and
|
||||||
|
def.reciprocate_damage == true and uses > 0 then
|
||||||
|
local item = hitter:get_wielded_item()
|
||||||
|
local wear = 65535 / uses
|
||||||
|
item:add_wear(wear)
|
||||||
|
hitter:set_wielded_item(item)
|
||||||
|
-- reciprocate tool damage only once
|
||||||
|
recip = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if damage == true then
|
||||||
|
local old_stack = ItemStack(stack)
|
||||||
|
stack:add_wear(use)
|
||||||
|
self:set_inventory_stack(player, i, stack)
|
||||||
|
self:run_callbacks("on_damage", player, stack)
|
||||||
|
if stack:get_count() == 0 then
|
||||||
|
self:run_callbacks("on_unequip", player, old_stack)
|
||||||
|
self:run_callbacks("on_destroy", player, old_stack)
|
||||||
|
self:set_player_armor(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
state = state + stack:get_wear()
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.def[name].state = state
|
||||||
|
self.def[name].count = items
|
||||||
|
end
|
||||||
|
|
||||||
armor.get_player_skin = function(self, name)
|
armor.get_player_skin = function(self, name)
|
||||||
local skin = nil
|
local skin = nil
|
||||||
if self.skin_mod == "skins" or self.skin_mod == "simple_skins" then
|
if self.skin_mod == "skins" or self.skin_mod == "simple_skins" then
|
||||||
@ -363,3 +449,4 @@ armor.drop_armor = function(pos, stack)
|
|||||||
obj:setvelocity({x=math.random(-1, 1), y=5, z=math.random(-1, 1)})
|
obj:setvelocity({x=math.random(-1, 1), y=5, z=math.random(-1, 1)})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3,11 +3,6 @@ if minetest.global_exists("intllib") then
|
|||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_alias("adminboots","3d_armor:boots_admin")
|
|
||||||
minetest.register_alias("adminhelmet","3d_armor:helmet_admin")
|
|
||||||
minetest.register_alias("adminchestplate","3d_armor:chestplate_admin")
|
|
||||||
minetest.register_alias("adminleggings","3d_armor:leggings_admin")
|
|
||||||
|
|
||||||
armor:register_armor("3d_armor:helmet_admin", {
|
armor:register_armor("3d_armor:helmet_admin", {
|
||||||
description = S("Admin Helmet"),
|
description = S("Admin Helmet"),
|
||||||
inventory_image = "3d_armor_inv_helmet_admin.png",
|
inventory_image = "3d_armor_inv_helmet_admin.png",
|
||||||
@ -52,29 +47,38 @@ armor:register_armor("3d_armor:boots_admin", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_alias("adminboots","3d_armor:boots_admin")
|
||||||
|
minetest.register_alias("adminhelmet","3d_armor:helmet_admin")
|
||||||
|
minetest.register_alias("adminchestplate","3d_armor:chestplate_admin")
|
||||||
|
minetest.register_alias("adminleggings","3d_armor:leggings_admin")
|
||||||
|
|
||||||
if armor.materials.wood then
|
if armor.materials.wood then
|
||||||
armor:register_armor("3d_armor:helmet_wood", {
|
armor:register_armor("3d_armor:helmet_wood", {
|
||||||
description = S("Wood Helmet"),
|
description = S("Wood Helmet"),
|
||||||
inventory_image = "3d_armor_inv_helmet_wood.png",
|
inventory_image = "3d_armor_inv_helmet_wood.png",
|
||||||
armor_groups = {fleshy=5},
|
|
||||||
groups = {armor_head=1, armor_heal=0, armor_use=2000},
|
groups = {armor_head=1, armor_heal=0, armor_use=2000},
|
||||||
|
armor_groups = {fleshy=5},
|
||||||
|
damage_groups = {cracky=3, snappy=2, choppy=3, crumbly=2, level=1},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:chestplate_wood", {
|
armor:register_armor("3d_armor:chestplate_wood", {
|
||||||
description = S("Wood Chestplate"),
|
description = S("Wood Chestplate"),
|
||||||
inventory_image = "3d_armor_inv_chestplate_wood.png",
|
inventory_image = "3d_armor_inv_chestplate_wood.png",
|
||||||
armor_groups = {fleshy=10},
|
|
||||||
groups = {armor_torso=1, armor_heal=0, armor_use=2000},
|
groups = {armor_torso=1, armor_heal=0, armor_use=2000},
|
||||||
|
armor_groups = {fleshy=10},
|
||||||
|
damage_groups = {cracky=3, snappy=2, choppy=3, crumbly=2, level=1},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:leggings_wood", {
|
armor:register_armor("3d_armor:leggings_wood", {
|
||||||
description = S("Wood Leggings"),
|
description = S("Wood Leggings"),
|
||||||
inventory_image = "3d_armor_inv_leggings_wood.png",
|
inventory_image = "3d_armor_inv_leggings_wood.png",
|
||||||
armor_groups = {fleshy=5},
|
|
||||||
groups = {armor_legs=1, armor_heal=0, armor_use=2000},
|
groups = {armor_legs=1, armor_heal=0, armor_use=2000},
|
||||||
|
armor_groups = {fleshy=5},
|
||||||
|
damage_groups = {cracky=3, snappy=2, choppy=3, crumbly=2, level=1},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:boots_wood", {
|
armor:register_armor("3d_armor:boots_wood", {
|
||||||
description = S("Wood Boots"),
|
description = S("Wood Boots"),
|
||||||
inventory_image = "3d_armor_inv_boots_wood.png",
|
inventory_image = "3d_armor_inv_boots_wood.png",
|
||||||
armor_groups = {fleshy=5},
|
armor_groups = {fleshy=5},
|
||||||
|
damage_groups = {cracky=3, snappy=2, choppy=3, crumbly=2, level=1},
|
||||||
groups = {armor_feet=1, armor_heal=0, armor_use=2000},
|
groups = {armor_feet=1, armor_heal=0, armor_use=2000},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -83,26 +87,30 @@ if armor.materials.cactus then
|
|||||||
armor:register_armor("3d_armor:helmet_cactus", {
|
armor:register_armor("3d_armor:helmet_cactus", {
|
||||||
description = S("Cactus Helmet"),
|
description = S("Cactus Helmet"),
|
||||||
inventory_image = "3d_armor_inv_helmet_cactus.png",
|
inventory_image = "3d_armor_inv_helmet_cactus.png",
|
||||||
armor_groups = {fleshy=5},
|
|
||||||
groups = {armor_head=1, armor_heal=0, armor_use=1000},
|
groups = {armor_head=1, armor_heal=0, armor_use=1000},
|
||||||
|
armor_groups = {fleshy=5},
|
||||||
|
damage_groups = {cracky=3, snappy=3, choppy=2, crumbly=2, level=1},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:chestplate_cactus", {
|
armor:register_armor("3d_armor:chestplate_cactus", {
|
||||||
description = S("Cactus Chestplate"),
|
description = S("Cactus Chestplate"),
|
||||||
inventory_image = "3d_armor_inv_chestplate_cactus.png",
|
inventory_image = "3d_armor_inv_chestplate_cactus.png",
|
||||||
armor_groups = {fleshy=10},
|
|
||||||
groups = {armor_torso=1, armor_heal=0, armor_use=1000},
|
groups = {armor_torso=1, armor_heal=0, armor_use=1000},
|
||||||
|
armor_groups = {fleshy=10},
|
||||||
|
damage_groups = {cracky=3, snappy=3, choppy=2, crumbly=2, level=1},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:leggings_cactus", {
|
armor:register_armor("3d_armor:leggings_cactus", {
|
||||||
description = S("Cactus Leggings"),
|
description = S("Cactus Leggings"),
|
||||||
inventory_image = "3d_armor_inv_leggings_cactus.png",
|
inventory_image = "3d_armor_inv_leggings_cactus.png",
|
||||||
armor_groups = {fleshy=5},
|
|
||||||
groups = {armor_legs=1, armor_heal=0, armor_use=1000},
|
groups = {armor_legs=1, armor_heal=0, armor_use=1000},
|
||||||
|
armor_groups = {fleshy=5},
|
||||||
|
damage_groups = {cracky=3, snappy=3, choppy=2, crumbly=2, level=1},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:boots_cactus", {
|
armor:register_armor("3d_armor:boots_cactus", {
|
||||||
description = S("Cactus Boots"),
|
description = S("Cactus Boots"),
|
||||||
inventory_image = "3d_armor_inv_boots_cactus.png",
|
inventory_image = "3d_armor_inv_boots_cactus.png",
|
||||||
armor_groups = {fleshy=5},
|
|
||||||
groups = {armor_feet=1, armor_heal=0, armor_use=1000},
|
groups = {armor_feet=1, armor_heal=0, armor_use=1000},
|
||||||
|
armor_groups = {fleshy=5},
|
||||||
|
damage_groups = {cracky=3, snappy=3, choppy=2, crumbly=2, level=1},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -110,26 +118,30 @@ if armor.materials.steel then
|
|||||||
armor:register_armor("3d_armor:helmet_steel", {
|
armor:register_armor("3d_armor:helmet_steel", {
|
||||||
description = S("Steel Helmet"),
|
description = S("Steel Helmet"),
|
||||||
inventory_image = "3d_armor_inv_helmet_steel.png",
|
inventory_image = "3d_armor_inv_helmet_steel.png",
|
||||||
|
groups = {armor_head=1, armor_heal=0, armor_use=800},
|
||||||
armor_groups = {fleshy=10},
|
armor_groups = {fleshy=10},
|
||||||
groups = {armor_head=1, armor_heal=0, armor_use=500},
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:chestplate_steel", {
|
armor:register_armor("3d_armor:chestplate_steel", {
|
||||||
description = S("Steel Chestplate"),
|
description = S("Steel Chestplate"),
|
||||||
inventory_image = "3d_armor_inv_chestplate_steel.png",
|
inventory_image = "3d_armor_inv_chestplate_steel.png",
|
||||||
|
groups = {armor_torso=1, armor_heal=0, armor_use=800},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_torso=1, armor_heal=0, armor_use=500},
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:leggings_steel", {
|
armor:register_armor("3d_armor:leggings_steel", {
|
||||||
description = S("Steel Leggings"),
|
description = S("Steel Leggings"),
|
||||||
inventory_image = "3d_armor_inv_leggings_steel.png",
|
inventory_image = "3d_armor_inv_leggings_steel.png",
|
||||||
|
groups = {armor_legs=1, armor_heal=0, armor_use=800},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_legs=1, armor_heal=0, armor_use=500},
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:boots_steel", {
|
armor:register_armor("3d_armor:boots_steel", {
|
||||||
description = S("Steel Boots"),
|
description = S("Steel Boots"),
|
||||||
inventory_image = "3d_armor_inv_boots_steel.png",
|
inventory_image = "3d_armor_inv_boots_steel.png",
|
||||||
|
groups = {armor_feet=1, armor_heal=0, armor_use=800},
|
||||||
armor_groups = {fleshy=10},
|
armor_groups = {fleshy=10},
|
||||||
groups = {armor_feet=1, armor_heal=0, armor_use=500},
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -137,26 +149,30 @@ if armor.materials.bronze then
|
|||||||
armor:register_armor("3d_armor:helmet_bronze", {
|
armor:register_armor("3d_armor:helmet_bronze", {
|
||||||
description = S("Bronze Helmet"),
|
description = S("Bronze Helmet"),
|
||||||
inventory_image = "3d_armor_inv_helmet_bronze.png",
|
inventory_image = "3d_armor_inv_helmet_bronze.png",
|
||||||
|
groups = {armor_head=1, armor_heal=6, armor_use=400},
|
||||||
armor_groups = {fleshy=10},
|
armor_groups = {fleshy=10},
|
||||||
groups = {armor_head=1, armor_heal=6, armor_use=250},
|
damage_groups = {cracky=3, snappy=2, choppy=2, crumbly=1, level=2},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:chestplate_bronze", {
|
armor:register_armor("3d_armor:chestplate_bronze", {
|
||||||
description = S("Bronze Chestplate"),
|
description = S("Bronze Chestplate"),
|
||||||
inventory_image = "3d_armor_inv_chestplate_bronze.png",
|
inventory_image = "3d_armor_inv_chestplate_bronze.png",
|
||||||
|
groups = {armor_torso=1, armor_heal=6, armor_use=400},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_torso=1, armor_heal=6, armor_use=250},
|
damage_groups = {cracky=3, snappy=2, choppy=2, crumbly=1, level=2},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:leggings_bronze", {
|
armor:register_armor("3d_armor:leggings_bronze", {
|
||||||
description = S("Bronze Leggings"),
|
description = S("Bronze Leggings"),
|
||||||
inventory_image = "3d_armor_inv_leggings_bronze.png",
|
inventory_image = "3d_armor_inv_leggings_bronze.png",
|
||||||
|
groups = {armor_legs=1, armor_heal=6, armor_use=400},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_legs=1, armor_heal=6, armor_use=250},
|
damage_groups = {cracky=3, snappy=2, choppy=2, crumbly=1, level=2},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:boots_bronze", {
|
armor:register_armor("3d_armor:boots_bronze", {
|
||||||
description = S("Bronze Boots"),
|
description = S("Bronze Boots"),
|
||||||
inventory_image = "3d_armor_inv_boots_bronze.png",
|
inventory_image = "3d_armor_inv_boots_bronze.png",
|
||||||
|
groups = {armor_feet=1, armor_heal=6, armor_use=400},
|
||||||
armor_groups = {fleshy=10},
|
armor_groups = {fleshy=10},
|
||||||
groups = {armor_feet=1, armor_heal=6, armor_use=250},
|
damage_groups = {cracky=3, snappy=2, choppy=2, crumbly=1, level=2},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -164,26 +180,30 @@ if armor.materials.diamond then
|
|||||||
armor:register_armor("3d_armor:helmet_diamond", {
|
armor:register_armor("3d_armor:helmet_diamond", {
|
||||||
description = S("Diamond Helmet"),
|
description = S("Diamond Helmet"),
|
||||||
inventory_image = "3d_armor_inv_helmet_diamond.png",
|
inventory_image = "3d_armor_inv_helmet_diamond.png",
|
||||||
|
groups = {armor_head=1, armor_heal=12, armor_use=200},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_head=1, armor_heal=12, armor_use=100},
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=3},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:chestplate_diamond", {
|
armor:register_armor("3d_armor:chestplate_diamond", {
|
||||||
description = S("Diamond Chestplate"),
|
description = S("Diamond Chestplate"),
|
||||||
inventory_image = "3d_armor_inv_chestplate_diamond.png",
|
inventory_image = "3d_armor_inv_chestplate_diamond.png",
|
||||||
|
groups = {armor_torso=1, armor_heal=12, armor_use=200},
|
||||||
armor_groups = {fleshy=20},
|
armor_groups = {fleshy=20},
|
||||||
groups = {armor_torso=1, armor_heal=12, armor_use=100},
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=3},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:leggings_diamond", {
|
armor:register_armor("3d_armor:leggings_diamond", {
|
||||||
description = S("Diamond Leggings"),
|
description = S("Diamond Leggings"),
|
||||||
inventory_image = "3d_armor_inv_leggings_diamond.png",
|
inventory_image = "3d_armor_inv_leggings_diamond.png",
|
||||||
|
groups = {armor_legs=1, armor_heal=12, armor_use=200},
|
||||||
armor_groups = {fleshy=20},
|
armor_groups = {fleshy=20},
|
||||||
groups = {armor_legs=1, armor_heal=12, armor_use=100},
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=3},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:boots_diamond", {
|
armor:register_armor("3d_armor:boots_diamond", {
|
||||||
description = S("Diamond Boots"),
|
description = S("Diamond Boots"),
|
||||||
inventory_image = "3d_armor_inv_boots_diamond.png",
|
inventory_image = "3d_armor_inv_boots_diamond.png",
|
||||||
|
groups = {armor_feet=1, armor_heal=12, armor_use=200},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_feet=1, armor_heal=12, armor_use=100},
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=3},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -191,26 +211,30 @@ if armor.materials.gold then
|
|||||||
armor:register_armor("3d_armor:helmet_gold", {
|
armor:register_armor("3d_armor:helmet_gold", {
|
||||||
description = S("Gold Helmet"),
|
description = S("Gold Helmet"),
|
||||||
inventory_image = "3d_armor_inv_helmet_gold.png",
|
inventory_image = "3d_armor_inv_helmet_gold.png",
|
||||||
|
groups = {armor_head=1, armor_heal=6, armor_use=300},
|
||||||
armor_groups = {fleshy=10},
|
armor_groups = {fleshy=10},
|
||||||
groups = {armor_head=1, armor_heal=6, armor_use=250},
|
damage_groups = {cracky=1, snappy=2, choppy=2, crumbly=3, level=2},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:chestplate_gold", {
|
armor:register_armor("3d_armor:chestplate_gold", {
|
||||||
description = S("Gold Chestplate"),
|
description = S("Gold Chestplate"),
|
||||||
inventory_image = "3d_armor_inv_chestplate_gold.png",
|
inventory_image = "3d_armor_inv_chestplate_gold.png",
|
||||||
|
groups = {armor_torso=1, armor_heal=6, armor_use=300},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_torso=1, armor_heal=6, armor_use=250},
|
damage_groups = {cracky=1, snappy=2, choppy=2, crumbly=3, level=2},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:leggings_gold", {
|
armor:register_armor("3d_armor:leggings_gold", {
|
||||||
description = S("Gold Leggings"),
|
description = S("Gold Leggings"),
|
||||||
inventory_image = "3d_armor_inv_leggings_gold.png",
|
inventory_image = "3d_armor_inv_leggings_gold.png",
|
||||||
|
groups = {armor_legs=1, armor_heal=6, armor_use=300},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_legs=1, armor_heal=6, armor_use=250},
|
damage_groups = {cracky=1, snappy=2, choppy=2, crumbly=3, level=2},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:boots_gold", {
|
armor:register_armor("3d_armor:boots_gold", {
|
||||||
description = S("Gold Boots"),
|
description = S("Gold Boots"),
|
||||||
inventory_image = "3d_armor_inv_boots_gold.png",
|
inventory_image = "3d_armor_inv_boots_gold.png",
|
||||||
|
groups = {armor_feet=1, armor_heal=6, armor_use=300},
|
||||||
armor_groups = {fleshy=10},
|
armor_groups = {fleshy=10},
|
||||||
groups = {armor_feet=1, armor_heal=6, armor_use=250},
|
damage_groups = {cracky=1, snappy=2, choppy=2, crumbly=3, level=2},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -218,26 +242,30 @@ if armor.materials.mithril then
|
|||||||
armor:register_armor("3d_armor:helmet_mithril", {
|
armor:register_armor("3d_armor:helmet_mithril", {
|
||||||
description = S("Mithril Helmet"),
|
description = S("Mithril Helmet"),
|
||||||
inventory_image = "3d_armor_inv_helmet_mithril.png",
|
inventory_image = "3d_armor_inv_helmet_mithril.png",
|
||||||
|
groups = {armor_head=1, armor_heal=12, armor_use=100},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_head=1, armor_heal=12, armor_use=50},
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:chestplate_mithril", {
|
armor:register_armor("3d_armor:chestplate_mithril", {
|
||||||
description = S("Mithril Chestplate"),
|
description = S("Mithril Chestplate"),
|
||||||
inventory_image = "3d_armor_inv_chestplate_mithril.png",
|
inventory_image = "3d_armor_inv_chestplate_mithril.png",
|
||||||
|
groups = {armor_torso=1, armor_heal=12, armor_use=100},
|
||||||
armor_groups = {fleshy=20},
|
armor_groups = {fleshy=20},
|
||||||
groups = {armor_torso=1, armor_heal=12, armor_use=50},
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:leggings_mithril", {
|
armor:register_armor("3d_armor:leggings_mithril", {
|
||||||
description = S("Mithril Leggings"),
|
description = S("Mithril Leggings"),
|
||||||
inventory_image = "3d_armor_inv_leggings_mithril.png",
|
inventory_image = "3d_armor_inv_leggings_mithril.png",
|
||||||
|
groups = {armor_legs=1, armor_heal=12, armor_use=100},
|
||||||
armor_groups = {fleshy=20},
|
armor_groups = {fleshy=20},
|
||||||
groups = {armor_legs=1, armor_heal=12, armor_use=50},
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:boots_mithril", {
|
armor:register_armor("3d_armor:boots_mithril", {
|
||||||
description = S("Mithril Boots"),
|
description = S("Mithril Boots"),
|
||||||
inventory_image = "3d_armor_inv_boots_mithril.png",
|
inventory_image = "3d_armor_inv_boots_mithril.png",
|
||||||
|
groups = {armor_feet=1, armor_heal=12, armor_use=100},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_feet=1, armor_heal=12, armor_use=50},
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -245,27 +273,31 @@ if armor.materials.crystal then
|
|||||||
armor:register_armor("3d_armor:helmet_crystal", {
|
armor:register_armor("3d_armor:helmet_crystal", {
|
||||||
description = S("Crystal Helmet"),
|
description = S("Crystal Helmet"),
|
||||||
inventory_image = "3d_armor_inv_helmet_crystal.png",
|
inventory_image = "3d_armor_inv_helmet_crystal.png",
|
||||||
|
groups = {armor_head=1, armor_heal=12, armor_use=100, armor_fire=1},
|
||||||
armor_groups = {fleshy=15},
|
armor_groups = {fleshy=15},
|
||||||
groups = {armor_head=1, armor_heal=12, armor_use=50, armor_fire=1},
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:chestplate_crystal", {
|
armor:register_armor("3d_armor:chestplate_crystal", {
|
||||||
description = S("Crystal Chestplate"),
|
description = S("Crystal Chestplate"),
|
||||||
inventory_image = "3d_armor_inv_chestplate_crystal.png",
|
inventory_image = "3d_armor_inv_chestplate_crystal.png",
|
||||||
|
groups = {armor_torso=1, armor_heal=12, armor_use=100, armor_fire=1},
|
||||||
armor_groups = {fleshy=20},
|
armor_groups = {fleshy=20},
|
||||||
groups = {armor_torso=1, armor_heal=12, armor_use=50, armor_fire=1},
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:leggings_crystal", {
|
armor:register_armor("3d_armor:leggings_crystal", {
|
||||||
description = S("Crystal Leggings"),
|
description = S("Crystal Leggings"),
|
||||||
inventory_image = "3d_armor_inv_leggings_crystal.png",
|
inventory_image = "3d_armor_inv_leggings_crystal.png",
|
||||||
|
groups = {armor_legs=1, armor_heal=12, armor_use=100, armor_fire=1},
|
||||||
armor_groups = {fleshy=20},
|
armor_groups = {fleshy=20},
|
||||||
groups = {armor_legs=1, armor_heal=12, armor_use=50, armor_fire=1},
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
})
|
})
|
||||||
armor:register_armor("3d_armor:boots_crystal", {
|
armor:register_armor("3d_armor:boots_crystal", {
|
||||||
description = S("Crystal Boots"),
|
description = S("Crystal Boots"),
|
||||||
inventory_image = "3d_armor_inv_boots_crystal.png",
|
inventory_image = "3d_armor_inv_boots_crystal.png",
|
||||||
armor_groups = {fleshy=15},
|
groups = {armor_feet=1, armor_heal=12, armor_use=100, physics_speed=1,
|
||||||
groups = {armor_feet=1, armor_heal=12, armor_use=50, physics_speed=1,
|
|
||||||
physics_jump=0.5, armor_fire=1},
|
physics_jump=0.5, armor_fire=1},
|
||||||
|
armor_groups = {fleshy=15},
|
||||||
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ end
|
|||||||
local modname = minetest.get_current_modname()
|
local modname = minetest.get_current_modname()
|
||||||
local modpath = minetest.get_modpath(modname)
|
local modpath = minetest.get_modpath(modname)
|
||||||
local worldpath = minetest.get_worldpath()
|
local worldpath = minetest.get_worldpath()
|
||||||
|
local last_punch_time = {}
|
||||||
|
|
||||||
dofile(modpath.."/api.lua")
|
dofile(modpath.."/api.lua")
|
||||||
|
|
||||||
@ -60,6 +61,14 @@ armor.formspec = armor.formspec..
|
|||||||
if armor.config.fire_protect then
|
if armor.config.fire_protect then
|
||||||
armor.formspec = armor.formspec.."label[5,2;"..S("Fire")..": armor_fire]"
|
armor.formspec = armor.formspec.."label[5,2;"..S("Fire")..": armor_fire]"
|
||||||
end
|
end
|
||||||
|
armor:register_on_destroy(function(player, stack)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
local def = stack:get_definition()
|
||||||
|
if name and def and def.description then
|
||||||
|
minetest.chat_send_player(name, S("Your").." "..def.description.." "..
|
||||||
|
S("got destroyed").."!")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
dofile(modpath.."/armor.lua")
|
dofile(modpath.."/armor.lua")
|
||||||
|
|
||||||
@ -270,43 +279,32 @@ if armor.config.drop == true or armor.config.destroy == true then
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if armor.config.punch_damage == true then
|
||||||
|
minetest.register_on_punchplayer(function(player, hitter,
|
||||||
|
time_from_last_punch, tool_capabilities)
|
||||||
|
armor:punch(player, hitter, time_from_last_punch, tool_capabilities)
|
||||||
|
local name = player:get_player_name()
|
||||||
|
if name then
|
||||||
|
last_punch_time[name] = minetest.get_gametime()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change)
|
minetest.register_on_player_hpchange(function(player, hp_change)
|
||||||
local name, player_inv = armor:get_valid_player(player, "[on_hpchange]")
|
if player and hp_change < 0 then
|
||||||
if name and hp_change < 0 then
|
local name = player:get_player_name()
|
||||||
local heal_max = 0
|
if name and armor.def[name] then
|
||||||
local state = 0
|
local heal = armor.def[name].heal or 0
|
||||||
local items = 0
|
if heal >= math.random(100) then
|
||||||
for i=1, 6 do
|
|
||||||
local stack = player_inv:get_stack("armor", i)
|
|
||||||
if stack:get_count() > 0 then
|
|
||||||
local def = stack:get_definition() or {}
|
|
||||||
local use = def.groups["armor_use"] or 0
|
|
||||||
local heal = def.groups["armor_heal"] or 0
|
|
||||||
local item = stack:get_name()
|
|
||||||
stack:add_wear(use)
|
|
||||||
armor:set_inventory_stack(player, i, stack)
|
|
||||||
state = state + stack:get_wear()
|
|
||||||
items = items + 1
|
|
||||||
if stack:get_count() == 0 then
|
|
||||||
local desc = minetest.registered_items[item].description
|
|
||||||
if desc then
|
|
||||||
minetest.chat_send_player(name,
|
|
||||||
S("Your")..desc.." "..S("got destroyed").."!")
|
|
||||||
end
|
|
||||||
armor:set_player_armor(player)
|
|
||||||
armor:run_callbacks("on_unequip", player, stack)
|
|
||||||
armor:run_callbacks("on_destroy", player, stack)
|
|
||||||
end
|
|
||||||
heal_max = heal_max + heal
|
|
||||||
end
|
|
||||||
end
|
|
||||||
armor.def[name].state = state
|
|
||||||
armor.def[name].count = items
|
|
||||||
heal_max = heal_max * armor.config.heal_multiplier
|
|
||||||
if heal_max >= math.random(100) then
|
|
||||||
hp_change = 0
|
hp_change = 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
-- check if armor damage was handled by on_punchplayer
|
||||||
|
local time = last_punch_time[name] or 0
|
||||||
|
if time == 0 or time + 1 < minetest.get_gametime() then
|
||||||
|
armor:punch(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
return hp_change
|
return hp_change
|
||||||
end, true)
|
end, true)
|
||||||
|
|
||||||
|
163
shields/init.lua
163
shields/init.lua
@ -3,6 +3,19 @@ if minetest.global_exists("intllib") then
|
|||||||
S = intllib.Getter()
|
S = intllib.Getter()
|
||||||
end
|
end
|
||||||
local use_moreores = minetest.get_modpath("moreores")
|
local use_moreores = minetest.get_modpath("moreores")
|
||||||
|
local function play_sound_effect(player, name)
|
||||||
|
if player then
|
||||||
|
local pos = player:get_pos()
|
||||||
|
if pos then
|
||||||
|
minetest.sound_play({
|
||||||
|
pos = pos,
|
||||||
|
name = name,
|
||||||
|
max_hear_distance = 10,
|
||||||
|
gain = 0.5,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if minetest.global_exists("armor") and armor.elements then
|
if minetest.global_exists("armor") and armor.elements then
|
||||||
table.insert(armor.elements, "shield")
|
table.insert(armor.elements, "shield")
|
||||||
@ -12,25 +25,47 @@ end
|
|||||||
|
|
||||||
-- Regisiter Shields
|
-- Regisiter Shields
|
||||||
|
|
||||||
minetest.register_tool("shields:shield_admin", {
|
armor:register_armor("shields:shield_admin", {
|
||||||
description = S("Admin Shield"),
|
description = S("Admin Shield"),
|
||||||
inventory_image = "shields_inv_shield_admin.png",
|
inventory_image = "shields_inv_shield_admin.png",
|
||||||
groups = {armor_shield=1000, armor_heal=100, armor_use=0, not_in_creative_inventory=1},
|
groups = {armor_shield=1000, armor_heal=100, armor_use=0, not_in_creative_inventory=1},
|
||||||
wear = 0,
|
on_punch = function(player, hitter, time_from_last_punch, tool_capabilities)
|
||||||
|
if hitter then
|
||||||
|
hitter:punch(player, time_from_last_punch, tool_capabilities)
|
||||||
|
play_sound_effect(player, "default_dig_metal")
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
if armor.materials.wood then
|
if armor.materials.wood then
|
||||||
minetest.register_tool("shields:shield_wood", {
|
armor:register_armor("shields:shield_wood", {
|
||||||
description = S("Wooden Shield"),
|
description = S("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=1, armor_heal=0, armor_use=2000},
|
||||||
wear = 0,
|
armor_groups = {fleshy=5},
|
||||||
|
damage_groups = {cracky=3, snappy=2, choppy=3, crumbly=2, level=1},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_wood_footstep")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_wood_footstep")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
minetest.register_tool("shields:shield_enhanced_wood", {
|
armor:register_armor("shields:shield_enhanced_wood", {
|
||||||
description = S("Enhanced Wood Shield"),
|
description = S("Enhanced Wood Shield"),
|
||||||
inventory_image = "shields_inv_shield_enhanced_wood.png",
|
inventory_image = "shields_inv_shield_enhanced_wood.png",
|
||||||
groups = {armor_shield=8, armor_heal=0, armor_use=1000},
|
groups = {armor_shield=1, armor_heal=0, armor_use=2000},
|
||||||
wear = 0,
|
armor_groups = {fleshy=8},
|
||||||
|
damage_groups = {cracky=3, snappy=2, choppy=3, crumbly=2, level=2},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_wood_footstep")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_wood_footstep")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "shields:shield_enhanced_wood",
|
output = "shields:shield_enhanced_wood",
|
||||||
@ -43,17 +78,33 @@ if armor.materials.wood then
|
|||||||
end
|
end
|
||||||
|
|
||||||
if armor.materials.cactus then
|
if armor.materials.cactus then
|
||||||
minetest.register_tool("shields:shield_cactus", {
|
armor:register_armor("shields:shield_cactus", {
|
||||||
description = S("Cactus Shield"),
|
description = S("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=1, armor_heal=0, armor_use=1000},
|
||||||
wear = 0,
|
armor_groups = {fleshy=5},
|
||||||
|
damage_groups = {cracky=3, snappy=3, choppy=2, crumbly=2, level=1},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_wood_footstep")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_wood_footstep")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
minetest.register_tool("shields:shield_enhanced_cactus", {
|
armor:register_armor("shields:shield_enhanced_cactus", {
|
||||||
description = S("Enhanced Cactus Shield"),
|
description = S("Enhanced Cactus Shield"),
|
||||||
inventory_image = "shields_inv_shield_enhanced_cactus.png",
|
inventory_image = "shields_inv_shield_enhanced_cactus.png",
|
||||||
groups = {armor_shield=8, armor_heal=0, armor_use=1000},
|
groups = {armor_shield=1, armor_heal=0, armor_use=1000},
|
||||||
wear = 0,
|
armor_groups = {fleshy=8},
|
||||||
|
damage_groups = {cracky=3, snappy=3, choppy=2, crumbly=2, level=2},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_dirt_footstep")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_dirt_footstep")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "shields:shield_enhanced_cactus",
|
output = "shields:shield_enhanced_cactus",
|
||||||
@ -66,56 +117,104 @@ if armor.materials.cactus then
|
|||||||
end
|
end
|
||||||
|
|
||||||
if armor.materials.steel then
|
if armor.materials.steel then
|
||||||
minetest.register_tool("shields:shield_steel", {
|
armor:register_armor("shields:shield_steel", {
|
||||||
description = S("Steel Shield"),
|
description = S("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=1, armor_heal=0, armor_use=800},
|
||||||
wear = 0,
|
armor_groups = {fleshy=10},
|
||||||
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_dig_metal")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_dug_metal")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if armor.materials.bronze then
|
if armor.materials.bronze then
|
||||||
minetest.register_tool("shields:shield_bronze", {
|
armor:register_armor("shields:shield_bronze", {
|
||||||
description = S("Bronze Shield"),
|
description = S("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=1, armor_heal=6, armor_use=400},
|
||||||
wear = 0,
|
armor_groups = {fleshy=10},
|
||||||
|
damage_groups = {cracky=2, snappy=3, choppy=2, crumbly=1, level=2},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_dig_metal")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_dug_metal")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if armor.materials.diamond then
|
if armor.materials.diamond then
|
||||||
minetest.register_tool("shields:shield_diamond", {
|
armor:register_armor("shields:shield_diamond", {
|
||||||
description = S("Diamond Shield"),
|
description = S("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=1, armor_heal=12, armor_use=200},
|
||||||
wear = 0,
|
armor_groups = {fleshy=15},
|
||||||
|
damage_groups = {cracky=2, snappy=1, choppy=1, level=3},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_glass_footstep")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_break_glass")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if armor.materials.gold then
|
if armor.materials.gold then
|
||||||
minetest.register_tool("shields:shield_gold", {
|
armor:register_armor("shields:shield_gold", {
|
||||||
description = S("Gold Shield"),
|
description = S("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=1, armor_heal=6, armor_use=300},
|
||||||
wear = 0,
|
armor_groups = {fleshy=10},
|
||||||
|
damage_groups = {cracky=1, snappy=2, choppy=2, crumbly=3, level=2},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_dig_metal")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_dug_metal")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if armor.materials.mithril then
|
if armor.materials.mithril then
|
||||||
minetest.register_tool("shields:shield_mithril", {
|
armor:register_armor("shields:shield_mithril", {
|
||||||
description = S("Mithril Shield"),
|
description = S("Mithril Shield"),
|
||||||
inventory_image = "shields_inv_shield_mithril.png",
|
inventory_image = "shields_inv_shield_mithril.png",
|
||||||
groups = {armor_shield=15, armor_heal=12, armor_use=50},
|
groups = {armor_shield=1, armor_heal=12, armor_use=100},
|
||||||
wear = 0,
|
armor_groups = {fleshy=15},
|
||||||
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_glass_footstep")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_break_glass")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if armor.materials.crystal then
|
if armor.materials.crystal then
|
||||||
minetest.register_tool("shields:shield_crystal", {
|
armor:register_armor("shields:shield_crystal", {
|
||||||
description = S("Crystal Shield"),
|
description = S("Crystal Shield"),
|
||||||
inventory_image = "shields_inv_shield_crystal.png",
|
inventory_image = "shields_inv_shield_crystal.png",
|
||||||
groups = {armor_shield=15, armor_heal=12, armor_use=50, armor_fire=1},
|
groups = {armor_shield=1, armor_heal=12, armor_use=100, armor_fire=1},
|
||||||
wear = 0,
|
armor_groups = {fleshy=15},
|
||||||
|
damage_groups = {cracky=2, snappy=1, level=3},
|
||||||
|
reciprocate_damage = true,
|
||||||
|
on_damage = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_glass_footstep")
|
||||||
|
end,
|
||||||
|
on_destroy = function(player, stack)
|
||||||
|
play_sound_effect(player, "default_break_glass")
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user