1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-27 07:30:09 -05:00

Add ability to switch to melee weapon

This commit is contained in:
Jbleezy
2022-01-03 04:00:44 -08:00
parent efeb3aa0f5
commit 834e0d46f0
2 changed files with 70 additions and 1 deletions

View File

@ -58,6 +58,7 @@
* Removed hint when player is first attacked on solo
## Weapons
* Switch to melee weapon by pressing the new melee weapon button (same button as the Maxis Drone on Origins)
### AN-94
* Increased weapon cost from 1200 to 1500

View File

@ -85,7 +85,7 @@ onplayerspawned()
self thread fall_velocity_check();
//self thread remove_fast_melee(); // Removed until melee weapon can be added
self thread melee_weapon_switch_watcher();
self thread solo_lives_fix();
@ -1731,6 +1731,74 @@ fall_velocity_check()
}
}
melee_weapon_switch_watcher()
{
self endon("disconnect");
self thread melee_weapon_disable_weapon_trading();
prev_wep = undefined;
while(1)
{
melee_wep = self get_player_melee_weapon();
curr_wep = self getCurrentWeapon();
if(self actionSlotTwoButtonPressed() && !self hasWeapon("equip_dieseldrone_zm"))
{
if(curr_wep != melee_wep)
{
prev_wep = curr_wep;
self switchToWeapon(melee_wep);
}
else
{
if(isDefined(prev_wep) && self hasWeapon(prev_wep))
{
self switchToWeapon(prev_wep);
}
else
{
self switchToWeapon(self getWeaponsListPrimaries()[0]);
}
prev_wep = undefined;
}
self waittill("weapon_change");
}
wait 0.05;
}
}
melee_weapon_disable_weapon_trading()
{
self endon("disconnect");
while(1)
{
melee_wep = self get_player_melee_weapon();
curr_wep = self getCurrentWeapon();
if(curr_wep == melee_wep && self getWeaponsListPrimaries().size >= 1)
{
self.is_drinking = 1;
while(curr_wep == melee_wep && self getWeaponsListPrimaries().size >= 1)
{
melee_wep = self get_player_melee_weapon();
curr_wep = self getCurrentWeapon();
wait 0.05;
}
self.is_drinking = 0;
}
wait 0.05;
}
}
remove_fast_melee()
{
self endon("disconnect");