From c60ac9d63fffff0542095306cc0a792c0f178c54 Mon Sep 17 00:00:00 2001 From: Konstantin Gitschthaler <31093949+MrXonte@users.noreply.github.com> Date: Mon, 9 Dec 2024 11:46:01 +0100 Subject: [PATCH] Ammo Drop from reserve now tries to drop a full box, instead of, at most, a full clip (#1694) Ammo dropping from the reserve was a bit weird. You currently drop `Min(Clipsize, Reserve)`, which is fine for default weapons where clip size = box ammo, but for any custom weapon with less ammo, things get increasingly weird. The worst-case scenario involves weapons with super-low ammo. Consider the often-used pocket rifle, which has only a clip size of 1; here, you must drop ammo 10 times to drop the same as a regular 357 box. My change makes it so that instead, you now drop `Min(Box Size, Reserve)`, which feels much better and has no downsides I can see. Dropping from the clip remains unchanged as it should. --- CHANGELOG.md | 1 + gamemodes/terrortown/gamemode/server/sv_player_ext.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 725ed1463..892a20654 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ All notable changes to TTT2 will be documented here. Inspired by [keep a changel - Changes to the enabled map prefixes will not be announced to players anymore (by @Histalek) - By default only `ttt` and `ttt2` map prefixes are enabled (by @Histalek) - Updated `ttt_identify_body_woconfirm` to be replicated across the server and client (by @Wryyyong) +- Changed how Ammo is dropped; if drop should be from reserve ammo, now tries to drop a full ammo box instead of a full clip. (by @MrXonte) ## [v0.14.0b](https://github.com/TTT-2/TTT2/tree/v0.14.0b) (2024-09-20) diff --git a/gamemodes/terrortown/gamemode/server/sv_player_ext.lua b/gamemodes/terrortown/gamemode/server/sv_player_ext.lua index 81de60e53..91b6b9dc1 100644 --- a/gamemodes/terrortown/gamemode/server/sv_player_ext.lua +++ b/gamemodes/terrortown/gamemode/server/sv_player_ext.lua @@ -1465,7 +1465,7 @@ function plymeta:DropAmmo(wep, useClip, amt) if useClip then amt = wep:Clip1() else - amt = math.min(wep.Primary.ClipSize, self:GetAmmoCount(wep.Primary.Ammo)) + amt = math.min(wep.AmmoEnt.AmmoAmount, self:GetAmmoCount(wep.Primary.Ammo)) end end local hook_data = { amt }