diff --git a/RJWSexperience/IdeologyAddon/Ideology/Precepts/PreceptComp_KnowsMemoryThoughtTagged.cs b/RJWSexperience/IdeologyAddon/Ideology/Precepts/PreceptComp_KnowsMemoryThoughtTagged.cs new file mode 100644 index 0000000..d402214 --- /dev/null +++ b/RJWSexperience/IdeologyAddon/Ideology/Precepts/PreceptComp_KnowsMemoryThoughtTagged.cs @@ -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); + } + } + } +} diff --git a/RJWSexperience/IdeologyAddon/Ideology/Precepts/PreceptComp_SelftTookThoughtExtended.cs b/RJWSexperience/IdeologyAddon/Ideology/Precepts/PreceptComp_SelftTookThoughtExtended.cs index 8329f7f..5130a36 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Precepts/PreceptComp_SelftTookThoughtExtended.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Precepts/PreceptComp_SelftTookThoughtExtended.cs @@ -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); - } - } - } }