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

◆ CheckForGoodTeleportationSpot()

Vector2 Terraria.Player.CheckForGoodTeleportationSpot ( ref bool canSpawn,
int teleportStartX,
int teleportRangeX,
int teleportStartY,
int teleportRangeY,
RandomTeleportationAttemptSettings settings )
inline

Definition at line 57059 of file Player.cs.

57060 {
57061 //IL_0011: Unknown result type (might be due to invalid IL or missing references)
57062 //IL_001b: Unknown result type (might be due to invalid IL or missing references)
57063 //IL_002f: Unknown result type (might be due to invalid IL or missing references)
57064 //IL_0034: Unknown result type (might be due to invalid IL or missing references)
57065 //IL_0039: Unknown result type (might be due to invalid IL or missing references)
57066 //IL_053a: Unknown result type (might be due to invalid IL or missing references)
57067 //IL_0093: Unknown result type (might be due to invalid IL or missing references)
57068 //IL_009d: Unknown result type (might be due to invalid IL or missing references)
57069 //IL_00b1: Unknown result type (might be due to invalid IL or missing references)
57070 //IL_00b6: Unknown result type (might be due to invalid IL or missing references)
57071 //IL_00bb: Unknown result type (might be due to invalid IL or missing references)
57072 //IL_00bd: Unknown result type (might be due to invalid IL or missing references)
57073 //IL_0271: Unknown result type (might be due to invalid IL or missing references)
57074 //IL_027e: Unknown result type (might be due to invalid IL or missing references)
57075 //IL_028b: Unknown result type (might be due to invalid IL or missing references)
57076 //IL_02a1: Unknown result type (might be due to invalid IL or missing references)
57077 //IL_01cd: Unknown result type (might be due to invalid IL or missing references)
57078 //IL_01d7: Unknown result type (might be due to invalid IL or missing references)
57079 //IL_01eb: Unknown result type (might be due to invalid IL or missing references)
57080 //IL_01f0: Unknown result type (might be due to invalid IL or missing references)
57081 //IL_01f5: Unknown result type (might be due to invalid IL or missing references)
57082 //IL_01f7: Unknown result type (might be due to invalid IL or missing references)
57083 //IL_01fa: Unknown result type (might be due to invalid IL or missing references)
57084 //IL_020d: Unknown result type (might be due to invalid IL or missing references)
57085 //IL_0213: Unknown result type (might be due to invalid IL or missing references)
57086 //IL_03a5: Unknown result type (might be due to invalid IL or missing references)
57087 //IL_03c1: Unknown result type (might be due to invalid IL or missing references)
57088 //IL_03f0: Unknown result type (might be due to invalid IL or missing references)
57089 //IL_03dd: Unknown result type (might be due to invalid IL or missing references)
57090 //IL_0413: Unknown result type (might be due to invalid IL or missing references)
57091 //IL_041d: Unknown result type (might be due to invalid IL or missing references)
57092 //IL_0422: Unknown result type (might be due to invalid IL or missing references)
57093 //IL_0424: Unknown result type (might be due to invalid IL or missing references)
57094 //IL_0426: Unknown result type (might be due to invalid IL or missing references)
57095 //IL_0428: Unknown result type (might be due to invalid IL or missing references)
57096 //IL_042d: Unknown result type (might be due to invalid IL or missing references)
57097 //IL_0444: Unknown result type (might be due to invalid IL or missing references)
57098 //IL_0449: Unknown result type (might be due to invalid IL or missing references)
57099 //IL_0455: Unknown result type (might be due to invalid IL or missing references)
57100 //IL_045a: Unknown result type (might be due to invalid IL or missing references)
57101 //IL_0464: Unknown result type (might be due to invalid IL or missing references)
57102 //IL_0469: Unknown result type (might be due to invalid IL or missing references)
57103 //IL_046b: Unknown result type (might be due to invalid IL or missing references)
57104 //IL_046d: Unknown result type (might be due to invalid IL or missing references)
57105 //IL_046f: Unknown result type (might be due to invalid IL or missing references)
57106 //IL_0474: Unknown result type (might be due to invalid IL or missing references)
57107 //IL_048b: Unknown result type (might be due to invalid IL or missing references)
57108 //IL_0490: Unknown result type (might be due to invalid IL or missing references)
57109 //IL_049c: Unknown result type (might be due to invalid IL or missing references)
57110 //IL_04a6: Unknown result type (might be due to invalid IL or missing references)
57111 //IL_04ab: Unknown result type (might be due to invalid IL or missing references)
57112 //IL_04ad: Unknown result type (might be due to invalid IL or missing references)
57113 //IL_04af: Unknown result type (might be due to invalid IL or missing references)
57114 //IL_04b1: Unknown result type (might be due to invalid IL or missing references)
57115 //IL_04b6: Unknown result type (might be due to invalid IL or missing references)
57116 //IL_04cd: Unknown result type (might be due to invalid IL or missing references)
57117 //IL_04d2: Unknown result type (might be due to invalid IL or missing references)
57118 //IL_04db: Unknown result type (might be due to invalid IL or missing references)
57119 //IL_04e0: Unknown result type (might be due to invalid IL or missing references)
57120 //IL_04ea: Unknown result type (might be due to invalid IL or missing references)
57121 //IL_04ef: Unknown result type (might be due to invalid IL or missing references)
57122 //IL_04f1: Unknown result type (might be due to invalid IL or missing references)
57123 //IL_04f3: Unknown result type (might be due to invalid IL or missing references)
57124 //IL_04f5: Unknown result type (might be due to invalid IL or missing references)
57125 //IL_04fa: Unknown result type (might be due to invalid IL or missing references)
57126 //IL_0511: Unknown result type (might be due to invalid IL or missing references)
57127 //IL_0516: Unknown result type (might be due to invalid IL or missing references)
57128 int num = 0;
57129 int num2 = 0;
57130 int num3 = 0;
57131 int num4 = width;
57132 Vector2 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-num4 / 2 + 8), (float)(-height));
57133 while (!canSpawn && num < settings.attemptsBeforeGivingUp)
57134 {
57135 num++;
57136 num2 = teleportStartX + Main.rand.Next(teleportRangeX);
57137 num3 = teleportStartY + Main.rand.Next(teleportRangeY);
57138 int num5 = 5;
57139 num2 = (int)MathHelper.Clamp((float)num2, (float)num5, (float)(Main.maxTilesX - num5));
57140 num3 = (int)MathHelper.Clamp((float)num3, (float)num5, (float)(Main.maxTilesY - num5));
57141 vector = new Vector2((float)num2, (float)num3) * 16f + new Vector2((float)(-num4 / 2 + 8), (float)(-height));
57142 if (Collision.SolidCollision(vector, num4, height))
57143 {
57144 continue;
57145 }
57146 if (Main.tile[num2, num3] == null)
57147 {
57148 Main.tile[num2, num3] = default(Tile);
57149 }
57150 if ((settings.avoidWalls && Main.tile[num2, num3].wall > 0) || (Main.tile[num2, num3].wall == 87 && (double)num3 > Main.worldSurface && !NPC.downedPlantBoss) || (Main.wallDungeon[Main.tile[num2, num3].wall] && (double)num3 > Main.worldSurface && !NPC.downedBoss3))
57151 {
57152 continue;
57153 }
57154 int num6 = 0;
57155 while (num6 < settings.maximumFallDistanceFromOrignalPoint)
57156 {
57157 if (Main.tile[num2, num3 + num6] == null)
57158 {
57159 Main.tile[num2, num3 + num6] = default(Tile);
57160 }
57161 Tile tile = Main.tile[num2, num3 + num6];
57162 vector = new Vector2((float)num2, (float)(num3 + num6)) * 16f + new Vector2((float)(-num4 / 2 + 8), (float)(-height));
57163 Collision.SlopeCollision(vector, velocity, num4, height, gravDir);
57164 if (!Collision.SolidCollision(vector, num4, height))
57165 {
57166 num6++;
57167 continue;
57168 }
57169 if (tile.active() && !tile.inActive() && Main.tileSolid[tile.type])
57170 {
57171 break;
57172 }
57173 num6++;
57174 }
57175 vector.Y -= 16f;
57176 int i = (int)vector.X / 16;
57177 int j = (int)vector.Y / 16;
57178 int num7 = (int)(vector.X + (float)num4 * 0.5f) / 16;
57179 int j2 = (int)(vector.Y + (float)height) / 16;
57180 Tile tileSafely = Framing.GetTileSafely(i, j);
57181 Tile tileSafely2 = Framing.GetTileSafely(num7, j2);
57182 if (settings.avoidAnyLiquid && tileSafely2.liquid > 0)
57183 {
57184 continue;
57185 }
57186 if (settings.mostlySolidFloor)
57187 {
57188 Tile tileSafely3 = Framing.GetTileSafely(num7 - 1, j2);
57189 Tile tileSafely4 = Framing.GetTileSafely(num7 + 1, j2);
57190 if (!tileSafely3.active() || tileSafely3.inActive() || !Main.tileSolid[tileSafely3.type] || Main.tileSolidTop[tileSafely3.type] || !tileSafely4.active() || tileSafely4.inActive() || !Main.tileSolid[tileSafely4.type] || Main.tileSolidTop[tileSafely4.type])
57191 {
57192 continue;
57193 }
57194 }
57195 if ((settings.avoidWalls && tileSafely.wall > 0) || (settings.avoidAnyLiquid && Collision.WetCollision(vector, num4, height)) || (settings.avoidLava && Collision.LavaCollision(vector, num4, height)) || (settings.avoidHurtTiles && Collision.AnyHurtingTiles(vector, num4, height)) || Collision.SolidCollision(vector, num4, height) || num6 >= settings.maximumFallDistanceFromOrignalPoint - 1)
57196 {
57197 continue;
57198 }
57199 Vector2 vector2 = Vector2.UnitX * 16f;
57200 if (Collision.TileCollision(vector - vector2, vector2, width, height, fallThrough: false, fall2: false, (int)gravDir) != vector2)
57201 {
57202 continue;
57203 }
57204 vector2 = -Vector2.UnitX * 16f;
57205 if (Collision.TileCollision(vector - vector2, vector2, width, height, fallThrough: false, fall2: false, (int)gravDir) != vector2)
57206 {
57207 continue;
57208 }
57209 vector2 = Vector2.UnitY * 16f;
57210 if (!(Collision.TileCollision(vector - vector2, vector2, width, height, fallThrough: false, fall2: false, (int)gravDir) != vector2))
57211 {
57212 vector2 = -Vector2.UnitY * 16f;
57213 if (!(Collision.TileCollision(vector - vector2, vector2, width, height, fallThrough: false, fall2: false, (int)gravDir) != vector2))
57214 {
57215 canSpawn = true;
57216 num3 += num6;
57217 break;
57218 }
57219 }
57220 }
57221 return vector;
57222 }
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51

References Terraria.Tile.active(), Terraria.Collision.AnyHurtingTiles(), Terraria.NPC.downedBoss3, Terraria.NPC.downedPlantBoss, Terraria.Framing.GetTileSafely(), Terraria.Player.gravDir, Terraria.Entity.height, Terraria.Tile.inActive(), Terraria.Collision.LavaCollision(), Terraria.Main.rand, Terraria.Collision.SlopeCollision(), Terraria.Collision.SolidCollision(), Terraria.Main.tile, Terraria.Collision.TileCollision(), Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, Terraria.Tile.type, Terraria.Entity.velocity, Terraria.Main.wallDungeon, Terraria.Collision.WetCollision(), Terraria.Entity.width, and Terraria.Main.worldSurface.

Referenced by Terraria.Player.DemonConch(), and Terraria.Player.TeleportationPotion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: