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

◆ UpdateMaxTurrets()

void Terraria.Player.UpdateMaxTurrets ( )
inline

Definition at line 49594 of file Player.cs.

49595 {
49596 if (Main.myPlayer != whoAmI)
49597 {
49598 return;
49599 }
49601 for (int i = 0; i < 1000; i++)
49602 {
49603 if (Main.projectile[i].WipableTurret)
49604 {
49605 list.Add(Main.projectile[i]);
49606 }
49607 }
49608 int num = 0;
49609 while (list.Count > maxTurrets && ++num < 1000)
49610 {
49611 Projectile projectile = list[0];
49612 for (int j = 1; j < list.Count; j++)
49613 {
49614 if (list[j].timeLeft < projectile.timeLeft)
49615 {
49616 projectile = list[j];
49617 }
49618 }
49619 projectile.Kill();
49620 list.Remove(projectile);
49621 }
49622 }

References System.Collections.Generic.Dictionary< TKey, TValue >.Count, Terraria.Projectile.Kill(), System.list, Terraria.Main.myPlayer, Terraria.Main.projectile, System.Collections.Generic.Dictionary< TKey, TValue >.Remove(), and Terraria.Projectile.timeLeft.