polter's map icon now rotates

This commit is contained in:
ben-tk committed 2021-11-18 00:05:25 -05:00
1 parent 8bf9742c7a
commit d547fe1d18
2 files changed
+17

No files matched your search

+9
View File
@@ -46,6 +46,15 @@ namespace CalamityMod.NPCs.Polterghast
npc.DeathSound = SoundID.NPCDeath39;
}
public override void BossHeadRotation(ref float rotation)
{
bool polterHasTarget = CalamityGlobalNPC.ghostBoss.WithinBounds(Main.maxNPCs) && Main.npc[CalamityGlobalNPC.ghostBoss].active && Main.npc[CalamityGlobalNPC.ghostBoss].HasValidTarget;
if (polterHasTarget && npc.Calamity().newAI[3] == 0f)
rotation = (Main.player[Main.npc[CalamityGlobalNPC.ghostBoss].target].Center - npc.Center).ToRotation() + MathHelper.PiOver2;
else
rotation = npc.velocity.ToRotation() + MathHelper.PiOver2;
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(despawnTimer);
+8
View File
@@ -96,6 +96,14 @@ namespace CalamityMod.NPCs.Polterghast
index = phase1IconIndex;
}
public override void BossHeadRotation(ref float rotation)
{
if (npc.HasValidTarget && npc.Calamity().newAI[3] == 0f)
rotation = (Main.player[npc.TranslatedTargetIndex].Center - npc.Center).ToRotation() + MathHelper.PiOver2;
else
rotation = npc.velocity.ToRotation() + MathHelper.PiOver2;
}
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(despawnTimer);