Compare commits

..

No commits in common. "a19953c6884bf9a8c42931f4c8f375ad76416874" and "77dd1a23d62bf9804650beeb8b52c78184ac9b37" have entirely different histories.

15 changed files with 36 additions and 200 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest> <Manifest>
<identifier>RJWSexperienceIdeology</identifier> <identifier>RJWSexperienceIdeology</identifier>
<version>1.0.2.0</version> <version>1.0.1.2</version>
<dependencies> <dependencies>
<li>RimJobWorld >= 5.3.0</li> <li>RimJobWorld >= 5.3.0</li>
</dependencies> </dependencies>

View file

@ -1,13 +1,3 @@
## Version 1.0.2.0
* Removed Incestuos_IncestOnly conflict with Zoophile
* Patched manual romance to respect incestuous precepts
* Patched SecondaryRomanceChanceFactor for incest precept
* Added settings to disable ether of patches if needed
* Changed Incestuos_IncestOnly would_fuck multiplier for blood related pawns: 2.0 -> 1.0
* Changed Incestuos_IncestOnly would_fuck multiplier for non-blood related pawns: 1.0 -> 0.1
* Removed "not obedient" social thought for raping a slave
* Bestiality_Acceptable now nullifies RJW bestiality thoughts
* Fixed swapped baseMoodEffect of holy and elevated pregnancy precepts
## Version 1.0.1.2 ## Version 1.0.1.2
* Removed 100% certainty spam for sex proselyzing * Removed 100% certainty spam for sex proselyzing
* Maybe removed sex proselyzing error with bestiality * Maybe removed sex proselyzing error with bestiality

View file

@ -9,16 +9,6 @@
<RSNotAnimal>not animal</RSNotAnimal> <RSNotAnimal>not animal</RSNotAnimal>
<RSShouldCanFuck>capable of sex is required</RSShouldCanFuck> <RSShouldCanFuck>capable of sex is required</RSShouldCanFuck>
<RSI_PatchRomanceChanceFactor>Enable romance patch for incest precepts*</RSI_PatchRomanceChanceFactor>
<RSI_PatchRomanceChanceFactorTip>Patch for incest precepts to affect RomanceChanceFactor. May conflict with romance mods./n/n* Requires a game restart to apply changes</RSI_PatchRomanceChanceFactorTip>
<RSI_PatchIncestuousManualRomance>Enable manual romance patch for incest precepts*</RSI_PatchIncestuousManualRomance>
<RSI_PatchIncestuousManualRomanceTip>Patch for incest precepts to affect manual romance options./n/n* Requires a game restart to apply changes</RSI_PatchIncestuousManualRomanceTip>
<RSI_PreceptTipModifyBestialityMtb>Time between bestiality attempts x{0}</RSI_PreceptTipModifyBestialityMtb>
<RSI_PreceptTipModifyFappinMtb>Time between masturbation attempts x{0}</RSI_PreceptTipModifyFappinMtb>
<RSI_PreceptTipModifyNecroMtb>Time between necrophilia attempts x{0}</RSI_PreceptTipModifyNecroMtb>
<RSI_PreceptTipModifyRapeCPMtb>Time between rape attempts x{0}</RSI_PreceptTipModifyRapeCPMtb>
<!-- Rewrite vanilla key --> <!-- Rewrite vanilla key -->
<!-- <CantRomanceTargetIncest>forbidden by ideology</CantRomanceTargetIncest> --> <CantRomanceTargetIncest>forbidden by ideology</CantRomanceTargetIncest>
</LanguageData> </LanguageData>

View file

