tModLoader Single Fire Fix: responsive single-fire weapons

Mail

Official Terrarian
This mod dramatically improves the responsiveness of single-fire weapons. Rather than a mod, this an unofficial bug-fix and a major quality of life improvement. Normally the game will ignore your input if you use a weapon just before it is ready, but with this mod, your input won't be ignored if you keep holding the button.

Fast attacking weapons will more easily and consistently achieve maximum DPS. Slow weapons will slightly increase in DPS and never require multiple clicks/button presses per attack. For those of you with frame perfect timing this does not increase attack speeds at all. Lower skill players will see this fix as a slight buff to most single-fire weapons in the game.

The reason this fix exists as a mod instead of being included in the base game is that weapon attack speeds are slightly inflated to compensate how the game frequently fails to register clicks and button presses and the developers don't want to have to review the attack speed of every single-fire weapon in the game this late in development.


For a version that works with 1.4 see my other thread for the Terraria Tweaker 2 edition of this mod.


I've posted this thread to use as the homepage in the mod browser since I can't change the standalone label or rename the mod on the other thread.

No need to direct download this mod. Search for it in the mod browser!

Code:
using Terraria;
using Terraria.ModLoader;
using OnPlayer = On.Terraria.Player;

namespace SingleFireFix
{
    class SingleFireFix : Mod
    {
        public static bool itemUsed = false;
   
        public override void Load() {
            OnPlayer.ItemCheck += WrapItemCheck;
            OnPlayer.HasAmmo += WrapUse;
        }
   
        private static void WrapItemCheck(OnPlayer.orig_ItemCheck orig, Terraria.Player self, int i) {
            bool didClick = self.controlUseItem && self.releaseUseItem;
            itemUsed = false;
            orig(self, i);
            if(didClick && !itemUsed)
                self.releaseUseItem = true;
        }
        private static bool WrapUse(OnPlayer.orig_HasAmmo orig, Terraria.Player self, Terraria.Item i, bool canUse) {
            return itemUsed = orig(self, i, canUse);
        }
    }
}
 

Attachments

  • SingleFireFix.0.9.1.zip
    6.9 KB · Views: 138
Last edited:
Back
Top Bottom