I took a long look into it, and I may have found an answer. This is where I started.
From StatUtility:
So, I think the only thing you need is to modify the StuffProperties of your Def and set the StatsDefs directly. In theory, It should work. If you look at the ThingDefGenereator_Leather long enough you'll see it.
Do not mistake the StatDefOf.ArmorRating_Heat for the StatDefOf.ComfyTemperatureMin/Max. The first is used for protection against fire.
I'm not really sure, but I'm confident that I understand how the statfactors works. Lets see if I'm able to translate it to words after looking at the code for two hours.
stuffprops.equippedStatFactors is a List<StatModifier>
a StatModifier is a class with two fields: StatDef stat; float value;
Take a simplified example for leather:
Maybe I'm wrong about the way the StatModifier works, but I believe that, in theory, you should be able to do what you asked. Easier said than done.
From StatUtility:
Code Select
public static float StatOffsetFromGear(Thing gear, StatDef stat)
{
float statOffsetFromList = StatUtility.GetStatOffsetFromList(gear.def.equippedStatOffsets, stat);
if (gear.Stuff != null)
statOffsetFromList *= StatUtility.GetStatFactorFromList(gear.Stuff.stuffProps.equippedStatFactors, stat);
return statOffsetFromList;
}
So, I think the only thing you need is to modify the StuffProperties of your Def and set the StatsDefs directly. In theory, It should work. If you look at the ThingDefGenereator_Leather long enough you'll see it.
Do not mistake the StatDefOf.ArmorRating_Heat for the StatDefOf.ComfyTemperatureMin/Max. The first is used for protection against fire.
I'm not really sure, but I'm confident that I understand how the statfactors works. Lets see if I'm able to translate it to words after looking at the code for two hours.
stuffprops.equippedStatFactors is a List<StatModifier>
a StatModifier is a class with two fields: StatDef stat; float value;
Take a simplified example for leather:
Code Select
Looking only at temperature, each kind of Leather Def.stuffprops.equippedStatFactors is composed from:
a "StatModifier1" = StatDefOf.ComfyTemperatureMin, 1.2f (Shared for all the leathers)
a "StatModifier2" = StatDefOf.ComfyTemperatureMin, (defoftheanimal.race.leatherEquippedStatFactors[index of ComfyTemperatureMin].value)
and a "StatModifier3" = StatDefOf.ComfyTemperatureMax, (defoftheanimal.race.leatherEquippedStatFactors[index of ComfyTemperatureMax].value
Maybe I'm wrong about the way the StatModifier works, but I believe that, in theory, you should be able to do what you asked. Easier said than done.