Rename HistoryEventDef mod extensions

This commit is contained in:
amevarashi 2022-07-19 16:25:25 +05:00
parent b2e368bbe6
commit baed7acc4c
9 changed files with 18 additions and 18 deletions

View file

@ -4,9 +4,9 @@ using Verse;
namespace RJWSexperience.Ideology.HistoryEvents namespace RJWSexperience.Ideology.HistoryEvents
{ {
public class DefExtension_PartnerDependentOverrides : DefModExtension public class DefExtension_EventOverrides : DefModExtension
{ {
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")] [SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public List<PartnerDependentRule> overrideRules = new List<PartnerDependentRule>(); public List<TwoPawnEventRule> overrideRules = new List<TwoPawnEventRule>();
} }
} }

View file

@ -4,9 +4,9 @@ using Verse;
namespace RJWSexperience.Ideology.HistoryEvents namespace RJWSexperience.Ideology.HistoryEvents
{ {
public class DefExtension_PartnerDependentSecondaryEvents : DefModExtension public class DefExtension_SecondaryEvents : DefModExtension
{ {
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")] [SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public List<PartnerDependentRule> generationRules = new List<PartnerDependentRule>(); public List<TwoPawnEventRule> generationRules = new List<TwoPawnEventRule>();
} }
} }

View file

@ -7,11 +7,11 @@ namespace RJWSexperience.Ideology.HistoryEvents
{ {
public static void RecordEventWithPartner(this HistoryEventDef def, Pawn pawn, Pawn partner) public static void RecordEventWithPartner(this HistoryEventDef def, Pawn pawn, Pawn partner)
{ {
DefExtension_PartnerDependentSecondaryEvents secondaryEvents = def.GetModExtension<DefExtension_PartnerDependentSecondaryEvents>(); DefExtension_SecondaryEvents secondaryEvents = def.GetModExtension<DefExtension_SecondaryEvents>();
if (secondaryEvents != null) if (secondaryEvents != null)
{ {
foreach (PartnerDependentRule rule in secondaryEvents.generationRules) foreach (TwoPawnEventRule rule in secondaryEvents.generationRules)
{ {
if (rule.Applies(pawn, partner)) if (rule.Applies(pawn, partner))
rule.historyEventDef.RecordEventWithPartner(pawn, partner); rule.historyEventDef.RecordEventWithPartner(pawn, partner);
@ -28,12 +28,12 @@ namespace RJWSexperience.Ideology.HistoryEvents
public static HistoryEvent CreateEventWithPartner(this HistoryEventDef def, Pawn pawn, Pawn partner) public static HistoryEvent CreateEventWithPartner(this HistoryEventDef def, Pawn pawn, Pawn partner)
{ {
DefExtension_PartnerDependentOverrides overrides = def.GetModExtension<DefExtension_PartnerDependentOverrides>(); DefExtension_EventOverrides overrides = def.GetModExtension<DefExtension_EventOverrides>();
if (overrides == null) if (overrides == null)
return new HistoryEvent(def, pawn.Named(HistoryEventArgsNames.Doer), partner.Named(ArgsNamesCustom.Partner)); return new HistoryEvent(def, pawn.Named(HistoryEventArgsNames.Doer), partner.Named(ArgsNamesCustom.Partner));
foreach (PartnerDependentRule rule in overrides.overrideRules) foreach (TwoPawnEventRule rule in overrides.overrideRules)
{ {
if (rule.Applies(pawn, partner)) if (rule.Applies(pawn, partner))
return rule.historyEventDef.CreateEventWithPartner(pawn, partner); return rule.historyEventDef.CreateEventWithPartner(pawn, partner);

View file

@ -4,7 +4,7 @@ using Verse;
namespace RJWSexperience.Ideology.HistoryEvents namespace RJWSexperience.Ideology.HistoryEvents
{ {
public class PartnerDependentRule public class TwoPawnEventRule
{ {
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")] [SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public HistoryEventDef historyEventDef; public HistoryEventDef historyEventDef;

View file

@ -43,9 +43,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="GlobalSuppressions.cs" /> <Compile Include="GlobalSuppressions.cs" />
<Compile Include="Ideology\HistoryEvents\DefExtension_PartnerDependentSecondaryEvents.cs" /> <Compile Include="Ideology\HistoryEvents\DefExtension_SecondaryEvents.cs" />
<Compile Include="Ideology\HistoryEvents\DefExtension_PartnerDependentOverrides.cs" /> <Compile Include="Ideology\HistoryEvents\DefExtension_EventOverrides.cs" />
<Compile Include="Ideology\HistoryEvents\PartnerDependentRule.cs" /> <Compile Include="Ideology\HistoryEvents\TwoPawnEventRule.cs" />
<Compile Include="Ideology\InteractionDefExtension_HistoryEvents.cs" /> <Compile Include="Ideology\InteractionDefExtension_HistoryEvents.cs" />
<Compile Include="Ideology\GoodwillSituationWorker_MemeCompatibility.cs" /> <Compile Include="Ideology\GoodwillSituationWorker_MemeCompatibility.cs" />
<Compile Include="Harmony.cs" /> <Compile Include="Harmony.cs" />

View file

@ -12,7 +12,7 @@
<defName>RSI_SexWithAnimal</defName> <defName>RSI_SexWithAnimal</defName>
<label>sex with animal</label> <label>sex with animal</label>
<modExtensions> <modExtensions>
<li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_PartnerDependentSecondaryEvents"> <li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_SecondaryEvents">
<generationRules> <generationRules>
<li> <li>
<filter> <filter>

View file

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

View file

@ -12,7 +12,7 @@
<defName>RSI_Raped</defName> <defName>RSI_Raped</defName>
<label>raped</label> <label>raped</label>
<modExtensions> <modExtensions>
<li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_PartnerDependentOverrides"> <li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_EventOverrides">
<overrideRules> <overrideRules>
<li> <li>
<filter> <filter>
@ -49,7 +49,7 @@
<defName>RSI_WasRaped</defName> <defName>RSI_WasRaped</defName>
<label>was raped</label> <label>was raped</label>
<modExtensions> <modExtensions>
<li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_PartnerDependentOverrides"> <li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_EventOverrides">
<overrideRules> <overrideRules>
<li> <li>
<filter> <filter>

View file

@ -17,7 +17,7 @@
<defName>RSI_VirginTaken</defName> <defName>RSI_VirginTaken</defName>
<label>virgin taken</label> <label>virgin taken</label>
<modExtensions> <modExtensions>
<li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_PartnerDependentSecondaryEvents"> <li Class="RJWSexperience.Ideology.HistoryEvents.DefExtension_SecondaryEvents">
<generationRules> <generationRules>
<li> <li>
<filter> <filter>