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

◆ Check2x1()

static void Terraria.WorldGen.Check2x1 ( int i,
int y,
ushort type )
inlinestatic

Definition at line 38005 of file WorldGen.cs.

38006 {
38007 if (destroyObject)
38008 {
38009 return;
38010 }
38011 int num = i;
38012 bool flag = true;
38013 if (Main.tile[num, y] == null)
38014 {
38015 Main.tile[num, y] = new Tile();
38016 }
38017 int num2 = Main.tile[num, y].frameX / 18;
38018 int num3 = num2 >> 1;
38019 int num4 = Main.tile[num, y].frameY / 18;
38020 num2 %= 2;
38021 num -= num2;
38022 if (Main.tile[num, y] == null)
38023 {
38024 Main.tile[num, y] = new Tile();
38025 }
38026 if (Main.tile[num + 1, y] == null)
38027 {
38028 Main.tile[num + 1, y] = new Tile();
38029 }
38030 if (Main.tile[num, y + 1] == null)
38031 {
38032 Main.tile[num, y + 1] = new Tile();
38033 }
38034 if (Main.tile[num + 1, y + 1] == null)
38035 {
38036 Main.tile[num + 1, y + 1] = new Tile();
38037 }
38038 if (Main.tile[num + 1, y].frameX == Main.tile[num, y].frameX + 18 && Main.tile[num, y].type == type && Main.tile[num + 1, y].type == type)
38039 {
38040 flag = false;
38041 }
38042 if (type == 29 || type == 103 || type == 462)
38043 {
38044 if (!Main.tile[num, y + 1].active() || !Main.tileTable[Main.tile[num, y + 1].type] || Main.tile[num, y + 1].halfBrick() || Main.tile[num, y + 1].topSlope())
38045 {
38046 flag = true;
38047 }
38048 if (!Main.tile[num + 1, y + 1].active() || !Main.tileTable[Main.tile[num + 1, y + 1].type] || Main.tile[num + 1, y + 1].halfBrick() || Main.tile[num + 1, y + 1].topSlope())
38049 {
38050 flag = true;
38051 }
38052 }
38053 else
38054 {
38055 if (!SolidTileAllowBottomSlope(num, y + 1))
38056 {
38057 flag = true;
38058 }
38059 if (!SolidTileAllowBottomSlope(num + 1, y + 1))
38060 {
38061 flag = true;
38062 }
38063 }
38064 if (type == 185)
38065 {
38066 if (Main.tile[num, y].frameX >= 1368 && Main.tile[num, y].frameX <= 1458 && Main.tile[num, y + 1].type != 2 && Main.tile[num + 1, y + 1].type != 2 && Main.tile[num, y + 1].type != 477 && Main.tile[num + 1, y + 1].type != 477 && Main.tile[num, y + 1].type != 492 && Main.tile[num + 1, y + 1].type != 492)
38067 {
38068 Main.tile[num, y].frameX -= 1368;
38069 Main.tile[num + 1, y].frameX -= 1368;
38070 }
38071 Tile tile = Main.tile[num, y];
38072 int num5 = tile.frameX / 36;
38073 num5 += (tile.frameY / 18 - 1) * 52;
38074 for (int j = num; j < num + 2; j++)
38075 {
38076 Tile tile2 = Main.tile[j, y + 1];
38077 if (tile2 == null || !tile2.active() || tile2.type < 0 || tile2.type >= TileID.Count)
38078 {
38079 continue;
38080 }
38081 ushort type2 = tile2.type;
38082 switch (num5)
38083 {
38084 case 25:
38085 case 26:
38086 case 27:
38087 case 28:
38088 case 29:
38089 case 30:
38090 if (!TileID.Sets.Snow[type2] && !TileID.Sets.Conversion.Ice[type2] && type2 != 162 && type2 != 224)
38091 {
38092 flag = true;
38093 }
38094 break;
38095 case 41:
38096 case 42:
38097 case 43:
38098 case 44:
38099 case 45:
38100 case 46:
38101 case 62:
38102 case 63:
38103 case 64:
38105 {
38106 flag = true;
38107 }
38108 break;
38109 }
38110 }
38111 }
38112 if (!flag)
38113 {
38114 return;
38115 }
38116 int frameX = Main.tile[num, y].frameX;
38117 if (!Main.tile[num, y].active())
38118 {
38119 frameX = Main.tile[num + 1, y].frameX;
38120 }
38121 destroyObject = true;
38122 if (Main.tile[num, y].type == type)
38123 {
38124 KillTile(num, y);
38125 }
38126 if (Main.tile[num + 1, y].type == type)
38127 {
38128 KillTile(num + 1, y);
38129 }
38130 if (type == 16)
38131 {
38132 if (num3 == 1)
38133 {
38134 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 716);
38135 }
38136 else
38137 {
38138 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 35);
38139 }
38140 }
38141 if (type == 18)
38142 {
38143 int type3 = 36;
38144 if (num3 >= 1 && num3 <= 3)
38145 {
38146 type3 = 634 + num3;
38147 }
38148 else if (num3 >= 4 && num3 <= 8)
38149 {
38150 type3 = 807 + num3;
38151 }
38152 else
38153 {
38154 switch (num3)
38155 {
38156 case 9:
38157 type3 = 916;
38158 break;
38159 case 10:
38160 type3 = 1145;
38161 break;
38162 case 11:
38163 type3 = 1398;
38164 break;
38165 case 12:
38166 type3 = 1401;
38167 break;
38168 case 13:
38169 type3 = 1404;
38170 break;
38171 case 14:
38172 type3 = 1461;
38173 break;
38174 case 15:
38175 type3 = 1511;
38176 break;
38177 case 16:
38178 type3 = 1795;
38179 break;
38180 case 17:
38181 type3 = 1817;
38182 break;
38183 case 18:
38184 type3 = 2229;
38185 break;
38186 case 19:
38187 type3 = 2251;
38188 break;
38189 case 20:
38190 type3 = 2252;
38191 break;
38192 case 21:
38193 type3 = 2253;
38194 break;
38195 case 22:
38196 type3 = 2534;
38197 break;
38198 case 23:
38199 type3 = 673;
38200 break;
38201 case 24:
38202 type3 = 2631;
38203 break;
38204 case 25:
38205 type3 = 2632;
38206 break;
38207 case 26:
38208 type3 = 2633;
38209 break;
38210 case 27:
38211 type3 = 2826;
38212 break;
38213 case 28:
38214 type3 = 3156;
38215 break;
38216 case 29:
38217 type3 = 3158;
38218 break;
38219 case 30:
38220 type3 = 3157;
38221 break;
38222 case 31:
38223 type3 = 3909;
38224 break;
38225 case 32:
38226 type3 = 3910;
38227 break;
38228 case 33:
38229 type3 = 3949;
38230 break;
38231 case 34:
38232 type3 = 3975;
38233 break;
38234 case 35:
38235 type3 = 4163;
38236 break;
38237 case 36:
38238 type3 = 4184;
38239 break;
38240 case 37:
38241 type3 = 4205;
38242 break;
38243 case 38:
38244 type3 = 4226;
38245 break;
38246 case 39:
38247 type3 = 4315;
38248 break;
38249 case 40:
38250 type3 = 4584;
38251 break;
38252 case 41:
38253 type3 = 5166;
38254 break;
38255 case 42:
38256 type3 = 5187;
38257 break;
38258 case 43:
38259 type3 = 5208;
38260 break;
38261 }
38262 }
38263 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, type3);
38264 }
38265 if (type == 185)
38266 {
38267 if (frameX >= 576 && frameX <= 610)
38268 {
38269 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(10, 100));
38270 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(20, 100));
38271 if (genRand.Next(3) != 0)
38272 {
38273 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(10, 100));
38274 }
38275 if (genRand.Next(3) != 0)
38276 {
38277 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(20, 100));
38278 }
38279 if (genRand.Next(2) == 0)
38280 {
38281 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(10, 100));
38282 }
38283 if (genRand.Next(2) == 0)
38284 {
38285 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(20, 100));
38286 }
38287 if (genRand.Next(3) == 0)
38288 {
38289 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(10, 100));
38290 }
38291 if (genRand.Next(3) == 0)
38292 {
38293 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(20, 100));
38294 }
38295 if (genRand.Next(4) == 0)
38296 {
38297 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(10, 100));
38298 }
38299 if (genRand.Next(4) == 0)
38300 {
38301 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(20, 100));
38302 }
38303 if (genRand.Next(5) == 0)
38304 {
38305 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(10, 100));
38306 }
38307 if (genRand.Next(5) == 0)
38308 {
38309 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 71, genRand.Next(20, 100));
38310 }
38311 }
38312 if (frameX >= 612 && frameX <= 646)
38313 {
38314 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 72, genRand.Next(10, 100));
38315 if (genRand.Next(2) == 0)
38316 {
38317 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 72, genRand.Next(20, 100));
38318 }
38319 if (genRand.Next(3) == 0)
38320 {
38321 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 72, genRand.Next(30, 100));
38322 }
38323 }
38324 if (frameX >= 648 && frameX <= 682)
38325 {
38326 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 73, genRand.Next(1, 6));
38327 if (genRand.Next(2) == 0)
38328 {
38329 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 73, genRand.Next(2, 6));
38330 }
38331 if (genRand.Next(3) == 0)
38332 {
38333 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 73, genRand.Next(3, 6));
38334 }
38335 }
38336 if (frameX >= 684 && frameX <= 718)
38337 {
38338 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 181, genRand.Next(1, 4));
38339 }
38340 if (frameX >= 720 && frameX <= 754)
38341 {
38342 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 180, genRand.Next(1, 4));
38343 }
38344 if (frameX >= 756 && frameX <= 790)
38345 {
38346 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 177, genRand.Next(1, 4));
38347 }
38348 if (frameX >= 792 && frameX <= 826)
38349 {
38350 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 179, genRand.Next(1, 4));
38351 }
38352 if (frameX >= 828 && frameX <= 862)
38353 {
38354 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 178, genRand.Next(1, 4));
38355 }
38356 if (frameX >= 864 && frameX <= 898)
38357 {
38358 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 182, genRand.Next(1, 4));
38359 }
38360 }
38361 if (type == 462)
38362 {
38363 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 3795);
38364 }
38365 if (type == 29)
38366 {
38367 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 87);
38368 SoundEngine.PlaySound(13, i * 16, y * 16);
38369 }
38370 switch (type)
38371 {
38372 case 103:
38373 {
38374 int type4 = 356;
38375 if (num3 == 1)
38376 {
38377 type4 = 2235;
38378 }
38379 if (num3 == 2)
38380 {
38381 type4 = 2242;
38382 }
38383 if (num3 == 3)
38384 {
38385 type4 = 2243;
38386 }
38387 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, type4);
38388 SoundEngine.PlaySound(13, i * 16, y * 16);
38389 break;
38390 }
38391 case 134:
38392 if (num3 == 1)
38393 {
38394 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 1220);
38395 }
38396 else
38397 {
38398 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, 525);
38399 }
38400 break;
38401 case 649:
38402 {
38403 num3 += num4 * 53;
38404 int num6 = 0;
38405 if (num3 < 6)
38406 {
38407 num6 = 3;
38408 }
38409 else if (num3 < 16)
38410 {
38411 num6 = 154;
38412 }
38413 else if (num3 < 17)
38414 {
38415 num6 = 71;
38416 }
38417 else if (num3 < 18)
38418 {
38419 num6 = 72;
38420 }
38421 else if (num3 < 19)
38422 {
38423 num6 = 73;
38424 }
38425 else if (num3 < 20)
38426 {
38427 num6 = 181;
38428 }
38429 else if (num3 < 21)
38430 {
38431 num6 = 180;
38432 }
38433 else if (num3 < 22)
38434 {
38435 num6 = 177;
38436 }
38437 else if (num3 < 23)
38438 {
38439 num6 = 179;
38440 }
38441 else if (num3 < 24)
38442 {
38443 num6 = 178;
38444 }
38445 else if (num3 < 25)
38446 {
38447 num6 = 182;
38448 }
38449 else if (num3 < 31)
38450 {
38451 num6 = 593;
38452 }
38453 else if (num3 < 34)
38454 {
38455 num6 = 9;
38456 }
38457 else if (num3 < 38)
38458 {
38459 num6 = 150;
38460 }
38461 else if (num3 < 41)
38462 {
38463 num6 = 3;
38464 }
38465 else if (num3 < 47)
38466 {
38467 num6 = 3271;
38468 }
38469 else if (num3 < 53)
38470 {
38471 num6 = 3086;
38472 }
38473 else if (num3 < 59)
38474 {
38475 num6 = 3081;
38476 }
38477 else if (num3 < 62)
38478 {
38479 num6 = 62;
38480 }
38481 else if (num3 < 65)
38482 {
38483 num6 = 169;
38484 }
38485 if (num6 != 0)
38486 {
38487 Item.NewItem(GetItemSource_FromTileBreak(num, y), num * 16, y * 16, 32, 32, num6);
38488 }
38489 break;
38490 }
38491 }
38492 destroyObject = false;
38493 SquareTileFrame(num, y);
38494 SquareTileFrame(num + 1, y);
38495 }
static void PlaySound(int type, Vector2 position, int style=1)
static bool[] Snow
Definition TileID.cs:203
static readonly ushort Count
Definition TileID.cs:1698
static bool destroyObject
Definition WorldGen.cs:1020
static void KillTile(int i, int j, bool fail=false, bool effectOnly=false, bool noItem=false)
static UnifiedRandom genRand
Definition WorldGen.cs:1215
static bool SolidTileAllowBottomSlope(int i, int j)
static IEntitySource GetItemSource_FromTileBreak(int x, int y)
static void SquareTileFrame(int i, int j, bool resetFrame=true)

References Terraria.ID.TileID.Count, Terraria.ID.TileID.Sets.Conversion.HardenedSand, Terraria.ID.TileID.Sets.Conversion.Ice, Terraria.Item.NewItem(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.ID.TileID.Sets.Conversion.Sand, Terraria.ID.TileID.Sets.Conversion.Sandstone, Terraria.ID.TileID.Sets.Snow, Terraria.DataStructures.Tile, Terraria.Main.tile, Terraria.Main.tileTable, and System.type.