Beispiel #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //Log.Warning("make new toil", true);

            this.FailOnDespawnedOrNull(TargetIndex.A);
            this.FailOnAggroMentalState(TargetIndex.A);

            this.FailOnDespawnedOrNull(TargetIndex.B);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B, putRemainderInQueue: false, subtractNumTakenFromJobCount: true).FailOnDestroyedNullOrForbidden(TargetIndex.B));

            //yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch);

            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.InteractionCell).FailOn(delegate(Toil MovingPawn)
            {
                CompSmokeSignalComms comp = CampfireBuilding.TryGetComp <CompSmokeSignalComms>();
                return !comp.CanSmokeSignalNow(out string _);
            }));

            yield return
                (Toils_General.WaitWith(TargetIndex.A, 360, useProgressBar: true)
                 .WithEffect(MyDefs.Smokejoint, TargetIndex.A));

            yield return(new Toil
            {
                initAction = () =>
                {
                    if ((CampfireBuilding.TryGetComp <CompSmokeSignalComms>() is CompSmokeSignalComms comp) && comp.CanSmokeSignalNow(out string _))
                    {
                        pawn.jobs.curJob.commTarget.TryOpenComms(pawn);
                    }
                }
            });
Beispiel #2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //Log.Warning("make new toil", true);

            this.FailOnDespawnedOrNull(TargetIndex.A);
            this.FailOnAggroMentalState(TargetIndex.A);


            yield return(Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.InteractionCell).FailOn(delegate(Toil MovingPawn)
            {
                CompSmokeSignalComms comp = (MovingPawn.actor.jobs.curJob.GetTarget(TargetIndex.A).Thing).TryGetComp <CompSmokeSignalComms>();
                return !comp.CanSmokeSignalNow(out string _);
            }));

            yield return
                (Toils_General.WaitWith(TargetIndex.A, 360, useProgressBar: true)
                 .WithEffect(MyDefs.Smokejoint, TargetIndex.A));

            /*
             * Toil spawnSmoke = new Toil();
             * spawnSmoke.tickAction = delegate
             * {
             *  Pawn actor = spawnSmoke.actor;
             *  if (actor.IsHashIntervalTick(50))
             *      FleckMaker.ThrowSmoke(TargetA.CenterVector3, actor.Map, 1);
             * };
             */
            yield return(new Toil
            {
                initAction = () =>
                {
                    CompSmokeSignalComms comp = (pawn.jobs.curJob.GetTarget(TargetIndex.A).Thing).TryGetComp <CompSmokeSignalComms>();

                    if (comp.CanSmokeSignalNow(out string _))
                    {
                        pawn.jobs.curJob.commTarget.TryOpenComms(pawn);
                    }
                }
            });