Exemple #1
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn pawn2 = t as Pawn;

            if (pawn2 == null || !TameUtility.CanTame(pawn2))
            {
                return(null);
            }
            if (pawn.Map.designationManager.DesignationOn(t, DesignationDefOf.Tame) == null)
            {
                return(null);
            }
            if (TameUtility.TriedToTameTooRecently(pawn2))
            {
                JobFailReason.Is(WorkGiver_InteractAnimal.AnimalInteractedTooRecentlyTrans);
                return(null);
            }
            if (!CanInteractWithAnimal(pawn, pawn2, forced))
            {
                return(null);
            }
            if (pawn2.RaceProps.EatsFood && !HasFoodToInteractAnimal(pawn, pawn2))
            {
                Job job = TakeFoodForAnimalInteractJob(pawn, pawn2);
                if (job == null)
                {
                    JobFailReason.Is(WorkGiver_InteractAnimal.NoUsableFoodTrans);
                }
                return(job);
            }
            return(new Job(JobDefOf.Tame, t));
        }
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            Pawn pawn2 = t as Pawn;

            if (pawn2 == null || !TameUtility.CanTame(pawn2))
            {
                return(null);
            }
            if (pawn.Map.designationManager.DesignationOn(t, DesignationDefOf.Tame) == null)
            {
                return(null);
            }
            if (Find.TickManager.TicksGame < pawn2.mindState.lastAssignedInteractTime + 30000)
            {
                JobFailReason.Is(WorkGiver_InteractAnimal.AnimalInteractedTooRecentlyTrans, null);
                return(null);
            }
            if (!this.CanInteractWithAnimal(pawn, pawn2, forced))
            {
                return(null);
            }
            if (pawn2.RaceProps.EatsFood && !base.HasFoodToInteractAnimal(pawn, pawn2))
            {
                Job job = base.TakeFoodForAnimalInteractJob(pawn, pawn2);
                if (job == null)
                {
                    JobFailReason.Is(WorkGiver_InteractAnimal.NoUsableFoodTrans, null);
                }
                return(job);
            }
            return(new Job(JobDefOf.Tame, t));
        }
        public override AcceptanceReport CanDesignateThing(Thing t)
        {
            Pawn pawn = t as Pawn;

            return(pawn != null && TameUtility.CanTame(pawn) && base.Map.designationManager.DesignationOn(pawn, this.Designation) == null);
        }