public static void PostFix(ref bool __result, ThingDef A, ThingDef B, BodyDef body) { if (__result && GhostGearUtility.GetIsGGApparel(A) && GhostGearUtility.GetIsGGApparel(B)) { __result = false; } }
// Token: 0x06000037 RID: 55 RVA: 0x000030D0 File Offset: 0x000012D0 public static void GGCaltropsUse(Pawn pawn, ThingWithComps GGArmour, bool usingCaltrops, bool rearming) { if (!rearming) { if (!usingCaltrops) { return; } var dmdef = DefDatabase <DamageDef> .GetNamed("Damage_GGCaltrops"); var postTD = DefDatabase <ThingDef> .GetNamed("Filth_GGCaltrops"); GenExplosion.DoExplosion(pawn.Position, pawn.Map, 4.9f, dmdef, pawn, 0, -1f, null, null, null, null, postTD, 1f, 1, false, null, 0f, 0, 0f, true); ((GhostGearApparel)GGArmour).CaltropsUses--; if (((GhostGearApparel)GGArmour).CaltropsUses < 0) { ((GhostGearApparel)GGArmour).CaltropsUses = 0; } } else if (GhostGearUtility.GGComposMentis(pawn, GGArmour, out var Reason)) { if (((GhostGearApparel)GGArmour).CaltropsUses >= ((GhostGearApparel)GGArmour).CaltropsMax) { Messages.Message("GhostGear.IsFullyRearmed".Translate(GGArmour.Label.CapitalizeFirst()), pawn, MessageTypeDefOf.NeutralEvent, false); SoundDefOf.ClickReject.PlayOneShotOnCamera(); return; } var GGRearm = DefDatabase <JobDef> .GetNamed("GGRearmCaltrops"); FindBestGGRearm(pawn, GGArmour, out var targ); if (targ != null) { var job = new Job(GGRearm, targ); pawn.jobs.TryTakeOrderedJob(job, JobTag.Misc); return; } Messages.Message("GhostGear.NoCaltropsFound".Translate(GGArmour.Label.CapitalizeFirst()), pawn, MessageTypeDefOf.NeutralEvent, false); SoundDefOf.ClickReject.PlayOneShotOnCamera(); } else { Messages.Message("GhostGear.CantDo".Translate(pawn, Reason, GGArmour.Label.CapitalizeFirst()), pawn, MessageTypeDefOf.NeutralEvent, false); SoundDefOf.ClickReject.PlayOneShotOnCamera(); } }
public static void PostFix(ref Verb __instance, ref bool __result, LocalTargetInfo targ) { if (!__result || __instance.IsMeleeAttack || !__instance.verbProps.requireLineOfSight || !targ.HasThing || targ.Thing is not Pawn pawn || !GhostGearUtility.IsTargetGhosted(pawn, __instance.caster)) { return; } if (Controller.Settings.ShowConfusion) { GhostGearUtility.DoConfusedMote(__instance.caster, pawn); } __result = false; }
// Token: 0x060000A2 RID: 162 RVA: 0x00005AD8 File Offset: 0x00003CD8 protected override Job TryGiveJob(Pawn pawn) { if (!Controller.Settings.DoAutoRearm || !pawn.IsColonistPlayerControlled) { return(null); } if (pawn.InMentalState) { return(null); } if (pawn.Map == null) { return(null); } var jobdef = DefDatabase <JobDef> .GetNamed("GGRearmCaltrops"); if (pawn.CurJobDef == jobdef) { return(null); } var GG = GhostGearUtility.GetWornGG(pawn); if (GG == null) { return(null); } var podsMax = ((GhostGearApparel)GG).CaltropsMax; var podsFuel = (GG as GhostGearApparel).CaltropsUses; var podsItem = DefDatabase <ThingDef> .GetNamed("GGCaltropsPod"); if (podsMax <= 0 || podsFuel >= podsMax || podsFuel * 100 / podsMax >= 100) { return(null); } FindBestRearm(pawn, podsItem, podsMax, podsFuel, out var targ); if (targ != null) { return(new Job(jobdef, targ)); } return(null); }
// Token: 0x06000002 RID: 2 RVA: 0x0000206C File Offset: 0x0000026C public override void Tick() { spawnTick++; if (spawnTick >= (2500f * Controller.Settings.CaltropDuration) + HaywireUtility.RndTicks(-25, 25)) { DoCaltropBurst(null, "TM", this); return; } if (spawnTick < 300 || Find.TickManager.TicksGame % 60 != 0) { return; } var TargetMap = Map; var TargetCell = Position; var Pawnlist = TargetCell.GetThingList(TargetMap); if (Pawnlist.Count <= 0) { return; } foreach (var thing in Pawnlist) { Pawn pawn; if ((pawn = thing as Pawn) == null || GhostGearUtility.IsWearingGhostGear(pawn, out _) || thing.Position != TargetCell) { continue; } if ((thing as Pawn).RaceProps.IsMechanoid) { DoCaltropBurst(thing as Pawn, "ME", this); } else if ((thing as Pawn).RaceProps.FleshType.defName == "Insectoid") { DoCaltropBurst(thing as Pawn, "IF", this); } else { DoCaltropBurst(thing as Pawn, "OS", this); } } }