RimWorld

RimWorld

FriendRivalPatch
This topic has been locked
Side1iner  [developer] 12 May, 2024 @ 1:22am
Thought patch
Post it here!
< >
Showing 1-1 of 1 comments
jokulimy 12 May, 2024 @ 3:44am 
Looked at your latest change.. so you are now changing the minimum mood debuff to 0... which i guess works.
anyway.. here is my patch that actually prevents the creation of the thoughts, feel free to use/edit it if you want

[HarmonyPatch(typeof(PawnDiedOrDownedThoughtsUtility), "AppendThoughts_Relations")]
class FiendRivalPatchThreshhold
{

[HarmonyTranspiler]
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructionEnumerable, MethodBase original)
{
var instructions = instructionEnumerable.ToList();
bool found = false;

for (int i = 0; i < instructions.Count; i++)
{
if (instructions.Is(OpCodes.Ldc_I4_S, 20))
{
yield return new CodeInstruction(OpCodes.Ldc_I4_S, 50);
found = true;
continue;
}
else
if (instructions.Is(OpCodes.Ldc_I4_S, -20))
{
yield return new CodeInstruction(OpCodes.Ldc_I4_S, -40);
found = true;
continue;
}
else
{
yield return instructions;
}

}
if (!found)
{
ModLog.Error($"Failed to patch {original.Name}");
}
}
}
< >
Showing 1-1 of 1 comments
Per page: 1530 50