mirror of
https://github.com/nzp-team/quakec.git
synced 2025-02-19 18:31:41 +00:00
Add new weapon 99 for buy_weapon that refills any ammo
This commit is contained in:
parent
64db82d124
commit
b03114c9fa
1 changed files with 87 additions and 44 deletions
|
@ -254,10 +254,13 @@ void () buy_weapon_touch =
|
|||
float startframe,endframe;
|
||||
string modelname;
|
||||
|
||||
float wcost;
|
||||
|
||||
if (other.classname != "player" || other.downed || other.isBuying) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.weapon != 99) {
|
||||
#ifndef PC
|
||||
other.Weapon_Name_Touch = GetWeaponName(self.weapon);
|
||||
#endif
|
||||
|
@ -274,7 +277,7 @@ void () buy_weapon_touch =
|
|||
is_pap = false;
|
||||
|
||||
// Set the cost and weapon value (for useprint).
|
||||
float wcost = (is_pap) ? 4500 : self.cost2;
|
||||
wcost = (is_pap) ? 4500 : self.cost2;
|
||||
float wep = (is_pap) ? EqualPapWeapon(self.weapon) : self.weapon;
|
||||
|
||||
useprint(other, 3, wcost, wep);
|
||||
|
@ -319,6 +322,46 @@ void () buy_weapon_touch =
|
|||
self = oldent;
|
||||
}
|
||||
}
|
||||
} else
|
||||
// Universal Ammo buy
|
||||
{
|
||||
#ifndef PC
|
||||
other.Weapon_Name_Touch = GetWeaponName(other.weapon);
|
||||
#endif
|
||||
|
||||
if (other.currentammo < getWeaponAmmo(other.weapon)) {
|
||||
|
||||
// Set the cost and weapon value (for useprint).
|
||||
wcost = (IsPapWeapon(other.weapon)) ? 4500 : self.cost2;
|
||||
|
||||
useprint(other, 3, wcost, other.weapon);
|
||||
|
||||
if (!other.button7 || other.semiuse || other.isBuying) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Player doesn't have enough points. Abort.
|
||||
if (other.points < wcost) {
|
||||
centerprint(other, STR_NOTENOUGHPOINTS);
|
||||
return;
|
||||
}
|
||||
|
||||
other.currentammo = getWeaponAmmo(other.weapon);
|
||||
|
||||
sound(other, 0,"sounds/misc/ching.wav", 1, 1);
|
||||
other.reload_delay = 0;
|
||||
|
||||
// Subtract the cost from player points.
|
||||
addmoney(other, wcost*-1, 0);
|
||||
|
||||
if (self.enemy) {
|
||||
oldent = self;
|
||||
self = self.enemy;
|
||||
self.use();
|
||||
self = oldent;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (self.weapon == W_BETTY)
|
||||
{
|
||||
if (other.secondary_grenades < 2)
|
||||
|
@ -408,7 +451,7 @@ void () buy_weapon_touch =
|
|||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (self.weapon != 99)
|
||||
{
|
||||
entity tempe;
|
||||
|
||||
|
|
Loading…
Reference in a new issue