Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ItemCheck_UseTeleportRod()

void Terraria.Player.ItemCheck_UseTeleportRod ( Item sItem)
inlineprivate

Definition at line 43286 of file Player.cs.

43287 {
43288 if (Main.myPlayer != whoAmI || (sItem.type != 1326 && sItem.type != 5335) || itemAnimation <= 0 || !ItemTimeIsZero)
43289 {
43290 return;
43291 }
43293 Vector2 pointPoisition = default(Vector2);
43294 pointPoisition.X = (float)Main.mouseX + Main.screenPosition.X;
43295 if (gravDir == 1f)
43296 {
43297 pointPoisition.Y = (float)Main.mouseY + Main.screenPosition.Y - (float)height;
43298 }
43299 else
43300 {
43301 pointPoisition.Y = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY;
43302 }
43303 pointPoisition.X -= width / 2;
43305 if (!(pointPoisition.X > 50f) || !(pointPoisition.X < (float)(Main.maxTilesX * 16 - 50)) || !(pointPoisition.Y > 50f) || !(pointPoisition.Y < (float)(Main.maxTilesY * 16 - 50)))
43306 {
43307 return;
43308 }
43309 int num = (int)(pointPoisition.X / 16f);
43310 int num2 = (int)(pointPoisition.Y / 16f);
43311 if ((Main.tile[num, num2].wall == 87 && !NPC.downedPlantBoss && (Main.remixWorld || (double)num2 > Main.worldSurface)) || Collision.SolidCollision(pointPoisition, width, height))
43312 {
43313 return;
43314 }
43316 NetMessage.SendData(65, -1, -1, null, 0, whoAmI, pointPoisition.X, pointPoisition.Y, 1);
43317 if (sItem.type != 1326)
43318 {
43319 return;
43320 }
43321 if (chaosState)
43322 {
43323 statLife -= statLifeMax2 / 7;
43325 if (Main.rand.Next(2) == 0)
43326 {
43328 }
43329 if (statLife <= 0)
43330 {
43331 KillMe(damageSource, 1.0, 0);
43332 }
43333 lifeRegenCount = 0;
43334 lifeRegenTime = 0f;
43335 }
43336 AddBuff(88, 360);
43337 }
static PlayerDeathReason ByOther(int type)
void ApplyItemTime(Item sItem)
Definition Player.cs:3752
float lifeRegenTime
Definition Player.cs:1571
bool ItemTimeIsZero
Definition Player.cs:3525
void KillMe(PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp=false)
Definition Player.cs:36665
void Teleport(Vector2 newPos, int Style=0, int extraInfo=0)
Definition Player.cs:35567
void LimitPointToPlayerReachableArea(ref Vector2 pointPoisition)
Definition Player.cs:43259
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Definition Player.cs:4441

References Terraria.DataStructures.PlayerDeathReason.ByOther(), Terraria.NPC.downedPlantBoss, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.mouseX, Terraria.Main.mouseY, Terraria.Main.myPlayer, Terraria.Main.rand, Terraria.Main.remixWorld, Terraria.Main.screenHeight, Terraria.Main.screenPosition, Terraria.NetMessage.SendData(), Terraria.Collision.SolidCollision(), Terraria.Main.tile, and Terraria.Main.worldSurface.