@ -54,7 +54,6 @@
<Compile Include="HistoryEvents\ArgsNamesCustom.cs" /> <Compile Include="HistoryEvents\ArgsNamesCustom.cs" />
<Compile Include="Keyed.cs" /> <Compile Include="Keyed.cs" />
<Compile Include="Precepts\DefExtension_Incest.cs" /> <Compile Include="Precepts\DefExtension_Incest.cs" />
<Compile Include="Precepts\IPreceptTipPostfix.cs" />
<Compile Include="PreceptWorkers\ThoughtWorker_Precept_GenitalSize.cs" /> <Compile Include="PreceptWorkers\ThoughtWorker_Precept_GenitalSize.cs" />
<Compile Include="PreceptWorkers\ThoughtWorker_Precept_GenitalSize_Social.cs" /> <Compile Include="PreceptWorkers\ThoughtWorker_Precept_GenitalSize_Social.cs" />
<Compile Include="PreceptWorkers\ThoughtWorker_Precept_NonPregnant.cs" /> <Compile Include="PreceptWorkers\ThoughtWorker_Precept_NonPregnant.cs" />
@ -88,8 +87,6 @@
<Compile Include="Rituals\RitualBehaviorWorkers.cs" /> <Compile Include="Rituals\RitualBehaviorWorkers.cs" />
<Compile Include="Rituals\RitualOutcomeComps.cs" /> <Compile Include="Rituals\RitualOutcomeComps.cs" />
<Compile Include="Rituals\RitualRoles.cs" /> <Compile Include="Rituals\RitualRoles.cs" />
<Compile Include="RsiMod.cs" />
<Compile Include="RsiSettings.cs" />
<Compile Include="StatParts.cs" /> <Compile Include="StatParts.cs" />
<Compile Include="IdeoUtility.cs" /> <Compile Include="IdeoUtility.cs" />
<Compile Include="Thoughts\ThoughtDefExtension_IncreaseRecord.cs" /> <Compile Include="Thoughts\ThoughtDefExtension_IncreaseRecord.cs" />
@ -100,7 +97,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref"> <PackageReference Include="Krafs.Rimworld.Ref">
<Version>1.4.3704</Version> <Version>1.4.3555</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Lib.Harmony"> <PackageReference Include="Lib.Harmony">
<Version>2.2.2</Version> <Version>2.2.2</Version>

View file

@ -4,17 +4,11 @@ namespace RJWSexperience.Ideology
{ {
public static class Keyed public static class Keyed
{ {
public static readonly string ModTitle = "RSI_Mod_Title".Translate();
public static readonly string MemeStatFactor = "MemeStatFactor".Translate(); public static readonly string MemeStatFactor = "MemeStatFactor".Translate();
public static readonly string RSVictimCondition = "RSVictimCondition".Translate(); public static readonly string RSVictimCondition = "RSVictimCondition".Translate();
public static readonly string RSBreederCondition = "RSBreederCondition".Translate(); public static readonly string RSBreederCondition = "RSBreederCondition".Translate();
public static readonly string RSNotHuman = "RSNotHuman".Translate(); public static readonly string RSNotHuman = "RSNotHuman".Translate();
public static readonly string RSNotAnimal = "RSNotAnimal".Translate(); public static readonly string RSNotAnimal = "RSNotAnimal".Translate();
public static readonly string RSShouldCanFuck = "RSShouldCanFuck".Translate(); public static readonly string RSShouldCanFuck = "RSShouldCanFuck".Translate();
public static readonly string PatchRomanceChanceFactor = "RSI_PatchRomanceChanceFactor".Translate();
public static readonly string PatchRomanceChanceFactorTip = "RSI_PatchRomanceChanceFactorTip".Translate();
public static readonly string PatchIncestuousManualRomance = "RSI_PatchIncestuousManualRomance".Translate();
public static readonly string PatchIncestuousManualRomanceTip = "RSI_PatchIncestuousManualRomanceTip".Translate();
} }
} }

View file

