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

◆ SpawnFallingBlockProjectile()

static bool Terraria.WorldGen.SpawnFallingBlockProjectile ( int i,
int j,
Tile tileCache,
Tile tileTopCache,
Tile tileBottomCache,
int type )
inlinestaticprivate

Definition at line 76122 of file WorldGen.cs.

76123 {
76124 if (Main.netMode == 1)
76125 {
76126 return false;
76127 }
76128 if (tileCache == null || tileTopCache == null || tileBottomCache == null)
76129 {
76130 return false;
76131 }
76132 if (!BlockBelowMakesSandFall(i, j))
76133 {
76134 return false;
76135 }
76137 {
76138 return false;
76139 }
76141 tileCache.ClearTile();
76142 if (Main.netMode == 0)
76143 {
76144 int num = Projectile.NewProjectile(GetProjectileSource_TileBreak(i, j), i * 16 + 8, j * 16 + 8, 0f, 0.41f, projType, dmg, 0f, Main.myPlayer);
76145 Main.projectile[num].ai[0] = 1f;
76146 SquareTileFrame(i, j);
76147 }
76148 if (Main.netMode == 2)
76149 {
76150 bool flag = false;
76151 for (int k = 0; k < 1000; k++)
76152 {
76153 if (Main.projectile[k].active && Main.projectile[k].owner == Main.myPlayer && Main.projectile[k].type == projType && Math.Abs(Main.projectile[k].timeLeft - 3600) < 60 && Main.projectile[k].Distance(new Vector2(i * 16 + 8, j * 16 + 10)) < 4f)
76154 {
76155 flag = true;
76156 break;
76157 }
76158 }
76159 if (!flag)
76160 {
76161 int num2 = Projectile.NewProjectile(GetProjectileSource_TileBreak(i, j), i * 16 + 8, j * 16 + 8, 0f, 2.5f, projType, dmg, 0f, Main.myPlayer);
76162 Main.projectile[num2].velocity.Y = 0.5f;
76163 Main.projectile[num2].position.Y += 2f;
76164 Main.projectile[num2].netUpdate = true;
76165 }
76166 SquareTileFrame(i, j);
76167 NetMessage.SendTileSquare(-1, i, j);
76168 ExploitDestroyQueue.Enqueue(new Point(i, j));
76169 ExploitDestroyQueue.Enqueue(new Point(i, j - 1));
76170 }
76171 return true;
76172 }
static double Abs(double value)
static Queue< Point > ExploitDestroyQueue
Definition WorldGen.cs:1192
static bool BlockBelowMakesSandFall(int i, int j)
static void GetSandfallProjData(int type, out int projType, out int dmg)
static EntitySource_TileBreak GetProjectileSource_TileBreak(int x, int y)
Definition WorldGen.cs:1308
static void SquareTileFrame(int i, int j, bool resetFrame=true)
static bool AllowsSandfall(Tile tileTopCache)

References System.Math.Abs(), Terraria.Tile.ClearTile(), Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Projectile.NewProjectile(), Terraria.Main.projectile, Terraria.NetMessage.SendTileSquare(), and System.type.