コード例 #1
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            Pawn followee = this.GetFollowee(pawn);

            if (followee == null)
            {
                Log.Error(base.GetType() + " has null followee. pawn=" + pawn.ToStringSafe <Pawn>(), false);
                return(null);
            }
            if (!followee.Spawned || !pawn.CanReach(followee, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn))
            {
                return(null);
            }
            float radius = this.GetRadius(pawn);

            if (!JobDriver_FollowClose.FarEnoughAndPossibleToStartJob(pawn, followee, radius))
            {
                return(null);
            }
            return(new Job(JobDefOf.FollowClose, followee)
            {
                expiryInterval = this.FollowJobExpireInterval,
                checkOverrideOnExpire = true,
                followRadius = radius
            });
        }
コード例 #2
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            Pawn followee = GetFollowee(pawn);

            if (followee == null)
            {
                Log.Error(GetType() + " has null followee. pawn=" + pawn.ToStringSafe());
                return(null);
            }
            if (!followee.Spawned || !pawn.CanReach(followee, PathEndMode.OnCell, Danger.Deadly))
            {
                return(null);
            }
            float radius = GetRadius(pawn);

            if (!JobDriver_FollowClose.FarEnoughAndPossibleToStartJob(pawn, followee, radius))
            {
                return(null);
            }
            Job job = new Job(JobDefOf.FollowClose, followee);

            job.expiryInterval        = FollowJobExpireInterval;
            job.checkOverrideOnExpire = true;
            job.followRadius          = radius;
            return(job);
        }
コード例 #3
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            if (!pawn.health.capacities.CapableOf(PawnCapacityDefOf.Moving))
            {
                return(null);
            }
            if (pawn.GetLord().LordJob is LordJob_FormAndSendVehicles)
            {
                Pair <VehiclePawn, VehicleHandler> vehicle = ((LordJob_FormAndSendVehicles)pawn.GetLord().LordJob).GetVehicleAssigned(pawn);

                if (vehicle.Second is null)
                {
                    if (!JobDriver_FollowClose.FarEnoughAndPossibleToStartJob(pawn, vehicle.First, FollowRadius))
                    {
                        return(null);
                    }
                    return(new Job(JobDefOf.FollowClose, vehicle.First)
                    {
                        lord = pawn.GetLord(),
                        expiryInterval = 140,
                        checkOverrideOnExpire = true,
                        followRadius = FollowRadius
                    });
                }
                return(new Job(JobDefOf_Vehicles.Board, vehicle.First));
            }
            return(null);
        }