Move PreceptComp_KnowsMemoryThoughtTagged to a separate file

This commit is contained in:
amevarashi 2022-06-19 18:31:01 +05:00
parent 53ece7a513
commit 5a3a700535
2 changed files with 41 additions and 35 deletions

View file

@ -0,0 +1,41 @@
using RimWorld;
using System.Diagnostics.CodeAnalysis;
using Verse;
namespace RJWSexperience.Ideology.Precepts
{
public class PreceptComp_KnowsMemoryThoughtTagged : PreceptComp_KnowsMemoryThought
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public string tag;
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public bool exclusive = false;
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public bool applyonpartner = false;
public PreceptComp_KnowsMemoryThoughtTagged() { }
public override void Notify_MemberWitnessedAction(HistoryEvent ev, Precept precept, Pawn member)
{
if (!applyonpartner && ev.args.TryGetArg(HistoryEventArgsNamesCustom.Partner, out Pawn pawn) && pawn == member)
{
return;
}
if (tag != null)
{
if (ev.args.TryGetArg(HistoryEventArgsNamesCustom.Tag, out string tags))
{
if (IdeoUtility.ContainAll(tags, tag.Replace(" ", "").Split(',')) ^ exclusive) base.Notify_MemberWitnessedAction(ev, precept, member);
}
else if (exclusive)
{
base.Notify_MemberWitnessedAction(ev, precept, member);
}
}
else
{
base.Notify_MemberWitnessedAction(ev, precept, member);
}
}
}
}

View file

@ -62,39 +62,4 @@ namespace RJWSexperience.Ideology.Precepts
}
}
}
public class PreceptComp_KnowsMemoryThoughtTagged : PreceptComp_KnowsMemoryThought
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public string tag;
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public bool exclusive = false;
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public bool applyonpartner = false;
public PreceptComp_KnowsMemoryThoughtTagged() { }
public override void Notify_MemberWitnessedAction(HistoryEvent ev, Precept precept, Pawn member)
{
if (!applyonpartner && ev.args.TryGetArg(HistoryEventArgsNamesCustom.Partner, out Pawn pawn) && pawn == member)
{
return;
}
if (tag != null)
{
if (ev.args.TryGetArg(HistoryEventArgsNamesCustom.Tag, out string tags))
{
if (IdeoUtility.ContainAll(tags, tag.Replace(" ", "").Split(',')) ^ exclusive) base.Notify_MemberWitnessedAction(ev, precept, member);
}
else if (exclusive)
{
base.Notify_MemberWitnessedAction(ev, precept, member);
}
}
else
{
base.Notify_MemberWitnessedAction(ev, precept, member);
}
}
}
}