Merge: The Pointer

This commit is contained in:
Cameron Ewell authored and GitHub committed 2026-02-07 15:59:04 -05:00
commit 1cbee1d40d
7 files changed
+98

No files matched your search

+5
View File
@@ -2748,6 +2748,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;
SelectedFishingMinigame = FishingMinigames.None;
#region Minion Reset Effects
+2
View File
@@ -21,6 +21,7 @@ namespace CalamityMod
public static ModKeybind TransformerHotKey { get; private set; }
public static ModKeybind SwitchGravityHotkey {get; private set;}
public static ModKeybind ExpandDebuffInfo { get; private set; }
public static ModKeybind ThePointerLock {get; private set;}
public override void Load()
{
@@ -42,6 +43,7 @@ namespace CalamityMod
TransformerHotKey = KeybindLoader.RegisterKeybind(Mod, "TransformerHotKey", "K");
SwitchGravityHotkey = KeybindLoader.RegisterKeybind(Mod, "GravitySwapOverride", "T");
ExpandDebuffInfo = KeybindLoader.RegisterKeybind(Mod, "ExpandDebuffInfo", "LeftControl");
ThePointerLock = KeybindLoader.RegisterKeybind(Mod, "ThePointerLock", "N");
}
public override void Unload()
+79
View File
@@ -0,0 +1,79 @@
using System.Collections.Generic;
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.ModLoader;
namespace CalamityMod.Items.Accessories
{
public class ThePointer : ModItem, ILocalizedModType
{
public static Asset<Texture2D> ActiveTexture;
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<TooltipLine> 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(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<Texture2D>("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("IronBar", 3).
AddIngredient(ItemID.ManaCrystal).
AddTile(TileID.WorkBenches).
Register();
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 649 B

@@ -1950,6 +1950,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:
@@ -15,3 +15,4 @@ SpectralVeilTeleport.DisplayName: Spectral Veil Teleport
TransformerHotKey.DisplayName: Transformer Hot Key
GravitySwapOverride.DisplayName: Gravity Swap Override
ExpandDebuffInfo.DisplayName: See Debuff Information
ThePointerLock.DisplayName: The Pointer Lock On