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

◆ SpreadDirt()

static bool Terraria.DelegateMethods.SpreadDirt ( int x,
int y )
inlinestatic

Definition at line 393 of file DelegateMethods.cs.

394 {
395 if (Vector2.Distance(v2_1, new Vector2(x, y)) > f_1)
396 {
397 return false;
398 }
399 WorldGen.TryKillingReplaceableTile(x, y, 0);
400 if (WorldGen.PlaceTile(x, y, 0))
401 {
402 if (Main.netMode != 0)
403 {
404 NetMessage.SendData(17, -1, -1, null, 1, x, y);
405 }
406 Vector2 position = new Vector2(x * 16, y * 16);
407 int num = 0;
408 for (int i = 0; i < 3; i++)
409 {
410 Dust dust = Dust.NewDustDirect(position, 16, 16, num, 0f, 0f, 100, Color.Transparent, 2.2f);
411 dust.noGravity = true;
412 dust.velocity.Y -= 1.2f;
413 dust.velocity *= 4f;
414 Dust dust2 = Dust.NewDustDirect(position, 16, 16, num, 0f, 0f, 100, Color.Transparent, 1.3f);
415 dust2.velocity.Y -= 1.2f;
416 dust2.velocity *= 2f;
417 }
418 int num2 = y + 1;
419 if (Main.tile[x, num2] != null && !TileID.Sets.Platforms[Main.tile[x, num2].type] && (Main.tile[x, num2].topSlope() || Main.tile[x, num2].halfBrick()))
420 {
421 WorldGen.SlopeTile(x, num2);
422 if (Main.netMode != 0)
423 {
424 NetMessage.SendData(17, -1, -1, null, 14, x, num2);
425 }
426 }
427 num2 = y - 1;
428 if (Main.tile[x, num2] != null && !TileID.Sets.Platforms[Main.tile[x, num2].type] && Main.tile[x, num2].bottomSlope())
429 {
430 WorldGen.SlopeTile(x, num2);
431 if (Main.netMode != 0)
432 {
433 NetMessage.SendData(17, -1, -1, null, 14, x, num2);
434 }
435 }
436 for (int j = x - 1; j <= x + 1; j++)
437 {
438 for (int k = y - 1; k <= y + 1; k++)
439 {
440 Tile tile = Main.tile[j, k];
441 if (!tile.active() || num == tile.type || (tile.type != 2 && tile.type != 23 && tile.type != 60 && tile.type != 70 && tile.type != 109 && tile.type != 199 && tile.type != 477 && tile.type != 492))
442 {
443 continue;
444 }
445 bool flag = true;
446 for (int l = j - 1; l <= j + 1; l++)
447 {
448 for (int m = k - 1; m <= k + 1; m++)
449 {
450 if (!WorldGen.SolidTile(l, m))
451 {
452 flag = false;
453 }
454 }
455 }
456 if (flag)
457 {
458 WorldGen.KillTile(j, k, fail: true);
459 if (Main.netMode != 0)
460 {
461 NetMessage.SendData(17, -1, -1, null, 0, j, k, 1f);
462 }
463 }
464 }
465 }
466 return true;
467 }
468 Tile tile2 = Main.tile[x, y];
469 if (tile2 == null)
470 {
471 return false;
472 }
473 if (tile2.type < 0 || tile2.type >= TileID.Count)
474 {
475 return false;
476 }
477 if (Main.tileSolid[tile2.type] && !TileID.Sets.Platforms[tile2.type])
478 {
479 return tile2.type == 380;
480 }
481 return true;
482 }
static bool[] Platforms
Definition TileID.cs:163
static readonly ushort Count
Definition TileID.cs:1698
static Color Transparent
Definition Color.cs:76
static float Distance(Vector2 value1, Vector2 value2)
Definition Vector2.cs:91

References Terraria.Tile.active(), Terraria.ID.TileID.Count, Microsoft.Xna.Framework.Vector2.Distance(), Terraria.DelegateMethods.f_1, Terraria.WorldGen.KillTile(), Terraria.Main.netMode, Terraria.Dust.NewDustDirect(), Terraria.WorldGen.PlaceTile(), Terraria.ID.TileID.Sets.Platforms, Terraria.NetMessage.SendData(), Terraria.WorldGen.SlopeTile(), Terraria.WorldGen.SolidTile(), Terraria.Main.tile, Terraria.Main.tileSolid, Microsoft.Xna.Framework.Color.Transparent, Terraria.WorldGen.TryKillingReplaceableTile(), Terraria.Tile.type, and Terraria.DelegateMethods.v2_1.

Referenced by Terraria.Projectile.Kill().