From 2e52bebfca414e18290441cf749ab9f676e07482 Mon Sep 17 00:00:00 2001 From: Dominic Date: Fri, 17 Sep 2021 16:58:08 -0500 Subject: [PATCH] Draedon works properly in MP --- NPCs/ExoMechs/Draedon.cs | 5 +++-- World/WorldUpdateMiscEffects.cs | 11 ++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index 89c62c9f1b..939a868631 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -314,8 +314,9 @@ namespace CalamityMod.NPCs.ExoMechs public override void FindFrame(int frameHeight) { npc.frame.Width = 102; + int xFrame = npc.frame.X / npc.frame.Width; - int yFrame = npc.frame.Y / npc.frame.Height; + int yFrame = npc.frame.Y / frameHeight; int frame = xFrame * Main.npcFrameCount[npc.type] + yFrame; // Prepare to stand up if called for and not already doing so. @@ -347,7 +348,7 @@ namespace CalamityMod.NPCs.ExoMechs } npc.frame.X = frame / Main.npcFrameCount[npc.type] * npc.frame.Width; - npc.frame.Y = frame % Main.npcFrameCount[npc.type] * npc.frame.Height; + npc.frame.Y = frame % Main.npcFrameCount[npc.type] * frameHeight; } public override void ScaleExpertStats(int numPlayers, float bossLifeScale) diff --git a/World/WorldUpdateMiscEffects.cs b/World/WorldUpdateMiscEffects.cs index e20d4186d8..1b15bbfedb 100644 --- a/World/WorldUpdateMiscEffects.cs +++ b/World/WorldUpdateMiscEffects.cs @@ -39,13 +39,10 @@ namespace CalamityMod.World public static void PerformWorldUpdates() { // Reset the exo mech to summon if Draedon is absent. - if (Main.netMode != NetmodeID.MultiplayerClient && DraedonMechToSummon != ExoMech.None && CalamityGlobalNPC.draedon == -1) - { + if (DraedonMechToSummon != ExoMech.None && CalamityGlobalNPC.draedon == -1) DraedonMechToSummon = ExoMech.None; - CalamityNetcode.SyncWorld(); - } - if (DraedonSummonCountdown > 0) + if (Main.netMode != NetmodeID.MultiplayerClient && DraedonSummonCountdown > 0) { DraedonSummonCountdown--; HandleDraedonSummoning(); @@ -131,11 +128,11 @@ namespace CalamityMod.World public static void HandleDraedonSummoning() { // Fire a giant laser into the sky. - if (Main.netMode != NetmodeID.MultiplayerClient && DraedonSummonCountdown == DraedonSummonCountdownMax - 45) + if (DraedonSummonCountdown == DraedonSummonCountdownMax - 45) Projectile.NewProjectile(DraedonSummonPosition + Vector2.UnitY * 80f, Vector2.Zero, ModContent.ProjectileType(), 70, 0f); if (DraedonSummonCountdown == 0) - NPC.NewNPC((int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType(), 0, 0f, (int)DraedonMechToSummon); + NPC.NewNPC((int)DraedonSummonPosition.X, (int)DraedonSummonPosition.Y, ModContent.NPCType()); } #endregion Handle Draedon Summoning