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

◆ AI_138_ExplosiveTrap()

void Terraria.Projectile.AI_138_ExplosiveTrap ( )
inlineprivate

Definition at line 58269 of file Projectile.cs.

58270 {
58271 //IL_0173: Unknown result type (might be due to invalid IL or missing references)
58272 spriteDirection = (direction = 1);
58273 int num = 694;
58274 int num2 = 48;
58276 switch (type)
58277 {
58278 case 692:
58279 num = 695;
58280 break;
58281 case 693:
58282 num = 696;
58283 break;
58284 }
58285 Lighting.AddLight(base.Center, 0.6f, 0.5f, 0.3f);
58286 if (++frameCounter >= 12)
58287 {
58288 frameCounter = 0;
58289 if (++frame >= Main.projFrames[type])
58290 {
58291 frame = 0;
58292 }
58293 }
58294 if (localAI[0] > 0f)
58295 {
58296 localAI[0] -= 1f;
58297 }
58298 if (localAI[0] <= 0f && owner == Main.myPlayer)
58299 {
58300 localAI[0] = 3f;
58301 bool flag = false;
58302 Rectangle rectangle = Utils.CenteredRectangle(base.Center + new Vector2(0f, -num2), new Vector2(num2 * 3));
58303 for (int i = 0; i < 200; i++)
58304 {
58305 NPC nPC = Main.npc[i];
58306 if (nPC.CanBeChasedBy(this) && rectangle.Intersects(nPC.Hitbox))
58307 {
58308 flag = true;
58309 break;
58310 }
58311 }
58312 if (flag)
58313 {
58317 }
58318 }
58319 tileCollide = true;
58320 velocity.Y += 0.2f;
58321 }
static SlotId PlayTrackedSound(SoundStyle style, Vector2 position)
static readonly LegacySoundStyle DD2_ExplosiveTrapExplode
Definition SoundID.cs:790
IEntitySource GetProjectileSource_FromThis()
static int GetExplosiveTrapCooldown(Player player)
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 Terraria.Lighting.AddLight(), Terraria.Utils.CenteredRectangle(), Terraria.ID.SoundID.DD2_ExplosiveTrapExplode, Terraria.Main.myPlayer, Terraria.Main.npc, Terraria.Main.player, Terraria.Audio.SoundEngine.PlayTrackedSound(), Terraria.Main.projFrames, System.type, and Microsoft.Xna.Framework.Vector2.Zero.