From a2bb17eefd2d3336f77635db26c0995a4d7fe9ea Mon Sep 17 00:00:00 2001 From: GinYuH <72181395+GinYuH@users.noreply.github.com> Date: Fri, 3 May 2024 23:25:53 -0700 Subject: [PATCH] polter clone glow cache --- NPCs/Polterghast/PolterPhantom.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index 8343504536..6593c96a5a 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -5,6 +5,7 @@ using CalamityMod.Events; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -19,12 +20,18 @@ namespace CalamityMod.NPCs.Polterghast private int despawnTimer = 600; private bool reachedChargingPoint = false; + public static Asset GlowTexture; + public override void SetStaticDefaults() { Main.npcFrameCount[NPC.type] = 4; NPCID.Sets.TrailingMode[NPC.type] = 1; NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); + if (!Main.dedServ) + { + GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + } } public override void SetDefaults() @@ -476,7 +483,6 @@ namespace CalamityMod.NPCs.Polterghast drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, color, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - Texture2D texture2D16 = ModContent.Request("CalamityMod/NPCs/Polterghast/PolterPhantomGlow").Value; Color c = Color.Red; if (!NPC.IsABestiaryIconDummy && (Main.npc[CalamityGlobalNPC.ghostBoss].ai[2] < changeColorGateValue || Main.npc[CalamityGlobalNPC.ghostBoss].Calamity().newAI[0] > changeColorGateValue)) c = Color.Black; @@ -494,11 +500,11 @@ namespace CalamityMod.NPCs.Polterghast otherAfterimageColor = Color.Lerp(otherAfterimageColor, Color.White, 0.5f); otherAfterimageColor = NPC.GetAlpha(otherAfterimageColor); otherAfterimageColor *= (afterimageAmt - j) / 15f; - spriteBatch.Draw(texture2D16, otherAfterimagePos, NPC.frame, otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(GlowTexture.Value, otherAfterimagePos, NPC.frame, otherAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); } } - spriteBatch.Draw(texture2D16, drawLocation, NPC.frame, blackWhiteLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + spriteBatch.Draw(GlowTexture.Value, drawLocation, NPC.frame, blackWhiteLerp, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); return false; }