RimTalk - Player - lyFixPart
This mod serves as an unofficial temporary fix for the mute failure issue in RimTalk-Player (化身为人拓展).
It implements minimal changes to resolve the problem where pawns under mute effects would occasionally initiate conversations under indeterminate conditions.
This mod will be permanently removed once the original RimTalk-Player mod releases an update addressing this issue.
The complete source code is shorter than this mod's About.txt:
这个模组是为了临时修复RimTalk-Player(化身为人拓展)的禁言失效问题而制作的非官方补丁。
只进行了极细微的修改,解决了有禁言效果的Pawn在不确定情况下依旧会自发开始对话的问题。
此模组会在原模组(RimTalk-Player)发布更新并修复此问题后下架删除。
以下是此模组比“About.txt"还短的源码:
namespace ly.RimTalk_P_fixpart
{
public static class ModInFo
{
public const String ModID = "ly.RimTalk.Player.FixPart";
public const string HarmonyPatchID = ModID + ".patch";
}
[StaticConstructorOnStartup]
public class StartUp
{
static StartUp()
{
Patcher.DoPatching();
}
}
public class Patcher
{
public static void DoPatching()
{
var harmony = new Harmony($"{ModInFo.HarmonyPatchID}");
harmony.PatchAll(Assembly.GetExecutingAssembly());
}
}
[HarmonyPatch(typeof(PawnState), "CanGenerateTalk")]
static class Patch_PawnState_CanGenerateTalk
{
static void Postfix(PawnState __instance, ref bool __result)
{
if (__result)
{
Pawn pawn = __instance.Pawn;
__result = (pawn.health.hediffSet == null ||
pawn.health.hediffSet.GetFirstHediffOfDef(PawnCheckUtil.DisableHediff, false) == null);
}
}
}
}