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
{
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")]
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
{
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")]
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)
{
DefExtension_PartnerDependentSecondaryEvents secondaryEvents = def.GetModExtension<DefExtension_PartnerDependentSecondaryEvents>();
DefExtension_SecondaryEvents secondaryEvents = def.GetModExtension<DefExtension_SecondaryEvents>();
if (secondaryEvents != null)
{
foreach (PartnerDependentRule rule in secondaryEvents.generationRules)
foreach (TwoPawnEventRule rule in secondaryEvents.generationRules)
{
if (rule.Applies(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)
{
DefExtension_PartnerDependentOverrides overrides = def.GetModExtension<DefExtension_PartnerDependentOverrides>();
DefExtension_EventOverrides overrides = def.GetModExtension<DefExtension_EventOverrides>();
if (overrides == null)
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))
return rule.historyEventDef.CreateEventWithPartner(pawn, partner);

View file

@ -4,7 +4,7 @@ using Verse;
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")]
public HistoryEventDef historyEventDef;

View file

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

View file

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

View file

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

View file

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

View file

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