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

◆ TryOpenDoor()

bool Terraria.GameContent.DoorOpeningHelper.TallGateOpeningInfoProvider.TryOpenDoor ( DoorOpenCloseTogglingInfo doorInfo,
PlayerInfoForOpeningDoors playerInfo )
inline

Implements Terraria.GameContent.DoorOpeningHelper.DoorAutoHandler.

Definition at line 156 of file DoorOpeningHelper.cs.

157 {
158 Point tileCoordsForToggling = doorInfo.tileCoordsForToggling;
159 Rectangle rectangle = new Rectangle(doorInfo.tileCoordsForToggling.X * 16, doorInfo.tileCoordsForToggling.Y * 16, 16, 80);
160 switch (playerInfo.playerGravityDirection)
161 {
162 case 1:
163 rectangle.Height += 16;
164 break;
165 case -1:
166 rectangle.Y -= 16;
167 rectangle.Height += 16;
168 break;
169 }
170 if (!rectangle.Intersects(playerInfo.hitboxToOpenDoor))
171 {
172 return false;
173 }
174 if (playerInfo.hitboxToOpenDoor.Top < rectangle.Top || playerInfo.hitboxToOpenDoor.Bottom > rectangle.Bottom)
175 {
176 return false;
177 }
178 bool flag = false;
179 if (WorldGen.ShiftTallGate(tileCoordsForToggling.X, tileCoordsForToggling.Y, flag))
180 {
181 NetMessage.SendData(19, -1, -1, null, 4 + flag.ToInt(), tileCoordsForToggling.X, tileCoordsForToggling.Y);
182 return true;
183 }
184 return false;
185 }

References Terraria.NetMessage.SendData(), Terraria.WorldGen.ShiftTallGate(), Microsoft.Xna.Framework.Point.X, and Microsoft.Xna.Framework.Point.Y.