SERVER: Fix weapon list when Pack-A-Punching

This commit is contained in:
cypress 2023-10-17 09:21:22 -04:00
parent 2ab61575f1
commit e58ffeb60a
2 changed files with 19 additions and 9 deletions

View file

@ -27,7 +27,7 @@
float backupWepSkin;
float sound_perk_delay;
void() W_TakeOut;
void() W_PutOutHack;
void(entity person) W_HideCrosshair;
//
@ -1188,7 +1188,7 @@ void PapUpgrade(entity pap, entity buyer) {
Weapon_RemoveWeapon(0);
W_HideCrosshair(self);
Set_W_Frame (0, 39, 2.0, 0, 0, W_PlayTakeOut, "models/machines/v_pap.mdl", true, S_BOTH);
Set_W_Frame (0, 39, 2.0, 0, 0, W_PutOutHack, "models/machines/v_pap.mdl", true, S_BOTH);
self.weapon2model = "";
UpdateV2model(self.weapon2model, 0);

View file

@ -288,6 +288,21 @@ void Weapon_SetActiveInSlot(float slot, float play_first_raise)
};
//
// Weapon_HasNoMulekickWeapon()
// Returns true if the player does not
// have a Mule Kick weapon slot.
//
float Weapon_HasNoMulekickWeapon()
{
for(float i = 0; i < MAX_PLAYER_WEAPONS; i++) {
if (self.weapons[i].is_mulekick_weapon == true)
return false;
}
return true;
}
//
// Weapon_AssignWeapon(weapon_slot, weapon_id, weapon_mag, weapon_reserve)
// Fills in weapon data for provided slot.
@ -314,7 +329,7 @@ void Weapon_AssignWeapon(float weapon_slot, float weapon_id, float weapon_mag, f
else
self.weapons[weapon_slot].weapon_reserve = getWeaponAmmo(self.weapons[weapon_slot].weapon_id);
if (weapon_slot == MULEKICK_WEAPON_SLOT - 1)
if (weapon_slot == MULEKICK_WEAPON_SLOT - 1 && Weapon_HasNoMulekickWeapon())
self.weapons[weapon_slot].is_mulekick_weapon = true;
self.weapons[weapon_slot].weapon_skin = GetWepSkin(weapon_id);
@ -406,13 +421,8 @@ void Weapon_FixUpList()
void Weapon_RemoveWeapon(float slot)
{
if (slot == 0) {
Weapon_SwapWeapons(false);
slot = 1;
}
self.weapons[slot].is_mulekick_weapon = false;
self.weapons[slot].weapon_id = 0;
Weapon_AssignWeapon(slot, 0, 0, 0);
Weapon_FixUpList();
};