public override void OnIntervalPassed(Pawn pawn, Hediff cause) { var extraRaceProps = pawn.def.GetModExtension <ExtendedRaceProperties>() ?? ExtendedRaceProperties.defaultValues; if (!extraRaceProps.HasAdrenaline) { return; } var adrenalineTracker = pawn.GetComp <CompAdrenalineTracker>(); var hasRush = pawn.health.hediffSet.HasHediff(extraRaceProps.adrenalineRushHediff); // If the pawn can produce adrenaline and doesn't already have an adrenaline rush, add adrenaline rush if (AdrenalineSettings.allowNaturalGain && (AdrenalineSettings.affectAnimals || !pawn.RaceProps.Animal) && adrenalineTracker.CanProduceAdrenaline && !hasRush && AdrenalineUtility.GetPerceivedThreatsFor(pawn).Any()) { TryTeachAdrenalineConcept(pawn); pawn.health.AddHediff(extraRaceProps.adrenalineRushHediff); } // Otherwise if they have an adrenaline rush and don't have an adrenaline crash hediff, add an adrenaline crash hediff else if (AdrenalineSettings.adrenalineCrashes && hasRush && extraRaceProps.adrenalineCrashHediff != null && !pawn.health.hediffSet.HasHediff(extraRaceProps.adrenalineCrashHediff)) { var crashHediff = (Hediff_AdrenalineCrash)pawn.health.AddHediff(extraRaceProps.adrenalineCrashHediff); crashHediff.ticksToSeverityGain = crashHediff.Props.severityGainDelay; } }
protected virtual void UpdateTotalThreatSignificance() { totalThreatSignificance = AdrenalineUtility.GetPerceivedThreatsFor(pawn).Sum(t => t.PerceivedThreatSignificanceFor(pawn)); }