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));
        }
 protected override void FinalizeDesignationSucceeded()
 {
     base.FinalizeDesignationSucceeded();
     foreach (PawnKindDef kind in justDesignated.Select((Pawn p) => p.kindDef).Distinct())
     {
         TameUtility.ShowDesignationWarnings(justDesignated.First((Pawn x) => x.kindDef == kind));
     }
     justDesignated.Clear();
     PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.AnimalTaming, KnowledgeAmount.Total);
 }
 protected override void FinalizeDesignationSucceeded()
 {
     base.FinalizeDesignationSucceeded();
     using (IEnumerator <PawnKindDef> enumerator = (from p in this.justDesignated
                                                    select p.kindDef).Distinct <PawnKindDef>().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             PawnKindDef kind = enumerator.Current;
             TameUtility.ShowDesignationWarnings(this.justDesignated.First((Pawn x) => x.kindDef == kind), true);
         }
     }
     this.justDesignated.Clear();
     PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.AnimalTaming, KnowledgeAmount.Total);
 }
Exemple #5
0
 protected override void Notify_DesignationAdded(Pawn pawn)
 {
     pawn.MapHeld.designationManager.TryRemoveDesignationOn(pawn, DesignationDefOf.Hunt);
     TameUtility.ShowDesignationWarnings(pawn);
 }
        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);
        }