-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
New CVars: mp_weapondrop
and mp_ammodrop
and fixes
#840
Conversation
Nice! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code style fixes
Co-authored-by: Sergey Shorokhov <[email protected]>
I've been thinking on a nice way to implement that. Thing is: drop weapons separately guided by player angles (left to right, depending on how many weapons player will drop) or drop weapons in forward, each one further forward than the last (easy implementation, just store them into an array and apply an scalar to their current velocity since all are going forward) - will take a look and then test |
Co-authored-by: Sergey Shorokhov <[email protected]>
Added new behaviour: mp_weapondrop 3 (as @StevenKal requested) will ensure players drop all their weapons (primary and secondary) after death. It basically uses the same pattern but every box created has more velocity than its predecessor. Depending on physics, players can stand still, be on mid air or just running fast, and that will affect weapons drop spreading. Used sv_cheats 1 and impulse 255 for testing purposes only, because in legit scenarios players can have at least 2 weapons. Credits to @metita for his help in test scenarios. |
mp_weapondrop
and mp_ammodrop
mp_weapondrop
and mp_ammodrop
and fixes
@@ -1386,78 +1395,130 @@ void PackPlayerNade(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) | |||
void CBasePlayer::PackDeadPlayerItems() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CBasePlayer::PackDeadPlayerItems()
function looks terrible (it's not because of your PR). It needs refactoring (later), for the logic is hard to track. 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wopox1337 yeah you're right, I just tried to stick to the original code but indeed it is certainly bad coded
mp_weapondrop
which controls behaviour on weapon drop after death. You can choose between(0)
do not drop anything after death,(1)
drop your heaviest weapon (default behaviour),(2)
drop your active weapon or(3)
drop all your weapons. It works independently ofmp_nadedrops
cvar (and it's also an extension of it)mp_ammodrop
which controls behaviour of ammo packing on weapon boxes drop. You can choose between(0)
keep ammo on player always,(1)
drop ammo on weaponbox only after death and(2)
drop ammo on every weaponbox you drop either death or manual drop.CreateWeaponBox
; ammo was not getting reset ifpackAmmo = true
, no matter if weapon is not considered "exhaustible"CanDrop
used insidePackDeadPlayerItems
in case modders want to make a weapon undroppable.PackPlayerItem
now returns the entity created.DeadPlayerWeapons
) and added an extra.Related to/fixes close #520 #620 #758 #821
Tested, work as intended
PS: Cvar's names/description corrections are welcome