1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-10 15:17:57 -05:00

Downing while purchasing a melee weapon gives the melee weapon

Various weapon switch fixes
This commit is contained in:
Jbleezy
2023-04-19 23:12:55 -07:00
parent 540ce0de5d
commit aa7086a1d6
7 changed files with 113 additions and 13 deletions

View File

@ -287,6 +287,7 @@
* Ammo can be purchased if only alt weapon ammo has been used
* Purchasing no longer shows the weapon model at other wallbuys of the same weapon
* Lethal grenade hint string no longer displays "ammo" after purchasing
* Downing while purchasing a melee weapon gives the melee weapon
## Mystery Box
* Players get every weapon they can before getting duplicates

View File

@ -49,12 +49,13 @@ main()
replaceFunc(maps\mp\zombies\_zm::check_quickrevive_for_hotjoin, scripts\zm\replaced\_zm::check_quickrevive_for_hotjoin);
replaceFunc(maps\mp\zombies\_zm_stats::set_global_stat, scripts\zm\replaced\_zm_stats::set_global_stat);
replaceFunc(maps\mp\zombies\_zm_playerhealth::playerhealthregen, scripts\zm\replaced\_zm_playerhealth::playerhealthregen);
replaceFunc(maps\mp\zombies\_zm_utility::track_players_intersection_tracker, scripts\zm\replaced\_zm_utility::track_players_intersection_tracker);
replaceFunc(maps\mp\zombies\_zm_utility::is_headshot, scripts\zm\replaced\_zm_utility::is_headshot);
replaceFunc(maps\mp\zombies\_zm_utility::shock_onpain, scripts\zm\replaced\_zm_utility::shock_onpain);
replaceFunc(maps\mp\zombies\_zm_utility::create_zombie_point_of_interest_attractor_positions, scripts\zm\replaced\_zm_utility::create_zombie_point_of_interest_attractor_positions);
replaceFunc(maps\mp\zombies\_zm_utility::get_current_zone, scripts\zm\replaced\_zm_utility::get_current_zone);
replaceFunc(maps\mp\zombies\_zm_utility::is_temporary_zombie_weapon, scripts\zm\replaced\_zm_utility::is_temporary_zombie_weapon);
replaceFunc(maps\mp\zombies\_zm_utility::wait_network_frame, scripts\zm\replaced\_zm_utility::wait_network_frame);
replaceFunc(maps\mp\zombies\_zm_utility::track_players_intersection_tracker, scripts\zm\replaced\_zm_utility::track_players_intersection_tracker);
replaceFunc(maps\mp\zombies\_zm_score::add_to_player_score, scripts\zm\replaced\_zm_score::add_to_player_score);
replaceFunc(maps\mp\zombies\_zm_score::minus_to_player_score, scripts\zm\replaced\_zm_score::minus_to_player_score);
replaceFunc(maps\mp\zombies\_zm_score::player_add_points_kill_bonus, scripts\zm\replaced\_zm_score::player_add_points_kill_bonus);
@ -105,6 +106,7 @@ main()
replaceFunc(maps\mp\zombies\_zm_spawner::zombie_can_drop_powerups, scripts\zm\replaced\_zm_spawner::zombie_can_drop_powerups);
replaceFunc(maps\mp\zombies\_zm_ai_basic::inert_wakeup, scripts\zm\replaced\_zm_ai_basic::inert_wakeup);
replaceFunc(maps\mp\zombies\_zm_melee_weapon::change_melee_weapon, scripts\zm\replaced\_zm_melee_weapon::change_melee_weapon);
replaceFunc(maps\mp\zombies\_zm_melee_weapon::give_melee_weapon, scripts\zm\replaced\_zm_melee_weapon::give_melee_weapon);
replaceFunc(maps\mp\zombies\_zm_weap_ballistic_knife::watch_use_trigger, scripts\zm\replaced\_zm_weap_ballistic_knife::watch_use_trigger);
replaceFunc(maps\mp\zombies\_zm_weap_claymore::claymore_detonation, scripts\zm\replaced\_zm_weap_claymore::claymore_detonation);
replaceFunc(maps\mp\zombies\_zm_weap_cymbal_monkey::player_handle_cymbal_monkey, scripts\zm\replaced\_zm_weap_cymbal_monkey::player_handle_cymbal_monkey);

View File

