public static void Patch_VerbTracker_GetVerbsCommands_Postfix( ref VerbTracker __instance, ref IEnumerable <Command> __result, ref KeyCode hotKey) { CompEquippable directOwner = __instance.directOwner as CompEquippable; MultiVerbComp multiVerb = (MultiVerbComp)null; if (directOwner == null || (M0)(multiVerb = (MultiVerbComp)ThingCompUtility.TryGetComp <MultiVerbComp>((Thing)((ThingComp)directOwner).parent)) == null) { return; } List <Command> commandList = new List <Command>(); int index = 0; commandList.AddRange(__result); using (List <Verb> .Enumerator enumerator = __instance.get_AllVerbs().GetEnumerator()) { while (enumerator.MoveNext()) { MechaniteForgeHarmonyPatches.Command_MultiVerb commandMultiVerb = new MechaniteForgeHarmonyPatches.Command_MultiVerb(enumerator.Current, multiVerb, index); commandList.Add((Command)commandMultiVerb); ++index; } } __result = (IEnumerable <Command>)commandList; }
public static bool Patch_VerbTracker_PrimaryVerb_Prefix( ref VerbTracker __instance, ref Verb __result) { if (__instance.get_AllVerbs() == null && MechaniteForgeHarmonyPatches.VerbTracker_InitVerbs != null) { MechaniteForgeHarmonyPatches.VerbTracker_InitVerbs.Invoke((object)__instance, new object[0]); } CompEquippable directOwner = __instance.directOwner as CompEquippable; MultiVerbComp multiVerbComp = (MultiVerbComp)null; if (directOwner != null && (M0)(multiVerbComp = (MultiVerbComp)ThingCompUtility.TryGetComp <MultiVerbComp>((Thing)((ThingComp)directOwner).parent)) != null) { __result = __instance.get_AllVerbs()[multiVerbComp.currentVerbIndex]; if (__result != null) { return(false); } } return(true); }