mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-10 14:42:05 +00:00
SERVER: Fix automatic reload not always functioning
This commit is contained in:
parent
8935f1889d
commit
8bdf2e2f1f
3 changed files with 21 additions and 12 deletions
|
@ -523,32 +523,41 @@ float() PU_CarpenterRequirement =
|
||||||
//
|
//
|
||||||
void() PU_MaxAmmo =
|
void() PU_MaxAmmo =
|
||||||
{
|
{
|
||||||
|
entity players;
|
||||||
entity tempe;
|
entity tempe;
|
||||||
|
|
||||||
tempe = find(world, classname, "player");
|
players = find(world, classname, "player");
|
||||||
|
|
||||||
while(tempe) {
|
while(players) {
|
||||||
|
|
||||||
if (!tempe.downed) {
|
if (!players.downed) {
|
||||||
// Fill all weapons
|
// Fill all weapons
|
||||||
for (float i = 0; i < MAX_PLAYER_WEAPONS; i++) {
|
for (float i = 0; i < MAX_PLAYER_WEAPONS; i++) {
|
||||||
tempe.weapons[i].weapon_reserve = getWeaponAmmo(tempe.weapons[i].weapon_id);
|
players.weapons[i].weapon_reserve = getWeaponAmmo(players.weapons[i].weapon_id);
|
||||||
}
|
}
|
||||||
// Give Grenades
|
// Give Grenades
|
||||||
tempe.primary_grenades = 4;
|
players.primary_grenades = 4;
|
||||||
// Give Betties
|
// Give Betties
|
||||||
if (tempe.grenades & 2) tempe.secondary_grenades = 2;
|
if (players.grenades & 2) players.secondary_grenades = 2;
|
||||||
} else {
|
} else {
|
||||||
// Reset shots fired, fill 2 mags into reserve.
|
// Reset shots fired, fill 2 mags into reserve.
|
||||||
tempe.teslacount = 0;
|
players.teslacount = 0;
|
||||||
tempe.currentammo = getWeaponMag(tempe.weapon) * 2;
|
players.weapons[0].weapon_reserve = getWeaponMag(players.weapon) * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Force the player to reload if their mag is empty
|
||||||
|
if (players.weapons[0].weapon_magazine == 0 || players.weapons[0].weapon_magazine_left == 0) {
|
||||||
|
tempe = self;
|
||||||
|
self = players;
|
||||||
|
W_Reload(S_BOTH);
|
||||||
|
self = tempe;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MAX AMMO! text
|
// MAX AMMO! text
|
||||||
|
|
||||||
#ifdef FTE
|
#ifdef FTE
|
||||||
|
|
||||||
ScrollText("MAX AMMO!", tempe);
|
ScrollText("MAX AMMO!", players);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -556,7 +565,7 @@ void() PU_MaxAmmo =
|
||||||
|
|
||||||
#endif // FTE
|
#endif // FTE
|
||||||
|
|
||||||
tempe = find(tempe, classname, "player");
|
players = find(players, classname, "player");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ void (float animation_type, void(optional float t) end_function, float playback_
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = self.knife_delay = time + duration + 0.2;
|
self.reload_delay2 = self.fire_delay2 = self.reload_delay = self.fire_delay = self.knife_delay = time + duration;
|
||||||
|
|
||||||
UpdateVmodel(self.weaponmodel, GetWepSkin(self.weapon));
|
UpdateVmodel(self.weaponmodel, GetWepSkin(self.weapon));
|
||||||
self.weapon2model = GetWeapon2Model(self.weapon);
|
self.weapon2model = GetWeapon2Model(self.weapon);
|
||||||
|
|
|
@ -94,7 +94,7 @@ void() ReturnWeaponModel =
|
||||||
UpdateV2model(self.weapon2model, GetWepSkin(self.weapon));
|
UpdateV2model(self.weapon2model, GetWepSkin(self.weapon));
|
||||||
|
|
||||||
// Always try to reload after any action.
|
// Always try to reload after any action.
|
||||||
if (self.weapons[0].weapon_magazine == 0 && self.weapons[0].weapon_reserve != 0)
|
if ((self.weapons[0].weapon_magazine == 0 || self.weapons[0].weapon_magazine_left == 0) && self.weapons[0].weapon_reserve != 0)
|
||||||
W_Reload(S_BOTH);
|
W_Reload(S_BOTH);
|
||||||
|
|
||||||
// If the person is swapping, play the sprint anim if they're sprinting after swap. Otherwise it plays idle
|
// If the person is swapping, play the sprint anim if they're sprinting after swap. Otherwise it plays idle
|
||||||
|
|
Loading…
Reference in a new issue