@ -65,6 +65,87 @@ change_melee_weapon( weapon_name, current_weapon )
self giveweapon( new_ballistic, 0 );
}
self giveMaxAmmo( new_ballistic );
self seteverhadweaponall( 1 );
}
return current_weapon;
}
give_melee_weapon( vo_dialog_id, flourish_weapon_name, weapon_name, ballistic_weapon_name, ballistic_upgraded_weapon_name, flourish_fn, trigger )
{
if ( isdefined( flourish_fn ) )
self thread [[ flourish_fn ]]();
self thread do_melee_weapon_change( weapon_name );
self.pre_temp_weapon = self do_melee_weapon_flourish_begin( flourish_weapon_name );
self maps\mp\zombies\_zm_audio::create_and_play_dialog( "weapon_pickup", vo_dialog_id );
self waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete" );
self do_melee_weapon_flourish_end( self.pre_temp_weapon, flourish_weapon_name, weapon_name, ballistic_weapon_name, ballistic_upgraded_weapon_name );
if ( self maps\mp\zombies\_zm_laststand::player_is_in_laststand() || isdefined( self.intermission ) && self.intermission )
return;
self.pre_temp_weapon = undefined;
if ( !( isdefined( level._allow_melee_weapon_switching ) && level._allow_melee_weapon_switching ) )
{
if ( isdefined( trigger ) )
trigger setinvisibletoplayer( self );
self trigger_hide_all();
}
}
do_melee_weapon_change( weapon_name )
{
self endon( "disconnect" );
self endon( "death" );
self endon( "fake_death" );
self endon( "player_downed" );
self waittill_any( "weapon_change", "weapon_change_complete" );
self giveweapon( weapon_name );
self.pre_temp_weapon = change_melee_weapon( weapon_name, self.pre_temp_weapon );
}
do_melee_weapon_flourish_end( gun, flourish_weapon_name, weapon_name, ballistic_weapon_name, ballistic_upgraded_weapon_name )
{
assert( !is_zombie_perk_bottle( gun ) );
assert( gun != level.revive_tool );
self enable_player_move_states();
self takeweapon( flourish_weapon_name );
if ( self maps\mp\zombies\_zm_laststand::player_is_in_laststand() || isdefined( self.intermission ) && self.intermission )
{
self.lastactiveweapon = self.pre_temp_weapon;
return;
}
if ( self is_multiple_drinking() )
{
self decrement_is_drinking();
return;
}
else if ( gun == "knife_zm" )
{
self switchtoweapon( weapon_name );
self decrement_is_drinking();
return;
}
else if ( gun != "none" && !is_placeable_mine( gun ) && !is_equipment( gun ) )
self switchtoweapon( gun );
else
{
primaryweapons = self getweaponslistprimaries();
if ( isdefined( primaryweapons ) && primaryweapons.size > 0 )
self switchtoweapon( primaryweapons[0] );
}
self waittill( "weapon_change_complete" );
if ( !self maps\mp\zombies\_zm_laststand::player_is_in_laststand() && !( isdefined( self.intermission ) && self.intermission ) )
self decrement_is_drinking();
}

View File

@ -112,18 +112,21 @@ vending_trigger_post_think( player, perk )
player endon( "disconnect" );
player endon( "end_game" );
player endon( "perk_abort_drinking" );
player.pre_bottle_weapon = player perk_give_bottle_begin( perk );
player.pre_temp_weapon = player perk_give_bottle_begin( perk );
evt = player waittill_any_return( "fake_death", "death", "player_downed", "weapon_change_complete" );
if ( evt == "weapon_change_complete" )
player thread wait_give_perk( perk, 1 );
player perk_give_bottle_end( player.pre_bottle_weapon, perk );
player perk_give_bottle_end( player.pre_temp_weapon, perk );
if ( player maps\mp\zombies\_zm_laststand::player_is_in_laststand() || isdefined( player.intermission ) && player.intermission )
return;
{
player.lastactiveweapon = player.pre_temp_weapon;
return;
}
player.pre_bottle_weapon = undefined;
player.pre_temp_weapon = undefined;
player notify( "burp" );

View File

@ -2,11 +2,6 @@
#include common_scripts\utility;
#include maps\mp\zombies\_zm_utility;
track_players_intersection_tracker()
{
// BO2 has built in push mechanic
}
is_headshot( sweapon, shitloc, smeansofdeath )
{
if ( smeansofdeath == "MOD_MELEE" || smeansofdeath == "MOD_BAYONET" || smeansofdeath == "MOD_IMPACT" || smeansofdeath == "MOD_UNKNOWN" || smeansofdeath == "MOD_IMPACT" )
@ -244,7 +239,17 @@ get_current_zone( return_zone )
return undefined;
}
is_temporary_zombie_weapon( str_weapon )
{
return is_zombie_perk_bottle( str_weapon ) || str_weapon == level.revive_tool || str_weapon == "zombie_builder_zm" || str_weapon == "chalk_draw_zm" || str_weapon == "no_hands_zm" || str_weapon == level.machine_assets["packapunch"].weapon || issubstr( str_weapon, "_flourish" );
}
wait_network_frame()
{
wait 0.1;
}
track_players_intersection_tracker()
{
// BO2 has built in push mechanic
}

View File

@ -293,6 +293,8 @@ meat_stink_cleanup_on_downed()
self waittill("player_downed");
self.lastactiveweapon = self.pre_meat_weapon;
level.meat_player = undefined;
self setMoveSpeedScale(1);

View File

@ -2255,6 +2255,12 @@ grief_laststand_weapons_return()
primary_weapons_returned++;
}
if ( is_temporary_zombie_weapon( self.grief_savedweapon_weapons[ i ] ) )
{
i++;
continue;
}
if ( "item_meat_zm" == self.grief_savedweapon_weapons[ i ] )
{
i++;
@ -2330,10 +2336,10 @@ grief_laststand_weapons_return()
self.grief_savedweapon_weapons = undefined;
if ( isDefined( self.pre_bottle_weapon ) && self hasWeapon( self.pre_bottle_weapon ) )
if ( isDefined( self.pre_temp_weapon ) && self hasWeapon( self.pre_temp_weapon ) )
{
self switchtoweapon( self.pre_bottle_weapon );
self.pre_bottle_weapon = undefined;
self switchtoweapon( self.pre_temp_weapon );
self.pre_temp_weapon = undefined;
return 1;
}