protected override Job TryGiveJob(Pawn pawn)
        {
            Job result;

            if (Find.TickManager.TicksGame < pawn.mindState.canLovinTick)
            {
                result = null;
            }
            else if (pawn.CurrentBed() == null || pawn.CurrentBed().Medical || !pawn.health.capacities.CanBeAwake)
            {
                result = null;
            }
            else
            {
                Pawn partnerInMyBed = LovePartnerRelationUtility.GetPartnerInMyBed(pawn);
                if (partnerInMyBed == null || !partnerInMyBed.health.capacities.CanBeAwake || Find.TickManager.TicksGame < partnerInMyBed.mindState.canLovinTick)
                {
                    result = null;
                }
                else if (!pawn.CanReserve(partnerInMyBed, 1, -1, null, false) || !partnerInMyBed.CanReserve(pawn, 1, -1, null, false))
                {
                    result = null;
                }
                else
                {
                    result = new Job(JobDefOf.Lovin, partnerInMyBed, pawn.CurrentBed());
                }
            }
            return(result);
        }
示例#2
0
 protected override Job TryGiveJob(Pawn pawn)
 {
     if (Find.TickManager.TicksGame < pawn.mindState.canLovinTick)
     {
         return(null);
     }
     if (pawn.CurrentBed() != null && !pawn.CurrentBed().Medical&& pawn.health.capacities.CanBeAwake)
     {
         Pawn partnerInMyBed = LovePartnerRelationUtility.GetPartnerInMyBed(pawn);
         if (partnerInMyBed != null && partnerInMyBed.health.capacities.CanBeAwake && Find.TickManager.TicksGame >= partnerInMyBed.mindState.canLovinTick)
         {
             if (pawn.CanReserve(partnerInMyBed, 1, -1, null, false) && partnerInMyBed.CanReserve(pawn, 1, -1, null, false))
             {
                 return(new Job(JobDefOf.Lovin, partnerInMyBed, pawn.CurrentBed()));
             }
             return(null);
         }
         return(null);
     }
     return(null);
 }
示例#3
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            if (Find.TickManager.TicksGame < pawn.mindState.canLovinTick)
            {
                return(null);
            }
            if (pawn.CurrentBed() == null || pawn.CurrentBed().Medical || !pawn.health.capacities.CanBeAwake)
            {
                return(null);
            }
            Pawn partnerInMyBed = LovePartnerRelationUtility.GetPartnerInMyBed(pawn);

            if (partnerInMyBed == null || !partnerInMyBed.health.capacities.CanBeAwake || Find.TickManager.TicksGame < partnerInMyBed.mindState.canLovinTick)
            {
                return(null);
            }
            if (!pawn.CanReserve(partnerInMyBed) || !partnerInMyBed.CanReserve(pawn))
            {
                return(null);
            }
            return(JobMaker.MakeJob(JobDefOf.Lovin, partnerInMyBed, pawn.CurrentBed()));
        }