Repository navigation
Better Ammo Boxes - #1773
Better Ammo Boxes#1773MrXonte wants to merge 13 commits into
Conversation
|
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 |
|
i assume this just removes the weird behaviour ttt does where it "rounds down" ammo?
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 |
yep exactly. This weird <25% rounding that has been an inconsistent mess ever since you can drop from reserve instead of only from clip.
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. Also for custom weapon bases, unless they inherit from and override tttbase without calling the baseclass as well, they should be fine. |
|
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 |
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.
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). I was however thinking about other changes to ammo management in #1751 , but those are beyond the scope of this PR. |
|
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 |
yea for now its just a small little change. Bigger changes to all ammo management are on my todo in the future.
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.
true! Probably calling the default ammo drop function with a small delay. |
|
So ive been busy and also tackled #1751 . Here just a short list of what ive done: Changed reserve ammo to be a global parameter that has nothing todo with an entities AmmoMax. Theoretically now allows for other ammo entities for the same ammo type without breaking. Supports old custom ammo that uses AmmoMax out of the box. |
|
Sorry, we are quite busy with work! @mexikoedi would you mind checking this out and help us with testing this independently? Id love to have you try this out as one of the most active people :) |
|
I tested it and it works without errors. But I also found some stuff which could be adjusted.
|
Sure, no problem!
Yeah, that's because I'm only scaling the visuals on the client side, not touching the server-side physics. It could be fixed by turning it into a server-side convar instead, but that would lose client-side control over this feature. Which do you think is the best approach?
It allows you to have multiple ammo entities for the same ammo type. So you could have a big and a small 9mm box if you wanted to. Very niche feature, but I thought it would be nice to have. Can be removed though. |
|
|
I think we should remove the model scaling part for now and can then iterate on that in a follow up PR instead. I like the other changes though. And thx @mexikoedi for helping us out here |
|
Finally found the time to do everything that was requested. no more box model scaling |
|
@saibotk it is ready |
|
Nice! @MrXonte can you add some screenshots to the PR description? |
updated the original PR message with the actual final state and a screenshot of the F1 menu. Also screenshot here as well |




Ammo boxes no longer despawn after the ammo has been picked from them, and they have less than 25% capacity left.
Maximum Reserve ammo is now a serverwide setting and no longer controlled by the individual ammo entity. Maximum reserve value can be controlled via F1 Administration -> Ammo Settings.
Ammo given by an ammo box entity can now be set in the same F1 menu.
Mutliple ammo box entities for the same ammo type that give different amounts of ammo are now possible.
(edited with final push state)