Skip to content

Commit

Permalink
Fix count when armor is destroyed.
Browse files Browse the repository at this point in the history
  • Loading branch information
orbea authored and BuckarooBanzay committed Apr 29, 2020
1 parent c3a7555 commit a6b89e7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 3d_armor/api.lua
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili
if not name then
return
end
local set_state
local set_count
local state = 0
local count = 0
local recip = true
Expand Down Expand Up @@ -376,11 +378,17 @@ armor.punch = function(self, player, hitter, time_from_last_punch, tool_capabili
end
if damage == true then
self:damage(player, i, stack, use)
set_state = self.def[name].state
set_count = self.def[name].count
end
state = state + stack:get_wear()
count = count + 1
end
end
if set_count and set_count ~= count then
state = set_state or state
count = set_count or count
end
self.def[name].state = state
self.def[name].count = count
end
Expand Down

0 comments on commit a6b89e7

Please sign in to comment.