public static Toil GotoPrisoner(Pawn pawn, Pawn talkee, PrisonerInteractionModeDef mode)
        {
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                pawn.pather.StartPath(talkee, PathEndMode.Touch);
            };
            toil.AddFailCondition(delegate
            {
                if (talkee.DestroyedOrNull())
                {
                    return(true);
                }
                if (mode != PrisonerInteractionModeDefOf.Execution && !talkee.Awake())
                {
                    return(true);
                }
                if (!talkee.IsPrisonerOfColony)
                {
                    return(true);
                }
                return((talkee.guest == null || talkee.guest.interactionMode != mode) ? true : false);
            });
            toil.socialMode          = RandomSocialMode.Off;
            toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            return(toil);
        }
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (!base.ShouldTakeCareOfPrisoner(pawn, t))
            {
                return(null);
            }
            Pawn pawn2 = (Pawn)t;
            PrisonerInteractionModeDef interactionMode = pawn2.guest.interactionMode;

            if ((interactionMode != PrisonerInteractionModeDefOf.AttemptRecruit && interactionMode != PrisonerInteractionModeDefOf.ReduceResistance) || !pawn2.guest.ScheduledForInteraction || !pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking) || (pawn2.Downed && !pawn2.InBed()) || !pawn.CanReserve(t, 1, -1, null, false) || !pawn2.Awake())
            {
                return(null);
            }
            if (interactionMode == PrisonerInteractionModeDefOf.ReduceResistance && pawn2.guest.Resistance <= 0f)
            {
                return(null);
            }
            return(new Job(JobDefOf.PrisonerAttemptRecruit, t));
        }
Пример #3
0
        public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
        {
            if (!ShouldTakeCareOfPrisoner(pawn, t))
            {
                return(null);
            }
            Pawn pawn2 = (Pawn)t;
            PrisonerInteractionModeDef interactionMode = pawn2.guest.interactionMode;

            if ((interactionMode == PrisonerInteractionModeDefOf.AttemptRecruit || interactionMode == PrisonerInteractionModeDefOf.ReduceResistance) && pawn2.guest.ScheduledForInteraction && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking) && (!pawn2.Downed || pawn2.InBed()) && pawn.CanReserve(t) && pawn2.Awake())
            {
                if (interactionMode == PrisonerInteractionModeDefOf.ReduceResistance && pawn2.guest.Resistance <= 0f)
                {
                    return(null);
                }
                return(JobMaker.MakeJob(JobDefOf.PrisonerAttemptRecruit, t));
            }
            return(null);
        }
Пример #4
0
 public void ExposeData()
 {
     Scribe_References.Look(ref hostFactionInt, "hostFaction");
     Scribe_Values.Look(ref isPrisonerInt, "prisoner", defaultValue: false);
     Scribe_Defs.Look(ref interactionMode, "interactionMode");
     Scribe_Values.Look(ref releasedInt, "released", defaultValue: false);
     Scribe_Values.Look(ref ticksWhenAllowedToEscapeAgain, "ticksWhenAllowedToEscapeAgain", 0);
     Scribe_Values.Look(ref spotToWaitInsteadOfEscaping, "spotToWaitInsteadOfEscaping");
     Scribe_Values.Look(ref lastPrisonBreakTicks, "lastPrisonBreakTicks", 0);
     Scribe_Values.Look(ref everParticipatedInPrisonBreak, "everParticipatedInPrisonBreak", defaultValue: false);
     Scribe_Values.Look(ref getRescuedThoughtOnUndownedBecauseOfPlayer, "getRescuedThoughtOnUndownedBecauseOfPlayer", defaultValue: false);
     Scribe_Values.Look(ref resistance, "resistance", -1f);
     Scribe_Values.Look(ref lastRecruiterName, "lastRecruiterName");
     Scribe_Values.Look(ref lastRecruiterNegotiationAbilityFactor, "lastRecruiterNegotiationAbilityFactor", 0f);
     Scribe_Values.Look(ref hasOpinionOfLastRecruiter, "hasOpinionOfLastRecruiter", defaultValue: false);
     Scribe_Values.Look(ref lastRecruiterOpinion, "lastRecruiterOpinion", 0);
     Scribe_Values.Look(ref lastRecruiterFinalChance, "lastRecruiterFinalChance", 0f);
     Scribe_Values.Look(ref lastRecruiterOpinionChanceFactor, "lastRecruiterOpinionChanceFactor", 0f);
     Scribe_Values.Look(ref lastRecruiterResistanceReduce, "lastRecruiterResistanceReduce", 0f);
     if (Scribe.mode == LoadSaveMode.PostLoadInit && !interactionMode.allowOnWildMan && pawn.IsWildMan())
     {
         interactionMode = PrisonerInteractionModeDefOf.NoInteraction;
     }
 }
Пример #5
0
 private static int <FillTab> m__0(PrisonerInteractionModeDef pim)
 {
     return(pim.listOrder);
 }