public void Spawn()
{
Main.InitLifeBytes();
if (this.whoAmI == Main.myPlayer)
{
if (Main.mapTime < 5)
Main.mapTime = 5;
Main.quickBG = 10;
this.FindSpawn();
if (!Player.CheckSpawn(this.SpawnX, this.SpawnY))
{
this.SpawnX = -1;
this.SpawnY = -1;
}
Main.maxQ = true;
}
if (Main.netMode == 1 && this.whoAmI == Main.myPlayer)
{
NetMessage.SendData(12, -1, -1, "", Main.myPlayer, 0.0f, 0.0f, 0.0f, 0, 0, 0);
Main.gameMenu = false;
}
this.headPosition = Vector2.Zero;
this.bodyPosition = Vector2.Zero;
this.legPosition = Vector2.Zero;
this.headRotation = 0.0f;
this.bodyRotation = 0.0f;
this.legRotation = 0.0f;
this.lavaTime = this.lavaMax;
if (this.statLife <= 0)
{
int num = this.statLifeMax2 / 2;
this.statLife = 100;
if (num > this.statLife)
this.statLife = num;
this.breath = this.breathMax;
if (this.spawnMax)
{
this.statLife = this.statLifeMax2;
this.statMana = this.statManaMax2;
}
}
this.immune = true;
this.dead = false;
this.immuneTime = 0;
this.active = true;
if (this.SpawnX >= 0 && this.SpawnY >= 0)
{
this.position.X = (float)(this.SpawnX * 16 + 8 - this.width / 2);
this.position.Y = (float)(this.SpawnY * 16 - this.height);
}
else
{
this.position.X = (float)(Main.spawnTileX * 16 + 8 - this.width / 2);
this.position.Y = (float)(Main.spawnTileY * 16 - this.height);
for (int i = Main.spawnTileX - 1; i < Main.spawnTileX + 2; ++i)
{
for (int j = Main.spawnTileY - 3; j < Main.spawnTileY; ++j)
{
if (Main.tileSolid[(int)Main.tile[i, j].type] && !Main.tileSolidTop[(int)Main.tile[i, j].type])
WorldGen.KillTile(i, j, false, false, false);
if ((int)Main.tile[i, j].liquid > 0)
{
Main.tile[i, j].lava(false);
Main.tile[i, j].liquid = (byte)0;
WorldGen.SquareTileFrame(i, j, true);
}
}
}
}
this.wet = false;
this.wetCount = (byte)0;
this.lavaWet = false;
this.fallStart = (int)((double)this.position.Y / 16.0);
this.fallStart2 = this.fallStart;
this.velocity.X = 0.0f;
this.velocity.Y = 0.0f;
for (int index = 0; index < 3; ++index)
this.UpdateSocialShadow();
this.oldPosition = this.position;
this.talkNPC = -1;
if (this.whoAmI == Main.myPlayer)
Main.npcChatCornerItem = 0;
if (this.pvpDeath)
{
this.pvpDeath = false;
this.immuneTime = 300;
this.statLife = this.statLifeMax;
}
else
this.immuneTime = 60;
if (this.whoAmI != Main.myPlayer)
return;
Main.BlackFadeIn = (int)byte.MaxValue;
Main.renderNow = true;
if (Main.netMode == 1)
Netplay.newRecent();
Main.screenPosition.X = this.position.X + (float)(this.width / 2) - (float)(Main.screenWidth / 2);
Main.screenPosition.Y = this.position.Y + (float)(this.height / 2) - (float)(Main.screenHeight / 2);
}