source-sdk-2013 icon indicating copy to clipboard operation
source-sdk-2013 copied to clipboard

all games: Add sv_infinite_ammo ConVar

Open copperpixel opened this issue 8 months ago • 3 comments

This PR implements the sv_infinite_ammo cheat-protected ConVar from Left 4 Dead/Alien Swarm. When enabled, it prevents the player's active weapon from depleting ammo. Furthermore, added functionality from Counter-Strike : GO where setting the ConVar to 2 or higher will only replenish the weapon's reserve (so the player still has to reload).

In Team Fortress 2, it also refills metal and weapon/item charges.

Closes:

  • https://github.com/ValveSoftware/Source-1-Games/issues/3673
  • https://github.com/ValveSoftware/Source-1-Games/issues/3828

copperpixel avatar Apr 22 '25 23:04 copperpixel

This doesn't seem to work with energy weapons in TF2

Should be fixed now

copperpixel avatar Apr 23 '25 05:04 copperpixel

Added your suggested changes, thanks! Although the SetScoutHypeMeter call is still needed as the Soda Popper charge doesn't seem to be affected by SetRageMeter and SetItemChargeMeter (impulse 101 doesn't affect it either).

copperpixel avatar Apr 24 '25 15:04 copperpixel

That may have just been an issue with my testing setup, then.

brokenparts avatar Apr 24 '25 17:04 brokenparts

Should infinite ammo apply to charge meters? Non-weapons in general? Shouldn't that be handled by something separate?

ZzZombo avatar Sep 11 '25 03:09 ZzZombo

Should infinite ammo apply to charge meters? Non-weapons in general? Shouldn't that be handled by something separate?

I think in most use cases where this ConVar would be used in it might be preferred to refill charges as well.

Additionally, a lot of the charge meters already can be refilled with ammo pickups.

copperpixel avatar Sep 11 '25 17:09 copperpixel