Пример #1
0
        protected virtual void Explosion()
        {
            IEnumerable <Thing> ducklist = Level.current.things[typeof(Duck)];

            Level.current.simulatePhysics = false;

            foreach (Duck duck in ducklist)
            {
                if (duck == null)
                {
                    throw new PropertyNotFoundException("WTF!");
                }
                duck.immobilized  = true;
                duck.crippleTimer = 4f;
            }

            Level       cl       = Level.current;
            SpriteThing tbcarrow = new SpriteThing(0f, 0f, new Sprite(EdoMod.GetPath <EdoMod>("images\\TBCArrow")));

            tbcarrow.layer    = Layer.HUD;
            tbcarrow.scale    = new Vec2(0.5f, 0.5f);
            tbcarrow.position = new Vec2(0f, Layer.HUD.height) + 1.1f * new Vec2(tbcarrow.halfWidth, -tbcarrow.halfHeight);
            tbcarrow.z        = 1000000;

            cl.AddThing(tbcarrow);

            //DelayCallback();
            //typeof(Level).GetField("_updateWaitFrames", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(Level.current, 500);
            //Thread thread = new Thread(DelayCallback);
            //thread.Start();
        }
Пример #2
0
        public override void OnPressAction()
        {
            if (_pin)
            {
                Music.Pause();
                SFX.Play(EdoMod.GetPath <EdoMod>("music\\tobecontinued"));
            }

            base.OnPressAction();
        }
Пример #3
0
        public override void Initialize()
        {
            this._font = new BitmapFont("biosFont", 8, -1);

            string[] cutsomPaths = { "images\\logo", "images\\corptron2", "images\\mojang" };

            string path = cutsomPaths[2];

            this._logo    = new Sprite(EdoMod.GetPath <EdoMod>(path), 0f, 0f);
            Graphics.fade = 0f;
        }
Пример #4
0
        public FirinMyLaser(float x, float y)
            : base(x, y)
        {
            playing = null;

            this._pickupSprite   = new Sprite("helmetPickup", 0f, 0f);
            this._sprite         = new SpriteMap(EdoMod.GetPath <EdoMod>("weapons\\firinMyLaser"), 32, 32, false);
            base.graphic         = this._pickupSprite;
            this.center          = new Vec2(8f, 8f);
            this.collisionOffset = new Vec2(-5f, -2f);
            this.collisionSize   = new Vec2(12f, 8f);
            this._sprite.CenterOrigin();
            this._isArmor           = false;
            this._equippedThickness = 3f;
        }
Пример #5
0
        public void Update()
        {
            //some basic error checking
            if (Level.current == null ||
                Steam.user == null)
            {
                return;
            }

            //fancy SFX replacement. yeah yeah, it's per frame, whatever. deal with it.
            if (ModSettings.enableDangerousInjections)
            {
                foreach (KeyValuePair <string, Tuple <float, string>[]> entry in _sfxr)
                {
                    if (entry.Value.Length > 0)
                    {
                        bool changed = false;
                        foreach (Tuple <float, string> val in entry.Value)
                        {
                            //no breaking is done intentionally. later entries have priority.
                            if (Rando.Float(0.0f, 1.0f) < val.Item1)
                            {
                                _sounds[entry.Key] = _sounds[val.Item2];
                                changed            = true;
                            }
                        }
                        //if not changed, reset to default
                        if (!changed)
                        {
                            _sounds[entry.Key] = _sounds_bak[entry.Key];
                        }
                    }
                }
            }


            //hat replacement
            if (!(Level.current is Editor))
            {
                IEnumerable <Thing> teamHatList = Level.current.things[typeof(TeamHat)];
                //int nhats = 0;
                foreach (TeamHat teamHat in teamHatList)
                {
                    //nhats++;
                    if (teamHat.team != null && teamHat.team.customData == null && teamHat.team.hasHat)
                    {
                        if (!(teamHat is EdoHat))
                        {
                            //'Normal' Special Hats
                            if (CensoredHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new CensoredHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (BreadfishHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new BreadfishHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (AdsHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new AdsHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (AndIHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new AndIHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            //Special Ability Hats
                            if (NoHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new NoHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (DittoHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new DittoHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (BombHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new BombHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (ChickenHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new ChickenHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (PiesHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new PiesHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (FinnerHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new FinnerHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (DJHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new DJHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            //Developer Hats
                            if (DenHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new DenHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (MilkHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new MilkHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            if (UpsideHat.isHat(teamHat))
                            {
                                ReplaceHat(teamHat, new UpsideHat(teamHat.x, teamHat.y, teamHat.team));
                            }
                            //turbans
                            if (TurbanData.find(teamHat.sprite.texture.textureIndex) != null)
                            {
                                Turban turban = new Turban(teamHat.x, teamHat.y, teamHat.team);
                                ReplaceHat(teamHat, turban);
                                SpawnCape(turban, new Sprite(Mod.GetPath <EdoMod>("capes\\king")).texture);
                            }
                        }

                        /*if(!(teamHat is Turban))
                         * {
                         *  Turban turban = TurbanData.findHat(teamHat);
                         *  if (turban != null)
                         *  {
                         *      ReplaceHat(teamHat, turban);
                         *  }
                         *  if (teamHat is Turban)
                         *  {
                         *      SpawnCape(turban, new Sprite(Mod.GetPath<EdoMod>("capes\\king")).texture);
                         *  }
                         * }*/
                    }
                }
                List <Thing> removedHats = teamSpawnsDone.Keys.Except(Level.current.things[typeof(TeamHat)]).ToList();
                foreach (Thing thing in removedHats)
                {
                    TeamHat teamHat = thing as TeamHat;
                    if (teamHat != null && teamSpawnsDone.ContainsKey(teamHat))
                    {
                        Cape cape;
                        if (teamSpawnsDone.TryGetValue(teamHat, out cape))
                        {
                            Level.Remove(cape);
                        }
                        teamSpawnsDone.Remove(teamHat);
                    }
                }

                //DIVEKICK!
                //Duck.grounded

                IEnumerable <Thing> ducks = Level.current.things[typeof(Duck)];
                foreach (Duck duck in ducks)
                {
                    if (!duck.grounded && duck.sliding)
                    {
                        //Duck target = Level.current.NearestThing<Duck>(duck.position);
                        foreach (Duck target in ducks)
                        {
                            //can't target null or self
                            if (target == null || target == duck)
                            {
                                continue;
                            }
                            //can't kill a dead target
                            if (target.dead)
                            {
                                continue;
                            }
                            //near to duck && falling down
                            if ((target.position - duck.position).length < 10f && duck.velocity.y > 0)
                            {
                                //Performed DIIIVE KICK!
                                SFX.Play(EdoMod.GetPath <EdoMod>("SFX\\DiveKick"));
                                target.Kill(new DTImpact(duck));
                            }
                        }
                    }
                }
            }
        }