public static void Postfix(Apparel __instance, DamageInfo dinfo, ref bool __result) { if (__instance == null) { return; } CompTurret apparel_Turret = __instance.TryGetComp <CompTurret>(); if (apparel_Turret != null) { if (dinfo.Def == DamageDefOf.EMP) { foreach (ThingComp item in __instance.AllComps) { CompTurretGun Turret = item as CompTurretGun; if (Turret != null && Turret.AffectedByEMP) { Turret.stunTicksLeft += Mathf.RoundToInt(dinfo.Amount * 30f); Turret.stunFromEMP = true; // Log.Message(Turret.gun.Label + " turret hit by EMP, disabling for " + Mathf.RoundToInt(dinfo.Amount * 30f) + " ticks, Total: "+ Turret.stunTicksLeft); } } } } }
static void Postfix(ref Pawn __instance) { if (__instance.apparel != null) { if (__instance.apparel.WornApparel.Any()) { foreach (var item in __instance.apparel.WornApparel) { CompTurret turret = item.TryGetCompFast <CompTurret>(); if (turret != null) { foreach (CompTurret comp in item.GetComps <CompTurret>()) { comp.PostDrawExtraSelectionOverlays(); } } } } } }
static void Postfix(ref Pawn __instance) { if (__instance.apparel != null) { if (__instance.apparel.WornApparel.Any()) { foreach (var item in __instance.apparel.WornApparel) { CompTurret turret = item.TryGetComp <CompTurret>(); if (turret != null) { foreach (CompTurret comp in item.GetComps <CompTurret>()) { if (comp.Props.drawTurret) { comp.PostDraw(); } } } } } } }