From 1219413040a5a9b673d7a4d4afd82613dd3d6a35 Mon Sep 17 00:00:00 2001 From: Niko Date: Wed, 12 Nov 2025 11:02:57 +0000 Subject: [PATCH] Add texture for Visor Shard --- Content/Items/Materials/VisorShard.cs | 41 ++++++++++++++++-- Content/Items/Materials/VisorShard.png | Bin 504 -> 37386 bytes .../en-US_Mods.ForgottenWawiTech.hjson | 9 ++-- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/Content/Items/Materials/VisorShard.cs b/Content/Items/Materials/VisorShard.cs index 02eca15..fa9dfd8 100644 --- a/Content/Items/Materials/VisorShard.cs +++ b/Content/Items/Materials/VisorShard.cs @@ -1,20 +1,55 @@ +// Animated by Axl_The_Protogen using Terraria.ID; using Terraria; using Terraria.ModLoader; +using Terraria.DataStructures; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using Terraria.GameContent; using ForgottenWawiTech.Content.Rarities; namespace ForgottenWawiTech.Content.Items.Materials { public class VisorShard : ModItem { + private const int FRAME_COUNT = 9; + private const int TICKS_PER_FRAME = 10; + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(TICKS_PER_FRAME, FRAME_COUNT)); + + } public override void SetDefaults() { - Item.width = 20; - Item.height = 20; + Item.width = 32; + Item.height = 32; Item.maxStack = 9999; Item.rare = ModContent.RarityType(); - Item.value = Item.buyPrice(gold: 1); + Item.value = Item.buyPrice(gold: 50); + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Item[Type].Value; + + // Protect against incorrect frame count + int frameHeight = texture.Height / Math.Max(1, FRAME_COUNT); + int frame = (int)((Main.GameUpdateCount / (ulong)Math.Max(1, TICKS_PER_FRAME)) % (ulong)Math.Max(1, FRAME_COUNT)); + + Rectangle source = new Rectangle(0, frame * frameHeight, texture.Width, frameHeight); + + Vector2 drawPos = Item.Center - Main.screenPosition; + Vector2 origin = new Vector2(source.Width / 2f, source.Height / 2f); + + // Use alphaColor for dropped items (includes item alpha), multiplied by light + Color drawColor = lightColor; + + spriteBatch.Draw(texture, drawPos, source, drawColor, rotation, origin, scale, SpriteEffects.None, 0f); + + return false; // we've handled the draw } } } \ No newline at end of file diff --git a/Content/Items/Materials/VisorShard.png b/Content/Items/Materials/VisorShard.png index 9e0cf81e52f4133dbe85453dd9a37993af17b5be..00594fbcc4d8f8a4c8eae07875250f0fcf59cb75 100644 GIT binary patch literal 37386 zcmeHQPiP%Q7@sHoqxpk1VrUKGSbauTEmQ&O6DXsMwW4@$KMua%}EA~c8>K@>cR z))tQu4>=W4cP9JW%>3TY+nKE}vzzZhy8FG|owvW=_s#dO zv+uoo?(FI5iAN@sQq#kg<<(+4uhd}v-Xq1{&(p6xS8N8CS5KcD-2Uo-39WUNIx;8v>>gey2Qxnh3e*Vipf9V?-E-#&bW1z0Cuj`MztJlB9 z)%vgX>z>wE{!bSU?s6PPA3a__7+73fG(>J}Y=F>UCi=m^+}xZ&e*CzecS^-D(OCwJ z^)vFVt-?hWuNWqhGjPbiUii|uNfUgH~9}_?dX0Gqo1wiOUjuWzD05|5$f4mv6ZA8ptBxitc zC|1@?wPnkER&oZSbw(61`snfc!2tZmxTr_WRboFF;94<;iOw=$te=r{> zanz3NA8a{08yK7EpbBQBECab^^wk_Y@Z*K!1 zUO)U6)&kfgCfwIE$nl)9_tKt?*iZ7DAFV$chtWrm*AE8ZLqh68Vle;QfNz-P+Bg!! zL}zWF7CGVu;z$S+$r+GdK`REVtjEj>=@rOY0$EFdwF9!20R16ZOMvPrBr0Yb4V`$8 zI*=>kCK*g{8fDAL8Q?tLK@J@v(+On)$gQZ!pHq>LCj-dyf!xOgkb)WM6%>l~>bg=o z?IgDWx}RuK&l)pxqOUA3NX|gC&Il=^j~=fd48U)M)PlsI^ar}jz}TpX*b!nA$!9^U z>R8qiSecHQ)=!ozZMV0#9T{`JI3FH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&2)78&qol`;+07t#pIRF3v diff --git a/Localization/en-US_Mods.ForgottenWawiTech.hjson b/Localization/en-US_Mods.ForgottenWawiTech.hjson index 1f27e29..646ea88 100644 --- a/Localization/en-US_Mods.ForgottenWawiTech.hjson +++ b/Localization/en-US_Mods.ForgottenWawiTech.hjson @@ -121,8 +121,8 @@ Items: { DisplayName: Visor Shard Tooltip: ''' - A fragment of a high-tech visor. - Emits a faint glow. + A fragment of a broken Nanite Visor. + Still hums with residual energy. ''' } @@ -231,10 +231,7 @@ Items: { } NeptuneTrophyItem: { - Tooltip: - ''' - Surprisingly large for a trophy. Especially from an otter. - ''' + Tooltip: Surprisingly large for a trophy. Especially from an otter. DisplayName: Neptune Trophy Item } }