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

Weapon stock ammo changes

This commit is contained in:
Jbleezy
2023-03-09 21:27:28 -08:00
parent 52d71ab0a6
commit 2204bae1be
6 changed files with 193 additions and 0 deletions

View File

@ -46,6 +46,7 @@ main()
replaceFunc(maps\mp\zombies\_zm_laststand::revive_give_back_weapons, scripts\zm\replaced\_zm_laststand::revive_give_back_weapons);
replaceFunc(maps\mp\zombies\_zm_laststand::revive_hud_think, scripts\zm\replaced\_zm_laststand::revive_hud_think);
replaceFunc(maps\mp\zombies\_zm_weapons::weapon_give, scripts\zm\replaced\_zm_weapons::weapon_give);
replaceFunc(maps\mp\zombies\_zm_weapons::ammo_give, scripts\zm\replaced\_zm_weapons::ammo_give);
replaceFunc(maps\mp\zombies\_zm_weapons::get_upgraded_ammo_cost, scripts\zm\replaced\_zm_weapons::get_upgraded_ammo_cost);
replaceFunc(maps\mp\zombies\_zm_weapons::makegrenadedudanddestroy, scripts\zm\replaced\_zm_weapons::makegrenadedudanddestroy);
replaceFunc(maps\mp\zombies\_zm_weapons::createballisticknifewatcher_zm, scripts\zm\replaced\_zm_weapons::createballisticknifewatcher_zm);
@ -60,6 +61,7 @@ main()
replaceFunc(maps\mp\zombies\_zm_perks::perk_think, scripts\zm\replaced\_zm_perks::perk_think);
replaceFunc(maps\mp\zombies\_zm_perks::perk_set_max_health_if_jugg, scripts\zm\replaced\_zm_perks::perk_set_max_health_if_jugg);
replaceFunc(maps\mp\zombies\_zm_perks::initialize_custom_perk_arrays, scripts\zm\replaced\_zm_perks::initialize_custom_perk_arrays);
replaceFunc(maps\mp\zombies\_zm_perks::wait_for_player_to_take, scripts\zm\replaced\_zm_perks::wait_for_player_to_take);
replaceFunc(maps\mp\zombies\_zm_power::standard_powered_items, scripts\zm\replaced\_zm_power::standard_powered_items);
replaceFunc(maps\mp\zombies\_zm_powerups::full_ammo_powerup, scripts\zm\replaced\_zm_powerups::full_ammo_powerup);
replaceFunc(maps\mp\zombies\_zm_powerups::nuke_powerup, scripts\zm\replaced\_zm_powerups::nuke_powerup);
@ -2166,6 +2168,47 @@ disable_carpenter()
arrayremovevalue(level.zombie_powerup_array, "carpenter");
}
change_weapon_ammo(weapon)
{
max_ammo = 0;
if (isSubStr(weapon, "m1911"))
{
if (is_weapon_upgraded(weapon))
{
if (level.scr_zm_ui_gametype == "zgrief")
{
max_ammo = 24;
}
else
{
max_ammo = 48;
}
}
}
else if (isSubStr(weapon, "an94"))
{
if (is_weapon_upgraded(weapon))
{
max_ammo = 450;
}
}
else if (isSubStr(weapon, "slipgun"))
{
max_ammo = 20;
}
if (max_ammo == 0)
{
return;
}
if (self getWeaponAmmoStock(weapon) > max_ammo)
{
self setWeaponAmmoStock(weapon, max_ammo);
}
}
wallbuy_location_changes()
{
if(!is_classic())

View File

@ -499,4 +499,78 @@ take_movefaster()
{
self set_perk_clientfield( "specialty_longersprint", 0 );
}
}
wait_for_player_to_take( player, weapon, packa_timer, upgrade_as_attachment )
{
current_weapon = self.current_weapon;
upgrade_name = self.upgrade_name;
upgrade_weapon = upgrade_name;
self endon( "pap_timeout" );
level endon( "Pack_A_Punch_off" );
while ( true )
{
packa_timer playloopsound( "zmb_perks_packa_ticktock" );
self waittill( "trigger", trigger_player );
if ( isdefined( level.pap_grab_by_anyone ) && level.pap_grab_by_anyone )
player = trigger_player;
packa_timer stoploopsound( 0.05 );
if ( trigger_player == player )
{
player maps\mp\zombies\_zm_stats::increment_client_stat( "pap_weapon_grabbed" );
player maps\mp\zombies\_zm_stats::increment_player_stat( "pap_weapon_grabbed" );
current_weapon = player getcurrentweapon();
if ( is_player_valid( player ) && !( player.is_drinking > 0 ) && !is_placeable_mine( current_weapon ) && !is_equipment( current_weapon ) && level.revive_tool != current_weapon && "none" != current_weapon && !player hacker_active() )
{
maps\mp\_demo::bookmark( "zm_player_grabbed_packapunch", gettime(), player );
self notify( "pap_taken" );
player notify( "pap_taken" );
player.pap_used = 1;
if ( !( isdefined( upgrade_as_attachment ) && upgrade_as_attachment ) )
player thread do_player_general_vox( "general", "pap_arm", 15, 100 );
else
player thread do_player_general_vox( "general", "pap_arm2", 15, 100 );
weapon_limit = get_player_weapon_limit( player );
player maps\mp\zombies\_zm_weapons::take_fallback_weapon();
primaries = player getweaponslistprimaries();
if ( isdefined( primaries ) && primaries.size >= weapon_limit )
player maps\mp\zombies\_zm_weapons::weapon_give( upgrade_weapon );
else
{
player giveweapon( upgrade_weapon, 0, player maps\mp\zombies\_zm_weapons::get_pack_a_punch_weapon_options( upgrade_weapon ) );
player givestartammo( upgrade_weapon );
player scripts\zm\_zm_reimagined::change_weapon_ammo(upgrade_weapon);
}
player switchtoweapon( upgrade_weapon );
if ( isdefined( player.restore_ammo ) && player.restore_ammo )
{
new_clip = player.restore_clip + weaponclipsize( upgrade_weapon ) - player.restore_clip_size;
new_stock = player.restore_stock + weaponmaxammo( upgrade_weapon ) - player.restore_max;
player setweaponammostock( upgrade_weapon, new_stock );
player setweaponammoclip( upgrade_weapon, new_clip );
}
player.restore_ammo = undefined;
player.restore_clip = undefined;
player.restore_stock = undefined;
player.restore_max = undefined;
player.restore_clip_size = undefined;
player maps\mp\zombies\_zm_weapons::play_weapon_vo( upgrade_weapon );
return;
}
}
wait 0.05;
}
}