@ -7,7 +7,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Reflection.Emit; using System.Reflection.Emit;
using System.Text;
using Verse; using Verse;
namespace RJWSexperience.Ideology.Patches namespace RJWSexperience.Ideology.Patches
@ -61,8 +60,6 @@ namespace RJWSexperience.Ideology.Patches
[HarmonyPatch(typeof(RelationsUtility), "Incestuous")] [HarmonyPatch(typeof(RelationsUtility), "Incestuous")]
public static class Rimworld_Patch_IncestuousManualRomance public static class Rimworld_Patch_IncestuousManualRomance
{ {
public static bool Prepare() => RsiMod.Prefs.patchIncestuousManualRomance;
/// <summary> /// <summary>
/// Override incestuous check in the manual romance /// Override incestuous check in the manual romance
/// </summary> /// </summary>
@ -100,8 +97,6 @@ namespace RJWSexperience.Ideology.Patches
[HarmonyPatch(typeof(Pawn_RelationsTracker), nameof(Pawn_RelationsTracker.SecondaryRomanceChanceFactor))] [HarmonyPatch(typeof(Pawn_RelationsTracker), nameof(Pawn_RelationsTracker.SecondaryRomanceChanceFactor))]
public static class Rimworld_Patch_SecondaryRomanceChanceFactor public static class Rimworld_Patch_SecondaryRomanceChanceFactor
{ {
public static bool Prepare() => RsiMod.Prefs.patchRomanceChanceFactor;
/// <summary> /// <summary>
/// <para> /// <para>
/// Replace /// Replace
@ -129,6 +124,9 @@ namespace RJWSexperience.Ideology.Patches
typeof(RomanceChanceFactorHelpers), typeof(RomanceChanceFactorHelpers),
nameof(RomanceChanceFactorHelpers.GetRomanceChanceFactor), nameof(RomanceChanceFactorHelpers.GetRomanceChanceFactor),
new[] { typeof(Pawn), typeof(Pawn) }); new[] { typeof(Pawn), typeof(Pawn) });
bool skipping = false;
bool yieldNext = false;
bool finished = false;
// Original IL looks something like this: // Original IL looks something like this:
// Load this.pawn // Load this.pawn
@ -144,103 +142,41 @@ namespace RJWSexperience.Ideology.Patches
// Idea is to substitute GetRelations call with a method with the same signature, // Idea is to substitute GetRelations call with a method with the same signature,
// store results in the same place original loop does and remove everything else until Endfinaly // store results in the same place original loop does and remove everything else until Endfinaly
IEnumerator<CodeInstruction> enumerator = instructions.GetEnumerator(); foreach (CodeInstruction instruction in instructions)
bool endOfInstructions = enumerator.MoveNext();
// Find and replace GetRelations
while (!endOfInstructions)
{ {
var instruction = enumerator.Current; if (finished)
{
yield return instruction;
continue;
}
if (skipping)
{
if (yieldNext)
{
yield return instruction;
yieldNext = false;
}
else if (instruction.opcode == OpCodes.Mul)
{
yieldNext = true;
}
else if (instruction.opcode == OpCodes.Endfinally)
{
finished = true;
}
continue;
}
if (instruction.Calls(getRelationsInfo)) if (instruction.Calls(getRelationsInfo))
{ {
yield return new CodeInstruction(OpCodes.Call, helperInfo); yield return new CodeInstruction(OpCodes.Call, helperInfo);
enumerator.MoveNext(); // skip original method call skipping = true;
break; continue;
} }
yield return instruction; yield return instruction;
endOfInstructions = enumerator.MoveNext();
}
if (endOfInstructions)
{
Log.Error("[RSI] Failed to transpile Pawn_RelationsTracker.SecondaryRomanceChanceFactor: PawnRelationUtility.GetRelations call not found");
yield break;
}
// Skip everything until Mul
while (!endOfInstructions)
{
if (enumerator.Current.opcode == OpCodes.Mul)
{
enumerator.MoveNext(); // skip Mul
yield return enumerator.Current; // return next op, it should be "store result"
break;
}
endOfInstructions = enumerator.MoveNext();
}
if (endOfInstructions)
{
Log.Error("[RSI] Failed to transpile Pawn_RelationsTracker.SecondaryRomanceChanceFactor: Mul not found. This error means half of SecondaryRomanceChanceFactor was erased. Very not good");
yield break;
}
// Skip the rest of the loop
while (!endOfInstructions)
{
if (enumerator.Current.opcode == OpCodes.Endfinally)
{
// Endfinally will be skipped by the next MoveNext()
break;
}
endOfInstructions = enumerator.MoveNext();
}
if (endOfInstructions)
{
Log.Error("[RSI] Failed to transpile Pawn_RelationsTracker.SecondaryRomanceChanceFactor: Endfinally not found. This error means half of SecondaryRomanceChanceFactor was erased. Very not good");
yield break;
}
// Return the rest of the method
while (enumerator.MoveNext())
{
yield return enumerator.Current;
}
}
[HarmonyPatch(typeof(Precept), nameof(Precept.GetTip))]
public static class Rimworld_Patch_PreceptTip
{
public static void Postfix(ref string __result, Precept __instance)
{
if (__instance.def.modExtensions.NullOrEmpty())
{
return;
}
bool tipChanged = false;
StringBuilder tipBuilder = new StringBuilder(__result);
tipBuilder.AppendLine();
tipBuilder.AppendInNewLine((Keyed.ModTitle + ":").Colorize(ColoredText.TipSectionTitleColor));
for (int i = 0; i < __instance.def.modExtensions.Count; i++)
{
if (__instance.def.modExtensions[i] is IPreceptTipPostfix tipPostfix)
{
tipBuilder.AppendInNewLine(" - " + tipPostfix.GetTip());
tipChanged = true;
}
}
if (tipChanged)
{
__result = tipBuilder.ToString();
}
} }
} }
} }

