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

◆ ExplodeTiles()

void Terraria.Projectile.ExplodeTiles ( Vector2 compareSpot,
int radius,
int minI,
int maxI,
int minJ,
int maxJ,
bool wallSplode )
inline

Explodes tiles within a radius of the given position and within the bounds passed in. The wallSplode parameter should be the result of M:Terraria.Projectile.ShouldWallExplode(Microsoft.Xna.Framework.Vector2,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) and dictates if walls will also be destroyed. This method honors the tile and wall explosion conditions.

Definition at line 91780 of file Projectile.cs.

91781 {
91782 //IL_0017: Unknown result type (might be due to invalid IL or missing references)
91783 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
91784 AchievementsHelper.CurrentlyMining = true;
91785 for (int i = minI; i <= maxI; i++)
91786 {
91787 for (int j = minJ; j <= maxJ; j++)
91788 {
91789 float num3 = Math.Abs((float)i - compareSpot.X / 16f);
91790 float num2 = Math.Abs((float)j - compareSpot.Y / 16f);
91791 if (!(Math.Sqrt(num3 * num3 + num2 * num2) < (double)radius))
91792 {
91793 continue;
91794 }
91795 bool flag = true;
91796 if (Main.tile[i, j] != null && Main.tile[i, j].active())
91797 {
91798 flag = CanExplodeTile(i, j);
91799 if (flag)
91800 {
91801 WorldGen.KillTile(i, j);
91802 if (!Main.tile[i, j].active() && Main.netMode != 0)
91803 {
91804 NetMessage.SendData(17, -1, -1, null, 0, i, j);
91805 }
91806 }
91807 }
91808 if (!flag)
91809 {
91810 continue;
91811 }
91812 for (int k = i - 1; k <= i + 1; k++)
91813 {
91814 for (int l = j - 1; l <= j + 1; l++)
91815 {
91816 if (Main.tile[k, l] != null && Main.tile[k, l].wall > 0 && wallSplode && WallLoader.CanExplode(k, l, Main.tile[k, l].wall))
91817 {
91818 WorldGen.KillWall(k, l);
91819 if (Main.tile[k, l].wall == 0 && Main.netMode != 0)
91820 {
91821 NetMessage.SendData(17, -1, -1, null, 2, k, l);
91822 }
91823 }
91824 }
91825 }
91826 }
91827 }
91828 AchievementsHelper.CurrentlyMining = false;
91829 }
static bool CanExplode(int i, int j, int type)
This serves as the central class from which wall-related functions are supported and carried out.
Definition WallLoader.cs:17
bool CanExplodeTile(int x, int y)

References Terraria.ModLoader.WallLoader.CanExplode(), Terraria.WorldGen.KillTile(), Terraria.WorldGen.KillWall(), Terraria.Main.netMode, Terraria.NetMessage.SendData(), and Terraria.Main.tile.

+ Here is the call graph for this function: