diff --git a/README.md b/README.md index e9f6cf53..283ae001 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,7 @@ * Barriers can no longer be rebuilt while sprinting or thowing a grenade * Entering and exiting last stand no longer refills last stand weapon clip automatically * Upgraded weapon camo is applied in last stand +* Dual wield last stand weapon is switched to when ammo is only in left clip * Decreased friendly player name fade out time from 1.5 seconds to 0.25 seconds * Removed enemy player name fade in time * Added icons on scoreboard when player is downed, bled out, in Who's Who mode, or in afterlife diff --git a/scripts/zm/_zm_reimagined.gsc b/scripts/zm/_zm_reimagined.gsc index 828ddfe5..b87affca 100644 --- a/scripts/zm/_zm_reimagined.gsc +++ b/scripts/zm/_zm_reimagined.gsc @@ -47,6 +47,7 @@ main() replaceFunc(maps\mp\zombies\_zm::ai_calculate_health, scripts\zm\replaced\_zm::ai_calculate_health); replaceFunc(maps\mp\zombies\_zm::onallplayersready, scripts\zm\replaced\_zm::onallplayersready); replaceFunc(maps\mp\zombies\_zm::last_stand_pistol_rank_init, scripts\zm\replaced\_zm::last_stand_pistol_rank_init); + replaceFunc(maps\mp\zombies\_zm::last_stand_best_pistol, scripts\zm\replaced\_zm::last_stand_best_pistol); replaceFunc(maps\mp\zombies\_zm::can_track_ammo, scripts\zm\replaced\_zm::can_track_ammo); replaceFunc(maps\mp\zombies\_zm::take_additionalprimaryweapon, scripts\zm\replaced\_zm::take_additionalprimaryweapon); replaceFunc(maps\mp\zombies\_zm::check_for_valid_spawn_near_team, scripts\zm\replaced\_zm::check_for_valid_spawn_near_team); diff --git a/scripts/zm/replaced/_zm.gsc b/scripts/zm/replaced/_zm.gsc index e27dfce5..c9965eef 100644 --- a/scripts/zm/replaced/_zm.gsc +++ b/scripts/zm/replaced/_zm.gsc @@ -907,6 +907,53 @@ last_stand_pistol_rank_init() level.pistol_values[ level.pistol_values.size ] = "microwavegundw_upgraded_zm"; } +last_stand_best_pistol() +{ + pistol_array = []; + current_weapons = self getweaponslistprimaries(); + + for ( i = 0; i < current_weapons.size; i++ ) + { + class = weaponclass( current_weapons[i] ); + + if ( issubstr( current_weapons[i], "knife_ballistic_" ) ) + class = "knife"; + + if ( class == "pistol" || class == "pistolspread" || class == "pistol spread" ) + { + if ( current_weapons[i] != level.default_laststandpistol && !flag( "solo_game" ) || !flag( "solo_game" ) && current_weapons[i] != level.default_solo_laststandpistol ) + { + ammo_count = self getammocount( current_weapons[i] ); + + dual_wield_name = weapondualwieldweaponname( current_weapons[i] ); + if ( dual_wield_name != "none" ) + { + ammo_count += self getweaponammoclip( dual_wield_name ); + } + + if ( ammo_count <= 0 ) + continue; + } + + pistol_array_index = pistol_array.size; + pistol_array[pistol_array_index] = spawnstruct(); + pistol_array[pistol_array_index].gun = current_weapons[i]; + pistol_array[pistol_array_index].value = 0; + + for ( j = 0; j < level.pistol_values.size; j++ ) + { + if ( level.pistol_values[j] == current_weapons[i] ) + { + pistol_array[pistol_array_index].value = j; + break; + } + } + } + } + + self.laststandpistol = last_stand_compare_pistols( pistol_array ); +} + can_track_ammo( weap ) { if ( !isdefined( weap ) )