View file

@ -2,6 +2,5 @@
{ {
public class DefExtension_ModifyBestialityMtb : DefExtension_ModifyMtb public class DefExtension_ModifyBestialityMtb : DefExtension_ModifyMtb
{ {
protected override string TipTemplateKey => "RSI_PreceptTipModifyBestialityMtb";
} }
} }

View file

@ -2,6 +2,5 @@
{ {
public class DefExtension_ModifyFappinMtb : DefExtension_ModifyMtb public class DefExtension_ModifyFappinMtb : DefExtension_ModifyMtb
{ {
protected override string TipTemplateKey => "RSI_PreceptTipModifyFappinMtb";
} }
} }

View file

@ -1,28 +1,11 @@
using System.Collections.Generic; using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.CodeAnalysis;
using Verse; using Verse;
namespace RJWSexperience.Ideology.Precepts namespace RJWSexperience.Ideology.Precepts
{ {
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field values are loaded from XML")] public abstract class DefExtension_ModifyMtb : DefModExtension
public abstract class DefExtension_ModifyMtb : DefModExtension, IPreceptTipPostfix
{ {
protected abstract string TipTemplateKey { get; } [SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public float multiplier = 1f; public float multiplier = 1f;
public string GetTip() => TipTemplateKey.Translate(multiplier.ToString());
public override IEnumerable<string> ConfigErrors()
{
if (multiplier == 1f)
{
yield return "There is no point if <multiplier> is 1";
}
else if (multiplier <= 0f)
{
yield return "<multiplier> must be > 0";
}
}
} }
} }

View file

@ -2,6 +2,5 @@
{ {
public class DefExtension_ModifyNecroMtb : DefExtension_ModifyMtb public class DefExtension_ModifyNecroMtb : DefExtension_ModifyMtb
{ {
protected override string TipTemplateKey => "RSI_PreceptTipModifyNecroMtb";
} }
} }

View file

@ -2,6 +2,5 @@
{ {
public class DefExtension_ModifyRapeCPMtb : DefExtension_ModifyMtb public class DefExtension_ModifyRapeCPMtb : DefExtension_ModifyMtb
{ {
protected override string TipTemplateKey => "RSI_PreceptTipModifyRapeCPMtb";
} }
} }

View file

@ -1,7 +0,0 @@
namespace RJWSexperience.Ideology.Precepts
{
public interface IPreceptTipPostfix
{
string GetTip();
}
}

View file

@ -1,26 +0,0 @@
using UnityEngine;
using Verse;
namespace RJWSexperience.Ideology
{
public class RsiMod : Mod
{
public static RsiSettings Prefs { get; private set; }
public RsiMod(ModContentPack content) : base(content)
{
Prefs = GetSettings<RsiSettings>();
}
public override string SettingsCategory() => Keyed.ModTitle;
public override void DoSettingsWindowContents(Rect inRect)
{
Listing_Standard listmain = new Listing_Standard();
listmain.Begin(inRect);
listmain.CheckboxLabeled(Keyed.PatchRomanceChanceFactor, ref Prefs.patchRomanceChanceFactor, Keyed.PatchRomanceChanceFactorTip);
listmain.CheckboxLabeled(Keyed.PatchIncestuousManualRomance, ref Prefs.patchIncestuousManualRomance, Keyed.PatchIncestuousManualRomanceTip);
listmain.End();
}
}
}

View file

@ -1,17 +0,0 @@
using Verse;
namespace RJWSexperience.Ideology
{
public class RsiSettings : ModSettings
{
public bool patchRomanceChanceFactor;
public bool patchIncestuousManualRomance;
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref patchRomanceChanceFactor, "patchSecondaryRomanceChanceFactor", true);
Scribe_Values.Look(ref patchIncestuousManualRomance, "patchIncestuousManualRomance", true);
}
}
}