mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Refactor PreceptDef_RequirementExtended into DefModExtension
This commit is contained in:
parent
11b427fe44
commit
80c4c34131
4 changed files with 29 additions and 19 deletions
|
@ -1,10 +1,11 @@
|
||||||
using RimWorld;
|
using RimWorld;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Verse;
|
||||||
|
|
||||||
namespace RJWSexperience.Ideology
|
namespace RJWSexperience.Ideology
|
||||||
{
|
{
|
||||||
public class PreceptDef_RequirementExtended : PreceptDef
|
public class PreceptDefExtension_MultipleMemesRequired : 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<MemeDef> requiredAllMemes = new List<MemeDef>();
|
public List<MemeDef> requiredAllMemes = new List<MemeDef>();
|
|
@ -48,14 +48,20 @@ namespace RJWSexperience.Ideology
|
||||||
{
|
{
|
||||||
public static void Postfix(PreceptDef precept, bool checkDuplicates, ref IdeoFoundation __instance, ref AcceptanceReport __result)
|
public static void Postfix(PreceptDef precept, bool checkDuplicates, ref IdeoFoundation __instance, ref AcceptanceReport __result)
|
||||||
{
|
{
|
||||||
if (precept is PreceptDef_RequirementExtended def && !def.requiredAllMemes.NullOrEmpty())
|
PreceptDefExtension_MultipleMemesRequired extension = precept.GetModExtension<PreceptDefExtension_MultipleMemesRequired>();
|
||||||
|
|
||||||
|
if (extension == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (extension.requiredAllMemes.NullOrEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int i = 0; i < extension.requiredAllMemes.Count; i++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < def.requiredAllMemes.Count; i++)
|
if (!__instance.ideo.memes.Contains(extension.requiredAllMemes[i]))
|
||||||
{
|
|
||||||
if (!__instance.ideo.memes.Contains(def.requiredAllMemes[i]))
|
|
||||||
{
|
{
|
||||||
List<string> report = new List<string>();
|
List<string> report = new List<string>();
|
||||||
foreach (MemeDef meme in def.requiredAllMemes) report.Add(meme.LabelCap);
|
foreach (MemeDef meme in extension.requiredAllMemes) report.Add(meme.LabelCap);
|
||||||
|
|
||||||
__result = new AcceptanceReport("RequiresMeme".Translate() + ": " + report.ToCommaList());
|
__result = new AcceptanceReport("RequiresMeme".Translate() + ": " + report.ToCommaList());
|
||||||
return;
|
return;
|
||||||
|
@ -64,4 +70,3 @@ namespace RJWSexperience.Ideology
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
<Compile Include="Ideology\GoodwillSituationWorker_MemeCompatibility.cs" />
|
<Compile Include="Ideology\GoodwillSituationWorker_MemeCompatibility.cs" />
|
||||||
<Compile Include="Harmony.cs" />
|
<Compile Include="Harmony.cs" />
|
||||||
<Compile Include="Ideology\Keyed.cs" />
|
<Compile Include="Ideology\Keyed.cs" />
|
||||||
<Compile Include="Ideology\PreceptDef_RequirementExtended.cs" />
|
<Compile Include="Ideology\PreceptDefExtension_MultipleMemesRequired.cs" />
|
||||||
<Compile Include="Ideology\Rituals\JobGiver_GangbangConsensual.cs" />
|
<Compile Include="Ideology\Rituals\JobGiver_GangbangConsensual.cs" />
|
||||||
<Compile Include="Ideology\Rituals\LordJob_Rituals.cs" />
|
<Compile Include="Ideology\Rituals\LordJob_Rituals.cs" />
|
||||||
<Compile Include="Ideology\RJW_Patch_Ideo.cs" />
|
<Compile Include="Ideology\RJW_Patch_Ideo.cs" />
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
</requiredMemes>
|
</requiredMemes>
|
||||||
</PreceptDef>
|
</PreceptDef>
|
||||||
|
|
||||||
<RJWSexperience.Ideology.PreceptDef_RequirementExtended>
|
<PreceptDef>
|
||||||
<defName>AnimalGangbangCeremony</defName>
|
<defName>AnimalGangbangCeremony</defName>
|
||||||
<label>animal gangbang</label>
|
<label>animal gangbang</label>
|
||||||
<description>A ritualistic gangbang where animals rape a victim.</description>
|
<description>A ritualistic gangbang where animals rape a victim.</description>
|
||||||
|
@ -65,11 +65,15 @@
|
||||||
<receivesExpectationsQualityOffset>true</receivesExpectationsQualityOffset>
|
<receivesExpectationsQualityOffset>true</receivesExpectationsQualityOffset>
|
||||||
<canGenerateAsSpecialPrecept>false</canGenerateAsSpecialPrecept>
|
<canGenerateAsSpecialPrecept>false</canGenerateAsSpecialPrecept>
|
||||||
<allowStackingRitualObligationAlerts>true</allowStackingRitualObligationAlerts>
|
<allowStackingRitualObligationAlerts>true</allowStackingRitualObligationAlerts>
|
||||||
|
<modExtensions>
|
||||||
|
<li Class="RJWSexperience.Ideology.PreceptDefExtension_MultipleMemesRequired">
|
||||||
<requiredAllMemes>
|
<requiredAllMemes>
|
||||||
<li>Rapist</li>
|
<li>Rapist</li>
|
||||||
<li>Zoophile</li>
|
<li>Zoophile</li>
|
||||||
</requiredAllMemes>
|
</requiredAllMemes>
|
||||||
</RJWSexperience.Ideology.PreceptDef_RequirementExtended>
|
</li>
|
||||||
|
</modExtensions>
|
||||||
|
</PreceptDef>
|
||||||
|
|
||||||
<PreceptDef>
|
<PreceptDef>
|
||||||
<defName>AnimalGangbangCeremony_Consensual</defName>
|
<defName>AnimalGangbangCeremony_Consensual</defName>
|
||||||
|
|
Loading…
Reference in a new issue