public static bool Prefix(Corpse corpse, DeathActionWorker_BigExplosion __instance) { bool flag = XenomorphUtil.IsInfectedPawn(corpse.InnerPawn); if (flag) { return(false); } return(true); }
public static bool Pre_PawnDied_Facehugger(Corpse corpse, DeathActionWorker_BigExplosion __instance) { // Log.Message(string.Format("{0}", corpse.Label)); bool flag = XenomorphUtil.IsInfectedPawn(corpse.InnerPawn); if (flag) { return(false); } return(true); }
// Token: 0x060039DF RID: 14815 RVA: 0x001B80A4 File Offset: 0x001B64A4 protected override DamageWorker.DamageResult ApplyMeleeDamageToTarget(LocalTargetInfo target) { DamageWorker.DamageResult result = new DamageWorker.DamageResult(); Pawn hitPawn = (Pawn)target; if (infect && !XenomorphUtil.IsInfectedPawn(hitPawn) && !hitPawn.Dead && hitPawn.RaceProps.body.AllParts.Any(x => x.def.defName.Contains("Head"))) { foreach (var part in hitPawn.RaceProps.body.AllParts.Where(x => x.def.defName.Contains("Head"))) { Hediff hediff = HediffMaker.MakeHediff(XenomorphDefOf.RRY_FaceHuggerInfection, hitPawn, null); Comp_Facehugger _Facehugger = CasterPawn.TryGetComp <Comp_Facehugger>(); HediffComp_XenoFacehugger comp = hediff.TryGetComp <HediffComp_XenoFacehugger>(); comp.instigator = CasterPawn; comp.instigatorKindDef = CasterPawn.kindDef; comp.royaleHugger = _Facehugger.RoyaleHugger; comp.previousImpregnations = _Facehugger.Impregnations; hitPawn.health.AddHediff(hediff, part, null); string text = TranslatorFormattedStringExtensions.Translate("Xeno_Facehugger_Attach", hitPawn.LabelShort, part.LabelShortCap); MoteMaker.ThrowText(hitPawn.Position.ToVector3(), hitPawn.Map, text, 5f); comp.GetDirectlyHeldThings(); caster.DeSpawn(); infect = false; } } else { foreach (DamageInfo dinfo in this.DamageInfosToApply(target)) { if (target.ThingDestroyed) { break; } result = target.Thing.TakeDamage(dinfo); } } return(result); }
// Patch_PawnRenderer_WigglerTick /* * public static void Patch_PawnRenderer_WigglerTick(PawnRenderer __instance) * { * Pawn pawn = HarmonyPatches.PawnRenderer_GetPawn(__instance); * foreach (var hd in pawn.health.hediffSet.hediffs) * { * HediffComp_XenoSpawner comp = hd.TryGetComp<HediffComp_XenoSpawner>(); * if (comp != null) * { * int num = Find.TickManager.TicksGame % 300 * 2; * if (num < 90) * { * this.downedAngle += 0.35f; * } * else if (num < 390 && num >= 300) * { * this.downedAngle -= 0.35f; * } * } * } * * } */ /* * * int num = Find.TickManager.TicksGame % 300 * 2; * if (num < 90) * { * this.downedAngle += 0.35f; * } * else if (num < 390 && num >= 300) * { * this.downedAngle -= 0.35f; * } */ // Token: 0x0600000C RID: 12 RVA: 0x0000283C File Offset: 0x00000A3C public static void RareTickPostfix(Corpse __instance) { if (XenomorphUtil.IsInfectedPawn(__instance.InnerPawn)) { HediffWithComps hediff = null; if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_FaceHuggerInfection)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_FaceHuggerInfection); } else if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_XenomorphImpregnation)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_XenomorphImpregnation); } else if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_HiddenXenomorphImpregnation)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_HiddenXenomorphImpregnation); } else if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_NeomorphImpregnation)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_NeomorphImpregnation); } else if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_HiddenNeomorphImpregnation)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_HiddenNeomorphImpregnation); } if (hediff != null) { for (int i = 0; i <= 250; i++) { // float sev = 0f; // hediff.TryGetComp<HediffComp_XenoSpawner>().CompPostTick(ref sev); hediff.PostTick(); } } } }
public static List <Pawn> SpawnedInfectedPawns(Map map) { return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsInfectedPawn(x))); }
public override void CompPostTick(ref float severityAdjustment) { bool selected = Find.Selector.SelectedObjects.Contains(Pawn) && Prefs.DevMode; base.CompPostTick(ref severityAdjustment); if (!QueenPresent && !PredalienPresent) { float num = 1f / ((3 * Pawn.BodySize) * 60000f); if (this.conversionProgress < 1f) { this.conversionProgress += num; } } if (Find.TickManager.TicksGame % 300 == 0) { if (Pawn.CurrentBed() == null) { Pawn.health.RemoveHediff(this.parent); } #if DEBUG if (this.conversionProgress >= 1f && selected) { Log.Message(string.Format("QueenPresent: {0}, PredalienPresent: {1}, RoyalEggPresent: {2}, RoyalPresent: {3}", QueenPresent, PredalienPresent, RoyalEggPresent, RoyalPresent)); } #endif if (!QueenPresent) { if (this.conversionProgress >= 1f && XenomorphUtil.TotalSpawnedEggCount(MyMap) < (cocoonedCount / 2) && !XenomorphUtil.IsInfectedPawn(Pawn)) { float chance = Pawn.RaceProps.Humanlike ? 0.001f + ((float)EggConvertTicks / 1000) : .05f + ((float)EggConvertTicks / 500); EggConvertTicks++; if (Rand.Chance(chance)) { Thing thing = ThingMaker.MakeThing(eggDef, null); Building_XenoEgg _XenoEgg = (Building_XenoEgg)thing; CompXenoHatcher xenoHatcher = _XenoEgg.TryGetComp <CompXenoHatcher>(); if (!RoyalEggPresent && !RoyalPresent) { xenoHatcher.royalProgress = Pawn.BodySize; } MyCocoon.Destroy(); GenPlace.TryPlaceThing(thing, Pawn.Position != null ? Pawn.Position : Pawn.PositionHeld, Pawn.Map ?? Pawn.MapHeld, ThingPlaceMode.Direct); // Pawn.health.RemoveHediff(this.parent); Pawn.Destroy(); } else { #if DEBUG // Log.Message(string.Format("{0}, failed convert chance", conversionProgress)); #endif } } } } }