Terraria.Mount.Dismount C# (CSharp) Method

Dismount() public method

public Dismount ( Player mountedPlayer ) : void
mountedPlayer Player
return void
        public void Dismount(Player mountedPlayer)
        {
            if (!this._active)
                return;
            bool cart = this.Cart;
            this._active = false;
            mountedPlayer.ClearBuff(this._data.buff);
            this._mountSpecificData = (object)null;
            if (cart)
            {
                mountedPlayer.ClearBuff(this._data.extraBuff);
                mountedPlayer.cartFlip = false;
                mountedPlayer.lastBoost = Vector2.Zero;
            }
            mountedPlayer.fullRotation = 0.0f;
            mountedPlayer.fullRotationOrigin = Vector2.Zero;
            if (Main.netMode != 2)
            {
                for (int index1 = 0; index1 < 100; ++index1)
                {
                    if (this._type == 6 || this._type == 11 || this._type == 13)
                    {
                        if (index1 % 10 == 0)
                        {
                            int Type = Main.rand.Next(61, 64);
                            int index2 = Gore.NewGore(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), Vector2.Zero, Type, 1f);
                            Main.gore[index2].alpha = 100;
                            Main.gore[index2].velocity = Vector2.Transform(new Vector2(1f, 0.0f), Matrix.CreateRotationZ((float)(Main.rand.NextDouble() * 6.28318548202515)));
                        }
                    }
                    else
                    {
                        int index2 = Dust.NewDust(new Vector2(mountedPlayer.position.X - 20f, mountedPlayer.position.Y), mountedPlayer.width + 40, mountedPlayer.height, this._data.spawnDust, 0.0f, 0.0f, 0, new Color(), 1f);
                        Main.dust[index2].scale += (float)Main.rand.Next(-10, 21) * 0.01f;
                        if (this._data.spawnDustNoGravity)
                            Main.dust[index2].noGravity = true;
                        else if (Main.rand.Next(2) == 0)
                        {
                            Main.dust[index2].scale *= 1.3f;
                            Main.dust[index2].noGravity = true;
                        }
                        else
                            Main.dust[index2].velocity *= 0.5f;
                        Main.dust[index2].velocity += mountedPlayer.velocity * 0.8f;
                    }
                }
            }
            this.Reset();
            mountedPlayer.position.Y += (float)mountedPlayer.height;
            mountedPlayer.height = 42;
            mountedPlayer.position.Y -= (float)mountedPlayer.height;
            if (mountedPlayer.whoAmI != Main.myPlayer)
                return;
            NetMessage.SendData(13, -1, -1, "", mountedPlayer.whoAmI, 0.0f, 0.0f, 0.0f, 0, 0, 0);
        }