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

◆ GasTrapCheck()

static bool Terraria.Projectile.GasTrapCheck ( int x,
int y,
Player user )
inlinestatic

Definition at line 33638 of file Projectile.cs.

33639 {
33640 if (Main.netMode == 1)
33641 {
33642 return false;
33643 }
33644 int num = Chest.FindChest(x, y);
33645 if (num < 0)
33646 {
33647 return false;
33648 }
33649 Chest chest = Main.chest[num];
33650 int num2 = 16;
33651 int num3 = 16;
33652 bool flag = false;
33653 for (int i = 0; i < 40; i++)
33654 {
33655 ushort num4 = Main.tile[chest.x, chest.y].type;
33657 {
33659 if (tileData != null)
33660 {
33661 int num5 = (int)Math.Ceiling((float)tileData.Width / 2f);
33662 int num6 = (int)Math.Ceiling((float)tileData.Width / 2f);
33663 num2 = num5 * 16;
33664 num3 = num6 * 16;
33665 if (num5 % 2 != 0)
33666 {
33667 num2 += 8;
33668 }
33669 if (num6 % 2 != 0)
33670 {
33671 num3 += 8;
33672 }
33673 }
33674 }
33675 if (chest.item[i] != null && chest.item[i].type == 5346)
33676 {
33677 UseGasTrapInChest(num, chest, i, num2, num3);
33678 flag = true;
33679 break;
33680 }
33681 }
33682 if (flag)
33683 {
33684 num3 -= 8;
33685 NewProjectile(position: new Vector2(x * 16 + num2, y * 16 + num3), spawnSource: user.GetProjectileSource_TileInteraction(x, y), velocity: Vector2.Zero, Type: 1007, Damage: 10, KnockBack: 0f, Owner: Main.myPlayer);
33686 }
33687 return flag;
33688 }
static double Ceiling(double a)
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static bool CustomPlace(int type, int style)
static TileObjectData GetTileData(int type, int style, int alternate=0)
static void UseGasTrapInChest(int chestIndex, Chest theChest, int gasTrapIndex, int gasOffsetX, int gasOffsetY)
static int NewProjectile(IEntitySource spawnSource, Vector2 position, Vector2 velocity, int Type, int Damage, float KnockBack, int Owner=-1, float ai0=0f, float ai1=0f, float ai2=0f)

References System.Math.Ceiling(), Terraria.Main.chest, Terraria.ObjectData.TileObjectData.CustomPlace(), Terraria.GameContent.Damage, Terraria.Chest.FindChest(), Terraria.ObjectData.TileObjectData.GetTileData(), Terraria.Chest.item, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Main.tile, Terraria.Item.type, Terraria.Chest.x, Terraria.Chest.y, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Player.Update().