mirror of
https://github.com/JezuzLizard/BO2-Reimagined.git
synced 2025-06-11 23:57:59 -05:00
Fix melee weapon not always switching back to correct weapon
Optimize melee weapon switch code
This commit is contained in:
@ -1743,28 +1743,21 @@ melee_weapon_switch_watcher()
|
|||||||
melee_wep = self get_player_melee_weapon();
|
melee_wep = self get_player_melee_weapon();
|
||||||
curr_wep = self getCurrentWeapon();
|
curr_wep = self getCurrentWeapon();
|
||||||
|
|
||||||
|
if(curr_wep != "none" && !is_offhand_weapon(curr_wep))
|
||||||
|
{
|
||||||
|
prev_wep = curr_wep;
|
||||||
|
}
|
||||||
|
|
||||||
if(self actionSlotTwoButtonPressed() && !self hasWeapon("equip_dieseldrone_zm"))
|
if(self actionSlotTwoButtonPressed() && !self hasWeapon("equip_dieseldrone_zm"))
|
||||||
{
|
{
|
||||||
if(curr_wep != melee_wep)
|
if(curr_wep != melee_wep)
|
||||||
{
|
{
|
||||||
prev_wep = curr_wep;
|
|
||||||
self switchToWeapon(melee_wep);
|
self switchToWeapon(melee_wep);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(isDefined(prev_wep) && self hasWeapon(prev_wep))
|
self maps/mp/zombies/_zm_weapons::switch_back_primary_weapon(prev_wep);
|
||||||
{
|
|
||||||
self switchToWeapon(prev_wep);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
self switchToWeapon(self getWeaponsListPrimaries()[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
prev_wep = undefined;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
self waittill("weapon_change");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wait 0.05;
|
wait 0.05;
|
||||||
|
Reference in New Issue
Block a user