From 85d10eea0848e67c458a837df55973df2dec0176 Mon Sep 17 00:00:00 2001 From: Dominic Date: Sat, 20 Mar 2021 23:00:31 -0500 Subject: [PATCH] Fixed a P1 DoG despawn desync bug --- NPCs/DevourerofGods/DevourerofGodsHead.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 51422f2c3d..21fc1d9d87 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -375,12 +375,17 @@ namespace CalamityMod.NPCs.DevourerofGods if ((double)npc.position.Y < Main.topWorld + 16f) npc.velocity.Y -= 3f; + int bodyType = ModContent.NPCType(); + int tailType = ModContent.NPCType(); if ((double)npc.position.Y < Main.topWorld + 16f) { - for (int a = 0; a < 200; a++) + for (int a = 0; a < Main.maxNPCs; a++) { - if (Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType() || Main.npc[a].type == ModContent.NPCType()) - Main.npc[a].active = false; + if (Main.npc[a].type != npc.type && Main.npc[a].type != bodyType && Main.npc[a].type != tailType) + continue; + + Main.npc[a].active = false; + Main.npc[a].netUpdate = true; } } }