コード例 #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedNullOrForbidden(SlaveInd);
            this.FailOnBurningImmobile(SlaveInd);
            this.FailOn(() =>
            {
                var slave = (Pawn)this.GetActor().CurJob.GetTarget(SlaveInd).Thing;
                return(slave.guest.interactionMode != (PrisonerInteractionMode)Data.PIM_FreeSlave);
            });
            this.FailOnDowned(SlaveInd);
            this.FailOnAggroMentalState(SlaveInd);
            yield return(Toils_Reserve.Reserve(SlaveInd, 1));

            yield return(Toils_Goto.GotoThing(SlaveInd, PathEndMode.ClosestTouch));

            yield return(Toils_Haul.StartCarryThing(SlaveInd));

            var gotoToil = Toils_Goto.GotoCell(ReleaseCellInd, PathEndMode.ClosestTouch);

            yield return(gotoToil);

            yield return(Toils_Haul.PlaceHauledThingInCell(ReleaseCellInd, gotoToil, false));

            yield return(Toils_Reserve.Release(SlaveInd));

            yield return(Toils_Prisoner.FreeSlave(SlaveInd, CollarInd));
        }
コード例 #2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedNullOrForbidden(PrisonerInd);
            this.FailOnDestroyedNullOrForbidden(CollarInd);
            this.FailOnBurningImmobile(CollarInd);
            yield return(Toils_Reserve.Reserve(PrisonerInd, 1));

            yield return(Toils_Reserve.Reserve(CollarInd, 1));

            yield return(Toils_Goto.GotoThing(CollarInd, PathEndMode.ClosestTouch));

            yield return(Toils_Haul.StartCarryThing(CollarInd));

            var gotoToil = Toils_Goto.GotoThing(PrisonerInd, PathEndMode.ClosestTouch);

            yield return(gotoToil);

            yield return(Toils_Haul.PlaceHauledThingInCell(CollarCellInd, gotoToil, false));

            yield return(Toils_Reserve.Release(CollarInd));

            yield return(Toils_Prisoner.Enslave(PrisonerInd, CollarInd));

            yield return(Toils_Reserve.Release(PrisonerInd));
        }
コード例 #3
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedNullOrForbidden(PrisonerInd);
            this.FailOnBurningImmobile(HaulToInd);
            if (!pawn.CurJob.GetTarget(PrisonerInd).Thing.IsForbidden(pawn))
            {
                this.FailOnForbidden(PrisonerInd);
            }
            this.AddEndCondition(() =>
            {
                // Cancel out if the prisoner enters the target room on their own
                var prisonerRoom = pawn.jobs.curJob.GetTarget(PrisonerInd).Thing.Position.GetRoom();
                var targetRoom   = pawn.jobs.curJob.GetTarget(HaulToInd).Cell.GetRoom();
                return(prisonerRoom == targetRoom ? JobCondition.Succeeded : JobCondition.Ongoing);
            });
            yield return(Toils_Reserve.Reserve(HaulToInd, 1));

            yield return(Toils_Reserve.Reserve(PrisonerInd, 1));

            var toilGoto = Toils_Goto.GotoThing(PrisonerInd, PathEndMode.ClosestTouch)
                           .FailOn(() =>
            {
                Job job = pawn.jobs.curJob;
                if (job.haulMode == HaulMode.ToCellStorage)
                {
                    Thing prisoner = job.GetTarget(PrisonerInd).Thing;
                    if (!pawn.jobs.curJob.GetTarget(HaulToInd).Cell.IsValidStorageFor(prisoner))
                    {
                        return(true);
                    }
                }
                return(false);
            });

            yield return(toilGoto);

            yield return(Toils_Haul.StartCarryThing(PrisonerInd));

            var carryToCell = Toils_Haul.CarryHauledThingToCell(HaulToInd);

            yield return(carryToCell);

            yield return(Toils_Haul.PlaceHauledThingInCell(HaulToInd, carryToCell, true));

            yield return(Toils_Prisoner.NoLongerNeedsHauling(PrisonerInd));

            yield return(Toils_Reserve.Release(HaulToInd));

            yield return(Toils_Reserve.Release(PrisonerInd));
        }