diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 4a7b99e0b1..7bbe75d4cd 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -20,6 +20,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Balancing { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class BalancingChangesManager { internal static List UniversalBalancingChanges = null; diff --git a/Buffs/Potions/AnechoicCoatingBuff.cs b/Buffs/Potions/AnechoicCoatingBuff.cs index d6a2abd8df..91214d013f 100644 --- a/Buffs/Potions/AnechoicCoatingBuff.cs +++ b/Buffs/Potions/AnechoicCoatingBuff.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.Potions @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.Potions public override void SetStaticDefaults() { DisplayName.SetDefault("Anechoic Coating"); - Description.SetDefault("Abyssal creatures' detection radius reduced"); + Description.SetDefault("Abyssal creatures' detection ranges reduced"); Main.debuff[Type] = false; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = false; diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 59940d5655..c03655b4f7 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -3322,103 +3322,8 @@ namespace CalamityMod.CalPlayer #endregion #region UpdateEquips - public override void UpdateVisibleVanityAccessories() - { - for (int n = 13; n < 18 + Player.extraAccessorySlots; n++) - { - Item item = Player.armor[n]; - - if (item.type == ModContent.ItemType()) - { - snowmanHide = false; - snowmanForce = true; - } - else if (item.type == ModContent.ItemType()) - { - abyssalDivingSuitHide = false; - abyssalDivingSuitForce = true; - } - else if (item.type == ModContent.ItemType()) - { - aquaticHeartHide = false; - aquaticHeartForce = true; - } - else if (item.type == ModContent.ItemType()) - { - profanedCrystalHide = false; - profanedCrystalForce = true; - } - - // Whichever is lowest in your vanity slots should take priority - if (item.type == ModContent.ItemType()) - { - featherCrownDraw = false; - moonCrownDraw = false; - abyssDivingGear = true; - } - if (item.type == ModContent.ItemType()) - { - abyssDivingGear = false; - moonCrownDraw = false; - featherCrownDraw = true; - } - if (item.type == ModContent.ItemType()) - { - abyssDivingGear = false; - featherCrownDraw = false; - moonCrownDraw = true; - } - - // Summon anime girl if it's in vanity slot as the pet is purely vanity - // It's possible for other "pet" items like Fungal Clump or HotE to summon a passive version of their "pets" with some tweaks though - if (item.type == ModContent.ItemType()) - { - spiritOriginVanity = true; - if (Player.whoAmI == Main.myPlayer) - { - if (Player.FindBuffIndex(ModContent.BuffType()) == -1) - Player.AddBuff(ModContent.BuffType(), 18000, true); - } - } - if (item.type == ModContent.ItemType()) - { - howlsHeartVanity = true; - if (Player.whoAmI == Main.myPlayer) - { - var source = Player.GetSource_Accessory(item); - if (Player.FindBuffIndex(ModContent.BuffType()) == -1) - { - Player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - int damage = (int)Player.GetTotalDamage().ApplyTo(HowlsHeart.HowlDamage); - int p = Projectile.NewProjectile(source, Player.Center, -Vector2.UnitY, ModContent.ProjectileType(), damage, 1f, Player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = HowlsHeart.HowlDamage; - } - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(source, Player.Center, -Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); - } - if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(source, Player.Center, -Vector2.UnitY, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, 0f, 0f); - } - } - } - } - } - public override void UpdateEquips() { - // Ankh Shield Mighty Wind immunity. - for (int i = 0; i < 8 + Player.extraAccessorySlots; i++) - { - if (Player.armor[i].type == ItemID.AnkhShield) - Player.buffImmune[BuffID.WindPushed] = true; - } - // TODO -- why is boss health bar code in Player.UpdateEquips and not a ModSystem CalamityConfig.Instance.BossHealthBarExtraInfo = shouldDrawSmallText; diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 98a3d25138..aafedc8681 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -89,6 +89,10 @@ namespace CalamityMod.CalPlayer copy = Main.RegisteredGameModes[GameModeID.Master]; copy.DebuffTimeMultiplier = 1f; Main.RegisteredGameModes[GameModeID.Master] = copy; + + // NOTE -- While this may seem at a glance to be redundant and nonsensical, the underlying setter for this property is what causes the game mode properties to + // be refreshed and copied from RegisteredGameModes. Without this, the above behavior is not reflected ingame, as GameModeData is a value type, not a reference type. + Main.GameMode = Main.GameMode; } // Go through the old positions for the player. @@ -527,17 +531,6 @@ namespace CalamityMod.CalPlayer private void MiscEffects() { - // Do a vanity/social slot check for SCal's expert drop since alternatives to get this working are a pain in the ass to create. - int blazingCursorItem = ModContent.ItemType(); - for (int i = 13; i < 18 + Player.extraAccessorySlots; i++) - { - if (Player.armor[i].type == blazingCursorItem) - { - blazingCursorVisuals = true; - break; - } - } - // Calculate/reset DoG cart rotations based on whether the DoG cart is in use. if (Player.mount.Active && Player.mount.Type == ModContent.MountType()) { diff --git a/CalPlayer/Dashes/PlayerDashManager.cs b/CalPlayer/Dashes/PlayerDashManager.cs index ba201a57c1..c0f3f54b0b 100644 --- a/CalPlayer/Dashes/PlayerDashManager.cs +++ b/CalPlayer/Dashes/PlayerDashManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; namespace CalamityMod.CalPlayer.Dashes { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class PlayerDashManager { internal static Dictionary DashIdentificationTable = new(); diff --git a/CalamityLists.cs b/CalamityLists.cs index b01d8862a0..87956e9fbb 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -75,6 +75,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public class CalamityLists { public static IList donatorList; diff --git a/CalamityMod.cs b/CalamityMod.cs index f8ecb74332..e3ce48e267 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -74,7 +74,9 @@ namespace CalamityMod { public class CalamityMod : Mod { - // CONSIDER -- I have been advised by Jopo that Mods should never contain static variables + // TODO -- A huge amount of random floating variables exist here. + // These should all be moved to other files, whether that's CalamityLists or brand new ModSystems. + // It is best to have a ton of small ModSystems. // Boss Spawners public static int ghostKillCount = 0; @@ -117,8 +119,11 @@ namespace CalamityMod public static int[] holyEnemyImmunities = new int[4] { BuffID.OnFire, BuffID.OnFire3, ModContent.BuffType(), ModContent.BuffType() }; internal static CalamityMod Instance; + + // TODO -- Mod references should be contained in a ModSystem (example name "ModLoadedChecker") internal Mod musicMod = null; // This is Calamity's official music mod, CalamityModMusic internal bool MusicAvailable => !(musicMod is null); + internal Mod ancientsAwakened = null; internal Mod bossChecklist = null; internal Mod census = null; @@ -144,7 +149,7 @@ namespace CalamityMod manaOriginal = TextureAssets.Mana; carpetOriginal = TextureAssets.FlyingCarpet; - // Apply IL edits instantly afterwards. + // Apply IL edits as soon as possible. ILChanges.Load(); // If any of these mods aren't loaded, it will simply keep them as null. @@ -198,6 +203,7 @@ namespace CalamityMod CooldownRegistry.Load(); BossRushEvent.Load(); + // TODO -- As ModBossBarStyle is a ModType, its Load function does not need to be called directly here. BossHealthBarManager.Load(this); DraedonStructures.Load(); EnchantmentManager.LoadAllEnchantments(); @@ -219,6 +225,7 @@ namespace CalamityMod { AstralSky = ModContent.Request("CalamityMod/ExtraTextures/AstralSky", AssetRequestMode.ImmediateLoad).Value; + // TODO -- Sky shaders should probably be loaded in a ModSystem Filters.Scene["CalamityMod:DevourerofGodsHead"] = new Filter(new DoGScreenShaderData("FilterMiniTower").UseColor(0.4f, 0.1f, 1.0f).UseOpacity(0.5f), EffectPriority.VeryHigh); SkyManager.Instance["CalamityMod:DevourerofGodsHead"] = new DoGSky(); @@ -271,6 +278,8 @@ namespace CalamityMod ChargeMeterUI.Load(); AstralArcanumUI.Load(this); + // TODO -- Is this not possible to place in ModNPC.Load or ModNPC.SetStaticDefaults ? + // Centralizing head texture registration like this seems absurdly stiff Apollo.LoadHeadIcons(); Artemis.LoadHeadIcons(); DevourerofGodsHead.LoadHeadIcons(); @@ -285,6 +294,8 @@ namespace CalamityMod ThanatosBody2.LoadHeadIcons(); ThanatosTail.LoadHeadIcons(); + // TODO -- Is this not possible to place in ModItem.Load or ModItem.SetStaticDefaults ? + // Centralizing hair dye shaders like this seems absurdly stiff GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(0, 255, 171), ((float)player.Calamity().adrenaline / (float)player.Calamity().adrenalineMax)))); GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(255, 83, 48), ((float)player.Calamity().rage / (float)player.Calamity().rageMax)))); GameShaders.Hair.BindShader(ModContent.ItemType(), new LegacyHairShaderData().UseLegacyMethod((Player player, Color newColor, ref bool lighting) => Color.Lerp(player.hairColor, new Color(139, 205, 255), ((float)player.wingTime / (float)player.wingTimeMax)))); diff --git a/Cooldowns/CooldownRegistry.cs b/Cooldowns/CooldownRegistry.cs index 76328fbcad..e8b078d334 100644 --- a/Cooldowns/CooldownRegistry.cs +++ b/Cooldowns/CooldownRegistry.cs @@ -6,6 +6,7 @@ using Terraria.ModLoader.Core; namespace CalamityMod.Cooldowns { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public class CooldownRegistry { // Indexed by ushort netID. Contains every registered cooldown. diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 7c69e90b33..ddb83e0ca1 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -18,6 +18,7 @@ namespace CalamityMod.DataStructures Phoenix, Aries, Polaris, Andromeda //Galaxia } + // TODO -- Attunements should be managed by an Attunement ModSystem public abstract class Attunement { public static Attunement[] attunementArray; diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs index 2d08eb1184..040ca16dfd 100644 --- a/DataStructures/NPCStats.cs +++ b/DataStructures/NPCStats.cs @@ -41,6 +41,7 @@ using CalamityMod.NPCs.AcidRain; namespace CalamityMod { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static partial class NPCStats { private const double ExpertContactVanillaMultiplier = 2D; diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 553b0d522d..5ad4d373db 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -7,6 +7,7 @@ using Terraria.Graphics.Shaders; namespace CalamityMod.Effects { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public class CalamityShaders { public static Effect AstralFogShader; diff --git a/Effects/FluidShaders.fx b/Effects/FluidShaders.fx index 9731758a06..f0ba5b72de 100644 --- a/Effects/FluidShaders.fx +++ b/Effects/FluidShaders.fx @@ -28,7 +28,7 @@ float4 CalculateDiffusion(float4 sampleColor : TEXCOORD, float2 coords : TEXCOOR // nextField[i, j] = currentField[i, j] + diffusionFactor * (totalCardinalState - currentField[i, j]) // However, this would considerably restrict the freedom of the simulation, as any visocity values above 1 would result // in overshooting estimations and cause unstable behavior. - // Instead of doing this instead of using the current state to calculate the next one, we attempt to solve for a state that when + // Instead of using the current state to calculate the next one, we attempt to solve for a state that when // done in reverse returns the original state. Mathematically, this is written like so: // currentField[i, j] = nextField[i, j] - diffusionFactor * (averageNextCardinalState - currentField[i, j]) diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index 0a9968e5b3..f129dc7317 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -39,6 +39,7 @@ using Terraria.DataStructures; namespace CalamityMod.Events { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public class BossRushEvent { public enum TimeChangeContext diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index c73157c015..5d43a38f81 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -8,6 +8,7 @@ using Terraria.ModLoader; namespace CalamityMod.ILEditing { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public partial class ILChanges { /// diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 59b723de68..d913e03e33 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -458,6 +458,9 @@ namespace CalamityMod.ILEditing if (projectile.minion) { Player player = Main.player[projectile.owner]; + if (Main.gameMenu || !player.active) + return proj; + CalamityPlayer.EnchantHeldItemEffects(player, player.Calamity(), player.ActiveItem()); if (player.Calamity().explosiveMinionsEnchant) projectile.Calamity().ExplosiveEnchantCountdown = CalamityGlobalProjectile.ExplosiveEnchantTime; diff --git a/Items/Accessories/AbyssalDivingGear.cs b/Items/Accessories/AbyssalDivingGear.cs index 0e0b8a94ba..aab4b74fef 100644 --- a/Items/Accessories/AbyssalDivingGear.cs +++ b/Items/Accessories/AbyssalDivingGear.cs @@ -69,6 +69,11 @@ namespace CalamityMod.Items.Accessories player.Calamity().abyssDivingGear = true; } + public override void UpdateVanity(Player player) + { + player.Calamity().abyssDivingGear = true; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index e567433003..79a305fa5c 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -67,9 +67,13 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.abyssalDivingSuit = true; if (hideVisual) - { modPlayer.abyssalDivingSuitHide = true; - } + } + + public override void UpdateVanity(Player player) + { + player.Calamity().abyssalDivingSuitHide = false; + player.Calamity().abyssalDivingSuitForce = true; } public override void AddRecipes() diff --git a/Items/Accessories/AquaticHeart.cs b/Items/Accessories/AquaticHeart.cs index 803bb83f19..a016ab513f 100644 --- a/Items/Accessories/AquaticHeart.cs +++ b/Items/Accessories/AquaticHeart.cs @@ -61,5 +61,11 @@ namespace CalamityMod.Items.Accessories if (hideVisual) modPlayer.aquaticHeartHide = true; } + + public override void UpdateVanity(Player player) + { + player.Calamity().aquaticHeartHide = false; + player.Calamity().aquaticHeartForce = true; + } } } diff --git a/Items/Accessories/AstralArcanum.cs b/Items/Accessories/AstralArcanum.cs index a93bb4f5b4..d2db7b964d 100644 --- a/Items/Accessories/AstralArcanum.cs +++ b/Items/Accessories/AstralArcanum.cs @@ -27,8 +27,8 @@ namespace CalamityMod.Items.Accessories Item.width = 26; Item.height = 26; Item.accessory = true; - Item.value = CalamityGlobalItem.Rarity13BuyPrice; - Item.Calamity().customRarity = CalamityRarity.PureGreen; + Item.value = CalamityGlobalItem.Rarity12BuyPrice; + Item.Calamity().customRarity = CalamityRarity.Turquoise; Item.rare = ItemRarityID.Purple; } diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index 55adaa6b1f..b17ecab8f6 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -35,6 +35,12 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + public override void UpdateVanity(Player player) + { + // Do a vanity/social slot check for SCal's expert drop since alternatives to get this working are a pain in the ass to create. + player.Calamity().blazingCursorVisuals = true; + } + public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().blazingCursorDamage = true; diff --git a/Items/Accessories/DaawnlightSpiritOrigin.cs b/Items/Accessories/DaawnlightSpiritOrigin.cs index c8bd56cecc..2668e83de3 100644 --- a/Items/Accessories/DaawnlightSpiritOrigin.cs +++ b/Items/Accessories/DaawnlightSpiritOrigin.cs @@ -83,6 +83,18 @@ namespace CalamityMod.Items.Accessories } } + public override void UpdateVanity(Player player) + { + // Summon anime girl if it's in vanity slot as the pet is purely vanity + // It's possible for other "pet" items like Fungal Clump or HotE to summon a passive version of their "pets" with some tweaks though + player.Calamity().spiritOriginVanity = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + player.AddBuff(ModContent.BuffType(), 18000, true); + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/FeatherCrown.cs b/Items/Accessories/FeatherCrown.cs index e7be0eec74..dcd7d27f7a 100644 --- a/Items/Accessories/FeatherCrown.cs +++ b/Items/Accessories/FeatherCrown.cs @@ -56,6 +56,11 @@ namespace CalamityMod.Items.Accessories player.Calamity().featherCrownDraw = true; //this bool is just used for drawing } + public override void UpdateVanity(Player player) + { + player.Calamity().featherCrownDraw = true; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs index f519aca545..e20c93e9b2 100644 --- a/Items/Accessories/HowlsHeart.cs +++ b/Items/Accessories/HowlsHeart.cs @@ -64,5 +64,30 @@ namespace CalamityMod.Items.Accessories } } } + + public override void UpdateVanity(Player player) + { + player.Calamity().howlsHeartVanity = true; + if (player.whoAmI == Main.myPlayer) + { + var source = player.GetSource_Accessory(Item); + if (player.FindBuffIndex(BuffType()) == -1) + player.AddBuff(BuffType(), 3600, true); + + if (player.ownedProjectileCounts[ProjectileType()] < 1) + { + int damage = (int)player.GetTotalDamage().ApplyTo(HowlDamage); + int p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ProjectileType(), damage, 1f, player.whoAmI, 0f, 1f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = HowlDamage; + } + + if (player.ownedProjectileCounts[ProjectileType()] < 1) + Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + + if (player.ownedProjectileCounts[ProjectileType()] < 1) + Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ProjectileType(), 0, 0f, player.whoAmI, 0f, 0f); + } + } } } diff --git a/Items/Accessories/MoonstoneCrown.cs b/Items/Accessories/MoonstoneCrown.cs index 1d2661baa4..34310283ee 100644 --- a/Items/Accessories/MoonstoneCrown.cs +++ b/Items/Accessories/MoonstoneCrown.cs @@ -61,6 +61,11 @@ namespace CalamityMod.Items.Accessories player.Calamity().moonCrownDraw = true; //this bool is just used for drawing } + public override void UpdateVanity(Player player) + { + player.Calamity().moonCrownDraw = true; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 60aea5a3a9..349681cf6c 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -123,6 +123,12 @@ namespace CalamityMod.Items.Accessories modPlayer.profanedCrystalHide = true; } + public override void UpdateVanity(Player player) + { + player.Calamity().profanedCrystalHide = false; + player.Calamity().profanedCrystalForce = true; + } + internal static void DetermineTransformationEligibility(Player player) { if (DownedBossSystem.downedSCal && DownedBossSystem.downedExoMechs && (player.maxMinions - player.slotsMinions) >= 10 && !player.Calamity().profanedCrystalForce && player.HasBuff()) diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index e5300bbb5d..c29244b2df 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Accessories player.jumpSpeedBoost += 0.3f; player.extraFall += 35; player.blackBelt = true; - player.dash = 1; + player.dashType = 1; player.Calamity().DashID = string.Empty; player.spikedBoots = 2; player.accFlipper = true; diff --git a/Items/Accessories/Vanity/Popo.cs b/Items/Accessories/Vanity/Popo.cs index 83bc72c411..07c57a10ec 100644 --- a/Items/Accessories/Vanity/Popo.cs +++ b/Items/Accessories/Vanity/Popo.cs @@ -46,6 +46,12 @@ namespace CalamityMod.Items.Accessories.Vanity Item.Calamity().devItem = true; } + public override void UpdateVanity(Player player) + { + player.Calamity().snowmanHide = false; + player.Calamity().snowmanForce = true; + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index 622bfedfd0..c629e83f09 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -203,6 +203,7 @@ namespace CalamityMod.Items case ItemID.ShrimpyTruffle: case ItemID.GravityGlobe: case ItemID.SuspiciousLookingTentacle: + case ItemID.LongRainbowTrailWings: item.expert = false; break; } @@ -1144,6 +1145,10 @@ namespace CalamityMod.Items if (item.type == ItemID.ObsidianSkull || item.type == ItemID.ObsidianHorseshoe || item.type == ItemID.ObsidianShield || item.type == ItemID.ObsidianWaterWalkingBoots || item.type == ItemID.LavaWaders || item.type == ItemID.ObsidianSkullRose || item.type == ItemID.MoltenCharm || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose || item.type == ItemID.AnkhShield) player.buffImmune[BuffID.OnFire] = true; + // Ankh Shield Mighty Wind immunity. + if (item.type == ItemID.AnkhShield) + player.buffImmune[BuffID.WindPushed] = true; + if (item.type == ItemID.HellfireTreads) { modPlayer.hellfireTreads = true; diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index d39efe5028..b6318a102d 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -7,6 +7,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items { + // TODO -- The item tweaks database and functions should be stored in a ModSystem. + // ApplyTweaks(ref Item item) would be the one exposed function, which CalamityGlobalItem would call in SetDefaults. public partial class CalamityGlobalItem : GlobalItem { #region Database and Initialization diff --git a/Items/Placeables/Banners/AquaticParasiteBanner.cs b/Items/Placeables/Banners/AquaticParasiteBanner.cs deleted file mode 100644 index 6315148efc..0000000000 --- a/Items/Placeables/Banners/AquaticParasiteBanner.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CalamityMod.Tiles; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class AquaticParasiteBanner : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Aquatic Parasite"); - } - - public override void SetDefaults() - { - Item.width = 10; - Item.height = 24; - Item.maxStack = 99; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(0, 0, 10, 0); - Item.createTile = ModContent.TileType(); - Item.placeStyle = 0; - } - } -} diff --git a/Items/Placeables/Banners/AquaticParasiteBanner.png b/Items/Placeables/Banners/AquaticParasiteBanner.png deleted file mode 100644 index 6867326e6e..0000000000 Binary files a/Items/Placeables/Banners/AquaticParasiteBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/BlightedEyeBanner.cs b/Items/Placeables/Banners/BlightedEyeBanner.cs deleted file mode 100644 index cddc27f031..0000000000 --- a/Items/Placeables/Banners/BlightedEyeBanner.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CalamityMod.Tiles; -using Terraria; -using Terraria.ModLoader; -using Terraria.ID; - -namespace CalamityMod.Items.Placeables.Banners -{ - public class BlightedEyeBanner : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}Blighted Eye"); - } - - public override void SetDefaults() - { - Item.width = 10; - Item.height = 24; - Item.maxStack = 99; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(0, 0, 10, 0); - Item.createTile = ModContent.TileType(); - Item.placeStyle = 54; - } - } -} diff --git a/Items/Placeables/Banners/BlightedEyeBanner.png b/Items/Placeables/Banners/BlightedEyeBanner.png deleted file mode 100644 index 8fbd55869a..0000000000 Binary files a/Items/Placeables/Banners/BlightedEyeBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/CryonBanner.png b/Items/Placeables/Banners/CryonBanner.png index fe68874fc5..29368d28ee 100644 Binary files a/Items/Placeables/Banners/CryonBanner.png and b/Items/Placeables/Banners/CryonBanner.png differ diff --git a/Items/Placeables/Banners/SandTortoiseBanner.cs b/Items/Placeables/Banners/SandTortoiseBanner.cs deleted file mode 100644 index 88e0f3e2fe..0000000000 --- a/Items/Placeables/Banners/SandTortoiseBanner.cs +++ /dev/null @@ -1,32 +0,0 @@ -using CalamityMod.Tiles; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Banners -{ - public class SandTortoiseBanner : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - Tooltip.SetDefault("{$CommonItemTooltip.BannerBonus}SandTortoiseBanner"); - } - - public override void SetDefaults() - { - Item.width = 10; - Item.height = 24; - Item.maxStack = 99; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(0, 0, 10, 0); - Item.createTile = ModContent.TileType(); - Item.placeStyle = 64; - } - } -} diff --git a/Items/Placeables/Banners/SandTortoiseBanner.png b/Items/Placeables/Banners/SandTortoiseBanner.png deleted file mode 100644 index 374fb4212a..0000000000 Binary files a/Items/Placeables/Banners/SandTortoiseBanner.png and /dev/null differ diff --git a/Items/Placeables/Banners/WulfrumSlimeBanner.cs b/Items/Placeables/Banners/WulfrumSlimeBanner.cs deleted file mode 100644 index 06e45ee077..0000000000 --- a/Items/Placeables/Banners/WulfrumSlimeBanner.cs +++ /dev/null @@ -1,37 +0,0 @@ -using CalamityMod.Tiles; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Banners -{ - public class WulfrumSlimeBanner : ModItem - { - public override void SetStaticDefaults() - { - SacrificeTotal = 1; - Tooltip.SetDefault("A decorative banner themed after an extinct slime species"); - } - - public override void SetDefaults() - { - Item.width = 10; - Item.height = 24; - Item.maxStack = 99; - Item.useTurn = true; - Item.autoReuse = true; - Item.useAnimation = 15; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.Swing; - Item.consumable = true; - Item.rare = ItemRarityID.Blue; - Item.value = Item.buyPrice(0, 0, 10, 0); - Item.createTile = ModContent.TileType(); - Item.placeStyle = 51; - } - public override void AddRecipes() - { - CreateRecipe(1).AddIngredient(ItemID.Silk, 3).AddIngredient(ModContent.ItemType(), 3).AddTile(TileID.Loom).Register(); - } - } -} diff --git a/Items/Placeables/Banners/WulfrumSlimeBanner.png b/Items/Placeables/Banners/WulfrumSlimeBanner.png deleted file mode 100644 index 5ee1d8364b..0000000000 Binary files a/Items/Placeables/Banners/WulfrumSlimeBanner.png and /dev/null differ diff --git a/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs b/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs index 8708ebc62a..9de535f8ee 100644 --- a/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs +++ b/Items/VanillaArmorChanges/VanillaArmorChangeManager.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; @@ -7,6 +7,7 @@ using Terraria.ID; namespace CalamityMod.Items.VanillaArmorChanges { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class VanillaArmorChangeManager { internal static List ArmorChanges; diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index 7628551bba..425b68923b 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Melee { DisplayName.SetDefault("Seeking Scorcher"); Tooltip.SetDefault("May your enemies burn in hell for the sins they have committed\n" + - "Throws a holy boomerang that seeks out up to three enemies before returning to the player"); + "Throws a holy boomerang that seeks out up to four enemies before returning to the player"); SacrificeTotal = 1; } diff --git a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs new file mode 100644 index 0000000000..269f9efca0 --- /dev/null +++ b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.cs @@ -0,0 +1,69 @@ +using Terraria.DataStructures; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class AdamantiteParticleAccelerator : ModItem + { + public const int ChargeFrames = 28; + public const int CooldownFrames = 16; + public static readonly Color[] LightColors = new Color[] { new Color(235, 40, 121), new Color(49, 161, 246) }; //beam colors + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Adamantite Particle Accelerator"); + Tooltip.SetDefault("Charges and fires 2 beams of opposite polarities. Hitting with the opposite polarity increases the damage"); + SacrificeTotal = 1; + } + + public override void SetDefaults() + { + Item.damage = 100; + Item.DamageType = DamageClass.Ranged; + Item.width = 54; + Item.height = 52; + Item.useTime = ChargeFrames + CooldownFrames; + Item.useAnimation = ChargeFrames + CooldownFrames; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 3f; + Item.channel = true; + Item.value = Item.buyPrice(0, 36, 0, 0); + Item.rare = ItemRarityID.Pink; + Item.autoReuse = true; + Item.shootSpeed = 6f; + Item.shoot = ModContent.ProjectileType(); + Item.noUseGraphic = true; + } + + + public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) + { + velocity *= Item.shootSpeed; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + return false; + } + + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.AdamantiteBar, 10). + AddTile(TileID.MythrilAnvil). + Register(); + } + + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + } + + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + } +} diff --git a/Items/Weapons/Ranged/AdamantiteParticleAccelerator.png b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.png new file mode 100644 index 0000000000..6b570634ea Binary files /dev/null and b/Items/Weapons/Ranged/AdamantiteParticleAccelerator.png differ diff --git a/Items/Weapons/Rogue/BouncySpikyBall.cs b/Items/Weapons/Rogue/BouncySpikyBall.cs index 2e701c5ee1..39f558d4a4 100644 --- a/Items/Weapons/Rogue/BouncySpikyBall.cs +++ b/Items/Weapons/Rogue/BouncySpikyBall.cs @@ -12,9 +12,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetStaticDefaults() { DisplayName.SetDefault("Bouncy Spiky Ball"); - Tooltip.SetDefault(@"Throws a very bouncy ball that richochets off walls and enemies + Tooltip.SetDefault(@"Throws a very bouncy ball that ricochets off walls and enemies Receives a small boost in damage and velocity after bouncing off an enemy -Stealth strikes provide a bigger boost after richocheting"); +Stealth strikes provide a bigger boost after ricocheting"); SacrificeTotal = 99; } diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index d08e27dd4f..3e95b96ab8 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -22,7 +22,8 @@ namespace CalamityMod.Items.Weapons.Rogue public override void SetDefaults() { - Item.width = 38; + Item.width = 62; + Item.height = 58; Item.damage = 563; Item.noMelee = true; Item.noUseGraphic = true; @@ -32,7 +33,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 33; Item.knockBack = 7f; Item.UseSound = SoundID.Item1; - Item.height = 54; Item.value = CalamityGlobalItem.Rarity14BuyPrice; Item.rare = ItemRarityID.Purple; Item.Calamity().customRarity = CalamityRarity.DarkBlue; diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 6dd3dc836b..1db3bc67e7 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -57,7 +57,9 @@ namespace CalamityMod.Items.Weapons.Summon } else if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0f) { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback, player.whoAmI, 0f, 0f); + int p = Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage * 2, knockback, player.whoAmI, 0f, 0f); + if (Main.projectile.IndexInRange(p)) + Main.projectile[p].originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index 81f5284485..074e289f17 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Summon { DisplayName.SetDefault("Virid Vanguard"); Tooltip.SetDefault("Summons 2 blades that rotate around you\n" + - "Each pair of blades take up three minion slots\n" + + "Each pair of blades takes up three minion slots\n" + "Right clicking prompts all blades to fly upward and redirect towards the mouse"); Item.staff[Item.type] = true; SacrificeTotal = 1; diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index 8ef3d00de0..3c4e9d870a 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -120,30 +120,30 @@ namespace CalamityMod { "Crabulon", 2.5f }, { "HiveMind", 3.5f }, { "Perforators", 3.51f }, - { "SlimeGod", 5.5f }, - { "Cryogen", 6.5f }, - { "AquaticScourge", 7.5f }, - { "BrimstoneElemental", 8.5f }, - { "Calamitas", 9.7f }, - { "GreatSandShark", 10.09f }, - { "Leviathan", 10.5f }, - { "AstrumAureus", 10.6f }, - { "PlaguebringerGoliath", 11.5f }, - { "Ravager", 12.5f }, - { "AstrumDeus", 13.5f }, - { "ProfanedGuardians", 14.5f }, - { "Dragonfolly", 14.6f }, - { "Providence", 15.01f }, // Thorium's Ragnarok is 15f - { "CeaselessVoid", 15.5f }, - { "StormWeaver", 15.51f }, - { "Signus", 15.52f }, - { "Polterghast", 16f }, - { "OldDuke", 16.5f }, - { "DevourerOfGods", 17f }, - { "Yharon", 18f }, - { "ExoMechs", 18.5f }, - { "SupremeCalamitas", 19f }, - { "AdultEidolonWyrm", 19.5f }, + { "SlimeGod", 6.5f }, + { "Cryogen", 8.5f }, + { "AquaticScourge", 9.5f }, + { "BrimstoneElemental", 10.5f }, + { "Calamitas", 11.7f }, + { "GreatSandShark", 12.09f }, + { "Leviathan", 12.5f }, + { "AstrumAureus", 12.6f }, + { "PlaguebringerGoliath", 13.5f }, + { "Ravager", 15.5f }, + { "AstrumDeus", 16.5f }, + { "ProfanedGuardians", 17.5f }, + { "Dragonfolly", 17.6f }, + { "Providence", 18.01f }, // Thorium's Ragnarok will most likely be 18f + { "CeaselessVoid", 18.5f }, + { "StormWeaver", 18.51f }, + { "Signus", 18.52f }, + { "Polterghast", 19f }, + { "OldDuke", 19.5f }, + { "DevourerOfGods", 20f }, + { "Yharon", 21f }, + { "ExoMechs", 21.5f }, + { "SupremeCalamitas", 22f }, + { "AdultEidolonWyrm", 22.5f }, // { "Yharim", 20f }, // { "Noxus", 120f }, // { "Xeroc", 121f }, @@ -152,8 +152,8 @@ namespace CalamityMod private static readonly Dictionary InvasionDifficulty = new Dictionary { { "Acid Rain Initial", 2.4f }, - { "Acid Rain Aquatic Scourge", 7.51f }, - { "Acid Rain Polterghast", 16.49f } + { "Acid Rain Aquatic Scourge", 9.51f }, + { "Acid Rain Polterghast", 19.49f } }; public static void Setup() @@ -235,15 +235,18 @@ namespace CalamityMod /// 3.0 = Eater of Worlds / Brain of Cthulhu
/// 4.0 = Queen Bee
/// 5.0 = Skeletron
- /// 6.0 = Wall of Flesh
- /// 7.0 = The Twins
- /// 8.0 = The Destroyer
- /// 9.0 = Skeletron Prime
- /// 10.0 = Plantera
- /// 11.0 = Golem
- /// 12.0 = Duke Fishron
- /// 13.0 = Lunatic Cultist
- /// 14.0 = Moon Lord + /// 6.0 = Deerclops
+ /// 7.0 = Wall of Flesh
+ /// 8.0 = Queen Slime
+ /// 9.0 = The Twins
+ /// 10.0 = The Destroyer
+ /// 11.0 = Skeletron Prime
+ /// 12.0 = Plantera
+ /// 13.0 = Golem
+ /// 14.0 = Empress of Light
+ /// 15.0 = Duke Fishron
+ /// 16.0 = Lunatic Cultist
+ /// 17.0 = Moon Lord ///
private static void BossChecklistSupport() { diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs index 13564cb88a..8e3d1ae7dc 100644 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ b/NPCs/Bumblebirb/Bumblefuck2.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.Bumblebirb DisplayName.SetDefault("Draconic Swarmer"); Main.npcFrameCount[NPC.type] = 5; NPCID.Sets.TrailingMode[NPC.type] = 1; - NPCID.Sets.BossBestiaryPriority.Add(Type); + this.HideFromBestiary(); } public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; @@ -43,19 +43,6 @@ namespace CalamityMod.NPCs.Bumblebirb NPC.Calamity().VulnerableToSickness = true; } - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - int associatedNPCType = ModContent.NPCType(); - bestiaryEntry.UIInfoProvider = new CommonEnemyUICollectionInfoProvider(ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[associatedNPCType], quickUnlock: true); - - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, - - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Though these creatures may look adorable, they are a vicious invasive species. If not dealt with quickly, they may drive the nearby fauna to extinction.") - }); - } - public override void AI() { CalamityAI.Bumblebirb2AI(NPC, Mod, true); diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index d2eb916512..c7c7c866fd 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -1242,12 +1242,14 @@ namespace CalamityMod.NPCs // Does not show up in the Bestiary LeadingConditionRule bloodOrbDrop = new LeadingConditionRule(DropHelper.BloodOrbBaseCondition); bloodOrbDrop.Add(ModContent.ItemType(), 5, hideLootReport: true); + globalLoot.Add(bloodOrbDrop); // Bloodflare set bonus Blood Orb drops: 50% chance from any valid enemy on the surface during a Blood Moon // See the condition lambda in DropHelper for details // Does not show up in the Bestiary LeadingConditionRule bloodflareBloodOrbDrop = new LeadingConditionRule(DropHelper.BloodOrbBloodflareCondition); bloodflareBloodOrbDrop.Add(ModContent.ItemType(), 2, hideLootReport: true); + globalLoot.Add(bloodflareBloodOrbDrop); } #endregion diff --git a/NPCs/CalamityPolarityNPC.cs b/NPCs/CalamityPolarityNPC.cs new file mode 100644 index 0000000000..0807e237cf --- /dev/null +++ b/NPCs/CalamityPolarityNPC.cs @@ -0,0 +1,111 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Particles; +using CalamityMod.Items.Weapons.Ranged; +using System.Collections.Generic; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.NPCs +{ + public class CalamityPolarityNPC : GlobalNPC + { + private float curPolarity = 0; + public List pulses; + private List pulsesToClear; + + public bool isPolarized => curPolarity != 0; + + public override bool InstancePerEntity => true; + + public float CurPolarity + { + get + { + return curPolarity; + } + internal set + { + curPolarity = value; + } + } + + public override void SetDefaults(NPC npc) + { + CurPolarity = 0; + pulses = new List(); + pulsesToClear = new List(); + + } + + //Applies a new polarity to the target + public void applyPolarity(float update, NPC npc) + { + //Round the polarity to avoid ending up with a polarity that's got decimals which will cause it to forever alternate between positive and negative. + CurPolarity = (float)Math.Round(update); + Color pulseColor = AdamantiteParticleAccelerator.LightColors[update < 0 ? 1 : 0]; + pulses.Add(new AuraPulseRing(pulseColor, new Vector2(Math.Max(npc.width / 156f * 1.1f, 0.25f) , 0.3f), new Vector2(Math.Max(npc.width / 156f * 1.5f, 0.4f), 0.01f), 40, npc)); + } + + public override GlobalNPC Clone(NPC npc, NPC npcClone) + { + CalamityPolarityNPC myClone = (CalamityPolarityNPC)base.Clone(npc, npcClone); + + myClone.curPolarity = CurPolarity; + + return myClone; + } + + public override void PostAI(NPC npc) + { + HandlePulses(); + + if (!isPolarized) + return; + + //Polarity decay + if (curPolarity < 0) + curPolarity++; + else if (curPolarity > 0) + curPolarity--; + + //Polarity particles + if (Main.rand.NextBool(2)) + { + Color sparkColor = AdamantiteParticleAccelerator.LightColors[CurPolarity < 0 ? 1 : 0]; + Particle spark = new ElectricSpark(npc.Center + Main.rand.NextVector2Circular(npc.width / 2f, npc.height / 2f), Main.rand.NextVector2CircularEdge(20f, 20f) * 0.4f, Color.Lerp(Color.White, sparkColor, 0.4f), sparkColor, Main.rand.NextFloat(0.5f, 1.2f), Main.rand.Next(20, 40), bloomScale: 2.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + + public void HandlePulses() + { + foreach (Particle pulse in pulses) + { + pulse.Time++; + pulse.Update(); + if (pulse.Time > pulse.Lifetime) + pulsesToClear.Add(pulse); + } + + pulses.RemoveAll(n => pulsesToClear.Contains(n)); + pulsesToClear.Clear(); + } + + public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + foreach (Particle pulse in pulses) + { + pulse.CustomDraw(spriteBatch, npc.Center); + pulse.CustomDraw(spriteBatch, npc.Center); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + } +} diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 809458cc1e..ba1585bb0a 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -12,6 +12,7 @@ namespace CalamityMod.NPCs.Crags { public override void SetStaticDefaults() { + this.HideFromBestiary(); DisplayName.SetDefault("Scryllar"); } @@ -45,16 +46,6 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToWater = true; } - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] { - //BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Crags, - - // Will move to localization whenever that is cleaned up. - new FlavorTextBestiaryInfoElement("Twisted detritus of those who once came to harvest the remains of the crags. The whispers got to them.") - }); - } - public override void AI() { NPC.rotation = NPC.velocity.X * 0.04f; diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index fc2f049e09..b842e9fd39 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -65,6 +65,7 @@ namespace CalamityMod.NPCs.DraedonLabThings NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = false; + NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath44; } diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index e27e1381f5..630ed4c25a 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -206,6 +206,11 @@ namespace CalamityMod.NPCs.HiveMind writer.Write(reelCount); writer.Write(frameX); writer.Write(frameY); + + writer.Write(NPC.frame.X); + writer.Write(NPC.frame.Y); + writer.Write(NPC.frame.Width); + writer.Write(NPC.frame.Height); } public override void ReceiveExtraAI(BinaryReader reader) @@ -228,6 +233,10 @@ namespace CalamityMod.NPCs.HiveMind reelCount = reader.ReadInt32(); frameX = reader.ReadInt32(); frameY = reader.ReadInt32(); + + Rectangle frame = new Rectangle(reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32(), reader.ReadInt32()); + if (frame.Width > 0 && frame.Height > 0) + NPC.frame = frame; } public override void FindFrame(int frameHeight) @@ -439,6 +448,8 @@ namespace CalamityMod.NPCs.HiveMind NPC.alpha = 0; NPC.dontTakeDamage = false; NPC.damage = NPC.defDamage; + NPC.netSpam = 0; + NPC.netUpdate = true; } NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); diff --git a/Particles/AuraPulseRing.cs b/Particles/AuraPulseRing.cs new file mode 100644 index 0000000000..ac9981d2a4 --- /dev/null +++ b/Particles/AuraPulseRing.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using static CalamityMod.CalamityUtils; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class AuraPulseRing : Particle + { + public override string Texture => "CalamityMod/Particles/HollowCircleHardEdge"; + public override bool UseAdditiveBlend => true; + public override bool SetLifetime => true; + + private Vector2 OriginalScale; + private Vector2 FinalScale; + public Vector2 CurrentScale; + private float opacity; + private Color BaseColor; + public NPC StuckTo; + + public AuraPulseRing(Color color, Vector2 originalScale, Vector2 finalScale, int lifeTime, NPC stuckTo) + { + BaseColor = color; + OriginalScale = originalScale; + FinalScale = finalScale; + CurrentScale = originalScale; + Lifetime = lifeTime; + StuckTo = stuckTo; + } + + public override void Update() + { + float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(SineBumpEasing, 0f, 0f, 1f)}); + + float heightProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(SineInOutEasing, 0f, 0f, 1f) }); + + opacity = (float)Math.Sin(LifetimeCompletion * MathHelper.Pi) * 0.8f + 0.2f; + + Color = BaseColor * opacity; + Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); + + if (StuckTo != null && StuckTo.active) + { + CurrentScale = Vector2.Lerp(OriginalScale, FinalScale, pulseProgress) * StuckTo.scale; + RelativeOffset = - Vector2.UnitY.RotatedBy(StuckTo.rotation) * StuckTo.height / 2f + Vector2.UnitY.RotatedBy(StuckTo.rotation) * StuckTo.height * heightProgress; + Rotation = StuckTo.rotation; + } + } + + public override void CustomDraw(SpriteBatch spriteBatch, Vector2 basePosition) + { + Texture2D tex = ModContent.Request("CalamityMod/Particles/HollowCircleHardEdge").Value; //somehow wont work for set particles and defaults to the first particle it has (blood) + + spriteBatch.Draw(tex, basePosition + RelativeOffset - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, CurrentScale, SpriteEffects.None, 0); + } + } +} diff --git a/Particles/FusableParticleManager.cs b/Particles/FusableParticleManager.cs index b8c3f171e1..50989324a8 100644 --- a/Particles/FusableParticleManager.cs +++ b/Particles/FusableParticleManager.cs @@ -16,6 +16,8 @@ namespace CalamityMod.Particles // As such, it is littered with many netMode checks. While some may be overprotective in their nature it is critical that // failsafes exist there, as visual failures tend to result in engine crashes, which will kill a lot of MP servers. // If someone other than me for any reason attempts to notably expand upon this system you must keep this in mind. -Dominic + + // TODO -- This can be made into a ModSystem. Its main thread load dependency with render targets is safe to put in OnModLoad. public static class FusableParticleManager { internal static List ParticleSets = new List(); diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 1c113bd1bc..827da34280 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader.Core; namespace CalamityMod.Particles { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class GeneralParticleHandler { private static List particles; diff --git a/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs b/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs index 977a39de53..b8e90601eb 100644 --- a/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseIdleHoldoutProjectile.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Projectiles.BaseProjectiles public abstract int IntendedProjectileType { get; } public static Dictionary ItemProjectileRelationship = new(); + // TODO -- There is no reason this load hook should need to be called from CalamityMod. + // All subclasses of this should be ILoadable and should load themselves. public static void LoadAll() { ItemProjectileRelationship = new Dictionary(); diff --git a/Projectiles/Ranged/AdamAcceleratorBeam.cs b/Projectiles/Ranged/AdamAcceleratorBeam.cs new file mode 100644 index 0000000000..efddc38ce4 --- /dev/null +++ b/Projectiles/Ranged/AdamAcceleratorBeam.cs @@ -0,0 +1,275 @@ +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.Enums; +using Terraria.GameContent.Shaders; +using Terraria.Graphics.Effects; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Particles; + +namespace CalamityMod.Projectiles.Ranged +{ + public class AdamAcceleratorBeam : ModProjectile + { + private const int Lifetime = 24; + + private const float MaxBeamScale = 1.2f; + public int DustType => polarity < 0 ? 226 : 73; + + private const float MaxBeamLength = 2400f; + private const float BeamTileCollisionWidth = 1f; + private const float BeamHitboxCollisionWidth = 15f; + private const int NumSamplePoints = 3; + private const float BeamLengthChangeFactor = 0.75f; + + private const float OuterBeamOpacityMultiplier = 0.82f; + private const float InnerBeamOpacityMultiplier = 0.2f; + private const float MaxBeamBrightness = 0.75f; + + private const float MainDustBeamEndOffset = 14.5f; + private const float SidewaysDustBeamEndOffset = 4f; + private const float BeamRenderTileOffset = 10.5f; + private const float BeamLengthReductionFactor = 14.5f; + + private Vector2 beamVector = Vector2.Zero; + public ref float polarity => ref Projectile.ai[1]; + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Adamantite Particle Beam"); + } + + public override void SetDefaults() + { + Projectile.width = 16; + Projectile.height = 16; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.alpha = 0; + // The beam itself still stops on tiles, but its invisible "source" projectile ignores them. + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + + // The beam lasts for only some frames and fades out over that time. + Projectile.timeLeft = Lifetime; + } + + public override void AI() + { + // If the projectile for some reason isn't still an Adamantite Particle Beam delete it immediately. + if (Projectile.type != ModContent.ProjectileType()) + { + Projectile.Kill(); + return; + } + + // On frame 1, set the beam vector and rotation, but set the real velocity to zero. + if (Projectile.velocity != Vector2.Zero) + { + beamVector = Vector2.Normalize(Projectile.velocity); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.velocity = Vector2.Zero; + } + + // Reduce the "power" and thus scale of the projectile over its lifetime. + float power = (float)Projectile.timeLeft / Lifetime; + Projectile.scale = MaxBeamScale * power; + + // Perform a laser scan to calculate the correct length of the beam. + float[] laserScanResults = new float[NumSamplePoints]; + + // A minimum width is forced for the beam scan to prevent massive lag when fired into open areas. + float scanWidth = Projectile.scale < 1f ? 1f : Projectile.scale; + Collision.LaserScan(Projectile.Center, beamVector, BeamTileCollisionWidth * scanWidth, MaxBeamLength, laserScanResults); + float avg = 0f; + for (int i = 0; i < laserScanResults.Length; ++i) + avg += laserScanResults[i]; + avg /= NumSamplePoints; + Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], avg, BeamLengthChangeFactor); + + // X = beam length. Y = beam width. + Vector2 beamDims = new Vector2(beamVector.Length() * Projectile.ai[0], Projectile.width * Projectile.scale); + Color beamColor = GetBeamColor(polarity); + ProduceBeamDust(beamColor); + // If the game is rendering (i.e. isn't a dedicated server), make the beam disturb water. + if (Main.netMode != NetmodeID.Server) + { + WaterShaderData wsd = (WaterShaderData)Filters.Scene["WaterDistortion"].GetShader(); + // A universal time-based sinusoid which updates extremely rapidly. GlobalTimeWrappedHourly is 0 to 3600, measured in seconds. + float waveSine = 0.1f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 20f); + Vector2 ripplePos = Projectile.position + new Vector2(beamDims.X * 0.5f, 0f).RotatedBy(Projectile.rotation); + // WaveData is encoded as a Color. Not sure why, considering Vector3 exists. + Color waveData = new Color(0.5f, 0.1f * Math.Sign(waveSine) + 0.5f, 0f, 1f) * Math.Abs(waveSine); + wsd.QueueRipple(ripplePos, waveData, beamDims, RippleShape.Square, Projectile.rotation); + } + + // Make the beam cast light along its length. + // v3_1 is an unnamed decompiled variable which is the color of the light cast by DelegateMethods.CastLight + DelegateMethods.v3_1 = beamColor.ToVector3() * power * MaxBeamBrightness; + Utils.PlotTileLine(Projectile.Center, Projectile.Center + beamVector * Projectile.ai[0], beamDims.Y, DelegateMethods.CastLight); + + //Also add some fast moving dust + if (Projectile.timeLeft == Lifetime) + { + int dustCount = Main.rand.Next(10, 30); + for (int i = 0; i < dustCount; i++) + { + float dustProgressAlongBeam = Projectile.ai[0] * Main.rand.NextFloat(0f, 0.7f); + Vector2 dustPosition = Projectile.Center + dustProgressAlongBeam * beamVector + beamVector.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(-6f, 6f) * Projectile.scale; + + Dust dust = Dust.NewDustPerfect(dustPosition, DustType, beamVector * Main.rand.NextFloat(2f, 16f), 0, beamColor); + dust.color = beamColor; + dust.noGravity = true; + dust.scale = 0.7f; + } + } + } + + // Determines whether the specified target hitbox is intersecting with the beam. + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + // If the target is touching the beam's hitbox (which is a small rectangle vaguely overlapping the host crystal), that's good enough. + if (projHitbox.Intersects(targetHitbox)) + return true; + // Otherwise, perform an AABB line collision check to check the whole beam. + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + beamVector * Projectile.ai[0], BeamHitboxCollisionWidth * Projectile.scale, ref _); + } + + public override void OnHitNPC(NPC target, int damage, float knockback, bool crit) + { + target.PolarityNPC().applyPolarity(polarity, target); //applies a positive or negative polarity on the target for 120 frames + } + + + public override void ModifyHitNPC(NPC target, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) + { + // Ensure that the hit direction is correct when hitting enemies. + hitDirection = (Projectile.Center.X < target.Center.X).ToDirectionInt(); + float targetPolarity = target.PolarityNPC().CurPolarity; + //If a polarity beam hits the target with the opposite polarity, the damage dealt increases by 20% + if (polarity * targetPolarity < 0) + { + double newDamage = damage * 1.2; + damage = (int)newDamage; + + for (int i = 0; i < 4; i++) + { + Color sparkColor = AdamantiteParticleAccelerator.LightColors[polarity < 0 ? 1 : 0]; + + Vector2 sparkSpeed = Owner.DirectionTo(target.Center).RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(8f, 17f); + Particle Spark = new CritSpark(target.Center, sparkSpeed, Color.White, sparkColor, 0.7f + Main.rand.NextFloat(0, 0.6f), 30, 0.4f, 0.6f); + GeneralParticleHandler.SpawnParticle(Spark); + } + + } + } + + private Color GetBeamColor(float polarity) + { + //Beam color changes based on polarity. Red for positive, blue for negative, just like a magnet + int index = (polarity > 0) ? 0 : 1; + Color c = AdamantiteParticleAccelerator.LightColors[index]; + c.A = 64; + return c; + } + + public override bool PreDraw(ref Color lightColor) + { + // If the beam doesn't have a defined projection vector or hasn't yet had its velocity set to zero, don't draw anything. + if (beamVector == Vector2.Zero || Projectile.velocity != Vector2.Zero) + return false; + + Texture2D tex = ModContent.Request(Texture).Value; + float beamLength = Projectile.ai[0]; + Vector2 centerFloored = Projectile.Center.Floor() + beamVector * Projectile.scale * BeamRenderTileOffset; + Vector2 scaleVec = new Vector2(Projectile.scale); + + // Reduce the beam length proportional to its square area to reduce block penetration. + beamLength -= BeamLengthReductionFactor * Projectile.scale * Projectile.scale; + + DelegateMethods.f_1 = 1f; // f_1 is an unnamed decompiled variable whose function is unknown. Leave it at 1. + Vector2 beamStartPos = centerFloored - Main.screenPosition; + Vector2 beamEndPos = beamStartPos + beamVector * beamLength; + Utils.LaserLineFraming llf = new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw); + + // Draw the outermost beam + // c_1 is an unnamed decompiled variable which is the render color of the beam drawn by DelegateMethods.RainbowLaserDraw + Color beamColor = GetBeamColor(polarity); + DelegateMethods.c_1 = beamColor * OuterBeamOpacityMultiplier * Projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); + + // Draw the inner beams, each with reduced size and whiter color + for (int i = 0; i < 5; ++i) + { + beamColor = Color.Lerp(beamColor, Color.White, 0.4f); + scaleVec *= 0.85f; + DelegateMethods.c_1 = beamColor * InnerBeamOpacityMultiplier * Projectile.Opacity; + Utils.DrawLaser(Main.spriteBatch, tex, beamStartPos, beamEndPos, scaleVec, llf); + } + return false; + } + + private void ProduceBeamDust(Color beamColor) + { + // Create a few dust per frame a small distance from where the beam ends. + Vector2 laserEndPos = Projectile.Center + beamVector * (Projectile.ai[0] - MainDustBeamEndOffset * Projectile.scale); + + for (int i = 0; i < 2; ++i) + { + // 50% chance for the dust to come off on either side of the beam. + float dustAngle = Projectile.rotation + (Main.rand.NextBool() ? 1f : -1f) * MathHelper.PiOver2; + float dustStartDist = Main.rand.NextFloat(1f, 1.8f); + Vector2 dustVel = dustAngle.ToRotationVector2() * dustStartDist; + int d = Dust.NewDust(laserEndPos, 0, 0, DustType, dustVel.X, dustVel.Y, 0, beamColor); + Main.dust[d].color = beamColor; + Main.dust[d].noGravity = true; + Main.dust[d].scale = 0.7f; + + // Scale up dust with the projectile if it's large. + if (Projectile.scale > 1f) + { + Main.dust[d].velocity *= Projectile.scale; + Main.dust[d].scale *= Projectile.scale; + } + + // If the beam isn't at max scale, then make additional smaller dust. + if (Projectile.scale != MaxBeamScale) + { + Dust smallDust = Dust.CloneDust(d); + smallDust.scale /= 2f; + } + } + + // Low chance every frame to spawn a large "directly sideways" dust which doesn't move. + if (Main.rand.NextBool(5)) + { + // Velocity, flipped sideways, times -50% to 50% of beam width. + Vector2 dustOffset = beamVector.RotatedBy(MathHelper.PiOver2) * (Main.rand.NextFloat() - 0.5f) * Projectile.width; + Vector2 dustPos = laserEndPos + dustOffset - Vector2.One * SidewaysDustBeamEndOffset; + int d = Dust.NewDust(dustPos, 8, 8, DustType, 0f, 0f, 100, beamColor, 1.2f); + Main.dust[d].velocity *= 0.5f; + + // Force the dust to always move downwards, never upwards. + Main.dust[d].velocity.Y = -Math.Abs(Main.dust[d].velocity.Y); + } + } + + // Automatically iterates through every tile the laser is overlapping to cut grass at all those locations. + public override void CutTiles() + { + // tilecut_0 is an unnamed decompiled variable which tells CutTiles how the tiles are being cut (in this case, via a projectile). + DelegateMethods.tilecut_0 = TileCuttingContext.AttackProjectile; + Utils.TileActionAttempt cut = DelegateMethods.CutTiles; + Vector2 beamStartPos = Projectile.Center; + Vector2 beamEndPos = beamStartPos + beamVector * Projectile.ai[0]; + Utils.PlotTileLine(beamStartPos, beamEndPos, Projectile.width * Projectile.scale, cut); + } + } +} diff --git a/Projectiles/Ranged/AdamAcceleratorBeam.png b/Projectiles/Ranged/AdamAcceleratorBeam.png new file mode 100644 index 0000000000..4bcb09bbf2 Binary files /dev/null and b/Projectiles/Ranged/AdamAcceleratorBeam.png differ diff --git a/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs b/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs new file mode 100644 index 0000000000..e11c4505dc --- /dev/null +++ b/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs @@ -0,0 +1,198 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using static CalamityMod.CalamityUtils; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class AdamantiteAcceleratorHoldout : ModProjectile + { + public override string Texture => "CalamityMod/Items/Weapons/Ranged/AdamantiteParticleAccelerator"; + const float maxTimeAnim = 35; + public Player Owner => Main.player[Projectile.owner]; + public float Timer => maxTimeAnim - Projectile.timeLeft; + public ref float ChargeTimer => ref Projectile.ai[0]; + public ref float DelayTimer => ref Projectile.ai[1]; + public ref float ChargeRate => ref Projectile.localAI[0]; + public ref float BounceBackPower => ref Projectile.localAI[1]; + public Vector2 NuzzlePosition => Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * 70f + (Vector2.UnitY * -12f * Owner.direction).RotatedBy(Projectile.rotation); + + private SlotId ChargeupSoundSlot; + + + + public override void SetStaticDefaults() + { + DisplayName.SetDefault("Adamantite Particle Accelerator"); + } + + public override void SetDefaults() + { + Projectile.width = 54; + Projectile.height = 52; + // This projectile has no hitboxes and no damage type. + Projectile.friendly = false; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = 900; + Projectile.velocity = Vector2.Zero; + } + + // ChargeTimer is a time-dilated frame counter. DelayTimer is the frame counter for when the beams are fired. + // ChargeRate is the rate at which the "frame" counter increases. BounceBackPower is there for the visuals of the gun recoiling in the players hands. + public override void AI() + { + Player player = Main.player[Projectile.owner]; + Vector2 rrp = player.RotatedRelativePoint(player.MountedCenter, true); + + Projectile.rotation = Owner.MountedCenter.AngleTo(Owner.Calamity().mouseWorld); + + // Calculate how quickly the gun should charge. Charge increases by some number close to 1 every frame. + // Speed increasing reforges make this number greater than 1. Slowing reforges make it smaller than 1. + if (ChargeRate == 0f) + ChargeRate = 44f / player.ActiveItem().useTime; + + if (ChargeTimer == 0f) + ChargeupSoundSlot = SoundEngine.PlaySound(SoundID.DD2_WitherBeastAuraPulse with { Volume = SoundID.DD2_WitherBeastAuraPulse.Volume * 1.6f }, Projectile.Center); + + else if (SoundEngine.TryGetActiveSound(ChargeupSoundSlot, out var soundOut) && soundOut.IsPlaying) + { + soundOut.Sound.Pitch = ChargeTimer * 2f ; + soundOut.Position = Projectile.Center; + } + + if (BounceBackPower > 0f) + BounceBackPower -= 0.07f; + + // Increment the timer for the gun. If the timer has passed 44, destroy it. + ChargeTimer += ChargeRate; + int maxTime = AdamantiteParticleAccelerator.ChargeFrames + AdamantiteParticleAccelerator.CooldownFrames; + if (ChargeTimer > maxTime) + { + if (Owner.channel) + ResetToStart(); + else + { + Projectile.Kill(); + return; + } + } + + // Compute the weapon's charge. + float chargeLevel = MathHelper.Clamp(Projectile.ai[0] / AdamantiteParticleAccelerator.ChargeFrames, 0f, 1f); + + // Common code among holdouts to keep the holdout projectile directly in the player's hand + UpdatePlayerVisuals(player, rrp); + + // Firing or charging? + if (chargeLevel >= 1f) + { + //Fires the first beam of the positive polarity on the 1st frame + if (DelayTimer == 0f) + { + FiringEffects(new Color(235, 40, 121)); + if (Projectile.owner == Main.myPlayer) + { + Projectile redLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), NuzzlePosition, Projectile.rotation.ToRotationVector2(), ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 120); + redLaser.Center = NuzzlePosition; + } + } + + //Fires the second beam of the negative polarity 8 frames after the first frame + else if (DelayTimer == 8f) + { + FiringEffects(new Color(49, 161, 246)); + if (Projectile.owner == Main.myPlayer) + { + Projectile blueLaser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), NuzzlePosition, Projectile.rotation.ToRotationVector2(), ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, -120); + blueLaser.Center = NuzzlePosition; + } + } + DelayTimer += 1f; + } + } + + public CurveSegment bounceAway = new CurveSegment(SineOutEasing, 0f, 0.5f, 0.5f); + public CurveSegment moveBack = new CurveSegment(SineInEasing, 0.56f, 1f, -1f); + public CurveSegment bounceBack = new CurveSegment(SineBumpEasing, 0.7f, 0f, -0.35f); + internal float RecoilDisplacement => PiecewiseAnimation(1 - BounceBackPower, new CurveSegment[] { bounceAway, moveBack, bounceBack }); + + public CurveSegment unsquish = new CurveSegment(SineOutEasing, 0f, 1f, -1f); + public CurveSegment oversquish = new CurveSegment(SineBumpEasing, 0.7f, 0f, -0.6f); + internal float RecoilSquish => PiecewiseAnimation(1 - MathHelper.Clamp(BounceBackPower * 2f, 0f, 1f), new CurveSegment[] { unsquish, oversquish }); + + private void UpdatePlayerVisuals(Player player, Vector2 rrp) + { + // Place the projectile directly into the player's hand at all times + Projectile.Center = rrp; + + // The gun is a holdout projectile, so change the player's variables to reflect that + player.ChangeDir(Math.Sign(Projectile.rotation.ToRotationVector2().X)); + player.heldProj = Projectile.whoAmI; + player.itemTime = 2; + player.itemAnimation = 2; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, Projectile.rotation - MathHelper.PiOver2); + + } + + private void FiringEffects(Color color) + { + SoundEngine.PlaySound(SoundID.Item92, NuzzlePosition); + SoundEngine.PlaySound(SoundID.Item60, NuzzlePosition); + + Particle pulse = new DirectionalPulseRing(NuzzlePosition + Projectile.rotation.ToRotationVector2() * 5f, Vector2.Zero, color, new Vector2(0.5f, 1f), Projectile.rotation, 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30); + GeneralParticleHandler.SpawnParticle(pulse); + + if (Owner == Main.LocalPlayer && Owner.Calamity().GeneralScreenShakePower < 5) + { + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 1; + } + + BounceBackPower = 1f; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D gun = Request("CalamityMod/Items/Weapons/Ranged/AdamantiteParticleAccelerator").Value; + + SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + float drawAngle = Projectile.rotation + (Owner.direction < 0 ? MathHelper.Pi : 0); + Vector2 drawOrigin = new Vector2(Owner.direction < 0 ? gun.Width - 33f : 33f, 33f); + Vector2 drawOffset = Owner.MountedCenter + Projectile.rotation.ToRotationVector2() * (10f - RecoilDisplacement * 5f) - Main.screenPosition; + + Vector2 scale = new Vector2(1f - 0.05f * RecoilSquish, 1f + 0.05f * RecoilSquish) * Projectile.scale; + + Main.EntitySpriteDraw(gun, drawOffset, null, lightColor, drawAngle, drawOrigin, scale, flip, 0); + + return false; + } + + public override bool PreKill(int timeLeft) + { + if (Owner.channel) + { + ResetToStart(); + return false; + } + + return true; + } + + public void ResetToStart() + { + Projectile.timeLeft = 900; + ChargeTimer = 0f; + DelayTimer = 0f; + } + } +} diff --git a/Projectiles/Ranged/SandyWaifuShark.cs b/Projectiles/Ranged/SandyWaifuShark.cs index b22f7138bd..1300a93f15 100644 --- a/Projectiles/Ranged/SandyWaifuShark.cs +++ b/Projectiles/Ranged/SandyWaifuShark.cs @@ -1,6 +1,5 @@ -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using System; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Ranged @@ -43,16 +42,8 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.frame > 7) Projectile.frame = 0; - if (Projectile.velocity.X < 0f) - { - Projectile.spriteDirection = -1; - Projectile.rotation = (float)Math.Atan2(-Projectile.velocity.Y, -Projectile.velocity.X); - } - else - { - Projectile.spriteDirection = 1; - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X); - } + Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi); if (Projectile.timeLeft < 210) CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 600f, 8f, 20f); @@ -64,7 +55,7 @@ namespace CalamityMod.Projectiles.Ranged Texture2D texture2D13 = ModContent.Request(Texture).Value; int num214 = ModContent.Request(Texture).Value.Height / Main.projFrames[Projectile.type]; int y6 = num214 * Projectile.frame; - Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, num214)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)num214 / 2f), Projectile.scale, spriteEffects, 0); return false; } diff --git a/Projectiles/Summon/MagicBat.cs b/Projectiles/Summon/MagicBat.cs index 618db67ee6..1153470b0a 100644 --- a/Projectiles/Summon/MagicBat.cs +++ b/Projectiles/Summon/MagicBat.cs @@ -23,7 +23,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.timeLeft = 150; - Projectile.DamageType = RogueDamageClass.Instance; + Projectile.minion = true; + Projectile.minionSlots = 0f; } public override void AI() => Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index 95a0bbb3e0..fb4db262ff 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Schematics { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class SchematicManager { internal const string RustedWorkshopKey = "Rusted Workshop"; diff --git a/Systems/SpeedrunTimerStoppingSystem.cs b/Systems/SpeedrunTimerStoppingSystem.cs index c67b0b3911..0923a54879 100644 --- a/Systems/SpeedrunTimerStoppingSystem.cs +++ b/Systems/SpeedrunTimerStoppingSystem.cs @@ -2,6 +2,7 @@ namespace CalamityMod.Systems { + // TODO -- Expand this ModSystem to contain the Speedrun Timer itself, as well as the UI. public class SpeedrunTimerStoppingSystem : ModSystem { public override void PreSaveAndQuit() => CalamityMod.SpeedrunTimer?.Stop(); diff --git a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs index df4e0b734f..5d9b11b5e7 100644 --- a/Tiles/DraedonStructures/AgedLaboratoryScreen.cs +++ b/Tiles/DraedonStructures/AgedLaboratoryScreen.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,6 +24,7 @@ namespace CalamityMod.Tiles.DraedonStructures ModTranslation name = CreateMapEntryName(); name.SetDefault("Aged Screen"); AddMapEntry(Color.DarkGray, name); + TileID.Sets.FramesOnKillWall[Type] = true; DustType = 8; } diff --git a/Tiles/DraedonStructures/LaboratoryScreen.cs b/Tiles/DraedonStructures/LaboratoryScreen.cs index b3dff55c87..7afe5b1046 100644 --- a/Tiles/DraedonStructures/LaboratoryScreen.cs +++ b/Tiles/DraedonStructures/LaboratoryScreen.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -23,6 +24,7 @@ namespace CalamityMod.Tiles.DraedonStructures ModTranslation name = CreateMapEntryName(); name.SetDefault("Screen"); AddMapEntry(Color.DarkGray, name); + TileID.Sets.FramesOnKillWall[Type] = true; DustType = 8; } diff --git a/Tiles/FurnitureExo/ExoScreenTile.cs b/Tiles/FurnitureExo/ExoScreenTile.cs index 89137d3a18..e5f7c3f414 100644 --- a/Tiles/FurnitureExo/ExoScreenTile.cs +++ b/Tiles/FurnitureExo/ExoScreenTile.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -25,6 +26,7 @@ namespace CalamityMod.Tiles.FurnitureExo AddMapEntry(new Color(71, 95, 114), name); DustType = 8; AnimationFrameHeight = 36; + TileID.Sets.FramesOnKillWall[Type] = true; } public override void AnimateTile(ref int frame, ref int frameCounter) diff --git a/Tiles/MonsterBanner.png b/Tiles/MonsterBanner.png index 245ab5fbc8..d0c4c374a9 100644 Binary files a/Tiles/MonsterBanner.png and b/Tiles/MonsterBanner.png differ diff --git a/UI/AstralArcanumUI.cs b/UI/AstralArcanumUI.cs index b614015ea1..f86695a739 100644 --- a/UI/AstralArcanumUI.cs +++ b/UI/AstralArcanumUI.cs @@ -10,6 +10,7 @@ using ReLogic.Content; namespace CalamityMod.UI { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class AstralArcanumUI { enum CircleStyle diff --git a/UI/CalamitasEnchantments/EnchantmentManager.cs b/UI/CalamitasEnchantments/EnchantmentManager.cs index 2871dc1ac5..dc0631ac55 100644 --- a/UI/CalamitasEnchantments/EnchantmentManager.cs +++ b/UI/CalamitasEnchantments/EnchantmentManager.cs @@ -13,6 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.UI.CalamitasEnchants { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class EnchantmentManager { internal const int ClearEnchantmentID = -18591774; diff --git a/UI/ChargeMeterUI.cs b/UI/ChargeMeterUI.cs index b6ea73e722..064decaeeb 100644 --- a/UI/ChargeMeterUI.cs +++ b/UI/ChargeMeterUI.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.UI { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public class ChargeMeterUI { // These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision. diff --git a/UI/InvasionProgressUIManager.cs b/UI/InvasionProgressUIManager.cs index 3081d57271..b673f5b890 100644 --- a/UI/InvasionProgressUIManager.cs +++ b/UI/InvasionProgressUIManager.cs @@ -1,10 +1,11 @@ -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.Linq; namespace CalamityMod.UI { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class InvasionProgressUIManager { private static readonly List gUIs = new List(); diff --git a/UI/PopupGUIManager.cs b/UI/PopupGUIManager.cs index 513378c193..61c72bbf6e 100644 --- a/UI/PopupGUIManager.cs +++ b/UI/PopupGUIManager.cs @@ -1,4 +1,4 @@ -using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics; using System; using System.Collections.Generic; using System.Linq; @@ -6,6 +6,7 @@ using Terraria; namespace CalamityMod.UI { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class PopupGUIManager { private static readonly List gUIs = new List(); diff --git a/UI/RipperUI.cs b/UI/RipperUI.cs index d7d4c944ea..1d5f7e7ff0 100644 --- a/UI/RipperUI.cs +++ b/UI/RipperUI.cs @@ -11,6 +11,7 @@ using Terraria.ModLoader; namespace CalamityMod.UI { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class RipperUI { // These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision. diff --git a/UI/SpeedrunTimerUI.cs b/UI/SpeedrunTimerUI.cs index eed608a72f..8cd76263fb 100644 --- a/UI/SpeedrunTimerUI.cs +++ b/UI/SpeedrunTimerUI.cs @@ -32,6 +32,7 @@ using Terraria.ModLoader; namespace CalamityMod.UI { + // TODO -- Combine with SpeedrunTimerStoppingSystem, which should be renamed and call the UI draw code in this file. public class SpeedrunTimerUI { // These values put the Speedrun Timer roughly at the top center of a 1080p screen. diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index d6f81d3296..4d43be5df0 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -9,6 +9,7 @@ using Terraria.ModLoader; namespace CalamityMod.UI { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public class StealthUI { // These values were handpicked on a 1080p screen by Ozzatron. Please disregard the bizarre precision. diff --git a/Utilities/CalamityRecipes.cs b/Utilities/CalamityRecipes.cs index 81b909184c..f1045ceafe 100644 --- a/Utilities/CalamityRecipes.cs +++ b/Utilities/CalamityRecipes.cs @@ -18,6 +18,7 @@ using Terraria.ModLoader; namespace CalamityMod { + // TODO -- Change this to a ModSystem so it does not need to be manually loaded from CalamityMod internal class CalamityRecipes { private static Recipe CreateRecipe(int itemID, int stack = 1) => CalamityMod.Instance.CreateRecipe(itemID, stack); diff --git a/Utilities/GeneralExtensionUtils.cs b/Utilities/GeneralExtensionUtils.cs index 895b51c85f..e28f8eed1d 100644 --- a/Utilities/GeneralExtensionUtils.cs +++ b/Utilities/GeneralExtensionUtils.cs @@ -11,6 +11,7 @@ namespace CalamityMod public static CalamityPlayer Calamity(this Player player) => player.GetModPlayer(); public static CalamityGlobalNPC Calamity(this NPC npc) => npc.GetGlobalNPC(); public static CalamityFallDamageNPC FallingNPC(this NPC npc) => npc.GetGlobalNPC(); + public static CalamityPolarityNPC PolarityNPC(this NPC npc) => npc.GetGlobalNPC(); public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem(); public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile(); public static Item ActiveItem(this Player player) => Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem; diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index 560939bef6..76999f398f 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -281,7 +281,12 @@ namespace CalamityMod float segmentProgress = (progress - segment.originX) / segmentLenght; //How far along the specific segment ratio = segment.originY; - ratio += segment.easing(segmentProgress, segment.degree) * segment.displacement; + //Failsafe because somehow it can fail? what + if (segment.easing != null) + ratio += segment.easing(segmentProgress, segment.degree) * segment.displacement; + + else + ratio += LinearEasing(segmentProgress, segment.degree) * segment.displacement; break; } diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index e4e0d66f39..27f271791c 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -303,9 +303,6 @@ namespace CalamityMod int item = -1; switch (style) { - case 0: - item = ModContent.ItemType(); - break; case 1: item = ModContent.ItemType(); break; @@ -450,18 +447,12 @@ namespace CalamityMod case 50: item = ModContent.ItemType(); break; - case 51: - item = ModContent.ItemType(); - break; case 52: item = ModContent.ItemType(); break; case 53: item = ModContent.ItemType(); break; - case 54: - item = ModContent.ItemType(); - break; case 55: item = ModContent.ItemType(); break; @@ -489,9 +480,6 @@ namespace CalamityMod case 63: item = ModContent.ItemType(); break; - case 64: - item = ModContent.ItemType(); - break; case 65: item = ModContent.ItemType(); break; diff --git a/Utilities/TileFraming.cs b/Utilities/TileFraming.cs index d490efc7b8..6ffeacb591 100644 --- a/Utilities/TileFraming.cs +++ b/Utilities/TileFraming.cs @@ -13,6 +13,8 @@ using Terraria.ModLoader; namespace CalamityMod { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. + // OnModLoad is guaranteed to be run after all content has autoloaded. public static class TileFraming { private static int[][] PlantCheckAgainst; diff --git a/Waters/CustomLavaManagement.cs b/Waters/CustomLavaManagement.cs index 3ba4dac11d..8006f2ed39 100644 --- a/Waters/CustomLavaManagement.cs +++ b/Waters/CustomLavaManagement.cs @@ -10,6 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Waters { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class CustomLavaManagement { internal static List CustomLavaStyles; diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index b5102fa65a..5e41427fc2 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -14,6 +14,7 @@ using static CalamityMod.Schematics.SchematicManager; namespace CalamityMod.World { + // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public static class DraedonStructures { private static int[] otherModTilesToAvoid;