How are armor values calculated?

Does anybody know how the game calculates armor values such as bash, cut, acid, and etc. I ask this because I was looking through the armor jsons because I was thinking about making my own mod, but I only saw Environmental Protection was listed. I found one post about this, but was unable to get correct calculations with it. So I thought I would post in general since it said it covered mechanics.

It’s based mainly off the materials its made of, and the thickness property in the armor. Look in materials.json and you’ll see that the differing materials have varying levels of cut, bash, fire resistance, etc defined.

I’ve yet to figure out the raw math behind it. In most cases, for single-material armor, it seems to just be the material’s armor value multiplied by thickness, but not 100% sure, and multiple materials seem to alter this.

Modified by damage to armor or reinforcement. Multiple materials are averaged.
Look up bash_resistance() in item.cpp

Ah right, almost forgot that condition is a factor. So my guess as to how it handles armor at 100% condition was right? I’m also assuming it ignores the properties of “null” if it’s listed alongside other materials.

Thanks guys I think I found the correct formula.

Edit: Yup confirmed multiple times the formula is Bash resist( which is the average of all materials bash values in the armor) * material_thickness(which is found in the armor json)* 1.5(or whatever you set the bash float resistance to). Note: this formula does not include armor from kevlar or leather padding.