Fix numerous compilation errors caused by botched entity iterator merge.
This commit is contained in:
1 parent
c1e7dd37de
commit
bb77d53b0c
11 files changed
+21
-31
No files matched your search
@@ -1463,7 +1463,7 @@ namespace CalamityMod.CalPlayer
|
||||
if (playerDist < BalancingConstants.LifeStealRange && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck)
|
||||
{
|
||||
lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife;
|
||||
healTarget = i;
|
||||
healTarget = otherPlayer.whoAmI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace CalamityMod.CalPlayer.DrawLayers
|
||||
{
|
||||
if (p.type == andromedaMechID && p.owner == drawPlayer.whoAmI)
|
||||
{
|
||||
robot = i;
|
||||
robot = p.whoAmI;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,8 +136,12 @@ namespace CalamityMod.Graphics.Metaballs
|
||||
}
|
||||
|
||||
// Draw gruesome eminence ghost heads.
|
||||
foreach (Projectile eminence in CalamityUtils.AllProjectilesByID(ModContent.ProjectileType<SpiritCongregation>()))
|
||||
eminence.ModProjectile<SpiritCongregation>().DrawHeadForMetaball();
|
||||
int eminenceType = ModContent.ProjectileType<SpiritCongregation>();
|
||||
foreach (Projectile p in Main.ActiveProjectiles)
|
||||
{
|
||||
if (p.type == eminenceType)
|
||||
p.ModProjectile<SpiritCongregation>().DrawHeadForMetaball();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,6 @@ namespace CalamityMod.Items.Potions
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
Condition evil2Dead = new(CalamityUtils.GetText("Condition.DownedEvil2Boss"), () => DownedBossSystem.downedHiveMind || DownedBossSystem.downedPerforator);
|
||||
CreateRecipe(5).
|
||||
AddIngredient(ItemID.BottledWater).
|
||||
AddIngredient<AerialiteOre>(2).
|
||||
@@ -46,7 +45,7 @@ namespace CalamityMod.Items.Potions
|
||||
AddIngredient<PearlShard>().
|
||||
AddIngredient<StormlionMandible>().
|
||||
AddTile(TileID.Bottles).
|
||||
AddDecraftCondition(evil2Dead).
|
||||
AddDecraftCondition(CalamityConditions.DownedHiveMindOrPerforator).
|
||||
Register();
|
||||
|
||||
CreateRecipe().
|
||||
|
||||
@@ -5,7 +5,7 @@ Drops: {
|
||||
DownedCrab: After defeating Crabulon
|
||||
DownedHM: After defeating the Hive Mind
|
||||
DownedPerfs: After defeating the Perforators
|
||||
DownedHMOrPerfs: After defeating the Hive Mind or the Perforators
|
||||
DownedHMOrPerfs: After defeating the Hive Mind or the Perforators
|
||||
DownedSG: After defeating the Slime God
|
||||
DownedCryo: After defeating Cryogen
|
||||
DownedAS: After defeating the Aquatic Scourge
|
||||
|
||||
@@ -290,7 +290,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos
|
||||
float distance = Vector2.Distance(playerCenter, NPC.Center);
|
||||
if (distance < maxDistance)
|
||||
{
|
||||
whoAmIArray[numProjectiles] = i;
|
||||
whoAmIArray[numProjectiles] = plr.whoAmI;
|
||||
targetCenterArray[numProjectiles] = playerCenter;
|
||||
int projectileLimit = numProjectiles + 1;
|
||||
numProjectiles = projectileLimit;
|
||||
|
||||
@@ -92,7 +92,6 @@ namespace CalamityMod.NPCs.PlagueEnemies
|
||||
{
|
||||
if (NPC.timeLeft < 750)
|
||||
NPC.timeLeft = 750;
|
||||
}
|
||||
}
|
||||
|
||||
int playerAmt = Main.CurrentFrameFlags.ActivePlayersCount;
|
||||
|
||||
@@ -2186,7 +2186,7 @@ PrepareToShoot:
|
||||
}
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
if (i != npc.whoAmI && n.type == npcType && Math.Abs(npc.position.X - n.position.X) + Math.Abs(npc.position.Y - n.position.Y) < (float)npc.width)
|
||||
if (n.whoAmI != npc.whoAmI && n.type == npcType && Math.Abs(npc.position.X - n.position.X) + Math.Abs(npc.position.Y - n.position.Y) < (float)npc.width)
|
||||
{
|
||||
if (npc.position.X < n.position.X)
|
||||
{
|
||||
@@ -2262,7 +2262,7 @@ PrepareToShoot:
|
||||
}
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
if (i != npc.whoAmI && n.type == npcType && Math.Abs(npc.position.X - n.position.X) + Math.Abs(npc.position.Y - n.position.Y) < (float)npc.width)
|
||||
if (n.whoAmI != npc.whoAmI && n.type == npcType && Math.Abs(npc.position.X - n.position.X) + Math.Abs(npc.position.Y - n.position.Y) < (float)npc.width)
|
||||
{
|
||||
if (npc.position.X < n.position.X)
|
||||
{
|
||||
@@ -10706,7 +10706,7 @@ PrepareToShoot:
|
||||
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
if (i == npc.whoAmI || n.type != npc.type)
|
||||
if (n.whoAmI == npc.whoAmI || n.type != npc.type)
|
||||
continue;
|
||||
|
||||
Vector2 targetDirection = n.Center - npc.Center;
|
||||
@@ -10716,7 +10716,7 @@ PrepareToShoot:
|
||||
targetDirection.Normalize();
|
||||
if (targetDirection.X == 0f && targetDirection.Y == 0f)
|
||||
{
|
||||
if (i > npc.whoAmI)
|
||||
if (n.whoAmI > npc.whoAmI)
|
||||
targetDirection.X = 1f;
|
||||
else
|
||||
targetDirection.X = -1f;
|
||||
|
||||
@@ -4898,7 +4898,7 @@ namespace CalamityMod.Projectiles
|
||||
if (playerDist < distanceRequired && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck)
|
||||
{
|
||||
lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife;
|
||||
healTarget = i;
|
||||
healTarget = otherPlayer.whoAmI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace CalamityMod.Projectiles.Summon
|
||||
float dist = (Projectile.Center - npc.Center).Length();
|
||||
if (dist < maxHomingRange)
|
||||
{
|
||||
targetIdx = i;
|
||||
targetIdx = npc.whoAmI;
|
||||
maxHomingRange = dist;
|
||||
hasHomingTarget = true;
|
||||
}
|
||||
|
||||
@@ -33,18 +33,6 @@ namespace CalamityMod
|
||||
return false;
|
||||
}
|
||||
|
||||
public static IEnumerable<Projectile> AllProjectilesByID(int projectileID)
|
||||
{
|
||||
// This uses the same efficient loop idea as AnyProjectiles.
|
||||
foreach (Projectile p in Main.ActiveProjectiles)
|
||||
{
|
||||
if (p.type != projectileID)
|
||||
continue;
|
||||
|
||||
yield return p;
|
||||
}
|
||||
}
|
||||
|
||||
public static int CountProjectiles(int projectileID) => Main.projectile.Count(proj => proj.type == projectileID && proj.active);
|
||||
|
||||
public static int CountHookProj() => Main.projectile.Count(proj => Main.projHook[proj.type] && proj.ai[0] == 2f && proj.active && proj.owner == Main.myPlayer);
|
||||
@@ -107,17 +95,17 @@ namespace CalamityMod
|
||||
// Find the closest target.
|
||||
float npcDistCompare = 25000f; // Initializing the value to a large number so the first entry is basically guaranteed to replace it.
|
||||
int index = -1;
|
||||
for (int i = 0; i < Main.maxNPCs; i++)
|
||||
foreach (NPC n in Main.ActiveNPCs)
|
||||
{
|
||||
float extraDistance = (n.width / 2) + (n.height / 2);
|
||||
if (!n.CanBeChasedBy(projectile, false) || !projectile.WithinRange(n.Center, maxDistance + extraDistance))
|
||||
continue;
|
||||
|
||||
float currentNPCDist = Vector2.Distance(Main.npc[i].Center, projectile.Center);
|
||||
if ((currentNPCDist < npcDistCompare) && (ignoreTiles || Collision.CanHit(projectile.Center, 1, 1, Main.npc[i].Center, 1, 1)))
|
||||
float currentNPCDist = Vector2.Distance(n.Center, projectile.Center);
|
||||
if ((currentNPCDist < npcDistCompare) && (ignoreTiles || Collision.CanHit(projectile.Center, 1, 1, n.Center, 1, 1)))
|
||||
{
|
||||
npcDistCompare = currentNPCDist;
|
||||
index = i;
|
||||
index = n.whoAmI;
|
||||
}
|
||||
}
|
||||
// If the index was never changed, don't do anything. Otherwise, tell the projectile where to home.
|
||||
|
||||
Reference in new issue
Block a user