Singular Hediff Abilities - SmArtKar/AthenaFramework GitHub Wiki
In case you want to add multiple bionics that add the same ability and don't want it to be duplicated you can use HediffCompProperties_GiveSingularAbility
instead of vanilla's HediffCompProperties_GiveAbility
public class HediffCompProperties_GiveSingularAbility : HediffCompProperties
{
public List<AbilityDef> abilityDefs;
}
This also requires you to place CompProperties_AbilitySingularTracker
on your ability
In case you're a C# coder who wants to alter their ability's effects based on the amount of hediffs that give it, you can subclass CompAbility_SingularTracker
and use it's methods and counter
public class CompAbility_SingularTracker : CompAbilityEffect
{
public int abilityCount = 0;
public override void PostExposeData()
{
base.PostExposeData();
Scribe_Values.Look(ref abilityCount, "abilityCount");
}
public virtual void AddAbility()
{
abilityCount++;
}
public virtual void RemoveAbility()
{
abilityCount--;
if (abilityCount > 0)
{
parent.pawn.abilities.abilities.Remove(parent);
}
}
}