Merge pull request #2 from cyber-bridge/master

Honor weapon .pickup return value.
This commit is contained in:
Marco Cawthorne 2022-01-04 01:30:07 +01:00 committed by GitHub
commit a0cec88f3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -163,17 +163,21 @@ Weapons_AddItem(base_player pl, int w, int startammo)
if (!value) if (!value)
return value; return value;
} else { } else {
/* new to our arsenal, so always return TRUE */ /* new to our arsenal */
g_weapons[w].pickup(TRUE, startammo); if (g_weapons[w].pickup(TRUE, startammo) == TRUE) {
pl.g_items |= g_weapons[w].id; pl.g_items |= g_weapons[w].id;
value = TRUE; value = TRUE;
/* it's new, so autoswitch? */ /* it's new, so autoswitch? */
if (pl.activeweapon == 0 && autocvar_sv_forceweapondraw == 1) { if (pl.activeweapon == 0 && autocvar_sv_forceweapondraw == 1) {
pl.activeweapon = w; pl.activeweapon = w;
Weapons_Draw(); Weapons_Draw();
} else {
Weapons_PickupNotify(pl, w);
}
} else { } else {
Weapons_PickupNotify(pl, w); /* cannot pickup this weapon (weapon says no) */
return FALSE;
} }
} }
} }