mirror of
https://gitgud.io/amevarashi/rjw-sexperience-ideology.git
synced 2024-08-15 00:43:19 +00:00
Refactor ThoughtDefExtension_StageFromOpinion
This commit is contained in:
parent
eda7261968
commit
5db34c0c1f
3 changed files with 26 additions and 23 deletions
|
@ -1,22 +1,21 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
public class Thought_Opinionbased : Thought_Memory
|
||||
{
|
||||
private List<float> minimumValueforStage;
|
||||
private ThoughtDefExtension_StageFromValue stageFromValue;
|
||||
|
||||
protected List<float> MinimumValueforStage
|
||||
protected ThoughtDefExtension_StageFromValue StageFromValue
|
||||
{
|
||||
get
|
||||
{
|
||||
if (minimumValueforStage == null)
|
||||
if (stageFromValue == null)
|
||||
{
|
||||
minimumValueforStage = def.GetModExtension<ThoughtDefExtension_StageFromOpinion>().minimumValueforStage;
|
||||
stageFromValue = def.GetModExtension<ThoughtDefExtension_StageFromValue>();
|
||||
}
|
||||
return minimumValueforStage;
|
||||
return stageFromValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,16 +46,7 @@ namespace RJWSexperience
|
|||
}
|
||||
|
||||
float value = pawn.relations?.OpinionOf(otherPawn) ?? 0f;
|
||||
|
||||
for (int i = MinimumValueforStage.Count - 1; i > 0; i--)
|
||||
{
|
||||
if (MinimumValueforStage[i] < value)
|
||||
{
|
||||
SetForcedStage(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
SetForcedStage(0);
|
||||
SetForcedStage(StageFromValue.GetStageIndex(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue