Caves of Qud

Caves of Qud

Harmony Injector
 This topic has been pinned, so it's probably important
namkazt  [developer] 15 Jan, 2019 @ 9:51am
Example Annotation Mod
1, create new mod folder in Mods ( %AppData%\..\LocalLow\Freehold Games\CavesOfQud\Mods )

2, create new script file (.cs)
Content:
using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Reflection; using UnityEngine; using Harmony; using GameObject = XRL.World.GameObject; using XRL.World.Parts.Mutation; namespace Namkazt.HarmonyTest { [HarmonyPatch(typeof(MultipleArms))] [HarmonyPatch("Mutate", new[] { typeof(GameObject), typeof(int) })] class Patch { // all method can use parameters: // 1, MultipleArms __instance : equal with `this` in original method // 2, (ref) ResultType __result : result if method have ( ref is optional ) // 3, other parameter of method if have but need exactly same name // 4, other param is on Harmony Patch wiki. // only void static void Postfix() { Debug.Log("[Namkazt.HarmonyTest] Yay!. We just override mutate function if you have mutation [MultipleArms]"); } } [HarmonyPatch(typeof(MultipleArms))] [HarmonyPatch("Mutate", new[] { typeof(GameObject), typeof(int) })] class SecondPath_SameFunction { // can be bool or void static bool Prefix() { Debug.Log("[Namkazt.HarmonyTest] It is second patch method. is it working ?"); // return false will BLOCK original function return true; // return true will contionue to run original function } } }
Last edited by namkazt; 18 Jan, 2019 @ 2:02am