View File

@ -70,6 +70,8 @@ full_ammo_powerup( drop_item, player )
{
players[i] givemaxammo(primary_weapons[x]);
}
players[i] scripts\zm\_zm_reimagined::change_weapon_ammo(primary_weapons[x]);
}
x++;
}

View File

@ -157,8 +157,56 @@ weapon_give( weapon, is_upgrade, magic_box, nosound )
}
}
self play_weapon_vo( weapon, magic_box );
self scripts\zm\_zm_reimagined::change_weapon_ammo(weapon);
}
ammo_give( weapon )
{
give_ammo = 0;
if ( !is_offhand_weapon( weapon ) )
{
weapon = get_weapon_with_attachments( weapon );
if ( isdefined( weapon ) )
{
stockmax = 0;
stockmax = weaponstartammo( weapon );
clipcount = self getweaponammoclip( weapon );
currstock = self getammocount( weapon );
if ( currstock - clipcount >= stockmax )
give_ammo = 0;
else
give_ammo = 1;
}
}
else if ( self has_weapon_or_upgrade( weapon ) )
{
if ( self getammocount( weapon ) < weaponmaxammo( weapon ) )
give_ammo = 1;
}
if ( give_ammo )
{
self play_sound_on_ent( "purchase" );
self givemaxammo( weapon );
alt_weap = weaponaltweaponname( weapon );
if ( "none" != alt_weap )
self givemaxammo( alt_weap );
self scripts\zm\_zm_reimagined::change_weapon_ammo(weapon);
return true;
}
if ( !give_ammo )
return false;
}
lethal_grenade_update_prompt( player )
{
weapon = self.stub.zombie_weapon_upgrade;

View File

@ -27,6 +27,8 @@ init()
level.special_weapon_magicbox_check = ::highrise_special_weapon_magicbox_check;
level.check_for_valid_spawn_near_team_callback = ::highrise_respawn_override;
slipgun_change_ammo();
level thread elevator_solo_revive_fix();
}
@ -91,6 +93,26 @@ highrise_respawn_override( revivee, return_struct )
}
}
slipgun_change_ammo()
{
foreach (buildable in level.zombie_include_buildables)
{
if(IsDefined(buildable.name) && buildable.name == "slipgun_zm")
{
buildable.onbuyweapon = ::onbuyweapon_slipgun;
return;
}
}
}
onbuyweapon_slipgun( player )
{
player givestartammo( self.stub.weaponname );
player switchtoweapon( self.stub.weaponname );
player scripts\zm\_zm_reimagined::change_weapon_ammo(self.stub.weaponname);
level notify( "slipgun_bought", player );
}
elevator_solo_revive_fix()
{
if (!(is_classic() && level.scr_zm_map_start_location == "rooftop"))