边缘世界 RimWorld

边缘世界 RimWorld

边缘爱情
 此主题已被置顶,因此可能具有重要性
telardo  [开发者] 2021 年 11 月 21 日 下午 7:14
Compatibility Guide (For modder)
I received several requests about filling pawns' romance need bar with interactions/activities in other romance mods. In most cases, I need a tedious transpiler but it can be done easily in these mods. If you're interested in adding this compatibility for your mod, the guide reads as follows.
First, we need to get the method info for the hook function with reflection.
using HarmonyLib; using System; using System.Reflection; using Verse; namespace YourMod { [StaticConstructorOnStartup] public static class HelperClass { public static MethodInfo fillRomanceBarMI; static HelperClass() { // check for this mod and get method info for hook if (ModLister.HasActiveModWithName("Romance On The Rim")) { fillRomanceBarMI = AccessTools.DeclaredMethod(Type.GetType("RomanceOnTheRim.RomanceUtility,RomanceOnTheRim"), "TryAffectRomanceNeedLevelForPawn"); } } } }
Once you have that static method info, you can invoke it to fill the romance need bar with
HelperClass.fillRomanceBarMI?.Invoke(null, new object[] { pawn, 0.2f });
, the first parameter in the hook function is the target pawn, the second is the need level offset. You can add it in your job driver, maybe in a tickaction or finishaction.
< >
正在显示第 1 - 1 条,共 1 条留言
telardo  [开发者] 2021 年 11 月 21 日 下午 7:17 
Thanks for making your mod fully compatible with this mod. If you have any questions about the guide, leave me a comment and I will try my best to offer help.^^
< >
正在显示第 1 - 1 条,共 1 条留言
每页显示数: 1530 50