diff --git a/README.md b/README.md index 7576a251..72646b24 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/scripts/zm/_zm_reimagined.gsc b/scripts/zm/_zm_reimagined.gsc index 7f402e12..33b04e0e 100644 --- a/scripts/zm/_zm_reimagined.gsc +++ b/scripts/zm/_zm_reimagined.gsc @@ -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); diff --git a/scripts/zm/replaced/_zm_melee_weapon.gsc b/scripts/zm/replaced/_zm_melee_weapon.gsc index 538529b9..fd91b4cd 100644 --- a/scripts/zm/replaced/_zm_melee_weapon.gsc +++ b/scripts/zm/replaced/_zm_melee_weapon.gsc @@ -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(); } \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_perks.gsc b/scripts/zm/replaced/_zm_perks.gsc index eba9aa8c..d580527a 100644 --- a/scripts/zm/replaced/_zm_perks.gsc +++ b/scripts/zm/replaced/_zm_perks.gsc @@ -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" ); diff --git a/scripts/zm/replaced/_zm_utility.gsc b/scripts/zm/replaced/_zm_utility.gsc index fff49a84..c79143de 100644 --- a/scripts/zm/replaced/_zm_utility.gsc +++ b/scripts/zm/replaced/_zm_utility.gsc @@ -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 } \ No newline at end of file diff --git a/scripts/zm/replaced/zgrief.gsc b/scripts/zm/replaced/zgrief.gsc index 03faa1cd..ac11adf0 100644 --- a/scripts/zm/replaced/zgrief.gsc +++ b/scripts/zm/replaced/zgrief.gsc @@ -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); diff --git a/scripts/zm/zgrief/zgrief_reimagined.gsc b/scripts/zm/zgrief/zgrief_reimagined.gsc index 68600be8..5c994cda 100644 --- a/scripts/zm/zgrief/zgrief_reimagined.gsc +++ b/scripts/zm/zgrief/zgrief_reimagined.gsc @@ -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; }