private static void CrushBlockCollideCheckGroupedFallingBlock(CrushBlock self, Vector2 amount)
        {
            GroupedFallingBlock fallingBlock = self.CollideFirst <GroupedFallingBlock>(self.Position + amount);

            if (fallingBlock != null)
            {
                fallingBlock.Trigger();
            }
        }
Ejemplo n.º 2
0
        private static void CrushBlockCollideCheckGroupedFallingBlock(CrushBlock self, Vector2 amount)
        {
            Console.WriteLine($"Tryina check {self.Position + amount}");
            GroupedFallingBlock fallingBlock = self.CollideFirst <GroupedFallingBlock>(self.Position + amount);

            if (fallingBlock != null)
            {
                fallingBlock.Trigger();
            }
        }
Ejemplo n.º 3
0
        private static bool onKevinMoveVCheck(On.Celeste.CrushBlock.orig_MoveVCheck orig, CrushBlock self, float amount)
        {
            IEnumerable <KevinBarrier> kevinBarriers = self.Scene.Tracker.GetEntities <KevinBarrier>().OfType <KevinBarrier>();

            foreach (KevinBarrier barrier in kevinBarriers)
            {
                barrier.Collidable = true;
            }

            bool isHit = orig(self, amount);

            if (isHit)
            {
                self.MoveVCollideSolidsAndBounds(self.Scene as Level, amount, thruDashBlocks: true, (a, b, collidedPlatform) => {
                    if (collidedPlatform is KevinBarrier barrier)
                    {
                        barrier.hitByKevin();
                    }
                }, checkBottom: false);
            }

            foreach (KevinBarrier barrier in kevinBarriers)
            {
                barrier.Collidable = false;
            }
            return(isHit);
        }
 private static bool OnCrushBlockMoveHCheck(On.Celeste.CrushBlock.orig_MoveHCheck orig, CrushBlock self, float amount)
 {
     CrushBlockCollideCheckGroupedFallingBlock(self, amount * Vector2.UnitX);
     return(orig(self, amount));
 }
        private static void onCrushBlockConstruct(On.Celeste.CrushBlock.orig_ctor_EntityData_Vector2 orig, CrushBlock self, EntityData data, Vector2 offset)
        {
            // we are using a hook rather than the constructor, because we want to run our code before the base constructor.
            if (self is ReskinnableCrushBlock crushBlock)
            {
                crushBlock.spriteDirectory = data.Attr("spriteDirectory", "objects/crushblock");
            }

            orig(self, data, offset);
        }
        private static void activateParticles(On.Celeste.CrushBlock.orig_ActivateParticles orig, CrushBlock self, Vector2 dir)
        {
            if (self is ReskinnableCrushBlock crush)
            {
                ParticleType origActivateParticle = P_Activate;
                P_Activate = crush.activateParticleColor;

                orig(self, dir);

                P_Activate = origActivateParticle;
            }
            else
            {
                orig(self, dir);
            }
        }
Ejemplo n.º 7
0
        private static void CrushBlock_AddImage(On.Celeste.CrushBlock.orig_AddImage orig, CrushBlock self, MTexture idle, int x, int y, int tx, int ty, int borderX, int borderY)
        {
            if (self is CoreKevin coreSelf)
            {
                // In the IL hook we read from these fields
                // I think you can do this better by checking crushDir but this works fine, for now at least
                CurrentLeftVisibility   = coreSelf.ActiveLeftImages.Count > 0 && coreSelf.ActiveLeftImages[0].Visible;
                CurrentRightVisibility  = coreSelf.ActiveRightImages.Count > 0 && coreSelf.ActiveRightImages[0].Visible;
                CurrentTopVisibility    = coreSelf.ActiveTopImages.Count > 0 && coreSelf.ActiveTopImages[0].Visible;
                CurrentBottomVisibility = coreSelf.ActiveBottomImages.Count > 0 && coreSelf.ActiveBottomImages[0].Visible;
            }
            else
            {
                // In the IL hook we edit the strings even for all Kevins
                // So we need this to set them correctly for vanilla Kevin
                CurrentLeftPath   = "objects/crushblock/lit_left";
                CurrentRightPath  = "objects/crushblock/lit_right";
                CurrentTopPath    = "objects/crushblock/lit_top";
                CurrentBottomPath = "objects/crushblock/lit_bottom";
            }

            orig(self, idle, x, y, tx, ty, borderX, borderY);
        }
Ejemplo n.º 8
0
 private static void CrushBlock_Attack(On.Celeste.CrushBlock.orig_Attack orig, CrushBlock self, Vector2 direction)
 {
     orig(self, direction);
     if (self is CoreKevin kevin)
     {
         kevin.Attacking = true;
     }
 }
Ejemplo n.º 9
0
 private static void CrushBlock_TurnOffImages(On.Celeste.CrushBlock.orig_TurnOffImages orig, CrushBlock self)
 {
     orig(self);
     if (self is CoreKevin kevin)
     {
         kevin.Attacking = false;
     }
 }
