public static bool Patch_CheckCreateVerbProperties(ref Pawn_NativeVerbs __instance) { bool flag = HarmonyPatches._cachedVerbProperties.GetValue(__instance) != null; bool result; if (flag) { result = true; } else { bool flag2 = XenomorphUtil.IsXenomorph(HarmonyPatches.pawnPawnNativeVerbs(__instance)); if (flag2) { HarmonyPatches._cachedVerbProperties.SetValue(__instance, new List <VerbProperties>()); HarmonyPatches.cachedVerbProperties(__instance).Add(NativeVerbPropertiesDatabase.VerbWithCategory((VerbCategory)1)); result = false; } else { result = true; } } return(result); }
private static bool Prefix(ref Pawn_NativeVerbs __instance) { if (__instance.cachedVerbProperties == null) { if (__instance.pawn.isSnotling()) { __instance.cachedVerbProperties = new List <VerbProperties>(); __instance.cachedVerbProperties.Add(NativeVerbPropertiesDatabase.VerbWithCategory(VerbCategory.BeatFire)); return(false); } } return(true); }
public static bool Patch_CheckCreateVerbProperties(ref Pawn_NativeVerbs __instance) { if (_cachedVerbProperties.GetValue(__instance) != null) { return(true); } if (pawnPawnNativeVerbs(__instance).def.thingClass == typeof(Insect) || pawnPawnNativeVerbs(__instance).def.thingClass == typeof(Queen)) { _cachedVerbProperties.SetValue(__instance, new List <VerbProperties>()); cachedVerbProperties(__instance).Add(NativeVerbPropertiesDatabase.VerbWithCategory(VerbCategory.BeatFire)); return(false); } return(true); }
private static bool Prefix(ref Pawn_NativeVerbs __instance) { bool flag = Pawn_NativeVerbs_CheckCreateVerbProperties_Patch.cachedVerbProperties(__instance) == null; if (flag) { bool flag2 = Pawn_NativeVerbs_CheckCreateVerbProperties_Patch.pawn(__instance).isSnotling(); if (flag2) { Pawn_NativeVerbs_CheckCreateVerbProperties_Patch.FI_cachedVerbProperties.SetValue(__instance, new List <VerbProperties>()); Pawn_NativeVerbs_CheckCreateVerbProperties_Patch.cachedVerbProperties(__instance).Add(NativeVerbPropertiesDatabase.VerbWithCategory(VerbCategory.BeatFire)); return(false); } } return(true); }
public static List <VerbProperties> cachedVerbProperties(Pawn_NativeVerbs instance) { return((List <VerbProperties>)_cachedVerbProperties.GetValue(instance)); }
public static Pawn pawnPawnNativeVerbs(Pawn_NativeVerbs instance) { return((Pawn)_pawnPawnNativeVerbs.GetValue(instance)); }
public static Pawn pawnPawnNativeVerbs(Pawn_NativeVerbs instance) { return((Pawn)HarmonyInstanceOrkz._pawnPawnNativeVerbs.GetValue(instance)); }
public override void PostExposeData(object obj) { if (Scribe.mode == LoadSaveMode.LoadingVars) { Game game = obj as Game; if (game != null && game.questManager == null) { game.questManager = new QuestManager(); } Zone zone = obj as Zone; if (zone != null && zone.ID == -1) { zone.ID = Find.UniqueIDsManager.GetNextZoneID(); } } if (Scribe.mode != LoadSaveMode.PostLoadInit) { return; } Pawn pawn = obj as Pawn; if (pawn != null && pawn.royalty == null) { pawn.royalty = new Pawn_RoyaltyTracker(pawn); } Pawn_NativeVerbs pawn_NativeVerbs = obj as Pawn_NativeVerbs; if (pawn_NativeVerbs != null && pawn_NativeVerbs.verbTracker == null) { pawn_NativeVerbs.verbTracker = new VerbTracker(pawn_NativeVerbs); } Thing thing = obj as Thing; if (thing != null) { if (thing.def.defName == "Sandbags" && thing.Stuff == null) { thing.SetStuffDirect(ThingDefOf.Cloth); } if (thing.def == ThingDefOf.MechCapsule) { foreach (XmlNode oldCrashedShipPart in oldCrashedShipParts) { XmlElement xmlElement = oldCrashedShipPart["def"]; XmlElement xmlElement2 = oldCrashedShipPart["id"]; if (xmlElement != null && xmlElement2 != null && Thing.IDNumberFromThingID(xmlElement2.InnerText) == thing.thingIDNumber) { upgradedCrashedShipParts.Add(new UpgradedCrashedShipPart { originalDefName = xmlElement.InnerText, thing = thing }); } } } } StoryWatcher storyWatcher = obj as StoryWatcher; if (storyWatcher != null) { if (storyWatcher.watcherAdaptation == null) { storyWatcher.watcherAdaptation = new StoryWatcher_Adaptation(); } if (storyWatcher.watcherPopAdaptation == null) { storyWatcher.watcherPopAdaptation = new StoryWatcher_PopAdaptation(); } } FoodRestrictionDatabase foodRestrictionDatabase = obj as FoodRestrictionDatabase; if (foodRestrictionDatabase != null && VersionControl.BuildFromVersionString(ScribeMetaHeaderUtility.loadedGameVersion) < 2057) { List <FoodRestriction> allFoodRestrictions = foodRestrictionDatabase.AllFoodRestrictions; for (int i = 0; i < allFoodRestrictions.Count; i++) { allFoodRestrictions[i].filter.SetAllow(ThingCategoryDefOf.CorpsesHumanlike, allow: true); allFoodRestrictions[i].filter.SetAllow(ThingCategoryDefOf.CorpsesAnimal, allow: true); } } SitePart sitePart = obj as SitePart; if (sitePart != null) { sitePart.hidden = sitePart.def.defaultHidden; } }
private static List <VerbProperties> cachedVerbProperties(Pawn_NativeVerbs instance) { return((List <VerbProperties>)Pawn_NativeVerbs_CheckCreateVerbProperties_Patch.FI_cachedVerbProperties.GetValue(instance)); }
private static Pawn pawn(Pawn_NativeVerbs instance) { return((Pawn)Pawn_NativeVerbs_CheckCreateVerbProperties_Patch.FI_pawn.GetValue(instance)); }