Server: Add sv_forceweapondraw 0/1, which lets mods override whether or not
the first weapon the player picks up will be deployed automatically.
This commit is contained in:
parent
a1b68075fa
commit
df1388f9fc
1 changed files with 21 additions and 4 deletions
|
@ -1,4 +1,22 @@
|
|||
#ifdef SERVER
|
||||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* force the drawing of the first weapon that's picked up */
|
||||
var int autocvar_sv_forceweapondraw = TRUE;
|
||||
|
||||
int
|
||||
Weapon_GetCount(void)
|
||||
{
|
||||
|
@ -84,7 +102,7 @@ Weapons_AddItem(base_player pl, int w, int startammo)
|
|||
value = TRUE;
|
||||
|
||||
/* it's new, so autoswitch? */
|
||||
if (pl.activeweapon == 0) {
|
||||
if (pl.activeweapon == 0 && autocvar_sv_forceweapondraw) {
|
||||
pl.activeweapon = w;
|
||||
Weapons_Draw();
|
||||
} else {
|
||||
|
@ -101,7 +119,7 @@ Weapons_AddItem(base_player pl, int w, int startammo)
|
|||
value = g_weapons[w].pickup(TRUE, startammo);
|
||||
|
||||
/* it's new, so autoswitch? */
|
||||
if (pl.activeweapon == 0) {
|
||||
if (pl.activeweapon == 0 && autocvar_sv_forceweapondraw) {
|
||||
pl.activeweapon = w;
|
||||
Weapons_Draw();
|
||||
} else {
|
||||
|
@ -201,4 +219,3 @@ CSEv_DropWeapon(void)
|
|||
player pl = (player)self;
|
||||
Weapon_DropCurrentWeapon(pl);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue