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

◆ ShiftTrapdoor()

static bool Terraria.WorldGen.ShiftTrapdoor ( int x,
int y,
bool playerAbove,
int onlyCloseOrOpen = -1 )
inlinestatic

Definition at line 45322 of file WorldGen.cs.

45323 {
45324 //IL_002b: Unknown result type (might be due to invalid IL or missing references)
45325 //IL_0030: Unknown result type (might be due to invalid IL or missing references)
45326 //IL_0031: Unknown result type (might be due to invalid IL or missing references)
45327 //IL_0270: Unknown result type (might be due to invalid IL or missing references)
45328 //IL_013d: Unknown result type (might be due to invalid IL or missing references)
45329 //IL_00f9: Unknown result type (might be due to invalid IL or missing references)
45330 //IL_0207: Unknown result type (might be due to invalid IL or missing references)
45331 Tile tileSafely = Framing.GetTileSafely(x, y);
45332 if (tileSafely.type == 386 && onlyCloseOrOpen != 1)
45333 {
45334 Point topLeftAndStyles = GetTopLeftAndStyles(ref x, ref y, 2, 2, 18, 18);
45335 if (topLeftAndStyles.X == 0)
45336 {
45337 if (Main.netMode != 1 && Wiring.running)
45338 {
45339 Wiring.SkipWire(x, y);
45340 Wiring.SkipWire(x, y + 1);
45341 Wiring.SkipWire(x + 1, y);
45342 Wiring.SkipWire(x + 1, y + 1);
45343 }
45344 if (!Collision.EmptyTile(x, y + 1, ignoreTiles: true) || !Collision.EmptyTile(x + 1, y + 1, ignoreTiles: true))
45345 {
45346 return false;
45347 }
45348 SoundEngine.PlaySound(8, x * 16 + 16, y * 16 + 16);
45349 for (int i = 0; i < 2; i++)
45350 {
45351 Framing.GetTileSafely(x + i, y).ClearTile();
45352 }
45353 for (int j = 0; j < 2; j++)
45354 {
45355 tileSafely = Framing.GetTileSafely(x + j, y + 1);
45356 tileSafely.type = 387;
45357 tileSafely.frameX = (short)(j * 18);
45358 tileSafely.frameY = (short)(topLeftAndStyles.Y * 18);
45359 }
45360 for (int k = -1; k < 3; k++)
45361 {
45362 for (int l = 0; l < 3; l++)
45363 {
45364 TileFrame(x + k, y + l);
45365 }
45366 }
45367 return true;
45368 }
45369 if (topLeftAndStyles.X == 1)
45370 {
45371 if (Main.netMode != 1 && Wiring.running)
45372 {
45373 Wiring.SkipWire(x, y - 1);
45374 Wiring.SkipWire(x, y);
45375 Wiring.SkipWire(x + 1, y - 1);
45376 Wiring.SkipWire(x + 1, y);
45377 }
45378 if (!Collision.EmptyTile(x, y, ignoreTiles: true) || !Collision.EmptyTile(x + 1, y, ignoreTiles: true))
45379 {
45380 return false;
45381 }
45382 SoundEngine.PlaySound(8, x * 16 + 16, y * 16);
45383 for (int m = 0; m < 2; m++)
45384 {
45385 Framing.GetTileSafely(x + m, y + 1).ClearTile();
45386 }
45387 for (int n = 0; n < 2; n++)
45388 {
45389 tileSafely = Framing.GetTileSafely(x + n, y);
45390 tileSafely.type = 387;
45391 tileSafely.frameX = (short)(n * 18);
45392 tileSafely.frameY = (short)(topLeftAndStyles.Y * 18);
45393 }
45394 for (int num = -1; num < 3; num++)
45395 {
45396 for (int num2 = -1; num2 < 2; num2++)
45397 {
45398 TileFrame(x + num, y + num2);
45399 }
45400 }
45401 return true;
45402 }
45403 }
45404 if (tileSafely.type == 387 && onlyCloseOrOpen != 0)
45405 {
45406 GetTopLeftAndStyles(ref x, ref y, 2, 1, 18, 18);
45407 int num3 = playerAbove.ToDirectionInt();
45408 for (int num4 = 0; num4 < 2; num4++)
45409 {
45410 tileSafely = Framing.GetTileSafely(x + num4, y + num3);
45411 if (tileSafely.active() && !Main.tileCut[tileSafely.type])
45412 {
45413 return false;
45414 }
45415 }
45416 if (Main.netMode != 1 && Wiring.running)
45417 {
45418 Wiring.SkipWire(x, y);
45419 Wiring.SkipWire(x, y + num3);
45420 Wiring.SkipWire(x + 1, y);
45421 Wiring.SkipWire(x + 1, y + num3);
45422 }
45423 SoundEngine.PlaySound(8, x * 16 + 16, y * 16);
45424 for (int num5 = 0; num5 < 2; num5++)
45425 {
45426 tileSafely = Framing.GetTileSafely(x + num5, y + num3);
45427 if (tileSafely.active() && Main.tileCut[tileSafely.type])
45428 {
45429 KillTile(x + num5, y + num3);
45430 }
45431 }
45432 for (int num6 = 0; num6 < 2; num6++)
45433 {
45434 TileColorCache cache = Framing.GetTileSafely(x + num6, y).BlockColorAndCoating();
45435 for (int num7 = 0; num7 < 2; num7++)
45436 {
45437 tileSafely = Framing.GetTileSafely(x + num6, y + num7 - (!playerAbove).ToInt());
45438 tileSafely.type = 386;
45439 tileSafely.frameX = (short)(num6 * 18 + playerAbove.ToInt() * 36);
45440 tileSafely.frameY = (short)(num7 * 18);
45441 tileSafely.UseBlockColors(cache);
45442 tileSafely.active(active: true);
45443 }
45444 }
45445 for (int num8 = -1; num8 < 3; num8++)
45446 {
45447 for (int num9 = -1; num9 < 3; num9++)
45448 {
45449 TileFrame(x + num8, y + num9 - (!playerAbove).ToInt() * 2);
45450 }
45451 }
45452 return true;
45453 }
45454 SoundEngine.PlaySound(9, x * 16, y * 16);
45455 return false;
45456 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
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 Point GetTopLeftAndStyles(ref int x, ref int y, int w, int h, int frameXinc, int frameYinc)

References Terraria.Collision.EmptyTile(), Terraria.Framing.GetTileSafely(), Terraria.Main.netMode, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Wiring.running, Terraria.Wiring.SkipWire(), and Terraria.Main.tileCut.

Referenced by Terraria.MessageBuffer.GetData(), Terraria.Wiring.HitWireSingle(), and Terraria.Player.TileInteractionsUse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: