From 4716ae5c73a0198fbc4e862dee2550e5ada17ae2 Mon Sep 17 00:00:00 2001 From: Xyk Date: Fri, 6 Feb 2026 13:34:33 -0800 Subject: [PATCH] Meld Particle Layering Fixes Also fixes the homing on antumbra shard when it kills an enemy --- Items/Weapons/Melee/EntropicClaymore.cs | 6 ++++-- Projectiles/Magic/CosmicTentacle.cs | 4 ++++ Projectiles/Ranged/CosmicFire.cs | 2 ++ Projectiles/Ranged/DeadSunExplosion.cs | 4 ++++ Projectiles/Rogue/AntumbraShardProjectile.cs | 6 +++++- Projectiles/Rogue/DestructionBolt.cs | 5 ++++- Projectiles/Rogue/DestructionStar.cs | 9 +++++++-- 7 files changed, 30 insertions(+), 6 deletions(-) diff --git a/Items/Weapons/Melee/EntropicClaymore.cs b/Items/Weapons/Melee/EntropicClaymore.cs index 8ade723dba..8316a87785 100644 --- a/Items/Weapons/Melee/EntropicClaymore.cs +++ b/Items/Weapons/Melee/EntropicClaymore.cs @@ -1,8 +1,9 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Enums; +using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -90,6 +91,7 @@ namespace CalamityMod.Items.Weapons.Melee GeneralParticleHandler.SpawnParticle(spark3); Particle spark2 = new SparkParticle(partPos, partVel, false, 24, partScale * 0.6f, Color.LightGreen); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; } Vector2 dustVel2 = new Vector2(5 * swordDirection, -5).RotatedBy(swingRotation - 1.7f * swordDirection); diff --git a/Projectiles/Magic/CosmicTentacle.cs b/Projectiles/Magic/CosmicTentacle.cs index 82d268e778..f1edf2171f 100644 --- a/Projectiles/Magic/CosmicTentacle.cs +++ b/Projectiles/Magic/CosmicTentacle.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -58,6 +59,7 @@ namespace CalamityMod.Projectiles.Magic GeneralParticleHandler.SpawnParticle(blastRing); Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor * 0.6f, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.48f * scaler, 0f, 4, true); GeneralParticleHandler.SpawnParticle(blastRing2); + blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything; } Projectile.velocity *= 0.96f; if (time == 3) @@ -89,6 +91,7 @@ namespace CalamityMod.Projectiles.Magic GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 12, 0.035f * scaling, Color.LightGreen * 0.75f, new Vector2(1.7f - (1 - sharpScaling), 0.9f + (1 - sharpScaling) * 2)); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; } if (Main.rand.NextBool(6)) { @@ -111,6 +114,7 @@ namespace CalamityMod.Projectiles.Magic { Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, InnerColor, "CalamityMod/Particles/LargeBloom", Vector2.One, Main.rand.NextFloat(-10, 10), 0.36f, 0f, scalingTimerMax / 2, true); GeneralParticleHandler.SpawnParticle(blastRing2); + blastRing2.DrawLayer = GeneralDrawLayer.AfterEverything; } Projectile.velocity = Vector2.Zero; } diff --git a/Projectiles/Ranged/CosmicFire.cs b/Projectiles/Ranged/CosmicFire.cs index 6a11f73d6f..1b8c93bc9f 100644 --- a/Projectiles/Ranged/CosmicFire.cs +++ b/Projectiles/Ranged/CosmicFire.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -60,6 +61,7 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.05f, "CalamityMod/Particles/GlowSpark", false, 17, 0.027f, Color.LightGreen, new Vector2(0.6f, 1.3f), true, false); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; } if (Time == 9f) diff --git a/Projectiles/Ranged/DeadSunExplosion.cs b/Projectiles/Ranged/DeadSunExplosion.cs index 040893cf7e..18d952eb85 100644 --- a/Projectiles/Ranged/DeadSunExplosion.cs +++ b/Projectiles/Ranged/DeadSunExplosion.cs @@ -1,5 +1,7 @@ using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Particles; +using CalamityMod.Projectiles.Pets; using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -32,6 +34,7 @@ namespace CalamityMod.Projectiles.Ranged { Particle explosion = new DetailedExplosion(Projectile.Center, Vector2.Zero, color1, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0065f + 0.1f, Main.rand.Next(15, 22)); GeneralParticleHandler.SpawnParticle(explosion); + explosion.DrawLayer = GeneralDrawLayer.AfterEverything; Particle explosion2 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0045f + 0.1f, Main.rand.Next(15, 22), false); GeneralParticleHandler.SpawnParticle(explosion2); Particle explosion3 = new DetailedExplosion(Projectile.Center, Vector2.Zero, Color.Black, Vector2.One, Main.rand.NextFloat(-5, 5), 0f, ExplosionRadius * 0.0030f + 0.1f, Main.rand.Next(15, 22), false); @@ -41,6 +44,7 @@ namespace CalamityMod.Projectiles.Ranged { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, color1, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0, ExplosionRadius * 0.005f + 0.05f, 25); GeneralParticleHandler.SpawnParticle(blastRing); + blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; } float numberOfDusts = ExplosionRadius * 0.1f + 10; diff --git a/Projectiles/Rogue/AntumbraShardProjectile.cs b/Projectiles/Rogue/AntumbraShardProjectile.cs index 18899e0bdf..bd944e8832 100644 --- a/Projectiles/Rogue/AntumbraShardProjectile.cs +++ b/Projectiles/Rogue/AntumbraShardProjectile.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Enums; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -109,6 +110,7 @@ namespace CalamityMod.Projectiles.Rogue GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new SparkParticle(Projectile.Center, -Projectile.velocity * randVel, false, lifetime, 0.9f, Color.LightGreen); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; if (Main.rand.NextBool() && !Projectile.Calamity().stealthStrike) { Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.FireworksRGB); @@ -126,10 +128,11 @@ namespace CalamityMod.Projectiles.Rogue GeneralParticleHandler.SpawnParticle(spark); Particle spark2 = new SparkParticle(placement, -Projectile.velocity * speed, false, 11, 0.5f, Color.LightGreen); GeneralParticleHandler.SpawnParticle(spark2); + spark2.DrawLayer = GeneralDrawLayer.AfterEverything; } if (closestTarget != null && Projectile.numHits < 1 && closestTarget.CanBeChasedBy(Projectile)) { - CalamityUtils.HomeInOnSelectedNPC(Projectile, chosenTarget, true, 0.95f, 16, 0.96f); + CalamityUtils.HomeInOnSelectedNPC(Projectile, Projectile.Center.ClosestNPCAt(2000), true, 0.95f, 16, 0.96f); } } } @@ -219,6 +222,7 @@ namespace CalamityMod.Projectiles.Rogue Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.85f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1f, 18); GeneralParticleHandler.SpawnParticle(bolt2); + bolt2.DrawLayer = GeneralDrawLayer.AfterEverything; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f * (storedVelocity.X > 0 ? 1 : -1)); } diff --git a/Projectiles/Rogue/DestructionBolt.cs b/Projectiles/Rogue/DestructionBolt.cs index 061624c956..d7f5e1c37c 100644 --- a/Projectiles/Rogue/DestructionBolt.cs +++ b/Projectiles/Rogue/DestructionBolt.cs @@ -1,4 +1,6 @@ -using CalamityMod.Particles; +using CalamityMod.Enums; +using CalamityMod.Graphics.Renderers; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -105,6 +107,7 @@ namespace CalamityMod.Projectiles.Rogue { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), Projectile.ai[1] * 0.5f, Projectile.ai[1] * 0.3f, 15, false); GeneralParticleHandler.SpawnParticle(blastRing); + blastRing.DrawLayer = GeneralDrawLayer.AfterEverything; } } else diff --git a/Projectiles/Rogue/DestructionStar.cs b/Projectiles/Rogue/DestructionStar.cs index cca15c79f5..0d25bf3cf0 100644 --- a/Projectiles/Rogue/DestructionStar.cs +++ b/Projectiles/Rogue/DestructionStar.cs @@ -1,4 +1,6 @@ using CalamityMod.Dusts; +using CalamityMod.Enums; +using CalamityMod.Graphics.Renderers; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -151,15 +153,15 @@ namespace CalamityMod.Projectiles.Rogue internal void Explode(bool big) { - - float sizeBonus = big ? Main.zenithWorld ? 6 : 2 : 1; float bigExplosionDamage = 3f; Player Owner = Main.player[Projectile.owner]; Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen with { A = 0 }, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f * sizeBonus, 11); GeneralParticleHandler.SpawnParticle(orb); + orb.DrawLayer = GeneralDrawLayer.AfterEverything; Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f * sizeBonus, 11); GeneralParticleHandler.SpawnParticle(orb2); + orb2.DrawLayer = GeneralDrawLayer.AfterEverything; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (big ? Main.zenithWorld ? bigExplosionDamage * 4f : bigExplosionDamage : Projectile.Calamity().stealthStrike ? 0.25f : 1f)), Projectile.knockBack * 1.5f, Projectile.owner); @@ -190,12 +192,15 @@ namespace CalamityMod.Projectiles.Rogue Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 1.3f * sizeBonus, 18); GeneralParticleHandler.SpawnParticle(bolt2); + bolt2.DrawLayer = GeneralDrawLayer.AfterEverything; Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * sizeBonus, 30); GeneralParticleHandler.SpawnParticle(bolt3); + bolt3.DrawLayer = GeneralDrawLayer.AfterEverything; Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.LightGreen * 0.55f, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f * sizeBonus, 30); GeneralParticleHandler.SpawnParticle(bolt4); + bolt4.DrawLayer = GeneralDrawLayer.AfterEverything; for (int i = 0; i < 2; i++) {