forked from mtcontrib/3d_armor
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:
parent
5642819ba5
commit
3ddcbae968
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user