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

◆ AI_163_Chum()

void Terraria.Projectile.AI_163_Chum ( )
inlineprivate

Definition at line 56769 of file Projectile.cs.

56770 {
56771 //IL_0150: Unknown result type (might be due to invalid IL or missing references)
56772 //IL_0174: Unknown result type (might be due to invalid IL or missing references)
56773 //IL_0238: Unknown result type (might be due to invalid IL or missing references)
56774 //IL_024c: Unknown result type (might be due to invalid IL or missing references)
56775 //IL_026c: Unknown result type (might be due to invalid IL or missing references)
56776 //IL_02f5: Unknown result type (might be due to invalid IL or missing references)
56777 //IL_02b1: Unknown result type (might be due to invalid IL or missing references)
56778 //IL_02d7: Unknown result type (might be due to invalid IL or missing references)
56779 //IL_03ca: Unknown result type (might be due to invalid IL or missing references)
56780 //IL_03cf: Unknown result type (might be due to invalid IL or missing references)
56781 //IL_03d9: Unknown result type (might be due to invalid IL or missing references)
56782 //IL_03de: Unknown result type (might be due to invalid IL or missing references)
56783 //IL_03e3: Unknown result type (might be due to invalid IL or missing references)
56784 //IL_0411: Unknown result type (might be due to invalid IL or missing references)
56785 //IL_0416: Unknown result type (might be due to invalid IL or missing references)
56786 //IL_0634: Unknown result type (might be due to invalid IL or missing references)
56787 //IL_0639: Unknown result type (might be due to invalid IL or missing references)
56788 //IL_0643: Unknown result type (might be due to invalid IL or missing references)
56789 //IL_0648: Unknown result type (might be due to invalid IL or missing references)
56790 //IL_064d: Unknown result type (might be due to invalid IL or missing references)
56791 //IL_0466: Unknown result type (might be due to invalid IL or missing references)
56792 //IL_046b: Unknown result type (might be due to invalid IL or missing references)
56793 //IL_0475: Unknown result type (might be due to invalid IL or missing references)
56794 //IL_047a: Unknown result type (might be due to invalid IL or missing references)
56795 //IL_047f: Unknown result type (might be due to invalid IL or missing references)
56796 //IL_04be: Unknown result type (might be due to invalid IL or missing references)
56797 //IL_04c3: Unknown result type (might be due to invalid IL or missing references)
56798 //IL_0584: Unknown result type (might be due to invalid IL or missing references)
56799 //IL_0589: Unknown result type (might be due to invalid IL or missing references)
56800 //IL_0593: Unknown result type (might be due to invalid IL or missing references)
56801 //IL_0598: Unknown result type (might be due to invalid IL or missing references)
56802 //IL_059d: Unknown result type (might be due to invalid IL or missing references)
56803 //IL_05c4: Unknown result type (might be due to invalid IL or missing references)
56804 //IL_05d3: Unknown result type (might be due to invalid IL or missing references)
56805 //IL_05dd: Unknown result type (might be due to invalid IL or missing references)
56806 //IL_05e2: Unknown result type (might be due to invalid IL or missing references)
56807 //IL_05f1: Unknown result type (might be due to invalid IL or missing references)
56808 //IL_05f6: Unknown result type (might be due to invalid IL or missing references)
56809 //IL_05fb: Unknown result type (might be due to invalid IL or missing references)
56810 //IL_069a: Unknown result type (might be due to invalid IL or missing references)
56811 float num = 0.05f;
56812 float num2 = width / 2;
56813 for (int i = 0; i < 1000; i++)
56814 {
56815 if (i != whoAmI && Main.projectile[i].active && Main.projectile[i].type == type && Math.Abs(position.X - Main.projectile[i].position.X) + Math.Abs(position.Y - Main.projectile[i].position.Y) < num2)
56816 {
56817 if (position.X < Main.projectile[i].position.X)
56818 {
56819 velocity.X -= num;
56820 }
56821 else
56822 {
56823 velocity.X += num;
56824 }
56825 if (position.Y < Main.projectile[i].position.Y)
56826 {
56827 velocity.Y -= num;
56828 }
56829 else
56830 {
56831 velocity.Y += num;
56832 }
56833 }
56834 }
56835 if (wet)
56836 {
56837 velocity.X *= 0.9f;
56838 int num3 = (int)(base.Center.X + (float)((width / 2 + 8) * direction)) / 16;
56839 int num4 = (int)(base.Center.Y / 16f);
56840 _ = position.Y / 16f;
56841 int num5 = (int)((position.Y + (float)height) / 16f);
56842 if (Main.tile[num3, num4] == null)
56843 {
56844 Main.tile[num3, num4] = default(Tile);
56845 }
56846 if (Main.tile[num3, num5] == null)
56847 {
56848 Main.tile[num3, num5] = default(Tile);
56849 }
56850 if (velocity.Y > 0f)
56851 {
56852 velocity.Y *= 0.5f;
56853 }
56854 num3 = (int)(base.Center.X / 16f);
56855 num4 = (int)(base.Center.Y / 16f);
56857 if (base.Center.Y > num6)
56858 {
56859 velocity.Y -= 0.1f;
56860 if (velocity.Y < -8f)
56861 {
56862 velocity.Y = -8f;
56863 }
56864 if (base.Center.Y + velocity.Y < num6)
56865 {
56866 velocity.Y = num6 - base.Center.Y;
56867 }
56868 }
56869 else
56870 {
56871 velocity.Y = num6 - base.Center.Y;
56872 }
56873 }
56874 else
56875 {
56876 if (velocity.Y == 0f)
56877 {
56878 velocity.X *= 0.95f;
56879 }
56880 velocity.X *= 0.98f;
56881 velocity.Y += 0.3f;
56882 if (velocity.Y > 15.9f)
56883 {
56884 velocity.Y = 15.9f;
56885 }
56886 }
56887 if (frameCounter == 0)
56888 {
56889 frameCounter = 1;
56890 frame = Main.rand.Next(4);
56891 }
56892 if (frameCounter < 10 && wet)
56893 {
56894 frameCounter++;
56895 for (float num7 = 0f; num7 < 1f; num7 += 0.5f)
56896 {
56897 Gore gore = Gore.NewGoreDirect(position + Vector2.UnitY * 6f, Vector2.Zero, 1201, scale * 0.7f);
56898 gore.velocity = Main.rand.NextVector2CircularEdge(10f, 10f);
56899 if (gore.velocity.Y > 0f)
56900 {
56901 gore.velocity.Y *= -1f;
56902 }
56903 }
56904 for (float num8 = 0f; num8 < 2f; num8 += 1f)
56905 {
56906 Gore gore2 = Gore.NewGoreDirect(position + Vector2.UnitY * 6f, Vector2.Zero, 1208, scale * 0.7f + Main.rand.NextFloat() * 0.15f);
56907 gore2.velocity = Main.rand.NextVector2CircularEdge(4f, 4f);
56908 if (gore2.velocity.Y > 0f)
56909 {
56910 gore2.velocity.Y *= -1f;
56911 }
56912 }
56913 }
56914 scale = Utils.GetLerpValue(0f, 60f, timeLeft, clamped: true);
56915 rotation += velocity.X * 0.14f;
56916 bool flag = !wet && ((Vector2)(ref velocity)).Length() < 0.8f;
56917 int maxValue = (wet ? 90 : 5);
56918 if (Main.rand.Next(maxValue) == 0 && !flag)
56919 {
56920 Gore gore3 = Gore.NewGoreDirect(position + Vector2.UnitY * 6f, Vector2.Zero, 1201, scale * 0.7f);
56921 if (wet)
56922 {
56923 gore3.velocity = Vector2.UnitX * Main.rand.NextFloatDirection() * 0.75f + Vector2.UnitY * Main.rand.NextFloat();
56924 }
56925 else if (gore3.velocity.Y < 0f)
56926 {
56927 gore3.velocity.Y = 0f - gore3.velocity.Y;
56928 }
56929 }
56930 Vector2 spot = base.Center + Vector2.UnitY * 16f;
56931 if (ai[0] >= 10f && timeLeft > 60)
56932 {
56933 timeLeft = 60;
56934 netUpdate = true;
56935 }
56936 if (ai[0] < 10f && timeLeft > 60)
56937 {
56938 Main.instance.ChumBucketProjectileHelper.AddChumLocation(spot);
56939 }
56940 }
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
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
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
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
float AI_061_FishingBobber_GetWaterLine(int X, int Y)
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 frameCounter
Used as a timer to decide when to change F:Terraria.Projectile.frame. Defaults to 0.
float scale
Scales how large the projectile will be drawn. Will also affect the hitbox (F:Terraria....

References Terraria.Utils.GetLerpValue(), Terraria.Main.instance, Terraria.Gore.NewGoreDirect(), Terraria.Main.projectile, Terraria.Main.rand, Terraria.Main.tile, and Terraria.Gore.velocity.

+ Here is the call graph for this function: