Skip to content

Commit

Permalink
Merge pull request #1293 from newbytf/dev-cur
Browse files Browse the repository at this point in the history
weapons: more stringent server side check for whether ammo exists to …
  • Loading branch information
newbytf authored Jan 24, 2024
2 parents 1d5fa44 + f5dbcd7 commit b4d7da7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ssqc/weapons.qc
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,7 @@ Slot W_BestWeaponSlot() {
for (float i = 1; i <= TF_NUM_SLOTS; i++) {
Slot slot = MakeSlot(i);
FO_FillWeapState(self, slot, &ws);
FO_WeapInfo* wi = ws->wi;

// AC also takes cells to fire.
if (ws->weapon == WEAP_ASSAULT_CANNON && self.ammo_cells < 7)
Expand All @@ -1604,7 +1605,7 @@ Slot W_BestWeaponSlot() {
// We don't need to handle out of ammo medi/spanner here because of
// fallback below.
if (ws.weapon != WEAP_NONE &&
((ws.wi)->ammo_type == AMMO_NONE || *ws.ammo_remaining))
(wi->ammo_type == AMMO_NONE || (*ws.ammo_remaining >= wi->ammo_per_shot)))
return slot;
}
return SlotMelee;
Expand Down

0 comments on commit b4d7da7

Please sign in to comment.