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

◆ AI_160_Kites()

void Terraria.Projectile.AI_160_Kites ( )
inlineprivate

Definition at line 51412 of file Projectile.cs.

51413 {
51414 //IL_000f: Unknown result type (might be due to invalid IL or missing references)
51415 //IL_0016: Unknown result type (might be due to invalid IL or missing references)
51416 //IL_001b: Unknown result type (might be due to invalid IL or missing references)
51417 //IL_0072: Unknown result type (might be due to invalid IL or missing references)
51418 //IL_0078: Unknown result type (might be due to invalid IL or missing references)
51419 //IL_007d: Unknown result type (might be due to invalid IL or missing references)
51420 //IL_0082: Unknown result type (might be due to invalid IL or missing references)
51421 //IL_0155: Unknown result type (might be due to invalid IL or missing references)
51422 //IL_01a4: Unknown result type (might be due to invalid IL or missing references)
51423 //IL_01a9: Unknown result type (might be due to invalid IL or missing references)
51424 //IL_01ac: Unknown result type (might be due to invalid IL or missing references)
51425 //IL_01b1: Unknown result type (might be due to invalid IL or missing references)
51426 //IL_01b3: Unknown result type (might be due to invalid IL or missing references)
51427 //IL_01cc: Unknown result type (might be due to invalid IL or missing references)
51428 //IL_01d6: Unknown result type (might be due to invalid IL or missing references)
51429 //IL_01db: Unknown result type (might be due to invalid IL or missing references)
51430 //IL_01e0: Unknown result type (might be due to invalid IL or missing references)
51431 //IL_01e2: Unknown result type (might be due to invalid IL or missing references)
51432 //IL_01e5: Unknown result type (might be due to invalid IL or missing references)
51433 //IL_01ea: Unknown result type (might be due to invalid IL or missing references)
51434 //IL_01ef: Unknown result type (might be due to invalid IL or missing references)
51435 //IL_01f1: Unknown result type (might be due to invalid IL or missing references)
51436 //IL_01f3: Unknown result type (might be due to invalid IL or missing references)
51437 //IL_01f8: Unknown result type (might be due to invalid IL or missing references)
51438 //IL_020b: Unknown result type (might be due to invalid IL or missing references)
51439 //IL_0210: Unknown result type (might be due to invalid IL or missing references)
51440 //IL_0224: Unknown result type (might be due to invalid IL or missing references)
51441 //IL_021c: Unknown result type (might be due to invalid IL or missing references)
51442 //IL_0221: Unknown result type (might be due to invalid IL or missing references)
51443 //IL_0407: Unknown result type (might be due to invalid IL or missing references)
51444 //IL_0408: Unknown result type (might be due to invalid IL or missing references)
51445 //IL_040d: Unknown result type (might be due to invalid IL or missing references)
51446 //IL_0411: Unknown result type (might be due to invalid IL or missing references)
51447 //IL_0416: Unknown result type (might be due to invalid IL or missing references)
51448 //IL_041d: Unknown result type (might be due to invalid IL or missing references)
51449 //IL_0427: Unknown result type (might be due to invalid IL or missing references)
51450 //IL_042c: Unknown result type (might be due to invalid IL or missing references)
51451 //IL_0432: Unknown result type (might be due to invalid IL or missing references)
51452 //IL_02d3: Unknown result type (might be due to invalid IL or missing references)
51453 //IL_02e9: Unknown result type (might be due to invalid IL or missing references)
51454 //IL_0259: Unknown result type (might be due to invalid IL or missing references)
51455 //IL_025e: Unknown result type (might be due to invalid IL or missing references)
51456 //IL_0268: Unknown result type (might be due to invalid IL or missing references)
51457 //IL_026d: Unknown result type (might be due to invalid IL or missing references)
51458 //IL_045b: Unknown result type (might be due to invalid IL or missing references)
51459 //IL_0460: Unknown result type (might be due to invalid IL or missing references)
51460 //IL_0461: Unknown result type (might be due to invalid IL or missing references)
51461 //IL_0466: Unknown result type (might be due to invalid IL or missing references)
51462 //IL_0468: Unknown result type (might be due to invalid IL or missing references)
51463 //IL_033b: Unknown result type (might be due to invalid IL or missing references)
51464 //IL_0357: Unknown result type (might be due to invalid IL or missing references)
51465 //IL_0358: Unknown result type (might be due to invalid IL or missing references)
51466 //IL_035d: Unknown result type (might be due to invalid IL or missing references)
51467 //IL_0368: Unknown result type (might be due to invalid IL or missing references)
51468 //IL_036d: Unknown result type (might be due to invalid IL or missing references)
51469 //IL_0371: Unknown result type (might be due to invalid IL or missing references)
51470 //IL_0376: Unknown result type (might be due to invalid IL or missing references)
51471 //IL_0380: Unknown result type (might be due to invalid IL or missing references)
51472 //IL_0382: Unknown result type (might be due to invalid IL or missing references)
51473 //IL_047c: Unknown result type (might be due to invalid IL or missing references)
51474 //IL_0488: Unknown result type (might be due to invalid IL or missing references)
51475 //IL_04a5: Unknown result type (might be due to invalid IL or missing references)
51476 //IL_04a6: Unknown result type (might be due to invalid IL or missing references)
51477 //IL_04ab: Unknown result type (might be due to invalid IL or missing references)
51478 //IL_04b0: Unknown result type (might be due to invalid IL or missing references)
51479 //IL_04b5: Unknown result type (might be due to invalid IL or missing references)
51480 //IL_03ac: Unknown result type (might be due to invalid IL or missing references)
51481 //IL_04e6: Unknown result type (might be due to invalid IL or missing references)
51482 //IL_04e8: Unknown result type (might be due to invalid IL or missing references)
51483 //IL_03de: Unknown result type (might be due to invalid IL or missing references)
51484 Player player = Main.player[owner];
51485 Vector2 vector = player.RotatedRelativePoint(player.MountedCenter);
51486 timeLeft = 60;
51487 bool flag = false;
51488 if (player.CCed || player.noItems)
51489 {
51490 flag = true;
51491 }
51492 else if (player.inventory[player.selectedItem].shoot != type)
51493 {
51494 flag = true;
51495 }
51496 else if (player.pulley)
51497 {
51498 flag = true;
51499 }
51500 else if (player.dead)
51501 {
51502 flag = true;
51503 }
51504 if (!flag)
51505 {
51506 Vector2 val = player.Center - base.Center;
51507 flag = ((Vector2)(ref val)).Length() > 2000f;
51508 }
51509 if (flag)
51510 {
51511 Kill();
51512 return;
51513 }
51514 float num = 4f;
51515 float num7 = 500f;
51516 float num8 = num7 / 2f;
51517 if (owner == Main.myPlayer && extraUpdates == 0)
51518 {
51519 float num14 = ai[0];
51520 if (ai[0] == 0f)
51521 {
51522 ai[0] = num8;
51523 }
51524 float num9 = ai[0];
51525 if (Main.mouseRight)
51526 {
51527 num9 -= 5f;
51528 }
51529 if (Main.mouseLeft)
51530 {
51531 num9 += 5f;
51532 }
51533 ai[0] = MathHelper.Clamp(num9, num, num7);
51534 if (num14 != num9)
51535 {
51536 netUpdate = true;
51537 }
51538 }
51539 if (numUpdates == 1)
51540 {
51541 extraUpdates = 0;
51542 }
51543 int num10 = 0;
51544 float cloudAlpha = Main.cloudAlpha;
51545 float num11 = 0f;
51546 if (WorldGen.InAPlaceWithWind(position, width, height))
51547 {
51548 num11 = Main.WindForVisuals;
51549 }
51550 float num12 = Utils.GetLerpValue(0.2f, 0.5f, Math.Abs(num11), clamped: true) * 0.5f;
51551 switch (num10)
51552 {
51553 case 0:
51554 {
51555 Vector2 mouseWorld = Main.MouseWorld;
51556 mouseWorld = base.Center;
51557 mouseWorld += new Vector2(num11, (float)Math.Sin(Main.GlobalTimeWrappedHourly) + cloudAlpha * 5f) * 25f;
51558 Vector2 v = mouseWorld - base.Center;
51559 v = v.SafeNormalize(Vector2.Zero) * (3f + cloudAlpha * 7f);
51560 if (num12 == 0f)
51561 {
51562 v = velocity;
51563 }
51564 float num13 = Distance(mouseWorld);
51565 float lerpValue = Utils.GetLerpValue(5f, 10f, num13, clamped: true);
51566 float y = velocity.Y;
51567 if (num13 > 10f)
51568 {
51569 velocity = Vector2.Lerp(velocity, v, 0.075f * lerpValue);
51570 }
51571 velocity.Y = y;
51572 velocity.Y -= num12;
51573 velocity.Y += 0.02f + num12 * 0.25f;
51574 velocity.Y = MathHelper.Clamp(velocity.Y, -2f, 2f);
51575 if (base.Center.Y + velocity.Y < mouseWorld.Y)
51576 {
51577 velocity.Y = MathHelper.Lerp(velocity.Y, velocity.Y + num12 + 0.01f, 0.75f);
51578 }
51579 velocity.X *= 0.98f;
51580 float num2 = Distance(vector);
51581 float num3 = ai[0];
51582 if (num2 > num3)
51583 {
51584 Vector2 vector3 = DirectionTo(vector);
51585 float num4 = num2 - num3;
51586 base.Center += vector3 * num4;
51587 bool num15 = Vector2.Dot(vector3, Vector2.UnitY) < 0.8f || num12 > 0f;
51588 velocity.Y += vector3.Y * 0.05f;
51589 if (num15)
51590 {
51591 velocity.Y -= 0.15f;
51592 }
51593 velocity.X += vector3.X * 0.2f;
51594 if (num3 == num && owner == Main.myPlayer)
51595 {
51596 Kill();
51597 return;
51598 }
51599 }
51600 break;
51601 }
51602 case 1:
51603 {
51604 Vector2 vector2 = DirectionTo(vector);
51605 velocity = Vector2.Lerp(velocity, vector2 * 16f, 1f);
51606 if (Distance(vector) < 10f && owner == Main.myPlayer)
51607 {
51608 Kill();
51609 return;
51610 }
51611 break;
51612 }
51613 }
51614 timeLeft = 2;
51615 Vector2 vector4 = base.Center - vector;
51616 int dir = ((vector4.X > 0f) ? 1 : (-1));
51617 if (Math.Abs(vector4.X) > Math.Abs(vector4.Y) / 2f)
51618 {
51619 player.ChangeDir(dir);
51620 }
51621 Vector2 vector5 = DirectionTo(vector).SafeNormalize(Vector2.Zero);
51622 if (num12 == 0f && velocity.Y > -0.02f)
51623 {
51624 rotation *= 0.95f;
51625 }
51626 else
51627 {
51628 float num5 = (-vector5).ToRotation() + (float)Math.PI / 4f;
51629 if (spriteDirection == -1)
51630 {
51631 num5 -= (float)Math.PI / 2f * (float)player.direction;
51632 }
51633 rotation = num5 + velocity.X * 0.05f;
51634 }
51635 float num6 = ((Vector2)(ref velocity)).Length();
51636 switch (type)
51637 {
51638 case 771:
51639 case 822:
51640 case 823:
51641 case 827:
51642 case 830:
51643 case 838:
51644 case 843:
51645 case 844:
51646 case 845:
51647 case 846:
51648 case 850:
51649 case 852:
51650 frame = 0;
51651 break;
51652 case 828:
51653 case 829:
51654 if (num6 < 6f)
51655 {
51656 frame = 1;
51657 }
51658 else
51659 {
51660 frame = 0;
51661 }
51662 break;
51663 case 826:
51664 frame = (int)ai[1];
51665 break;
51666 case 824:
51667 case 839:
51668 case 840:
51669 case 853:
51670 if (num12 < 0.15f)
51671 {
51672 frame = 0;
51673 break;
51674 }
51675 frameCounter++;
51676 if ((float)frameCounter > (1f - num12) * 10f)
51677 {
51678 frameCounter = 0;
51679 frame = Main.rand.Next(4);
51680 }
51681 break;
51682 default:
51683 if (num6 < 3f)
51684 {
51685 frame = 0;
51686 }
51687 else if (num6 < 5f)
51688 {
51689 frame = 1;
51690 }
51691 else if (num6 < 7f)
51692 {
51693 frame = 2;
51694 }
51695 else
51696 {
51697 frame = 3;
51698 }
51699 break;
51700 }
51701 spriteDirection = player.direction;
51702 }
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
float Distance(Vector2 Other)
Definition Entity.cs:275
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
Vector2 DirectionTo(Vector2 Destination)
Definition Entity.cs:289
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
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....
bool netUpdate
Set manually to true in M:Terraria.ModLoader.ModProjectile.AI once to make it sync its current F:Terr...
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...
int extraUpdates
Additional update steps per tick. Useful for really fast projectiles such as Shadowbeam Staff....
int frameCounter
Used as a timer to decide when to change F:Terraria.Projectile.frame. Defaults to 0.

References Terraria.Player.CCed, Terraria.Player.ChangeDir(), Terraria.Main.cloudAlpha, Terraria.Player.dead, Terraria.Entity.direction, Terraria.Utils.GetLerpValue(), Terraria.Main.GlobalTimeWrappedHourly, Terraria.WorldGen.InAPlaceWithWind(), Terraria.Player.inventory, Terraria.Player.MountedCenter, Terraria.Main.mouseLeft, Terraria.Main.mouseRight, Terraria.Main.MouseWorld, Terraria.Main.myPlayer, Terraria.Player.noItems, Terraria.Main.player, Terraria.Player.pulley, Terraria.Main.rand, Terraria.Player.RotatedRelativePoint(), Terraria.Player.selectedItem, Terraria.Item.shoot, and Terraria.Main.WindForVisuals.

+ Here is the call graph for this function: