protected override bool Satisfied(Pawn pawn)
        {
            if (pawn.IsPrisoner)
            {
                //show tutorials
                Tutorials.Introduction();
                Tutorials.Management();

                IntVec3 c;

                var need = pawn.needs.TryGetNeed <Need_Motivation>();
                if (need == null)
                {
                    if (!pawn.guest.PrisonerIsSecure || RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn))
                    {
                        return(false);
                    }
                    else if (PrisonLaborUtility.LaborEnabled(pawn))
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }

                // Prisoner will escape if get ready to run.
                // If he can run he will start ticking impatient, once complete he will get ready.
                if (!pawn.guest.PrisonerIsSecure ||
                    RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn))
                {
                    need.CanEscape = true;
                    if (need.ReadyToRun)
                    {
                        return(false);
                    }
                }
                else
                {
                    need.CanEscape = false;
                }


                if (PrisonLaborUtility.LaborEnabled(pawn))
                {
                    return(true);
                }

                need.Enabled = false;
            }
            return(false);
        }
示例#2
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            var prisoner = t as Pawn;
            var need     = prisoner.needs.TryGetNeed <Need_Motivation>();

            if (need == null || prisoner == null)
            {
                return(null);
            }
            if (!ShouldTakeCareOfPrisoner(pawn, prisoner))
            {
                return(null);
            }
            if (prisoner.Downed || !pawn.CanReserve(t, 1, -1, null, false) || !prisoner.Awake())
            {
                return(null);
            }
            if (pawn.IsPrisoner)
            {
                return(null);
            }
            if (!PrisonLaborUtility.LaborEnabled(prisoner) && !need.CanEscape)
            {
                return(null);
            }
            if (PrisonLaborUtility.RecruitInLaborEnabled(prisoner))
            {
                return(new Job(JobDefOf.PrisonerAttemptRecruit, t));
            }
            if ((!PrisonLaborUtility.WorkTime(prisoner) || !need.NeedToBeInspired) && !need.CanEscape)
            {
                return(null);
            }

            return(new Job(DefDatabase <JobDef> .GetNamed("PrisonLabor_PrisonerSupervise"), prisoner));
        }