2023-01-15 20:14:26 +00:00
|
|
|
|
using rjw;
|
2023-01-06 15:23:13 +00:00
|
|
|
|
using Verse;
|
|
|
|
|
|
|
|
|
|
namespace RJW_Genes
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This Gene regularly removes the broken hediff of a pawn.
|
|
|
|
|
/// Blocking / Removing thoughts are done in an XML Patch.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class Gene_Unbreakable : Gene
|
|
|
|
|
{
|
|
|
|
|
/// DevNote: I first tried to Harmony-Postfix the AfterSexUtility and never add it - but that failed?
|
|
|
|
|
|
|
|
|
|
private const int RESET_INTERVAL = 30000; // 30k should be 0.5 day
|
|
|
|
|
public override void PostAdd()
|
|
|
|
|
{
|
|
|
|
|
base.PostAdd();
|
|
|
|
|
RemoveBrokenHediff();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Tick()
|
|
|
|
|
{
|
|
|
|
|
base.Tick();
|
|
|
|
|
if (pawn.IsHashIntervalTick(RESET_INTERVAL))
|
|
|
|
|
RemoveBrokenHediff();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void RemoveBrokenHediff()
|
|
|
|
|
{
|
|
|
|
|
// Clean-Up of existing feeling brokens
|
|
|
|
|
var maybeBrokenHediff = pawn.health.hediffSet.GetFirstHediffOfDef(xxx.feelingBroken);
|
|
|
|
|
if (maybeBrokenHediff != null)
|
|
|
|
|
{
|
|
|
|
|
pawn.health.RemoveHediff(maybeBrokenHediff);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|