public static void GetGizmos_PostFix(Pawn_EquipmentTracker __instance, ref IEnumerable <Gizmo> __result) // adds abilities to pawns { Pawn pawn = __instance.pawn; if (!pawn.IsColonist) { return; } if (PawnAttackGizmoUtility.CanShowEquipmentGizmos()) { List <Gizmo> newOutput = new List <Gizmo>(); newOutput.AddRange(__result); if (pawn.Drafted) { foreach (ThingWithComps thingWithComps in __instance.AllEquipmentListForReading) { foreach (ThingComp thingComp in thingWithComps.AllComps.FindAll(c => c is CompWeaponTransform comp1)) { newOutput.AddRange(thingComp.CompGetGizmosExtra()); } } } __result = newOutput; } }
public IEnumerable <Gizmo> GetGizmos() { if (PawnAttackGizmoUtility.CanShowEquipmentGizmos()) { List <ThingWithComps> list = this.AllEquipmentListForReading; for (int i = 0; i < list.Count; i++) { ThingWithComps eq = list[i]; foreach (Command command in eq.GetComp <CompEquippable>().GetVerbsCommands()) { if (i != 0) { if (i != 1) { if (i == 2) { command.hotKey = KeyBindingDefOf.Misc3; } } else { command.hotKey = KeyBindingDefOf.Misc2; } } else { command.hotKey = KeyBindingDefOf.Misc1; } yield return(command); } } } yield break; }
public static void GetGizmos_PostFix(Pawn_EquipmentTracker __instance, ref IEnumerable <Gizmo> __result) { if (PawnAttackGizmoUtility.CanShowEquipmentGizmos()) { if (__instance?.Primary?.def?.defName == "RE_StunGun") { __result = __result.Concat(__instance.Primary.GetComp <CompStunCharge>().CompGetGizmosExtra()); } } }
public IEnumerable <Gizmo> GetGizmos() { if (PawnAttackGizmoUtility.CanShowEquipmentGizmos()) { List <ThingWithComps> list = this.AllEquipmentListForReading; for (int i = 0; i < list.Count; i++) { ThingWithComps eq = list[i]; using (IEnumerator <Command> enumerator = eq.GetComp <CompEquippable>().GetVerbsCommands().GetEnumerator()) { if (enumerator.MoveNext()) { Command command = enumerator.Current; switch (i) { case 0: command.hotKey = KeyBindingDefOf.Misc1; break; case 1: command.hotKey = KeyBindingDefOf.Misc2; break; case 2: command.hotKey = KeyBindingDefOf.Misc3; break; } yield return((Gizmo)command); /*Error: Unable to find new state assignment for yield return*/; } } } } yield break; IL_0187: /*Error near IL_0188: Unexpected return in MoveNext()*/; }