public static void GetGizmos(Pawn __instance, ref IEnumerable <Gizmo> __result) { if ((__instance.IsColonistPlayerControlled && !__instance.story.DisabledWorkTagsBackstoryAndTraits.OverlapsWithOnAnyWorkType(WorkTags.Violent)) || DebugSettings.godMode) { if (__instance.equipment != null && __instance.inventory != null) { IEnumerable <ThingWithComps> carriedWeapons = __instance.getCarriedWeapons(); GoldfishModule pawnMemory = GoldfishModule.GetGoldfishForPawn(__instance); //if (carriedWeapons.Count() > 0 || (pawnMemory != null && pawnMemory.RememberedWeapons.Count > 0)) { List <ThingStuffPair> rangedWeaponMemories = new List <ThingStuffPair>(); List <ThingStuffPair> meleeWeaponMemories = new List <ThingStuffPair>(); if (pawnMemory != null) { foreach (ThingStuffPair weapon in pawnMemory.RememberedWeapons) { if (weapon.thing.IsMeleeWeapon) { meleeWeaponMemories.Add(weapon); } else if (weapon.thing.IsRangedWeapon) { rangedWeaponMemories.Add(weapon); } } } Gizmo_SidearmsList advanced = new Gizmo_SidearmsList(__instance, carriedWeapons, pawnMemory.RememberedWeapons); List <Gizmo> results = new List <Gizmo>(); foreach (Gizmo gizmo in __result) { results.Add(gizmo); } results.Add(advanced); __result = results; } } } if (DebugSettings.godMode) { Gizmo_Brainscope brainscope = new Gizmo_Brainscope(__instance); List <Gizmo> results = new List <Gizmo>(); foreach (Gizmo gizmo in __result) { results.Add(gizmo); } results.Add(brainscope); __result = results; } }
public static void GetGizmos(Pawn __instance, ref IEnumerable <Gizmo> __result) { if (!__instance.IsValidSidearmsCarrier()) { return; } try { if ((__instance.IsColonistPlayerControlled) || DebugSettings.godMode) { if (__instance.equipment != null && __instance.inventory != null) { IEnumerable <ThingWithComps> carriedWeapons = __instance.getCarriedWeapons(includeTools: true); CompSidearmMemory pawnMemory = CompSidearmMemory.GetMemoryCompForPawn(__instance); if (pawnMemory == null) { return; } //if (carriedWeapons.Count() > 0 || (pawnMemory != null && pawnMemory.RememberedWeapons.Count > 0)) { List <ThingDefStuffDefPair> rangedWeaponMemories = new List <ThingDefStuffDefPair>(); List <ThingDefStuffDefPair> meleeWeaponMemories = new List <ThingDefStuffDefPair>(); if (pawnMemory != null) { foreach (ThingDefStuffDefPair weapon in pawnMemory.RememberedWeapons) { if (weapon.thing.IsMeleeWeapon) { meleeWeaponMemories.Add(weapon); } else if (weapon.thing.IsRangedWeapon) { rangedWeaponMemories.Add(weapon); } } } Gizmo_SidearmsList advanced = new Gizmo_SidearmsList(__instance, carriedWeapons, pawnMemory.RememberedWeapons); List <Gizmo> results = new List <Gizmo>(); results.Add(advanced); if (DebugSettings.godMode) { Gizmo_Brainscope brainscope = new Gizmo_Brainscope(__instance); results.Add(brainscope); } foreach (Gizmo gizmo in __result) { results.Add(gizmo); } ; __result = results; } } } } catch (Exception e) { Log.Error("Exception during SimpleSidearms gizmo intercept. Cancelling intercept. Exception: " + e.ToString()); } }