From dc594e2e7e4afae58dd82e6f98bff29fee4ab0bb Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 31 Oct 2024 18:22:45 +0900 Subject: [PATCH] ZombieList. --- CalamityLists.cs | 42 ------------------ Systems/Collections/NPCs/ZombieList.cs | 60 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 42 deletions(-) create mode 100644 Systems/Collections/NPCs/ZombieList.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index cfe78054b9..fd555fd221 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -56,8 +56,6 @@ namespace CalamityMod { public sealed class CalamityLists : ModSystem { - // Some of these lists of enemies are unused, but were difficult to create. Many of these common enemy types have a ton of variants. - public static List zombieList; public static List demonEyeList; public static List skeletonList; public static List angryBonesList; @@ -113,45 +111,6 @@ namespace CalamityMod public override void OnModLoad() { - zombieList = new List() - { - NPCID.Zombie, - NPCID.ArmedZombie, - NPCID.BaldZombie, - NPCID.PincushionZombie, - NPCID.ArmedZombiePincussion, // what is this spelling - NPCID.SlimedZombie, - NPCID.ArmedZombieSlimed, - NPCID.SwampZombie, - NPCID.ArmedZombieSwamp, - NPCID.TwiggyZombie, - NPCID.ArmedZombieTwiggy, - NPCID.FemaleZombie, - NPCID.ArmedZombieCenx, - NPCID.ZombieRaincoat, - NPCID.ZombieEskimo, - NPCID.ArmedZombieEskimo, - NPCID.BigRainZombie, - NPCID.SmallRainZombie, - NPCID.BigFemaleZombie, - NPCID.SmallFemaleZombie, - NPCID.BigTwiggyZombie, - NPCID.SmallTwiggyZombie, - NPCID.BigSwampZombie, - NPCID.SmallSwampZombie, - NPCID.BigSlimedZombie, - NPCID.SmallSlimedZombie, - NPCID.BigPincushionZombie, - NPCID.SmallPincushionZombie, - NPCID.BigBaldZombie, - NPCID.SmallBaldZombie, - NPCID.BigZombie, - NPCID.SmallZombie, - NPCID.MaggotZombie, - NPCType() - // halloween zombies not included because they don't drop shackles or zombie arms - }; - demonEyeList = new List() { NPCID.DemonEye, @@ -1099,7 +1058,6 @@ namespace CalamityMod public override void Unload() { - zombieList = null; demonEyeList = null; skeletonList = null; angryBonesList = null; diff --git a/Systems/Collections/NPCs/ZombieList.cs b/Systems/Collections/NPCs/ZombieList.cs new file mode 100644 index 0000000000..de8077571c --- /dev/null +++ b/Systems/Collections/NPCs/ZombieList.cs @@ -0,0 +1,60 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.NormalNPCs; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + public sealed class ZombieList : ModSystem + { + public static IList List { get; private set; } + + public override void OnModLoad() + { + List = + [ + NPCID.Zombie, + NPCID.ArmedZombie, + NPCID.BaldZombie, + NPCID.PincushionZombie, + NPCID.ArmedZombiePincussion, // what is this spelling + NPCID.SlimedZombie, + NPCID.ArmedZombieSlimed, + NPCID.SwampZombie, + NPCID.ArmedZombieSwamp, + NPCID.TwiggyZombie, + NPCID.ArmedZombieTwiggy, + NPCID.FemaleZombie, + NPCID.ArmedZombieCenx, + NPCID.ZombieRaincoat, + NPCID.ZombieEskimo, + NPCID.ArmedZombieEskimo, + NPCID.BigRainZombie, + NPCID.SmallRainZombie, + NPCID.BigFemaleZombie, + NPCID.SmallFemaleZombie, + NPCID.BigTwiggyZombie, + NPCID.SmallTwiggyZombie, + NPCID.BigSwampZombie, + NPCID.SmallSwampZombie, + NPCID.BigSlimedZombie, + NPCID.SmallSlimedZombie, + NPCID.BigPincushionZombie, + NPCID.SmallPincushionZombie, + NPCID.BigBaldZombie, + NPCID.SmallBaldZombie, + NPCID.BigZombie, + NPCID.SmallZombie, + NPCID.MaggotZombie, + NPCType() + // halloween zombies not included because they don't drop shackles or zombie arms + ]; + } + + public override void Unload() => List = null; + + public static bool IsZombie(NPC npc) => List.Contains(npc.type); + } +}