RJW-Sexperience/Source/RJWSexperience/Thoughts/Thought_Recordbased.cs

29 lines
787 B
C#
Raw Normal View History

2022-04-18 14:51:59 +00:00
using RimWorld;
2023-04-17 09:17:07 +00:00
using Verse;
2022-04-18 14:51:59 +00:00
namespace RJWSexperience
{
/// <summary>
2023-04-17 09:17:07 +00:00
/// Thought class that uses record to select active stage
2022-04-18 14:51:59 +00:00
/// </summary>
public class Thought_Recordbased : Thought_Memory
{
private ThoughtDefExtension_StageFromRecord extension;
2023-04-17 09:17:07 +00:00
protected ThoughtDefExtension_StageFromRecord Extension => extension ?? (extension = def.GetModExtension<ThoughtDefExtension_StageFromRecord>());
2023-04-17 09:17:07 +00:00
/// <summary>
/// This method is called for every thought right after the pawn is assigned
/// </summary>
public override bool TryMergeWithExistingMemory(out bool showBubble)
{
2023-04-17 09:17:07 +00:00
UpdateCurStage();
return base.TryMergeWithExistingMemory(out showBubble);
}
2023-04-17 09:17:07 +00:00
protected virtual void UpdateCurStage()
2022-04-18 14:51:59 +00:00
{
2023-04-17 09:17:07 +00:00
SetForcedStage(Extension.GetStageIndex(pawn));
2022-04-18 14:51:59 +00:00
}
}
}