From bc002616aa6040ffc231684f2c25a548931400dc Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Fri, 9 May 2025 14:00:11 -0500 Subject: [PATCH 1/3] The Pointer --- CalPlayer/CalamityPlayer.cs | 5 ++ CalamityKeybinds.cs | 2 + Items/Accessories/ThePointer.cs | 62 ++++++++++++++++++ Items/Accessories/ThePointer.png | Bin 0 -> 523 bytes .../Mods.CalamityMod.Items.Accessories.hjson | 11 ++++ .../en-US/Mods.CalamityMod.Keybinds.hjson | 1 + 6 files changed, 81 insertions(+) create mode 100644 Items/Accessories/ThePointer.cs create mode 100644 Items/Accessories/ThePointer.png diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index b6b82b7bff..5d9180fe85 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -2568,6 +2568,11 @@ namespace CalamityMod.CalPlayer pinkCandle = false; yellowCandle = false; + + //Disable Lockon when not on gamepad to prevent it being left on forever by The Pointer + if (!Main.gamePad) + LockOnHelper.ForceUsability = false; + #region Minion Reset Effects wDroid = false; resButterfly = false; diff --git a/CalamityKeybinds.cs b/CalamityKeybinds.cs index d03b60e0a8..0aacb5f1b0 100644 --- a/CalamityKeybinds.cs +++ b/CalamityKeybinds.cs @@ -20,6 +20,7 @@ namespace CalamityMod public static ModKeybind SpectralVeilHotKey { get; private set; } public static ModKeybind TransformerHotKey { get; private set; } public static ModKeybind SwitchGravityHotkey {get; private set;} + public static ModKeybind ThePointerLock {get; private set;} public override void Load() { @@ -40,6 +41,7 @@ namespace CalamityMod SpectralVeilHotKey = KeybindLoader.RegisterKeybind(Mod, "SpectralVeilTeleport", "Z"); TransformerHotKey = KeybindLoader.RegisterKeybind(Mod, "TransformerHotKey", "K"); SwitchGravityHotkey = KeybindLoader.RegisterKeybind(Mod, "GravitySwapOverride", "T"); + ThePointerLock = KeybindLoader.RegisterKeybind(Mod, "ThePointerLock", "N"); } public override void Unload() diff --git a/Items/Accessories/ThePointer.cs b/Items/Accessories/ThePointer.cs new file mode 100644 index 0000000000..aac949df39 --- /dev/null +++ b/Items/Accessories/ThePointer.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameInput; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories +{ + public class ThePointer : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 26; + Item.height = 26; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Blue; + Item.accessory = true; + } + + public override void ModifyTooltips(List list) => list.IntegrateHotkey(CalamityKeybinds.ThePointerLock); + + public override void UpdateAccessory(Player player, bool hideVisual) + { + LockOnHelper.ForceUsability = true; + if (CalamityKeybinds.ThePointerLock.JustPressed) + { + LockOnHelper.Toggle(); + if (LockOnHelper.AimedTarget != null) + { + Vector2 dir = player.DirectionTo(LockOnHelper.AimedTarget.Center); + int loops = (int)((player.Center.Distance(LockOnHelper.AimedTarget.Center))/30f)+1; + for (var i = 1; i < loops; i++) + { + var pos = player.Center + dir*i*30f; + if (i >= loops-1) + pos = LockOnHelper.AimedTarget.Center - dir*30f; + var x = new LineParticle(pos, dir, false, 10, 1, new Color(70,70,255)); + GeneralParticleHandler.SpawnParticle(x); + } + } + } + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Glass). + AddRecipeGroup("AnyCopperBar", 2). + AddRecipeGroup("AnyIronBar",3). + AddIngredient(ItemID.ManaCrystal). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Accessories/ThePointer.png b/Items/Accessories/ThePointer.png new file mode 100644 index 0000000000000000000000000000000000000000..09529fca73ad22cc2f75155f0d6b3c92340f7e67 GIT binary patch literal 523 zcmeAS@N?(olHy`uVBq!ia0vp^QXtI13?%1G+4BcTF%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl{S5AX?bHA_5J@a2oy#=AyFMl)v2IC${jS`~|3>b4RR5`~3@|6N={LqmaT z%bEVv0x8~-Aiv=MNPxlig;E<(g0sLQvY3H^?=T269?xHq0u+=eag8Vm&QB{TPb^Ah z2uRG#E79|F4N)-FGt@KhzV_V`sAgMgglC$krxpVTki*I##mLIQ2xNHyu{4wo@|gxB zGgzDn$TnnTVh{k*Q9zv8&H@(C0}2E|pnN|2@}DTG}F##rCJlfG6(yb`|j8Za)qa>pUXO@geCw5uaVLK literal 0 HcmV?d00001 diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 97c8a4c75a..a27ab93d09 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1914,6 +1914,17 @@ TheFirstShadowflame: { ''' } +ThePointer: { + DisplayName: The Pointer + Tooltip: + ''' + Allows automatic targeting of enemies + Press [KEY] to cycle through targets near your mouse + After cycling through all close enemies, the next press will disable it + "Great for cats!" + ''' +} + TheSponge: { DisplayName: The Sponge Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson index 93d081e17b..0466f562dd 100644 --- a/Localization/en-US/Mods.CalamityMod.Keybinds.hjson +++ b/Localization/en-US/Mods.CalamityMod.Keybinds.hjson @@ -14,3 +14,4 @@ RageMode.DisplayName: Rage Mode SpectralVeilTeleport.DisplayName: Spectral Veil Teleport TransformerHotKey.DisplayName: Transformer Hot Key GravitySwapOverride.DisplayName: Gravity Swap Override +ThePointerLock.DisplayName: The Pointer Lock On From 7f20da529249c35584eadcd46cac60f50f391ebc Mon Sep 17 00:00:00 2001 From: doze-zoze Date: Sat, 3 Jan 2026 11:15:02 -0600 Subject: [PATCH 2/3] sprite! --- Items/Accessories/ThePointer.cs | 37 +++++++++++++++++------- Items/Accessories/ThePointer.png | Bin 523 -> 584 bytes Items/Accessories/ThePointer_Active.png | Bin 0 -> 649 bytes 3 files changed, 27 insertions(+), 10 deletions(-) create mode 100644 Items/Accessories/ThePointer_Active.png diff --git a/Items/Accessories/ThePointer.cs b/Items/Accessories/ThePointer.cs index aac949df39..cbf05e1b17 100644 --- a/Items/Accessories/ThePointer.cs +++ b/Items/Accessories/ThePointer.cs @@ -1,19 +1,18 @@ using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.GameInput; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { public class ThePointer : ModItem, ILocalizedModType { + public static Asset ActiveTexture; public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { @@ -35,25 +34,43 @@ namespace CalamityMod.Items.Accessories if (LockOnHelper.AimedTarget != null) { Vector2 dir = player.DirectionTo(LockOnHelper.AimedTarget.Center); - int loops = (int)((player.Center.Distance(LockOnHelper.AimedTarget.Center))/30f)+1; + int loops = (int)((player.Center.Distance(LockOnHelper.AimedTarget.Center)) / 30f) + 1; for (var i = 1; i < loops; i++) { - var pos = player.Center + dir*i*30f; - if (i >= loops-1) - pos = LockOnHelper.AimedTarget.Center - dir*30f; - var x = new LineParticle(pos, dir, false, 10, 1, new Color(70,70,255)); + var pos = player.Center + dir * i * 30f; + if (i >= loops - 1) + pos = LockOnHelper.AimedTarget.Center - dir * 30f; + var x = new LineParticle(pos, dir, false, 10, 1, new Color(238, 2, 52)); GeneralParticleHandler.SpawnParticle(x); } } } } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (LockOnHelper.AimedTarget == null) + return true; + var tex = ActiveTexture ??= ModContent.Request("CalamityMod/Items/Accessories/ThePointer_Active"); + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + tex.Value, + position, + tex.Frame(), + drawColor, + itemColor, + tex.Size() * 0.5f, + 0.1f, + wantedScale: 0.75f); + return false; + } + public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.Glass). AddRecipeGroup("AnyCopperBar", 2). - AddRecipeGroup("AnyIronBar",3). + AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.ManaCrystal). AddTile(TileID.WorkBenches). Register(); diff --git a/Items/Accessories/ThePointer.png b/Items/Accessories/ThePointer.png index 09529fca73ad22cc2f75155f0d6b3c92340f7e67..b6325d80d8f6da24bef6aaf575d29aa682a1216f 100644 GIT binary patch delta 389 zcmeBXIl-dX8Q|y6%O%Cdz`(%k>ERLtq}6~}frA-HdhYtwI8jj{O*g^k~!oBheVK+_g`x;Tbd_%FTG$aO@4hdJPF$+o$l|J#4> zcp6Y9w}P9e#dd7ulfEraK|q=ND0#EF72 ziENz(YgfI}k4awoV0p)@($)umh1VH1ud;mp=I`bcR>mEicg#~g*B+EFdq2Z*%7GpKLLAg)@-kjN^wXBv#N@2q%V?vAYlFVdQ&MBb@0Bob6_y7O^ delta 328 zcmX@X(#@jS8Q|y6%O%Cdz`(%k>ERLtq@_TZgBeK9o3iK6L`8)-^#Gp`SF^-p1z*0H zZMy)37&w3&Rt70XRt82O z%L|C5p=^*ZH5i$};!HrcAtMum0FaIX;>>myuy_`b4FccF7#Usw0|Q2*S;_#En!wJ$ z0#s>WWNg5=0Aec0M%D!olcoUKAixAPmkF#g$kGDHg6c9fFaXJ3Ryr@q`QD@n$b8`G z;uzxLz4bCTU$cS$%Y~`)4|whTpF3MKQ{l?C6OUBX+-gp4;1Yb=y^wR#=WSp4>(l#U zTsN}>zYyP-J}*X7UC|-=Yf4K7&qYeju z_tq6@J>M1QC~Ka)xl`h=Hp6odzXm6cg$E?gU*HOwP`u*UnLnM^Cd~Pm)N|%|Vy>5M zlq*-#wW!xqekra|W?eev(&I+QEg7neL96O6bzPg(H09I0ovy1-T1NRtwQ#@S3%dCG y#9e2uLktB9Y}@*MCVZOw$l}32JEo8WB9%-QF|DaR3%_jv`P Date: Sat, 3 Jan 2026 17:19:00 -0500 Subject: [PATCH 3/3] Fix double quotes in The Pointer flavor tooltip --- Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 886680afe9..53667a906e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1961,7 +1961,7 @@ ThePointer: { Allows automatic targeting of enemies Press [KEY] to cycle through targets near your mouse After cycling through all close enemies, the next press will disable it - "Great for cats!" + 'Great for cats!' ''' }