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

◆ GetPlayerInfoForOpeningDoor()

PlayerInfoForOpeningDoors Terraria.GameContent.DoorOpeningHelper.GetPlayerInfoForOpeningDoor ( Player player)
inlineprivate

Definition at line 315 of file DoorOpeningHelper.cs.

316 {
317 int num = player.controlRight.ToInt() - player.controlLeft.ToInt();
318 int playerGravityDirection = (int)player.gravDir;
319 Rectangle hitbox = player.Hitbox;
320 hitbox.Y -= -1;
321 hitbox.Height += -2;
322 float num2 = player.velocity.X;
323 if (num == 0 && _timeWeCanOpenDoorsUsingVelocityAlone == 0)
324 {
325 num2 = 0f;
326 }
327 float value = (float)num + num2;
328 int num3 = Math.Sign(value) * (int)Math.Ceiling(Math.Abs(value));
329 hitbox.X += num3;
330 if (num == 0)
331 {
332 num = Math.Sign(value);
333 }
335 Rectangle value2 = (hitbox2 = player.Hitbox);
336 hitbox2.X += num3;
338 Point point = r.TopLeft().ToTileCoordinates();
339 Point point2 = r.BottomRight().ToTileCoordinates();
340 Rectangle tileCoordSpaceForCheckingForDoors = new Rectangle(point.X, point.Y, point2.X - point.X, point2.Y - point.Y);
341 PlayerInfoForOpeningDoors result = default(PlayerInfoForOpeningDoors);
342 result.hitboxToOpenDoor = hitbox;
343 result.intendedOpeningDirection = num;
344 result.playerGravityDirection = playerGravityDirection;
345 result.tileCoordSpaceForCheckingForDoors = tileCoordSpaceForCheckingForDoors;
346 return result;
347 }
static double Ceiling(double a)
static double Abs(double value)
static int Sign(decimal value)
Definition Math.cs:1202
static Rectangle Union(Rectangle value1, Rectangle value2)
Definition Rectangle.cs:197

References Terraria.GameContent.DoorOpeningHelper._timeWeCanOpenDoorsUsingVelocityAlone, System.Math.Abs(), System.Math.Ceiling(), Terraria.Player.controlLeft, Terraria.Player.controlRight, Terraria.Player.gravDir, Terraria.Entity.Hitbox, System.Math.Sign(), Microsoft.Xna.Framework.Rectangle.Union(), System.value, Terraria.Entity.velocity, Microsoft.Xna.Framework.Point.X, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Point.Y.

Referenced by Terraria.GameContent.DoorOpeningHelper.LookForDoorsToOpen().