Пример #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Reserve.Reserve(TargetIndex.B));

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

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B));

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

            yield return(Toils_General.Wait(1500).WithProgressBarToilDelay(TargetIndex.A).FailOnDestroyedNullOrForbidden(TargetIndex.A));

            Toil finish = new Toil
            {
                initAction = delegate
                {
                    if (item != null)
                    {
                        Apparel_MkArmor mk1 = station.ContainedArmor;
                        if (mk1 != null)
                        {
                            int toRefuel = (int)(mk1.CoreComp.Props.MaxFuel - mk1.CoreComp.Fuel);
                            int num      = Mathf.Min(toRefuel, item.stackCount);
                            item.SplitOff(num).Destroy();
                            mk1.CoreComp.AddFuel(num);
                        }
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            };

            yield return(finish);
        }
Пример #2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Reserve.Reserve(TargetIndex.B));

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

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B));

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

            yield return(Toils_General.Wait(1500).WithProgressBarToilDelay(TargetIndex.A).FailOnDestroyedNullOrForbidden(TargetIndex.A));

            Toil finish = new Toil
            {
                initAction = delegate
                {
                    if (core != null)
                    {
                        Apparel_MkArmor mk1 = station.ContainedArmor;
                        if (mk1 != null)
                        {
                            if (mk1.Core != null)
                            {
                                CellFinder.TryFindRandomCellNear(station.Position, station.Map, 2, null, out IntVec3 result);
                                GenSpawn.Spawn(mk1.Core, result, station.Map);
                                mk1.Core = null;
                            }

                            mk1.ChangeCore(core);
                            pawn.carryTracker.TryDropCarriedThing(pawn.Position, ThingPlaceMode.Near, out Thing t);
                            core.DeSpawn();
                        }
                    }
                },
Пример #3
0
        public static bool HasMk1Enable(Pawn p, ThingDef armorDef)
        {
            if (p.apparel == null)
            {
                return(false);
            }

            foreach (var apparel in p.apparel.WornApparel)
            {
                if (apparel.def == armorDef)
                {
                    Apparel_MkArmor mk = (Apparel_MkArmor)apparel;
                    if (mk.Active)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }