Esempio n. 1
0
        //获取多人起跳
        public static Gizmo GetMulJump(Pawn pawn)
        {
            var command_Target = new Command_CastSkillTargetingFloor
            {
                self            = pawn,
                targetingParams = JumpTP(),
                defaultLabel    = "WarframeJumpGizmo.name".Translate(),
                defaultDesc     = "WarframeJumpGizmo.desc".Translate(),
                range           = 14f,
                icon            = ContentFinder <Texture2D> .Get("Skills/Jump"),
                cooldownTime    = 60,
                hotKey          = KeyBindingDefOf.Command_ItemForbid,
                disabled        = !pawn.Drafted || pawn.stances.stunner.Stunned
            };

            command_Target.action = delegate(Pawn _, LocalTargetInfo poc)
            {
                var enumerable = Find.Selector.SelectedObjects.Where(x =>
                                                                     x is Pawn {
                    IsColonistPlayerControlled: true, Drafted: true
                } pawn3&& pawn3.IsWarframe())
                                 .Cast <Pawn>();
                foreach (var pawn2 in enumerable)
                {
                    if (OutRange(command_Target.range, pawn2, poc.Cell.ToVector3()))
                    {
                        SoundDefOf.ClickReject.PlayOneShotOnCamera();
                        return;
                    }

                    if (!poc.Cell.Walkable(pawn2.Map))
                    {
                        Messages.Message("WFCantJumpToThere".Translate(), MessageTypeDefOf.RejectInput, false);
                        return;
                    }

                    var jtype = GetJumpType(pawn2, poc.Cell);


                    if (jtype == 0)
                    {
                        var wfroof = pawn2.Map.roofGrid.RoofAt(pawn2.Position);
                        if (wfroof != null)
                        {
                            if (wfroof != RoofDefOf.RoofConstructed)
                            {
                                Messages.Message("WFJumpRockRoof".Translate(), MessageTypeDefOf.RejectInput, false);
                                return;
                            }

                            if (!wfroof.soundPunchThrough.NullOrUndefined())
                            {
                                wfroof.soundPunchThrough.PlayOneShot(new TargetInfo(pawn2.Position, pawn2.Map));
                                var iterator = CellRect.CenteredOn(pawn2.Position, 1).GetIterator();
                                while (!iterator.Done())
                                {
                                    Find.CurrentMap.roofGrid.SetRoof(iterator.Current, null);
                                    iterator.MoveNext();
                                }
                            }
                        }

                        var locroof = pawn2.Map.roofGrid.RoofAt(poc.Cell);
                        if (locroof != null)
                        {
                            if (locroof != RoofDefOf.RoofConstructed)
                            {
                                Messages.Message("WFJumpRockRoof".Translate(), MessageTypeDefOf.RejectInput, false);
                                return;
                            }

                            if (!locroof.soundPunchThrough.NullOrUndefined())
                            {
                                locroof.soundPunchThrough.PlayOneShot(new TargetInfo(poc.Cell, pawn2.Map));
                                var iterator = CellRect.CenteredOn(poc.Cell, 1).GetIterator();
                                while (!iterator.Done())
                                {
                                    Find.CurrentMap.roofGrid.SetRoof(iterator.Current, null);
                                    iterator.MoveNext();
                                }
                            }
                        }
                    }


                    pawn2.pather.StartPath(poc, PathEndMode.Touch);
                    pawn2.Position = poc.Cell;

                    pawn2.pather.StopDead();
                    if (pawn2.jobs.curJob != null)
                    {
                        pawn2.jobs.curDriver.Notify_PatherArrived();
                    }

                    SoundDef.Named("Warframe_Jump").PlayOneShot(pawn2);
                    pawn2.stances.stunner.StunFor((int)command_Target.cooldownTime, pawn2);
                }
            };
            command_Target.finishAction = delegate
            {
                var enumerable = Find.Selector.SelectedObjects.Where(x =>
                                                                     x is Pawn {
                    IsColonistPlayerControlled: true, Drafted: true
                } pawn3&& pawn3.IsWarframe())
                                 .Cast <Pawn>();
                foreach (var pawn2 in enumerable)
                {
                    GenDraw.DrawRadiusRing(pawn2.Position,
                                           command_Target
                                           .range); //DrawFieldEdges(WarframeStaticMethods.getCellsAround(ck1.self.Position, ck1.self.Map, ck1.range));
                }
            };
            return(command_Target);
        }
Esempio n. 2
0
        public override IEnumerable <Gizmo> GetWornGizmos()
        {
            if (Find.Selector.SingleSelectedThing != Wearer)
            {
                yield break;
            }

            var pawn = Wearer;

            if (pawn == null || !pawn.IsWarframe())
            {
                yield break;
            }

            var ck1 = new Command_CastSkillTargetingFloor
            {
                self            = Wearer,
                targetingParams = WarframeStaticMethods.JumpTP(),
                defaultLabel    = "WarframeJumpGizmo.name".Translate(),
                defaultDesc     = "WarframeJumpGizmo.desc".Translate(),
                range           = 14f,
                icon            = ContentFinder <Texture2D> .Get("Skills/Jump"),
                cooldownTime    = 60,
                hotKey          = KeyBindingDefOf.Command_ItemForbid,
                disabled        = !Wearer.Drafted || jumpCD > 0 || Wearer.stances.stunner.Stunned
            };

            ck1.action = delegate(Pawn self, LocalTargetInfo target)
            {
                if (WarframeStaticMethods.OutRange(ck1.range, self, target.Cell.ToVector3()))
                {
                    SoundDefOf.ClickReject.PlayOneShotOnCamera();
                    return;
                }

                if (!target.Cell.Walkable(self.Map))
                {
                    Messages.Message("WFCantJumpToThere".Translate(), MessageTypeDefOf.RejectInput, false);
                    return;
                }

                var jtype = WarframeStaticMethods.GetJumpType(self, target.Cell);


                if (jtype == 0)
                {
                    var wfroof = self.Map.roofGrid.RoofAt(self.Position);
                    if (wfroof != null)
                    {
                        if (wfroof != RoofDefOf.RoofConstructed)
                        {
                            Messages.Message("WFJumpRockRoof".Translate(), MessageTypeDefOf.RejectInput, false);
                            return;
                        }

                        if (!wfroof.soundPunchThrough.NullOrUndefined())
                        {
                            wfroof.soundPunchThrough.PlayOneShot(new TargetInfo(self.Position, self.Map));
                            var iterator = CellRect.CenteredOn(self.Position, 1).GetIterator();
                            while (!iterator.Done())
                            {
                                Find.CurrentMap.roofGrid.SetRoof(iterator.Current, null);
                                iterator.MoveNext();
                            }
                        }
                    }

                    var locroof = self.Map.roofGrid.RoofAt(target.Cell);
                    if (locroof != null)
                    {
                        if (locroof != RoofDefOf.RoofConstructed)
                        {
                            Messages.Message("WFJumpRockRoof".Translate(), MessageTypeDefOf.RejectInput, false);
                            return;
                        }

                        if (!locroof.soundPunchThrough.NullOrUndefined())
                        {
                            locroof.soundPunchThrough.PlayOneShot(new TargetInfo(self.Position, self.Map));
                            var iterator = CellRect.CenteredOn(target.Cell, 1).GetIterator();
                            while (!iterator.Done())
                            {
                                Find.CurrentMap.roofGrid.SetRoof(iterator.Current, null);
                                iterator.MoveNext();
                            }
                        }
                    }
                }

                self.pather.StartPath(target, PathEndMode.Touch);
                self.Position = target.Cell;

                self.pather.StopDead();
                if (self.jobs.curJob != null)
                {
                    self.jobs.curDriver.Notify_PatherArrived();
                }

                SoundDef.Named("Warframe_Jump").PlayOneShot(self);
                jumpCD = ck1.cooldownTime;
            };
            ck1.finishAction = delegate
            {
                GenDraw.DrawRadiusRing(ck1.self.Position,
                                       ck1.range); //DrawFieldEdges(WarframeStaticMethods.getCellsAround(ck1.self.Position, ck1.self.Map, ck1.range));
            };
            yield return(ck1);
        }