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

◆ ExpandVertically()

static void Terraria.Collision.ExpandVertically ( int startX,
int startY,
out int topY,
out int bottomY,
int maxExpandUp = 100,
int maxExpandDown = 100 )
inlinestatic

Definition at line 3519 of file Collision.cs.

3520 {
3521 topY = startY;
3522 bottomY = startY;
3523 if (!WorldGen.InWorld(startX, startY, 10))
3524 {
3525 return;
3526 }
3527 for (int i = 0; i < maxExpandUp; i++)
3528 {
3529 if (topY <= 0)
3530 {
3531 break;
3532 }
3533 if (topY < 10)
3534 {
3535 break;
3536 }
3537 if (Main.tile[startX, topY] == null)
3538 {
3539 break;
3540 }
3541 if (WorldGen.SolidTile3(startX, topY))
3542 {
3543 break;
3544 }
3545 topY--;
3546 }
3547 for (int j = 0; j < maxExpandDown; j++)
3548 {
3549 if (bottomY >= Main.maxTilesY - 10)
3550 {
3551 break;
3552 }
3553 if (bottomY > Main.maxTilesY - 10)
3554 {
3555 break;
3556 }
3557 if (Main.tile[startX, bottomY] == null)
3558 {
3559 break;
3560 }
3561 if (WorldGen.SolidTile3(startX, bottomY))
3562 {
3563 break;
3564 }
3565 bottomY++;
3566 }
3567 }

References Terraria.WorldGen.InWorld(), Terraria.Main.maxTilesY, Terraria.WorldGen.SolidTile3(), and Terraria.Main.tile.

Referenced by Terraria.NPC.AI(), Terraria.StrayMethods.CanSpawnSandstormFriendly(), Terraria.StrayMethods.CanSpawnSandstormHostile(), Terraria.StrayMethods.CheckArenaScore(), Terraria.Main.DrawProjDirect(), and Terraria.StrayMethods.SendWalker().