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

◆ GetTileRotation()

static float Terraria.Collision.GetTileRotation ( Vector2 position)
inlinestatic

Definition at line 4383 of file Collision.cs.

4384 {
4385 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
4386 //IL_000d: Unknown result type (might be due to invalid IL or missing references)
4387 //IL_001b: Unknown result type (might be due to invalid IL or missing references)
4388 float num = position.Y % 16f;
4389 int num2 = (int)(position.X / 16f);
4390 int num3 = (int)(position.Y / 16f);
4391 Tile tile = Main.tile[num2, num3];
4392 bool flag = false;
4393 for (int num4 = 2; num4 >= 0; num4--)
4394 {
4395 if (tile.active())
4396 {
4397 if (Main.tileSolid[tile.type])
4398 {
4399 int num5 = tile.blockType();
4400 if (!TileID.Sets.Platforms[tile.type])
4401 {
4402 return num5 switch
4403 {
4404 1 => 0f,
4405 2 => (float)Math.PI / 4f,
4406 3 => -(float)Math.PI / 4f,
4407 _ => 0f,
4408 };
4409 }
4410 int num6 = tile.frameX / 18;
4411 if (((num6 >= 0 && num6 <= 7) || (num6 >= 12 && num6 <= 16)) && (num == 0f || flag))
4412 {
4413 return 0f;
4414 }
4415 switch (num6)
4416 {
4417 case 8:
4418 case 19:
4419 case 21:
4420 case 23:
4421 return -(float)Math.PI / 4f;
4422 case 10:
4423 case 20:
4424 case 22:
4425 case 24:
4426 return (float)Math.PI / 4f;
4427 case 25:
4428 case 26:
4429 if (!flag)
4430 {
4431 switch (num5)
4432 {
4433 case 2:
4434 return (float)Math.PI / 4f;
4435 case 3:
4436 return -(float)Math.PI / 4f;
4437 }
4438 break;
4439 }
4440 return 0f;
4441 }
4442 }
4443 else if (Main.tileSolidTop[tile.type] && tile.frameY == 0 && flag)
4444 {
4445 return 0f;
4446 }
4447 }
4448 num3++;
4449 tile = Main.tile[num2, num3];
4450 flag = true;
4451 }
4452 return 0f;
4453 }
static bool[] Platforms
Definition TileID.cs:219

References Terraria.Tile.active(), Terraria.Tile.blockType(), Terraria.Tile.frameY, Terraria.ID.TileID.Sets.Platforms, Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, and Terraria.Tile.type.

Referenced by Terraria.Mount.UpdateFrame().

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