‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_powerup_full_ammo.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\hud_util_shared;
5 #using scripts\shared\laststand_shared;
6 #using scripts\shared\system_shared;
7 #using scripts\shared\util_shared;
8 
9 #insert scripts\shared\shared.gsh;
10 #insert scripts\shared\version.gsh;
11 
12 #using scripts\shared\ai\zombie_death;
13 
14 #using scripts\zm\_zm_pers_upgrades_functions;
15 #using scripts\zm\_zm_placeable_mine;
16 #using scripts\zm\_zm_powerups;
17 #using scripts\zm\_zm_score;
18 #using scripts\zm\_zm_spawner;
19 #using scripts\zm\_zm_utility;
20 
21 #insert scripts\zm\_zm_powerups.gsh;
22 #insert scripts\zm\_zm_utility.gsh;
23 
24 #precache( "string", "ZOMBIE_POWERUP_MAX_AMMO" );
25 #precache( "eventstring", "zombie_notification" );
26 
27 #namespace zm_powerup_full_ammo;
28 
29 ‪REGISTER_SYSTEM( "zm_powerup_full_ammo", &‪__init__, undefined )
30 
31 
32 //-----------------------------------------------------------------------------------
33 // setup
34 //-----------------------------------------------------------------------------------
35 function ‪__init__()
36 {
38  if( ToLower( GetDvarString( "g_gametype" ) ) != "zcleansed" )
39  {
41  }
42 }
43 
44 function ‪grab_full_ammo( player )
45 {
46  level thread ‪full_ammo_powerup( self ,player );
47  player thread ‪zm_powerups::powerup_vo("full_ammo");
48 }
49 
50 function ‪full_ammo_powerup( drop_item , player)
51 {
52  players = GetPlayers( player.team );
53 
54  if(isDefined(level._get_game_module_players))
55  {
56  players = [[level._get_game_module_players]](player);
57  }
58 
59  level notify( "zmb_max_ammo_level" );
60 
61  for (i = 0; i < players.size; i++)
62  {
63  // skip players in last stand
64  if ( players[i] ‪laststand::player_is_in_laststand() )
65  {
66  continue;
67  }
68 
69  if(isDefined(level.check_player_is_ready_for_ammo))
70  {
71  if( [[level.check_player_is_ready_for_ammo]](players[i]) == false )
72  {
73  continue; //not ready
74  }
75  }
76 
77  primary_weapons = players[i] GetWeaponsList( true );
78 
79  players[i] notify( "zmb_max_ammo" );
80  players[i] notify( "zmb_lost_knife" );
82  for( x = 0; x < primary_weapons.size; x++ )
83  {
84  //don't give grenades if headshot only option is enabled
85  if( level.headshots_only && ‪zm_utility::is_lethal_grenade( primary_weapons[x] ) )
86  {
87  continue;
88  }
89 
90  // Don't refill Equipment
91  if ( IsDefined( level.zombie_include_equipment ) &&
92  IsDefined( level.zombie_include_equipment[ primary_weapons[ x ] ] ) &&
93  !‪IS_TRUE( level.zombie_equipment[ primary_weapons[ x ] ].refill_max_ammo ) )
94  {
95  continue;
96  }
97 
98  // exclude specific weapons from this list
99  if ( IsDefined( level.zombie_weapons_no_max_ammo ) && IsDefined( level.zombie_weapons_no_max_ammo[ primary_weapons[ x ].name ] ) )
100  {
101  continue;
102  }
103 
104  if ( ‪zm_utility::is_hero_weapon( primary_weapons[ x ] ) )
105  {
106  continue;
107  }
108 
109 
110  if ( players[i] HasWeapon( primary_weapons[x] ) )
111  players[i] GiveMaxAmmo( primary_weapons[x] );
112  }
113  }
114 
115  level thread ‪full_ammo_on_hud( drop_item, player.team );
116 }
117 
118 function ‪full_ammo_on_hud( drop_item, player_team )
119 {
120  players = GetPlayers( player_team );
121 
122  players[0] playsoundToTeam ("zmb_full_ammo", player_team);
123 
124  if (isdefined(drop_item))
125  {
126  LUINotifyEvent( &"zombie_notification", 1, drop_item.hint );
127  }
128 }
‪is_lethal_grenade
‪function is_lethal_grenade(weapon)
Definition: _zm_utility.gsc:4145
‪full_ammo_powerup
‪function full_ammo_powerup(drop_item, player)
Definition: _zm_powerup_full_ammo.gsc:50
‪register_powerup
‪function register_powerup(str_powerup, func_grab_powerup, func_setup)
Definition: _zm_powerups.gsc:1956
‪full_ammo_on_hud
‪function full_ammo_on_hud(drop_item, player_team)
Definition: _zm_powerup_full_ammo.gsc:118
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪POWERUP_ONLY_AFFECTS_GRABBER
‪#define POWERUP_ONLY_AFFECTS_GRABBER
Definition: _zm_powerups.gsh:31
‪POWERUP_ZOMBIE_GRABBABLE
‪#define POWERUP_ZOMBIE_GRABBABLE
Definition: _zm_powerups.gsh:33
‪powerup_vo
‪function powerup_vo(type)
Definition: _zm_powerups.gsc:1216
‪grab_full_ammo
‪function grab_full_ammo(player)
Definition: _zm_powerup_full_ammo.gsc:44
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪is_hero_weapon
‪function is_hero_weapon(weapon)
Definition: _zm_utility.gsc:4408
‪func_should_always_drop
‪function func_should_always_drop()
Definition: _zm_powerups.gsc:1644
‪player_is_in_laststand
‪function player_is_in_laststand()
Definition: laststand_shared.gsc:18
‪__init__
‪function __init__()
Definition: _zm_powerup_full_ammo.gsc:35
‪disable_all_prompts_for_player
‪function disable_all_prompts_for_player()
Definition: _zm_placeable_mine.gsc:199
‪add_zombie_powerup
‪function add_zombie_powerup(powerup_name, client_field_name, clientfield_version=VERSION_SHIP)
Definition: _zm_powerups.csc:40
‪POWERUP_ANY_TEAM
‪#define POWERUP_ANY_TEAM
Definition: _zm_powerups.gsh:32