local wear=0
local divide=0
for i=0,5 do
local add=player:get_inventory({type="detached", name=name.."_armor"}):get_stack("armor",i):get_wear()
if not (add == 0) then
divide=divide+1
end
wear=wear+add
end
formspec = formspec:gsub("armor_preview", armor.textures[name].preview)
formspec = formspec:gsub("armor_level", armor.def[name].level)
formspec = formspec:gsub("armor_wear", 100-((math.floor(wear/(divide*65535)*1000+0.5)/10) or "0").."")
BTW, wear bar would be nice too.
Note you also have to change :
:+1: Keep up the good work !!! Great mods !!!