1
0
mirror of https://github.com/minetest-mods/3d_armor.git synced 2024-12-27 03:00:40 +01:00

Fix for #34 - Divide Armor Wear by # Pieces

See Details contained in #34

Note1: I split out the fix for Issue 13 and it had been applied
Note2: I will also do a seperate pull request for Issue 30

From what I udnerstand smaller specific pull requests allow for reversion of specific additions and features much more easily. Please do correct me if I have the wrong end of the stick on this.
This commit is contained in:
Sirrobzeroone 2020-12-24 13:11:06 +11:00 committed by Buckaroo Banzai
parent 5642819ba5
commit 3ddcbae968

View File

@ -416,6 +416,12 @@ end
armor.damage = function(self, player, index, stack, use)
local old_stack = ItemStack(stack)
local worn_armor = armor:get_weared_armor_elements(player)
local armor_worn_cnt = 0
for k,v in pairs(worn_armor) do
armor_worn_cnt = armor_worn_cnt + 1
end
use = math.ceil(use/armor_worn_cnt)
stack:add_wear(use)
self:run_callbacks("on_damage", player, index, stack)
self:set_inventory_stack(player, index, stack)