protected override Job TryGiveJob(Pawn pawn)
        {
            if (!pawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation))
            {
                return(null);
            }
            Lord  lord  = pawn.GetLord();
            Thing thing = GatherItemsForShipCaravanUtility.FindThingToHaul(pawn, lord);

            if (thing is null)
            {
                return(null);
            }
            return(new Job(JobDefOf_Vehicles.PrepareCaravan_GatheringVehicle, thing)
            {
                lord = lord
            });
        }
示例#2
0
 private Toil DetermineNumToHaul()
 {
     return(new Toil
     {
         initAction = delegate()
         {
             int num = GatherItemsForShipCaravanUtility.CountLeftToTransfer(pawn, Transferable, job.lord);
             if (pawn.carryTracker.CarriedThing != null)
             {
                 num -= pawn.carryTracker.CarriedThing.stackCount;
             }
             if (num <= 0)
             {
                 pawn.jobs.EndCurrentJob(JobCondition.Succeeded, true);
             }
             else
             {
                 job.count = num;
             }
         },
         defaultCompleteMode = ToilCompleteMode.Instant,
         atomicWithPrevious = true
     });
 }