public override bool AllowVerbCast(IntVec3 root, TargetInfo targ) { if (targ.HasThing && targ.Thing.def.size != IntVec2.One) { return(root.AdjacentTo8WayOrInside(targ.Thing)); } return(root.AdjacentTo8WayOrInside(targ.Cell)); }
public static bool IsAdjacentOrInsideAndAllowedToTouch(IntVec3 root, LocalTargetInfo target, Map map) { GenAdj.GetAdjacentCorners(target, out IntVec3 BL, out IntVec3 TL, out IntVec3 TR, out IntVec3 BR); if (root.AdjacentTo8WayOrInside(target)) { return(!IsAdjacentCornerAndNotAllowed(root, BL, TL, TR, BR, map)); } return(false); }
public static bool IsAdjacentOrInsideAndAllowedToTouch(IntVec3 root, LocalTargetInfo target, Map map) { IntVec3 b1; IntVec3 t1; IntVec3 tr; IntVec3 br; GenAdj.GetAdjacentCorners(target, out b1, out t1, out tr, out br); return root.AdjacentTo8WayOrInside(target) && !TouchPathEndModeUtilityShips.IsAdjacentCornerAndNotAllowed(root, b1, t1, tr, br, map); }
public static bool IsAdjacentOrInsideAndAllowedToTouch(IntVec3 root, LocalTargetInfo target, Map map) { IntVec3 bL; IntVec3 tL; IntVec3 tR; IntVec3 bR; GenAdj.GetAdjacentCorners(target, out bL, out tL, out tR, out bR); return(root.AdjacentTo8WayOrInside(target) && !TouchPathEndModeUtility.IsAdjacentCornerAndNotAllowed(root, bL, tL, tR, bR, map)); }
// Token: 0x0600289D RID: 10397 RVA: 0x000EEC98 File Offset: 0x000ECE98 public bool IsAdjacentOrInsideAndAllowedToTouch(IntVec3 root, LocalTargetInfo target, Map map) { IntVec3 bl; IntVec3 tl; IntVec3 tr; IntVec3 br; GetAdjacentCorners(target, out bl, out tl, out tr, out br); return(root.AdjacentTo8WayOrInside(target) && !TouchPathEndModeUtility.IsAdjacentCornerAndNotAllowed(root, bl, tl, tr, br, map)); }
// Token: 0x060004D1 RID: 1233 RVA: 0x0003100C File Offset: 0x0002F40C protected override Job TryGiveJob(Pawn pawn) { float Searchradius = HuntingRange; IntVec3 c = IntVec3.Invalid; if (XenomorphKidnapUtility.TryFindGoodKidnapVictim(pawn, Searchradius, out Pawn t, null) && !GenAI.InDangerousCombat(pawn)) { if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, t, out c)) { ThingDef namedA = XenomorphDefOf.RRY_Xenomorph_Humanoid_Cocoon; ThingDef namedB = XenomorphDefOf.RRY_Xenomorph_Animal_Cocoon; bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (c != IntVec3.Invalid && t != null && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); //Log.Message(string.Format("{0} {1} {2} {3} {4} {5}", y, !adjacent, !filled, edifice, building, thing)); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); return(new Job(XenomorphDefOf.RRY_Job_XenomorphKidnap) { targetA = t, targetB = lc, count = 1 }); } else { if (Find.Selector.SelectedObjects.Contains(pawn)) { Log.Message(string.Format("{0} something went wrong", this)); } } } else { if (Find.Selector.SelectedObjects.Contains(pawn)) { Log.Message(string.Format("{0} No Cocooning spot Found", this)); } } }
public static bool IsAdjacentOrInsideAndAllowedToTouch(IntVec3 root, LocalTargetInfo target, Map map) { GenAdj.GetAdjacentCorners(target, out IntVec3 b1, out IntVec3 t1, out IntVec3 tr, out IntVec3 br); return(root.AdjacentTo8WayOrInside(target) && !IsAdjacentCornerAndNotAllowed(root, b1, t1, tr, br, map)); }
// Token: 0x060004D1 RID: 1233 RVA: 0x0003100C File Offset: 0x0002F40C protected override Job TryGiveJob(Pawn pawn) { float Searchradius = HuntingRange; Map map = pawn.Map; IntVec3 c = IntVec3.Invalid; Pawn Victim = null; if (!pawn.isXenomorph(out Comp_Xenomorph xenomorph) || map == null) { return(null); } MapComponent_HiveGrid hiveGrid = pawn.Map.HiveGrid(); /* * if (GenAI.InDangerousCombat(pawn)) * { * Log.Warning(string.Format("{0} is InDangerousCombat", pawn.NameShortColored)); * } */ if (XenomorphKidnapUtility.TryFindGoodKidnapVictim(pawn, Searchradius, out Victim, null, forceRoofed, allowCocooned, minRadius, allowHosts) && !GenAI.InDangerousCombat(pawn)) { if (xenomorph.HiveLoc.IsValid && xenomorph.HiveLoc.InBounds(map) && xenomorph.HiveLoc != IntVec3.Zero) { c = xenomorph.HiveLoc; } /* * else * if (!hiveGrid.Hivelist.NullOrEmpty()) * { * c = hiveGrid.Hivelist.RandomElement().Position; * } * else * if (!hiveGrid.HiveLoclist.NullOrEmpty()) * { * c = hiveGrid.HiveLoclist.RandomElement(); * } * else */ bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (c != IntVec3.Invalid && Victim != null && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool roofed = (y.Roofed(pawn.Map) && this.forceRoofed) || !this.forceRoofed; bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetThingList(pawn.Map).Any(x => x.GetType() == typeof(Building_XenoEgg) && x.GetType() == typeof(Building_XenomorphCocoon) && x.GetType() == typeof(HiveLike)); // Log.Message(string.Format("{0}, adjacent: {1}, filled: {2}, edifice: {3}, building: {4}", y, !adjacent, !filled, edifice, building)); return(!adjacent && !filled && edifice && building && !thingA && roofed && pawn.CanReserveAndReach(y, PathEndMode.OnCell, Danger.Deadly, layer: ReservationLayerDefOf.Floor)); }; if (pawn.GetLord() != null && pawn.GetLord() is Lord lord) { // Log.Message(string.Format("TryFindGoodHiveLoc pawn.GetLord() != null")); } else { // Log.Message(string.Format("TryFindGoodHiveLoc pawn.GetLord() == null")); } if (pawn.mindState.duty.def != XenomorphDefOf.RRY_Xenomorph_DefendAndExpandHive && pawn.mindState.duty.def != XenomorphDefOf.RRY_Xenomorph_DefendHiveAggressively) { pawn.mindState.duty = new PawnDuty(XenomorphDefOf.RRY_Xenomorph_DefendAndExpandHive, c, 40f); } if (RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 2, 8)) { return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Kidnap) { targetA = Victim, targetB = lc, targetC = lc.RandomAdjacentCell8Way(), count = 1 }); } } else { Log.Error("No suitable hive location found"); // if (Find.Selector.SelectedObjects.Contains(pawn)) Log.Message(string.Format("{0} something went wrong", this)); } } else { // Log.Error("No suitable Victim found"); } return(null); }
// Token: 0x06000424 RID: 1060 RVA: 0x0002CE84 File Offset: 0x0002B284 protected override Job TryGiveJob(Pawn pawn) { if (pawn.Map == null || pawn.Map != Find.CurrentMap) { return(null); } IntVec3 c = IntVec3.Invalid; CompXenoEggLayer compEggLayer = pawn.TryGetComp <CompXenoEggLayer>(); if (compEggLayer == null || !compEggLayer.CanLayNow) { return(null); } ThingDef namedA = XenomorphDefOf.RRY_Xenomorph_Humanoid_Cocoon; ThingDef namedB = XenomorphDefOf.RRY_Xenomorph_Animal_Cocoon; if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out c)) { bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (c != IntVec3.Invalid && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; return(new Job(XenomorphDefOf.RRY_Job_LayXenomorphEgg, lc)); } else { if (Find.Selector.SelectedObjects.Contains(pawn)) { Log.Message(string.Format("{0} something went wrong", this)); } } } else { if (Find.Selector.SelectedObjects.Contains(pawn)) { Log.Message(string.Format("{0} No Egglaying spot Found", this)); } c = pawn.Position; Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; return(new Job(XenomorphDefOf.RRY_Job_LayXenomorphEgg, lc)); } return(null); }
// allows to attack only adjacent cells (melee targets) public override bool AllowVerbCast(IntVec3 root, TargetInfo targ) { if (targ.HasThing && targ.Thing.def.size != IntVec2.One) { return root.AdjacentTo8WayOrInside(targ.Thing); } return root.AdjacentTo8Way(targ.Cell); }
// Token: 0x06000424 RID: 1060 RVA: 0x0002CE84 File Offset: 0x0002B284 protected override Job TryGiveJob(Pawn pawn) { if (pawn.Map == null || pawn.Map != Find.CurrentMap) { return(null); } IntVec3 c = IntVec3.Invalid; CompXenoEggLayer compEggLayer = pawn.TryGetComp <CompXenoEggLayer>(); if (compEggLayer == null || !compEggLayer.CanLayNow) { return(null); } if (!pawn.isXenomorph(out Comp_Xenomorph xenomorph)) { return(null); } else { c = xenomorph.HiveLoc; bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThingsNotWater)) { using (PawnPath pawnPath = pawn.Map.pathFinder.FindPath(pawn.Position, c, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.PassAllDestroyableThings, false), PathEndMode.OnCell)) { IntVec3 cellBeforeBlocker; Thing thing = pawnPath.FirstBlockingBuilding(out cellBeforeBlocker, pawn); if (thing != null) { Job job = DigUtility.PassBlockerJob(pawn, thing, cellBeforeBlocker, true, true); if (job != null) { return(job); } } } Log.Message("queen can reach eggsite"); Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; if (pawn.GetLord() == null) { // Log.Message(string.Format("XenoLord TryFindGoodHiveLoc for {0} Cell Found: {1}, Allow: Fogged, Digging", pawn.LabelShortCap, c)); LordJob newJob = new LordJob_DefendAndExpandHiveLike(false, pawn.Faction, c, 40f); pawn.CreateNewLord(c, newJob); } return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_LayEgg, lc)); } else { Log.Warning("queen couldnt reach eggsite"); } if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out c)) { if (c != IntVec3.Invalid && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_LayEgg, lc)); } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0} something went wrong", this)); } } } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0} No Egglaying spot Found", this)); } c = pawn.Position; Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_LayEgg, lc)); } } return(null); }
// Token: 0x060004D1 RID: 1233 RVA: 0x0003100C File Offset: 0x0002F40C protected override Job TryGiveJob(Pawn pawn) { float Searchradius = MaxRange; IntVec3 c = IntVec3.Invalid; if (Searchradius == 0) { if (pawn.mindState.duty != null) { if (pawn.mindState.duty.focus.Cell.GetThingList(pawn.Map).Any(x => x.def == XenomorphDefOf.RRY_Xenomorph_Hive)) { Searchradius = 7f; } if (pawn.mindState.duty.focus.Cell.GetThingList(pawn.Map).Any(x => x.def == XenomorphDefOf.RRY_Xenomorph_Hive_Child)) { Searchradius = 3f; } if (pawn.mindState.duty.focus.Cell.GetThingList(pawn.Map).Any(x => x.def == XenomorphDefOf.RRY_Xenomorph_Hive_Slime)) { Searchradius = 5f; } } } if (XenomorphKidnapUtility.TryFindGoodKidnapVictim(pawn, Searchradius, out Pawn t, null, this.forceRoofed, true, MinRange) && !GenAI.InDangerousCombat(pawn)) { if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out c, t, true, !this.forceRoofed, this.forceCanDig)) { ThingDef namedA = XenomorphDefOf.RRY_Xenomorph_Cocoon_Humanoid; ThingDef namedB = XenomorphDefOf.RRY_Xenomorph_Cocoon_Animal; bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (c != IntVec3.Invalid && t != null && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool roofed = (y.Roofed(pawn.Map) && this.forceRoofed) || !this.forceRoofed; bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0}, adjacent: {1}, filled: {2}, edifice: {3}, building: {4}", y, !adjacent, !filled, edifice, building)); } return(!adjacent && !filled && edifice && building && thingA && thingB && roofed); }; if (pawn.GetLord() != null && pawn.GetLord() is Lord lord) { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("TryFindGoodHiveLoc pawn.GetLord() != null")); } } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("TryFindGoodHiveLoc pawn.GetLord() == null")); } } if (pawn.mindState.duty.def != XenomorphDefOf.RRY_Xenomorph_DefendAndExpandHive && pawn.mindState.duty.def != XenomorphDefOf.RRY_Xenomorph_DefendHiveAggressively) { pawn.mindState.duty = new PawnDuty(XenomorphDefOf.RRY_Xenomorph_DefendAndExpandHive, c, 40f); } if (RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 2, 6)) { return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Kidnap) { targetA = t, targetB = lc, count = 1 }); } } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0} something went wrong", this)); } } } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0} No Cocooning spot Found", this)); } } }