New CVars: mp_weapondrop and mp_ammodrop and fixes#840
New CVars: mp_weapondrop and mp_ammodrop and fixes#840wopox1337 merged 8 commits intorehlds:masterfrom
mp_weapondrop and mp_ammodrop and fixes#840Conversation
|
Nice! |
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_ammodropmp_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.
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.
@wopox1337 yeah you're right, I just tried to stick to the original code but indeed it is certainly bad coded
* First implementation * Update player.cpp * Apply suggestions from code review Co-authored-by: Sergey Shorokhov <[email protected]> * Improve readability * Improve readability x2 Co-authored-by: Sergey Shorokhov <[email protected]> * Tabulation tip * Compile error resolved * Add mp_weapondrop 3: drop all weapons --------- Co-authored-by: Sergey Shorokhov <[email protected]>



mp_weapondropwhich 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_nadedropscvar (and it's also an extension of it)mp_ammodropwhich 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"CanDropused insidePackDeadPlayerItemsin case modders want to make a weapon undroppable.PackPlayerItemnow 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