Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ ShiftTallGate()

static bool Terraria.WorldGen.ShiftTallGate ( int x,
int y,
bool closing,
bool forced = false )
inlinestatic

Definition at line 43268 of file WorldGen.cs.

43269 {
43270 ushort type = (ushort)(closing ? 388 : 389);
43271 ushort num = (ushort)(closing ? 389 : 388);
43272 Tile tileSafely = Framing.GetTileSafely(x, y);
43273 if (tileSafely.type != num)
43274 {
43275 return false;
43276 }
43277 Point point = new Point(tileSafely.frameX / 18, 0);
43279 point.Y = tileSafely.frameY / tileData.CoordinateFullHeight;
43280 _ = tileData.Width;
43281 int height = tileData.Height;
43282 int i = 0;
43283 for (int num2 = tileSafely.frameY % tileData.CoordinateFullHeight; i < height && num2 - tileData.CoordinateHeights[i] >= 0; i++)
43284 {
43285 num2 -= tileData.CoordinateHeights[i];
43286 }
43287 _ = tileData.CoordinateFullHeight;
43288 y -= i;
43289 if (Main.netMode != 1 && Wiring.running)
43290 {
43291 for (int j = 0; j < height; j++)
43292 {
43293 Wiring.SkipWire(x, y + j);
43294 }
43295 }
43296 for (int k = 0; k < height; k++)
43297 {
43298 if (!forced && !Collision.EmptyTile(x, y + k, ignoreTiles: true))
43299 {
43300 return false;
43301 }
43302 }
43303 SoundEngine.PlaySound(8, x * 16 + 16, y * 16 + 16);
43304 for (int l = 0; l < height; l++)
43305 {
43306 tileSafely = Framing.GetTileSafely(x, y + l);
43307 tileSafely.type = type;
43308 }
43309 for (int m = -1; m < 2; m++)
43310 {
43311 for (int n = -1; n < height + 1; n++)
43312 {
43313 TileFrame(x + m, y + n);
43314 }
43315 }
43316 return true;
43317 }
static void PlaySound(int type, Vector2 position, int style=1)
static TileObjectData GetTileData(int type, int style, int alternate=0)
static void TileFrame(int i, int j, bool resetFrame=false, bool noBreak=false)

References Terraria.Collision.EmptyTile(), Terraria.ObjectData.TileObjectData.GetTileData(), Terraria.Framing.GetTileSafely(), Terraria.Main.netMode, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Wiring.running, Terraria.Wiring.SkipWire(), System.type, and Microsoft.Xna.Framework.Point.X.

Referenced by Terraria.NPC.AI_003_Fighters(), Terraria.NPC.AI_007_TownEntities(), Terraria.NPC.AI_107_ImprovedWalkers(), Terraria.MessageBuffer.GetData(), Terraria.Wiring.HitWireSingle(), Terraria.Player.TileInteractionsUse(), Terraria.GameContent.DoorOpeningHelper.TallGateOpeningInfoProvider.TryCloseDoor(), and Terraria.GameContent.DoorOpeningHelper.TallGateOpeningInfoProvider.TryOpenDoor().