Disableable Hediffs - SmArtKar/AthenaFramework GitHub Wiki
Using HediffCompProperties_DisableOnDamage
you can disable hediffs upon the owner being damaged. Main use of this is to make implants that disable upon being hit with EMP. Upon triggering, original hediff would be temporary removed and "stored" in a new replacementDef
hediff. Upon that hediff being destroyed, the original would be restored.
public class HediffCompProperties_DisableOnDamage : HediffCompProperties
{
// Def of a hediff that will replace this hediff upon being disabled
public HediffDef replacementDef;
// Minimal amount of damage required to disable the hediff
public float minDamage = 0f;
// After what time the hediff should be reenabled. When set to -1, parent hediff will only be reenabled when the replacement hediff is disabled
public int disabledDurationTicks = -1;
// When set to true, disabled duration will be increased even when the hediff is already disabled
public bool increaseDisabledDuration = true;
// When set, disabledDurationTicks will be replaced by values from this curve with X being the amount of damage dealt
public SimpleCurve durationScaling;
// Only works when increaseDisabledDuration is set to true. When activated, damage taken when the hediff is already disabled will be added to the timer. When not, timer will simply be set to the supposed duration (if it's above current remaining duration)
public bool accumulateDuration = true;
// White and black lists for damageDefs. Defaults to all damage defs
public List<DamageDef> damageDefWhitelist;
public List<DamageDef> damageDefBlacklist;
}
replacementDef
must contain HediffCompProperties_HediffRestorer
comp that acts as a temporary holder.