RJW-Sexperience/Source/RJWSexperience/Cum/Thought_AteCum.cs

40 lines
943 B
C#
Raw Normal View History

2022-04-18 14:51:59 +00:00
using RimWorld;
namespace RJWSexperience // Change in namespace will lead to save incompatibility
2022-04-18 14:51:59 +00:00
{
public class Thought_AteCum : Thought_Recordbased
{
public override int CurStageIndex
{
get
{
2022-04-26 06:05:05 +00:00
if (pawn?.health?.hediffSet?.HasHediff(VariousDefOf.CumAddiction) ?? false)
return def.stages.Count - 1;
2022-04-18 14:51:59 +00:00
return base.CurStageIndex;
}
}
public override bool TryMergeWithExistingMemory(out bool showBubble)
{
ThoughtHandler thoughts = pawn.needs.mood.thoughts;
if (thoughts.memories.NumMemoriesInGroup(this) >= def.stackLimit)
{
Thought_AteCum thought_Memory = (Thought_AteCum)thoughts.memories.OldestMemoryInGroup(this);
if (thought_Memory != null)
{
showBubble = thought_Memory.age > thought_Memory.def.DurationTicks / 2;
2022-04-18 14:51:59 +00:00
thought_Memory.Merged();
return true;
}
}
showBubble = true;
return false;
}
protected virtual void Merged()
{
age = 0;
}
}
}