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

◆ SortStardustDragonProjectiles()

void Terraria.Main.SortStardustDragonProjectiles ( List< int > list)
inlineprivate

Definition at line 34962 of file Main.cs.

34963 {
34965 for (int i = 0; i < list.Count; i++)
34966 {
34967 int num = list[i];
34968 if (Main.projectile[num].type == 628)
34969 {
34970 list.Remove(num);
34971 List<int> list3 = new List<int>();
34972 list3.Insert(0, num);
34973 int byUUID = Projectile.GetByUUID(Main.projectile[num].owner, Main.projectile[num].ai[0]);
34974 while (byUUID >= 0 && !list3.Contains(byUUID) && Main.projectile[byUUID].active && Main.projectile[byUUID].type >= 625 && Main.projectile[byUUID].type <= 627)
34975 {
34976 list3.Add(byUUID);
34978 byUUID = Projectile.GetByUUID(Main.projectile[byUUID].owner, Main.projectile[byUUID].ai[0]);
34979 }
34980 List<int> list4 = new List<int>();
34981 for (int num2 = list3.Count - 2; num2 >= 0; num2--)
34982 {
34983 list4.Add(list3[num2]);
34984 }
34985 list4.Add(list3[list3.Count - 1]);
34986 list2.Add(list4);
34987 i = -1;
34988 }
34989 }
34991 list2.Add(list5);
34992 list.Clear();
34993 for (int j = 0; j < list2.Count; j++)
34994 {
34995 for (int k = 0; k < list2[j].Count; k++)
34996 {
34997 list.Add(list2[j][k]);
34998 }
34999 }
35000 for (int l = 0; l < list.Count; l++)
35001 {
35002 Projectile projectile = Main.projectile[list[l]];
35003 int byUUID2 = Projectile.GetByUUID(projectile.owner, projectile.ai[0]);
35004 if (projectile.type < 626 || projectile.type > 628 || byUUID2 < 0 || !ProjectileID.Sets.StardustDragon[Main.projectile[byUUID2].type])
35005 {
35006 continue;
35007 }
35008 Vector2 vector = Main.projectile[byUUID2].Center - projectile.Center;
35009 if (vector != Vector2.Zero)
35010 {
35011 float num3 = Main.projectile[byUUID2].scale * 16f;
35012 float num4 = vector.Length();
35013 float num5 = num3 - num4;
35014 if (num5 != 0f)
35015 {
35016 projectile.Center += Vector2.Normalize(vector) * (0f - num5);
35017 }
35018 }
35019 }
35020 }
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static Projectile[] projectile
Definition Main.cs:1691

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Clear(), System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, Terraria.Projectile.GetByUUID(), System.Text.RegularExpressions.i, System.list, Microsoft.Xna.Framework.Vector2.Normalize(), Terraria.Main.projectile, System.Collections.Generic.Dictionary< TKey, TValue >.Remove(), Terraria.ID.ProjectileID.Sets.StardustDragon, and Microsoft.Xna.Framework.Vector2.Zero.

Referenced by Terraria.Main.SortDrawCacheWorms().