Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better Ammo Boxes #1773

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Better Ammo Boxes #1773

wants to merge 5 commits into from

Conversation

MrXonte
Copy link
Contributor

@MrXonte MrXonte commented Feb 20, 2025

Ammo boxes no longer despawn after the ammo has been picked from them, and they have less than 25% capacity left. It was always possible to create boxes with less than 25% capacity since boxes check your clip size when dropping ammo but check their max size for despawning. Aka, if an SMG with a 10-round clip drops 3 ammo, that's valid, even though that's less than 25% of the 30-round SMG ammo box capacity. This should be more consistent now as there is no lower limit.

Ammo boxes are now visually scaled with ammo stored from 50-100% model scale.

@MrXonte
Copy link
Contributor Author

MrXonte commented Feb 20, 2025

Should I add a convar to enable the box scaling? This feels like a minor change with no real downsides to me.

I also wanted to get your opinions on a further part of this change I want to add: Removing Weapon Ammo Storage
Personally, I find it very irritating that weapons store ammo in them (beyond the clip), especially since you can't see it. Wouldn't it make more sense to make you drop your ammo instead of storing it in the weapon? With ammo boxes next to it that not only communicates that there is ammo there it also makes switching between weapons of the same ammo type so much better. Its incredibly annoying when you switch but have all your ammo stuck in the old weapon you just dropped, then pick it up again, drop the ammo and be fast enough to switch guns before you can autopickup the ammo you just dropped again.

@wgetJane
Copy link
Contributor

i assume this just removes the weird behaviour ttt does where it "rounds down" ammo?

Removing Weapon Ammo Storage

while i think the way ammo gets stored in dropped guns is silly as well, i think it's going to be very difficult to change it in a way that keeps ttt2 compatible with most of existing weapon addons: everything from custom t weps, custom floor weps, to completely different weapon bases, idk how you're supposed to really handle that

at most i think it would really only make sense for the ttt weapon base and only ones that use smg, shotgun, rifle, deagle, and pistol ammo

@MrXonte
Copy link
Contributor Author

MrXonte commented Feb 20, 2025

i assume this just removes the weird behaviour ttt does where it "rounds down" ammo?

yep exactly. This weird <25% rounding that has been an inconsistent mess ever since you can drop from reserve instead of only from clip.

Removing Weapon Ammo Storage

while i think the way ammo gets stored in dropped guns is silly as well, i think it's going to be very difficult to change it in a way that keeps ttt2 compatible with most of existing weapon addons: everything from custom t weps, custom floor weps, to completely different weapon bases, idk how you're supposed to really handle that

at most i think it would really only make sense for the ttt weapon base and only ones that use smg, shotgun, rifle, deagle, and pistol ammo

My plan was toverify that the ammo type exists and then drop them as boxes, that would also allow for this to work for third party ammo types.
To not break any addons, the original code would need to remain for unknown ammo types, still storing the ammo in the gun. I would change the weird behaviour there though, since currently you store all your reserve ammo in the gun, but when you pick it up again you delete any stored ammo above your clipMax. For default weapons clipmax is equal to the ammo box max so no issue, but if you have a gun with less or more than that you can give yourself ammo above max or delete stored ammo.

Also for custom weapon bases, unless they inherit from and override tttbase without calling the baseclass as well, they should be fine.

@wgetJane
Copy link
Contributor

wgetJane commented Feb 20, 2025

not sure how you'd make easy to use without adding a sort of ammo inventory ui for players

maybe i guess have a radial menu that pops up when you hold the current ammo drop bind?

it could easily display all your reserve ammo and you mouseover and release the key to drop some amount from it (and of course an option at the top or bottom of the radial menu to drop your current gun's clip)

it could internally work as just calling a concommand with the ammo type as the arg so it'd work with potential custom ammo types

also how do you handle picking up ammo for guns you don't own? i assume you'd be able to manually pick up ammo?

ammo boxes also would need to drop on death as well

@MrXonte
Copy link
Contributor Author

MrXonte commented Feb 20, 2025

it could internally work as just calling a concommand with the ammo type as the arg so it'd work with potential custom ammo types

Its actually super easy, you just check if the weps ammoEnt is valid, and if so create a box. If not, leave it at the current stored ammo system. Thats also how ammo dropping currently works, since many weps already don't have ammo entitites.

not sure how you'd make easy to use without adding a sort of ammo inventory ui for players

maybe i guess have a radial menu that pops up when you hold the current ammo drop bind?

it could easily display all your reserve ammo and you mouseover and release the key to drop some amount from it (and of course an option at the top or bottom of the radial menu to drop your current gun's clip)

also how do you handle picking up ammo for guns you don't own? i assume you'd be able to manually pick up ammo?

You cant currently have ammo from multiple different types in reserve unless you have a wep with that ammo type and I don't plan to support that (as it causes generell issues with ammo availability, weapon swape tradeoffs, etc).
What i want to do is only to change it so that when you drop your wep you also drop the matching ammo boxes if possible instead of storing the ammo in the gun.

I was however thinking about other changes to ammo management in #1751 , but those are beyond the scope of this PR.

@wgetJane
Copy link
Contributor

oh that's much simpler than i imagined you were gonna implement it

imo it'll feel a little odd to drop a bunch of ammo boxes when trying to drop a weapon, maybe keep it to 1 ammo box at most even if it'll have a ton of ammo inside

you'd also need to delay their drop or offset their initial pos so they dont immediately collide with each other in the air

@MrXonte
Copy link
Contributor Author

MrXonte commented Feb 21, 2025

oh that's much simpler than i imagined you were gonna implement it

yea for now its just a small little change. Bigger changes to all ammo management are on my todo in the future.

imo it'll feel a little odd to drop a bunch of ammo boxes when trying to drop a weapon, maybe keep it to 1 ammo box at most even if it'll have a ton of ammo inside

given the current rules you would at most drop 2 boxes since that's the max reserve which should be ok i think? Tons of boxes would be super weird, I agree.
Nevermind for pistol ammo its 3 boxes, for anything else 2. WHY

you'd also need to delay their drop or offset their initial pos so they dont immediately collide with each other in the air

true! Probably calling the default ammo drop function with a small delay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants