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

◆ AI_047_MagnetSphere()

void Terraria.Projectile.AI_047_MagnetSphere ( )
inlineprivate

Definition at line 42470 of file Projectile.cs.

42471 {
42472 //IL_0101: Unknown result type (might be due to invalid IL or missing references)
42473 //IL_010b: Unknown result type (might be due to invalid IL or missing references)
42474 //IL_0110: Unknown result type (might be due to invalid IL or missing references)
42475 if (ai[0] == 0f)
42476 {
42477 ai[0] = velocity.X;
42478 ai[1] = velocity.Y;
42479 }
42480 if (velocity.X > 0f)
42481 {
42482 rotation += (Math.Abs(velocity.Y) + Math.Abs(velocity.X)) * 0.001f;
42483 }
42484 else
42485 {
42486 rotation -= (Math.Abs(velocity.Y) + Math.Abs(velocity.X)) * 0.001f;
42487 }
42488 frameCounter++;
42489 if (frameCounter > 6)
42490 {
42491 frameCounter = 0;
42492 frame++;
42493 if (frame > 4)
42494 {
42495 frame = 0;
42496 }
42497 }
42498 if (((Vector2)(ref velocity)).Length() > 2f)
42499 {
42500 velocity *= 0.98f;
42501 }
42502 for (int i = 0; i < 1000; i++)
42503 {
42504 if (i != whoAmI)
42505 {
42506 Projectile projectile = Main.projectile[i];
42507 if (projectile.active && projectile.owner == owner && projectile.type == type && timeLeft > Main.projectile[i].timeLeft && Main.projectile[i].timeLeft > 30)
42508 {
42509 Main.projectile[i].timeLeft = 30;
42510 }
42511 }
42512 }
42514 }
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
int owner
The index of the player who owns this projectile. In Multiplayer, Clients "own" projectiles that they...
float[] ai
An array with 3 slots used for any sort of data storage, which is occasionally synced to the server....
int frame
The frame number in the spritesheet that this projectile will be drawn with. Assign in M:Terraria....
int type
The Projectile ID of this projectile. The Projectile ID is a unique number assigned to each Projectil...
int timeLeft
Time in ticks before this projectile will naturally despawn. Each update timeLeft is decreased by 1...
float rotation
Rotation of the projectile. Radians not Degrees. Use T:Microsoft.Xna.Framework.MathHelper if you want...
void AI_047_MagnetSphere_TryAttacking()
int frameCounter
Used as a timer to decide when to change F:Terraria.Projectile.frame. Defaults to 0.

References Terraria.Entity.active, Terraria.Projectile.owner, Terraria.Main.projectile, and Terraria.Projectile.type.