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

Move weapon ammo changes to weapon files

Encounter: move upgraded starting weapon ammo change to zgrief_reimagined
This commit is contained in:
Jbleezy
2023-12-15 01:07:50 -08:00
parent f3b1ac3b84
commit ac6d7a8634
17 changed files with 63 additions and 57 deletions

View File

@ -2619,54 +2619,6 @@ 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, "mp44"))
{
if (is_weapon_upgraded(weapon))
{
max_ammo = 300;
}
}
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

@ -1226,7 +1226,7 @@ wait_for_player_to_take( player, weapon, packa_timer, upgrade_as_attachment )
{
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 notify("weapon_ammo_change");
}
player switchtoweapon( upgrade_weapon );

View File

@ -363,11 +363,12 @@ 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++;
}
players[i] notify("weapon_ammo_change");
i++;
}
level thread full_ammo_on_hud( drop_item, player.team );

View File

@ -466,7 +466,7 @@ weapon_give( weapon, is_upgrade, magic_box, nosound )
}
self play_weapon_vo( weapon, magic_box );
self scripts\zm\_zm_reimagined::change_weapon_ammo(weapon);
self notify("weapon_ammo_change");
}
ammo_give( weapon )
@ -519,7 +519,7 @@ ammo_give( weapon )
self setWeaponAmmoClip( alt_weap, weaponClipSize(alt_weap) );
}
self scripts\zm\_zm_reimagined::change_weapon_ammo(weapon);
self notify("weapon_ammo_change");
return true;
}

View File

@ -546,6 +546,7 @@ grief_onplayerconnect()
self thread head_icon();
self thread obj_waypoint();
self thread headstomp_watcher();
self thread decrease_upgraded_start_weapon_ammo();
self thread maps\mp\gametypes_zm\zmeat::create_item_meat_watcher();
self.killsconfirmed = 0;
self.killsdenied = 0;
@ -962,6 +963,36 @@ headstomp_watcher()
}
}
decrease_upgraded_start_weapon_ammo()
{
self endon("disconnect");
flag_wait("initial_blackscreen_passed");
upgraded_start_weapon = level.zombie_weapons[level.start_weapon].upgrade_name;
max_ammo = int(weaponmaxammo(upgraded_start_weapon) / 2);
while (1)
{
self waittill("weapon_ammo_change");
foreach (weapon in self getweaponslistprimaries())
{
if (weapon != upgraded_start_weapon)
{
continue;
}
ammo = self getweaponammostock(weapon);
if (ammo > max_ammo)
{
self setweaponammostock(weapon, max_ammo);
}
}
}
}
round_start_wait(time, initial)
{
level endon("end_game");

View File

@ -215,7 +215,6 @@ 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 );
}