protected override Job TryGiveJob(Pawn pawn)
        {
            int transportersGroup = pawn.mindState.duty.transportersGroup;

            PitUtility.GetTransportersInGroup(transportersGroup, pawn.Map, JobGiver_HaulToPit.tmpTransporters);
            for (int i = 0; i < JobGiver_HaulToPit.tmpTransporters.Count; i++)
            {
                CompPit transporter = JobGiver_HaulToPit.tmpTransporters[i];
                if (LoadPitJobUtility.HasJobOnTransporter(pawn, transporter))
                {
                    return(LoadPitJobUtility.JobOnTransporter(pawn, transporter));
                }
            }
            return(null);
        }
Beispiel #2
0
        public override void Notify_Starting()
        {
            base.Notify_Starting();
            ThingCount thingCount = LoadPitJobUtility.FindThingToLoad(this.pawn, base.Container.TryGetComp <CompPit>());

            this.job.targetA  = thingCount.Thing;
            this.job.count    = thingCount.Count;
            this.initialCount = thingCount.Count;
            this.pawn.Reserve(thingCount.Thing, this.job, 1, -1, null, true);
            foreach (Pawn p in this.Map.mapPawns.SpawnedPawnsInFaction(Faction.OfPlayer))
            {
                bool flag3 = p.needs != null && p.needs.mood != null && p.needs.mood.thoughts != null;
                if (flag3)
                {
                    p.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("PD_ThrownPrisonerIntoPit"), null);
                    p.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("PD_ThrownPrisonerIntoPitImLovinIt"), null);
                }
            }
        }
 public static bool HasJobOnTransporter(Pawn pawn, CompPit transporter)
 {
     return(transporter.AnythingLeftToLoad && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation) && pawn.CanReach(transporter.parent, PathEndMode.Touch, pawn.NormalMaxDanger(), false, TraverseMode.ByPawn) && LoadPitJobUtility.FindThingToLoad(pawn, transporter).Thing != null);
 }
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            CompPit transporter = t.TryGetComp <CompPit>();

            return(LoadPitJobUtility.JobOnTransporter(pawn, transporter));
        }