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

◆ TryCloseDoor()

DoorCloseAttemptResult Terraria.GameContent.DoorOpeningHelper.TallGateOpeningInfoProvider.TryCloseDoor ( DoorOpenCloseTogglingInfo info,
PlayerInfoForClosingDoors playerInfo )
inline

Implements Terraria.GameContent.DoorOpeningHelper.DoorAutoHandler.

Definition at line 187 of file DoorOpeningHelper.cs.

188 {
189 Point tileCoordsForToggling = info.tileCoordsForToggling;
190 Tile tile = Main.tile[tileCoordsForToggling.X, tileCoordsForToggling.Y];
191 if (!tile.active() || tile.type != 389)
192 {
193 return DoorCloseAttemptResult.DoorIsInvalidated;
194 }
195 _ = tile.frameY % 90 / 18;
196 Rectangle value = new Rectangle(tileCoordsForToggling.X * 16, tileCoordsForToggling.Y * 16, 16, 80);
197 value.Inflate(1, 0);
198 Rectangle rectangle = Rectangle.Intersect(value, playerInfo.hitboxToNotCloseDoor);
199 if (rectangle.Width > 0 || rectangle.Height > 0)
200 {
201 return DoorCloseAttemptResult.StillInDoorArea;
202 }
203 bool flag = true;
204 if (WorldGen.ShiftTallGate(tileCoordsForToggling.X, tileCoordsForToggling.Y, flag))
205 {
206 NetMessage.SendData(13, -1, -1, null, Main.myPlayer);
207 NetMessage.SendData(19, -1, -1, null, 4 + flag.ToInt(), tileCoordsForToggling.X, tileCoordsForToggling.Y);
208 return DoorCloseAttemptResult.ClosedDoor;
209 }
210 return DoorCloseAttemptResult.FailedToCloseDoor;
211 }
static Rectangle Intersect(Rectangle value1, Rectangle value2)
Definition Rectangle.cs:143

References Terraria.Tile.active(), System.info, Microsoft.Xna.Framework.Rectangle.Intersect(), Terraria.Main.myPlayer, Terraria.NetMessage.SendData(), Terraria.WorldGen.ShiftTallGate(), Terraria.Main.tile, Terraria.Tile.type, System.value, Microsoft.Xna.Framework.Point.X, and Microsoft.Xna.Framework.Point.Y.