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

◆ CheckCannon()

static void Terraria.WorldGen.CheckCannon ( int i,
int j,
int type )
inlinestatic

Definition at line 42161 of file WorldGen.cs.

42162 {
42163 if (destroyObject)
42164 {
42165 return;
42166 }
42167 bool flag = false;
42168 int num = Main.tile[i, j].frameX / 18;
42169 int num2 = 0;
42170 while (num >= 4)
42171 {
42172 num2++;
42173 num -= 4;
42174 }
42175 num = i - num;
42176 int num3 = Main.tile[i, j].frameY / 18;
42177 int num4 = 0;
42178 while (num3 >= 3)
42179 {
42180 num4 += 54;
42181 num3 -= 3;
42182 }
42183 num3 = j - num3;
42184 int num5 = 72 * num2;
42185 for (int k = num; k < num + 4; k++)
42186 {
42187 int num6 = num4;
42188 for (int l = num3; l < num3 + 3; l++)
42189 {
42190 if (Main.tile[k, l] == null)
42191 {
42192 Main.tile[k, l] = new Tile();
42193 }
42194 if (!Main.tile[k, l].active() || Main.tile[k, l].type != type || Main.tile[k, l].frameX != num5 || Main.tile[k, l].frameY != num6)
42195 {
42196 flag = true;
42197 }
42198 num6 += 18;
42199 }
42200 if (Main.tile[k, num3 + 3] == null)
42201 {
42202 Main.tile[k, num3 + 3] = new Tile();
42203 }
42204 if (!SolidTileAllowBottomSlope(k, num3 + 3) && k != num && k != num + 3)
42205 {
42206 flag = true;
42207 }
42208 num5 += 18;
42209 }
42210 if (!flag)
42211 {
42212 return;
42213 }
42214 destroyObject = true;
42215 for (int m = num; m < num + 4; m++)
42216 {
42217 for (int n = num3; n < num3 + 3; n++)
42218 {
42219 if (Main.tile[m, n].type == type && Main.tile[m, n].active())
42220 {
42221 KillTile(m, n);
42222 }
42223 }
42224 }
42225 int type2 = 928;
42226 switch (num2)
42227 {
42228 case 1:
42229 type2 = 1337;
42230 break;
42231 case 2:
42232 type2 = 3369;
42233 break;
42234 case 3:
42235 case 4:
42236 type2 = 3664;
42237 break;
42238 }
42239 Item.NewItem(GetItemSource_FromTileBreak(i, j), i * 16, j * 16, 32, 32, type2);
42240 destroyObject = false;
42241 for (int num7 = num; num7 < num + 4; num7++)
42242 {
42243 for (int num8 = num3; num8 < num3 + 3; num8++)
42244 {
42246 }
42247 }
42248 }
static bool destroyObject
Definition WorldGen.cs:1020
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static void TileFrame(int i, int j, bool resetFrame=false, bool noBreak=false)
static bool SolidTileAllowBottomSlope(int i, int j)
static IEntitySource GetItemSource_FromTileBreak(int x, int y)

References Terraria.Item.NewItem(), Terraria.DataStructures.Tile, Terraria.Main.tile, and System.type.