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

◆ GetOnTrack()

static bool Terraria.Minecart.GetOnTrack ( int tileX,
int tileY,
ref Vector2 Position,
int Width,
int Height )
inlinestatic

Definition at line 1361 of file Minecart.cs.

1362 {
1363 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
1364 //IL_003a: Unknown result type (might be due to invalid IL or missing references)
1365 //IL_003b: Unknown result type (might be due to invalid IL or missing references)
1366 //IL_0040: Unknown result type (might be due to invalid IL or missing references)
1367 //IL_0045: Unknown result type (might be due to invalid IL or missing references)
1368 //IL_004a: Unknown result type (might be due to invalid IL or missing references)
1369 //IL_004b: Unknown result type (might be due to invalid IL or missing references)
1370 //IL_00e8: Unknown result type (might be due to invalid IL or missing references)
1371 //IL_00e9: Unknown result type (might be due to invalid IL or missing references)
1372 //IL_00ee: Unknown result type (might be due to invalid IL or missing references)
1373 //IL_00f3: Unknown result type (might be due to invalid IL or missing references)
1374 //IL_00f4: Unknown result type (might be due to invalid IL or missing references)
1375 //IL_00f5: Unknown result type (might be due to invalid IL or missing references)
1376 //IL_00f6: Unknown result type (might be due to invalid IL or missing references)
1377 //IL_00fb: Unknown result type (might be due to invalid IL or missing references)
1378 //IL_00fd: Unknown result type (might be due to invalid IL or missing references)
1379 //IL_00fe: Unknown result type (might be due to invalid IL or missing references)
1380 Tile tile = Main.tile[tileX, tileY];
1381 if (tile.type != 314)
1382 {
1383 return false;
1384 }
1385 Vector2 vector = default(Vector2);
1386 ((Vector2)(ref vector))._002Ector((float)(Width / 2) - 25f, (float)(Height / 2));
1387 Vector2 vector2 = Position + vector + _trackMagnetOffset;
1388 int num = (int)vector2.X % 16 / 2;
1389 int num2 = -1;
1390 int num3 = 0;
1391 for (int i = num; i < 8; i++)
1392 {
1393 num3 = _tileHeight[tile.frameX][i];
1394 if (num3 >= 0)
1395 {
1396 num2 = i;
1397 break;
1398 }
1399 }
1400 if (num2 == -1)
1401 {
1402 for (int num4 = num - 1; num4 >= 0; num4--)
1403 {
1404 num3 = _tileHeight[tile.frameX][num4];
1405 if (num3 >= 0)
1406 {
1407 num2 = num4;
1408 break;
1409 }
1410 }
1411 }
1412 if (num2 == -1)
1413 {
1414 return false;
1415 }
1416 vector2.X = tileX * 16 + num2 * 2;
1417 vector2.Y = tileY * 16 + num3;
1419 vector2 -= vector;
1420 Position = vector2;
1421 return true;
1422 }
static Vector2 _trackMagnetOffset
Definition Minecart.cs:67
static int[][] _tileHeight
Definition Minecart.cs:89

References Terraria.Minecart._tileHeight, Terraria.Minecart._trackMagnetOffset, Terraria.Tile.frameX, Terraria.Main.tile, and Terraria.Tile.type.

Referenced by Terraria.Player.GrappleMovement().

+ Here is the caller graph for this function: