Create HistoryEvents namespace and folder

This commit is contained in:
amevarashi 2022-07-03 20:49:53 +05:00
parent bfddab0cf1
commit 6a1978414d
9 changed files with 34 additions and 34 deletions

View file

@ -1,6 +1,6 @@
namespace RJWSexperience.Ideology
namespace RJWSexperience.Ideology.HistoryEvents
{
public static class HistoryEventArgsNamesCustom
public static class ArgsNamesCustom
{
public const string Tag = "TAG";
public const string Partner = "PARTNER";

View file

@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Verse;
namespace RJWSexperience.Ideology
namespace RJWSexperience.Ideology.HistoryEvents
{
public class HistoryEventDefExtension_PartnerDependentOverrides : DefModExtension
public class DefExtension_PartnerDependentOverrides : DefModExtension
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public List<PartnerDependentOverride> overrideRules = new List<PartnerDependentOverride>();

View file

@ -1,8 +1,8 @@
using Verse;
namespace RJWSexperience.Ideology
namespace RJWSexperience.Ideology.HistoryEvents
{
public static class HETag
public static class Tag
{
public const string BeenRaped = "[BeenRaped]";
public const string Rape = "[Rape]";

View file

@ -3,6 +3,7 @@ using RimWorld;
using rjw;
using rjw.Modules.Interactions.Internals.Implementation;
using rjw.Modules.Interactions.Objects;
using RJWSexperience.Ideology.HistoryEvents;
using RJWSexperience.Ideology.Precepts;
using System;
using System.Collections.Generic;
@ -14,7 +15,7 @@ namespace RJWSexperience.Ideology.Patches
{
public static HistoryEvent CreateTaggedEvent(this HistoryEventDef def, Pawn pawn, string tag, Pawn partner)
{
return new HistoryEvent(def, pawn.Named(HistoryEventArgsNames.Doer), tag.Named(HistoryEventArgsNamesCustom.Tag), partner.Named(HistoryEventArgsNamesCustom.Partner));
return new HistoryEvent(def, pawn.Named(HistoryEventArgsNames.Doer), tag.Named(ArgsNamesCustom.Tag), partner.Named(ArgsNamesCustom.Partner));
}
public static HistoryEvent CreateEvent(this HistoryEventDef def, Pawn pawn)
@ -24,10 +25,10 @@ namespace RJWSexperience.Ideology.Patches
public static HistoryEvent CreateEventWithPartner(this HistoryEventDef def, Pawn pawn, Pawn partner)
{
HistoryEventDefExtension_PartnerDependentOverrides overrides = def.GetModExtension<HistoryEventDefExtension_PartnerDependentOverrides>();
DefExtension_PartnerDependentOverrides overrides = def.GetModExtension<DefExtension_PartnerDependentOverrides>();
if (overrides == null)
return new HistoryEvent(def, pawn.Named(HistoryEventArgsNames.Doer), partner.Named(HistoryEventArgsNamesCustom.Partner));
return new HistoryEvent(def, pawn.Named(HistoryEventArgsNames.Doer), partner.Named(ArgsNamesCustom.Partner));
foreach (var rule in overrides.overrideRules)
{
@ -35,7 +36,7 @@ namespace RJWSexperience.Ideology.Patches
return rule.historyEventDef.CreateEventWithPartner(pawn, partner);
}
return new HistoryEvent(def, pawn.Named(HistoryEventArgsNames.Doer), partner.Named(HistoryEventArgsNamesCustom.Partner));
return new HistoryEvent(def, pawn.Named(HistoryEventArgsNames.Doer), partner.Named(ArgsNamesCustom.Partner));
}
public static Faction GetFactionUsingPrecept(this Pawn baby, out Ideo ideo)
@ -168,18 +169,18 @@ namespace RJWSexperience.Ideology.Patches
{
if (partner.IsSlave)
{
Find.HistoryEventsManager.RecordEvent(VariousDefOf.RapedSlave.CreateTaggedEvent(human, HETag.Rape + HETag.Gender(human), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.WasRapedSlave.CreateTaggedEvent(partner, HETag.BeenRaped + HETag.Gender(partner), human));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.RapedSlave.CreateTaggedEvent(human, Tag.Rape + Tag.Gender(human), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.WasRapedSlave.CreateTaggedEvent(partner, Tag.BeenRaped + Tag.Gender(partner), human));
}
else if (partner.IsPrisoner)
{
Find.HistoryEventsManager.RecordEvent(VariousDefOf.RapedPrisoner.CreateTaggedEvent(human, HETag.Rape + HETag.Gender(human), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.WasRapedPrisoner.CreateTaggedEvent(partner, HETag.BeenRaped + HETag.Gender(partner), human));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.RapedPrisoner.CreateTaggedEvent(human, Tag.Rape + Tag.Gender(human), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.WasRapedPrisoner.CreateTaggedEvent(partner, Tag.BeenRaped + Tag.Gender(partner), human));
}
else
{
Find.HistoryEventsManager.RecordEvent(VariousDefOf.Raped.CreateTaggedEvent(human, HETag.Rape + HETag.Gender(human), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.WasRaped.CreateTaggedEvent(partner, HETag.BeenRaped + HETag.Gender(partner), human));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.Raped.CreateTaggedEvent(human, Tag.Rape + Tag.Gender(human), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.WasRaped.CreateTaggedEvent(partner, Tag.BeenRaped + Tag.Gender(partner), human));
}
}
}

View file

@ -1,5 +1,6 @@
using RimWorld;
using rjw;
using RJWSexperience.Ideology.HistoryEvents;
using Verse;
namespace RJWSexperience.Ideology.Patches
@ -11,23 +12,23 @@ namespace RJWSexperience.Ideology.Patches
string tag = "";
if (props.isRape)
{
if (pawn == props.pawn && props.isRapist) tag += HETag.Rape;
else tag += HETag.BeenRaped;
if (pawn == props.pawn && props.isRapist) tag += Tag.Rape;
else tag += Tag.BeenRaped;
}
if (!pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, partner))
{
tag += HETag.NotSpouse;
tag += Tag.NotSpouse;
}
if (pawn.gender == Gender.Male)
{
if (degree > 1) Find.HistoryEventsManager.RecordEvent(VariousDefOf.Virgin_TakenM.CreateTaggedEvent(pawn, tag + HETag.Gender(pawn), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.Virgin_TookM.CreateTaggedEvent(partner, tag + HETag.Gender(pawn), pawn));
if (degree > 1) Find.HistoryEventsManager.RecordEvent(VariousDefOf.Virgin_TakenM.CreateTaggedEvent(pawn, tag + Tag.Gender(pawn), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.Virgin_TookM.CreateTaggedEvent(partner, tag + Tag.Gender(pawn), pawn));
}
else
{
if (degree > 1) Find.HistoryEventsManager.RecordEvent(VariousDefOf.Virgin_TakenF.CreateTaggedEvent(pawn, tag + HETag.Gender(pawn), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.Virgin_TookF.CreateTaggedEvent(partner, tag + HETag.Gender(pawn), pawn));
if (degree > 1) Find.HistoryEventsManager.RecordEvent(VariousDefOf.Virgin_TakenF.CreateTaggedEvent(pawn, tag + Tag.Gender(pawn), partner));
Find.HistoryEventsManager.RecordEvent(VariousDefOf.Virgin_TookF.CreateTaggedEvent(partner, tag + Tag.Gender(pawn), pawn));
}
}
}

View file

@ -17,13 +17,13 @@ namespace RJWSexperience.Ideology.Precepts
public override void Notify_MemberWitnessedAction(HistoryEvent ev, Precept precept, Pawn member)
{
if (!applyonpartner && ev.args.TryGetArg(HistoryEventArgsNamesCustom.Partner, out Pawn pawn) && pawn == member)
if (!applyonpartner && ev.args.TryGetArg(HistoryEvents.ArgsNamesCustom.Partner, out Pawn pawn) && pawn == member)
{
return;
}
if (tag != null)
{
if (ev.args.TryGetArg(HistoryEventArgsNamesCustom.Tag, out string tags))
if (ev.args.TryGetArg(HistoryEvents.ArgsNamesCustom.Tag, out string tags))
{
if (IdeoUtility.ContainAll(tags, tag.Replace(" ", "").Split(',')) ^ exclusive) base.Notify_MemberWitnessedAction(ev, precept, member);
}

View file

@ -11,13 +11,11 @@ namespace RJWSexperience.Ideology.Precepts
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public bool exclusive = false;
public PreceptComp_SelfTookThoughtTagged() { }
public override void Notify_MemberTookAction(HistoryEvent ev, Precept precept, bool canApplySelfTookThoughts)
{
if (tag != null)
{
if (ev.args.TryGetArg(HistoryEventArgsNamesCustom.Tag, out string tags))
if (ev.args.TryGetArg(HistoryEvents.ArgsNamesCustom.Tag, out string tags))
{
if (IdeoUtility.ContainAll(tags, tag.Replace(" ", "").Split(',')) ^ exclusive)
{
@ -42,7 +40,7 @@ namespace RJWSexperience.Ideology.Precepts
return;
}
Pawn arg = ev.args.GetArg<Pawn>(HistoryEventArgsNames.Doer);
Pawn partner = ev.args.GetArg<Pawn>(HistoryEventArgsNamesCustom.Partner);
Pawn partner = ev.args.GetArg<Pawn>(HistoryEvents.ArgsNamesCustom.Partner);
if (arg.needs?.mood != null && (!this.onlyForNonSlaves || !arg.IsSlave))
{
if (this.thought.minExpectationForNegativeThought != null && ExpectationsUtility.CurrentExpectationFor(arg).order < this.thought.minExpectationForNegativeThought.order)

View file

@ -43,12 +43,12 @@
</ItemGroup>
<ItemGroup>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Ideology\HistoryEventDefExtension_PartnerDependentOverrides.cs" />
<Compile Include="Ideology\HistoryEvents\DefExtension_PartnerDependentOverrides.cs" />
<Compile Include="Ideology\InteractionDefExtension_HistoryEvents.cs" />
<Compile Include="Ideology\GoodwillSituationWorker_MemeCompatibility.cs" />
<Compile Include="Harmony.cs" />
<Compile Include="Ideology\HETag.cs" />
<Compile Include="Ideology\HistoryEventArgsNamesCustom.cs" />
<Compile Include="Ideology\HistoryEvents\Tag.cs" />
<Compile Include="Ideology\HistoryEvents\ArgsNamesCustom.cs" />
<Compile Include="Ideology\IssueUtility.cs" />
<Compile Include="Ideology\Keyed.cs" />
<Compile Include="Ideology\Patches\RJW_Patch_ChancePerHour.cs" />

View file

@ -22,7 +22,7 @@
<defName>RSI_NonIncestuosMarriage</defName>
<label>Non-incestuos marriage</label>
<modExtensions>
<li Class="RJWSexperience.Ideology.HistoryEventDefExtension_PartnerDependentOverrides">
<li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_PartnerDependentOverrides">
<overrideRules>
<li>
<filter>
@ -81,7 +81,7 @@
<defName>RSI_NonIncestuosSex</defName>
<label>Non-incestuos sex</label>
<modExtensions>
<li Class="RJWSexperience.Ideology.HistoryEventDefExtension_PartnerDependentOverrides">
<li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_PartnerDependentOverrides">
<overrideRules>
<li>
<filter>