Ejemplo n.º 10
0
        private static DashCollisionResults KevinDash(On.Celeste.CrushBlock.orig_OnDashed orig, CrushBlock self, Player player, Vector2 dir)
        {
            var dirCh = dir.Y < 0 ? 'u' : dir.Y > 0 ? 'd' : dir.X < 0 ? 'l' : 'r';
            var level = self.Scene as Level ?? throw new Exception("but why tho");

            level.Session.SetFlag("kevin:" + dirCh);
            if (new[] { "kevin:u", "kevin:d", "kevin:l", "kevin:r" }.All(f => level.Session.GetFlag(f)))
            {
                BingoClient.Instance.ModSaveData.AddFlag("kevin");
            }
            return(orig(self, player, dir));
        }
Ejemplo n.º 11
0
        private void Level_Update(On.Celeste.Level.orig_Update orig, Level self)
        {
            Level newLevel = self;

            actionHelper.SetLevel(newLevel);
            spawnHelper.SetLevel(newLevel);
            currentLevel = newLevel;

            if (Settings.Blur && Settings.BlurEnabled)
            {
                BlurCurrentLevel(newLevel, Settings.BlurLevel);
            }
            else
            {
                BlurCurrentLevel(newLevel, 1);
            }

            if (Settings.DisableGrab && Settings.DisableGrabEnabled)
            {
                SaveData.Instance.Assists.NoGrabbing = true;
            }
            else
            {
                SaveData.Instance.Assists.NoGrabbing = false;
            }

            if (Settings.Mirror && Settings.MirrorEnabled)
            {
                SaveData.Instance.Assists.MirrorMode = true;
                if (Settings.Invert && Settings.InvertEnabled)
                {
                    Input.MoveX.Inverted = false;
                    Input.Aim.InvertedX  = false;
                }
                else
                {
                    Input.MoveX.Inverted = true;
                    Input.Aim.InvertedX  = true;
                }
            }
            else
            {
                SaveData.Instance.Assists.MirrorMode = false;
                if (Settings.Invert && Settings.InvertEnabled)
                {
                    Input.MoveX.Inverted = true;
                    Input.Aim.InvertedX  = true;
                }
                else
                {
                    Input.MoveX.Inverted = false;
                    Input.Aim.InvertedX  = false;
                }
            }

            if (Settings.Invisible && Settings.InvisibleEnabled)
            {
                SaveData.Instance.Assists.InvisibleMotion = true;
            }
            else
            {
                SaveData.Instance.Assists.InvisibleMotion = false;
            }

            if (Settings.LowFriction && Settings.LowFrictionEnabled)
            {
                SaveData.Instance.Assists.LowFriction = true;
            }
            else
            {
                SaveData.Instance.Assists.LowFriction = false;
            }

            if (Settings.GodMode && Settings.GodModeEnabled)
            {
                SaveData.Instance.Assists.Invincible = true;
            }
            else
            {
                SaveData.Instance.Assists.Invincible = false;
            }

            if (spawnKevin)
            {
                CrushBlock crushBlock = new CrushBlock(ply.Position - new Vector2(12, 50), 25, 25, CrushBlock.Axes.Vertical, false);
                currentLevel.Add(crushBlock);
                currentLevel.Entities.UpdateLists();
                crushBlock.OnDashCollide(ply, new Vector2(0, -1));
                spawnKevin = false;
            }

            if (newLevel.Entities.AmountOf <PlayerSeeker>() > 0 || inCredits || ascending)
            {
                disableCommands = true;
            }
            else
            {
                disableCommands = false;
            }

            orig(newLevel);
        }
Ejemplo n.º 12
0
        private static bool CrushBlock_CanActivate(On.Celeste.CrushBlock.orig_CanActivate orig, CrushBlock self, Vector2 direction)
        {
            bool result = orig(self, direction);

            if (self is ChainedKevin chainedKevin && result)
            {
                return(chainedKevin.vectorDirection == direction);
            }
Ejemplo n.º 13
0
        private static bool CrushBlock_MoveHCheck(On.Celeste.CrushBlock.orig_MoveHCheck orig, CrushBlock self, float amount)
        {
            float target = self.Position.X + amount;

            bool chainStop = false;

            if (self is ChainedKevin chainedKevin)
            {
                if (chainedKevin.direction == Directions.Left && target <= chainedKevin.start.X - chainedKevin.chainLength)
                {
                    chainStop = true;
                    amount    = chainedKevin.start.X - chainedKevin.chainLength - self.X;
                }
                else if (chainedKevin.direction == Directions.Right && target >= chainedKevin.start.X + chainedKevin.chainLength)
                {
                    chainStop = true;
                    amount    = chainedKevin.start.X + chainedKevin.chainLength - self.X;
                }

                if (chainStop)
                {
                    Audio.Play(CustomSFX.game_chainedFallingBlock_chain_tighten_block, chainedKevin.Center);
                }

                return(self.MoveHCollideSolidsAndBounds(self.SceneAs <Level>(), amount, thruDashBlocks: true) || chainStop);
            }
            else
            {
                return(orig(self, amount));
            }
        }