//Tweaked Job to return only Haul-related results public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { if (t.Faction != pawn.Faction) { return(null); } Blueprint blueprint = t as Blueprint; Thing firstBlockingThing = GenConstruct.FirstBlockingThing(blueprint, pawn); if (firstBlockingThing != null) { return(Utilities.HandleBlockingThingJob(firstBlockingThing, pawn, forced)); } if (!Utilities.CanDeliverResources(blueprint, pawn, forced)) { return(null); } if (base.RemoveExistingFloorJob(pawn, blueprint) != null) { return(null); } Job resourceDeliveryJob = base.ResourceDeliverJobFor(pawn, blueprint, true); if (resourceDeliveryJob != null) { return(resourceDeliveryJob); } return(null); }
// Token: 0x060000EA RID: 234 RVA: 0x00008318 File Offset: 0x00006518 public static void CanConstruct_Prefix(ref bool __result, Thing t, Pawn p, bool checkSkills = true, bool forced = false) { bool flag = !p.kindDef.RaceProps.Humanlike; if (flag) { bool flag2 = GenConstruct.FirstBlockingThing(t, p) != null; if (flag2) { __result = false; } LocalTargetInfo target = t; PathEndMode peMode = PathEndMode.Touch; Danger maxDanger = (!forced) ? p.NormalMaxDanger() : Danger.Deadly; bool flag3 = !p.CanReserveAndReach(target, peMode, maxDanger, 1, -1, null, forced); if (flag3) { __result = false; } bool flag4 = t.IsBurning(); if (flag4) { __result = false; } __result = true; } __result = false; }
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { if (t.Faction != pawn.Faction) { return(null); } Frame frame = t as Frame; Thing firstBlockingThing = GenConstruct.FirstBlockingThing(frame, pawn); if (firstBlockingThing != null) { return(Utilities.HandleBlockingThingJob(firstBlockingThing, pawn, forced)); } if (!Utilities.CanDeliverResources(frame, pawn, forced)) { return(null); } Job resourceDeliveryJob = base.ResourceDeliverJobFor(pawn, frame, true); if (resourceDeliveryJob != null) { return(resourceDeliveryJob); } return(null); }
// Token: 0x060000EB RID: 235 RVA: 0x000083A0 File Offset: 0x000065A0 public static void HandleBlockingThingJob_Prefix(ref Job __result, Thing constructible, Pawn worker, bool forced = false) { Thing thing = GenConstruct.FirstBlockingThing(constructible, worker); bool flag = thing == null; if (flag) { __result = null; } bool flag2 = thing.def.category == ThingCategory.Plant && worker.RaceProps.Animal; if (flag2) { bool flag3 = worker.CanReserveAndReach(thing, PathEndMode.ClosestTouch, worker.NormalMaxDanger(), 1, -1, null, forced); if (flag3) { __result = new Job(JobDefOf.CutPlant, thing); } } else { bool flag4 = thing.def.category == ThingCategory.Item && worker.RaceProps.Animal; if (flag4) { bool everHaulable = thing.def.EverHaulable; if (everHaulable) { __result = HaulAIUtility.HaulAsideJobFor(worker, thing); } Log.ErrorOnce(string.Concat(new object[] { "Never haulable ", thing, " blocking ", constructible.ToStringSafe <Thing>(), " at ", constructible.Position }), 6429262, false); } else { bool flag5 = thing.def.category == ThingCategory.Building && worker.RaceProps.Animal; if (flag5) { bool flag6 = worker.CanReserveAndReach(thing, PathEndMode.Touch, worker.NormalMaxDanger(), 1, -1, null, forced); if (flag6) { __result = new Job(WPJobDefOf.WPDeconstruct, thing) { ignoreDesignations = true }; } } } } __result = null; }
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { // Different factions if (t.Faction != pawn.Faction) { return(null); } // Not upgradable var upgradableComp = t.TryGetComp <CompUpgradable>(); if (upgradableComp == null) { return(null); } // Not designated to be upgraded if (t.Map.designationManager.DesignationOn(t, DesignationDefOf.UpgradeTurret) == null) { return(null); } // Blocked if (GenConstruct.FirstBlockingThing(t, pawn) != null) { return(GenConstruct.HandleBlockingThingJob(t, pawn, forced)); } // Construction skill var checkSkill = def.workType == WorkTypeDefOf.Construction; if (checkSkill && pawn.skills.GetSkill(SkillDefOf.Construction).Level < upgradableComp.Props.constructionSkillPrerequisite) { return(null); } return(ResourceDeliverJobFor(pawn, upgradableComp, false)); }