Terraria.Player.WallslideMovement C# (CSharp) Method

WallslideMovement() public method

public WallslideMovement ( ) : void
return void
        public void WallslideMovement()
        {
            this.sliding = false;
            if (this.slideDir == 0 || this.spikedBoots <= 0 || this.mount.Active || (!this.controlLeft || this.slideDir != -1) && (!this.controlRight || this.slideDir != 1))
                return;
            bool flag = false;
            float num1 = this.position.X;
            if (this.slideDir == 1)
                num1 += (float)this.width;
            float num2 = num1 + (float)this.slideDir;
            float num3 = (float)((double)this.position.Y + (double)this.height + 1.0);
            if ((double)this.gravDir < 0.0)
                num3 = this.position.Y - 1f;
            float num4 = num2 / 16f;
            float num5 = num3 / 16f;
            if (WorldGen.SolidTile((int)num4, (int)num5) && WorldGen.SolidTile((int)num4, (int)num5 - 1))
                flag = true;
            if (this.spikedBoots >= 2)
            {
                if (!flag || ((double)this.velocity.Y <= 0.0 || (double)this.gravDir != 1.0) && ((double)this.velocity.Y >= (double)this.gravity || (double)this.gravDir != -1.0))
                    return;
                float num6 = this.gravity;
                if (this.slowFall)
                    num6 = !this.controlUp ? this.gravity / 3f * this.gravDir : this.gravity / 10f * this.gravDir;
                this.fallStart = (int)((double)this.position.Y / 16.0);
                if (this.controlDown && (double)this.gravDir == 1.0 || this.controlUp && (double)this.gravDir == -1.0)
                {
                    this.velocity.Y = 4f * this.gravDir;
                    int index = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)((this.width / 2 - 4) * this.slideDir), (float)((double)this.position.Y + (double)(this.height / 2) + (double)(this.height / 2 - 4) * (double)this.gravDir)), 8, 8, 31, 0.0f, 0.0f, 0, new Color(), 1f);
                    if (this.slideDir < 0)
                        Main.dust[index].position.X -= 10f;
                    if ((double)this.gravDir < 0.0)
                        Main.dust[index].position.Y -= 12f;
                    Main.dust[index].velocity *= 0.1f;
                    Main.dust[index].scale *= 1.2f;
                    Main.dust[index].noGravity = true;
                    Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
                }
                else if ((double)this.gravDir == -1.0)
                    this.velocity.Y = (float)(-(double)num6 + 9.99999974737875E-06) * this.gravDir;
                else
                    this.velocity.Y = (float)(-(double)num6 + 9.99999974737875E-06) * this.gravDir;
                this.sliding = true;
            }
            else
            {
                if ((!flag || (double)this.velocity.Y <= 0.5 || (double)this.gravDir != 1.0) && ((double)this.velocity.Y >= -0.5 || (double)this.gravDir != -1.0))
                    return;
                this.fallStart = (int)((double)this.position.Y / 16.0);
                if (this.controlDown)
                    this.velocity.Y = 4f * this.gravDir;
                else
                    this.velocity.Y = 0.5f * this.gravDir;
                this.sliding = true;
                int index = Dust.NewDust(new Vector2(this.position.X + (float)(this.width / 2) + (float)((this.width / 2 - 4) * this.slideDir), (float)((double)this.position.Y + (double)(this.height / 2) + (double)(this.height / 2 - 4) * (double)this.gravDir)), 8, 8, 31, 0.0f, 0.0f, 0, new Color(), 1f);
                if (this.slideDir < 0)
                    Main.dust[index].position.X -= 10f;
                if ((double)this.gravDir < 0.0)
                    Main.dust[index].position.Y -= 12f;
                Main.dust[index].velocity *= 0.1f;
                Main.dust[index].scale *= 1.2f;
                Main.dust[index].noGravity = true;
                Main.dust[index].shader = GameShaders.Armor.GetSecondaryShader(this.cShoe, this);
            }
        }
Player