‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_powerup_nuke.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\flag_shared;
5 #using scripts\shared\lui_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 #using scripts\shared\ai\zombie_utility;
14 #using scripts\shared\ai\systems\gib;
15 
16 #using scripts\zm\_zm_daily_challenges;
17 #using scripts\zm\_zm_powerups;
18 #using scripts\zm\_zm_score;
19 #using scripts\zm\_zm_spawner;
20 #using scripts\zm\_zm_utility;
21 
22 #insert scripts\zm\_zm_powerups.gsh;
23 #insert scripts\zm\_zm_utility.gsh;
24 
25 #insert scripts\shared\ai\systems\gib.gsh;
26 
27 #define NUKE_EFFECT "zombie/fx_powerup_nuke_zmb"
28 
29 #precache( "string", "ZOMBIE_POWERUP_NUKE" );
30 #precache( "fx", NUKE_EFFECT );
31 
32 #namespace zm_powerup_nuke;
33 
34 ‪REGISTER_SYSTEM( "zm_powerup_nuke", &‪__init__, undefined )
35 
36 #define N_NUKE_SPAWN_DELAY 3
37 
38 
39 //-----------------------------------------------------------------------------------
40 // setup
41 //-----------------------------------------------------------------------------------
42 function ‪__init__()
43 {
45  ‪clientfield::register( "actor", "zm_nuked", ‪VERSION_TU1, 1, "counter" );
46  ‪clientfield::register( "vehicle", "zm_nuked", ‪VERSION_TU1, 1, "counter" );
48 }
49 
50 function ‪grab_nuke( player )
51 {
52  level thread ‪nuke_powerup( self, player.team );
53 
54  //chrisp - adding powerup VO sounds
55  player thread ‪zm_powerups::powerup_vo("nuke");
56  zombies = GetAiTeamArray( level.zombie_team );
57  //player.zombie_nuked = array::get_all_closest( self.origin, zombies );
58  player.zombie_nuked = ArraySort( zombies, self.origin );
59  player notify("nuke_triggered");
60 }
61 
62 // kill them all!
63 function ‪nuke_powerup( drop_item, player_team )
64 {
65  // First delay spawning while the nuke goes off
67 
68  location = drop_item.origin;
69 
70  if( isdefined( drop_item.fx ) )
71  {
72  ‪PlayFx( drop_item.fx, location );
73  }
74  level thread ‪nuke_flash(player_team);
75 
76  wait( 0.5 );
77 
78  zombies = GetAiTeamArray( level.zombie_team );
79  //zombies = array::get_all_closest( location, zombies );
80  zombies = ArraySort( zombies, location );
81  zombies_nuked = [];
82 
83  // Mark them for death
84  for (i = 0; i < zombies.size; i++)
85  {
86  // unaffected by nuke
87  if ( ‪IS_TRUE( zombies[i].ignore_nuke ) )
88  {
89  continue;
90  }
91 
92  // already going to die
93  if ( IsDefined(zombies[i].marked_for_death) && zombies[i].marked_for_death )
94  {
95  continue;
96  }
97 
98  // check for custom damage func
99  if ( IsDefined(zombies[i].nuke_damage_func) )
100  {
101  zombies[i] thread [[ zombies[i].nuke_damage_func ]]();
102  continue;
103  }
104 
106  {
107  continue;
108  }
109 
110  zombies[i].marked_for_death = true;
111  if ( !‪IS_TRUE(zombies[i].nuked) && !‪zm_utility::is_magic_bullet_shield_enabled( zombies[i] ) )
112  {
113  zombies[i].nuked = true;
114  zombies_nuked[ zombies_nuked.size ] = zombies[i];
115  zombies[i] ‪clientfield::increment( "zm_nuked" );
116  }
117  }
118 
119  for (i = 0; i < zombies_nuked.size; i++)
120  {
121  wait (randomfloatrange(0.1, 0.7));
122  if( !IsDefined( zombies_nuked[i] ) )
123  {
124  continue;
125  }
126 
127  if( ‪zm_utility::is_magic_bullet_shield_enabled( zombies_nuked[i] ) )
128  {
129  // This could be potentially confusing to the player
130  // The only way it should get here is if the allowDeath field was cleared between the time the nuke was grabbed and the time this loop gets to it
131  // At this point the zombie is probably already on fire, but now it's not going to die
132  continue;
133  }
134 
135  if( !( ‪IS_TRUE( zombies_nuked[i].isdog ) ) )
136  {
137  if ( !‪IS_TRUE( zombies_nuked[i].no_gib ) )
138  {
139  zombies_nuked[i] ‪zombie_utility::zombie_head_gib();
140  }
141  zombies_nuked[i] playsound ("evt_nuked");
142  }
143 
144 
145  zombies_nuked[i] dodamage( zombies_nuked[i].health + 666, zombies_nuked[i].origin );
147  }
148 
149  level notify( "nuke_complete" );
150 
151  players = GetPlayers( player_team );
152  for(i = 0; i < players.size; i++)
153  {
154  players[i] ‪zm_score::player_add_points( "nuke_powerup", 400 );
155  }
156 }
157 
158 function ‪nuke_flash(team)
159 {
160 /* players = GetPlayers();
161  for(i=0; i<players.size; i ++)
162  {
163  players[i] zm_utility::play_sound_2d("evt_nuke_flash");
164  }
165  level thread devil_dialog_delay(); */
166 
167  if (IsDefined(team))
168  GetPlayers()[0] PlaySoundToTeam("evt_nuke_flash", team);
169  else
170  GetPlayers()[0] PlaySound("evt_nuke_flash");
171 
172  ‪lui::screen_flash( 0.2, 0.5, 1.0, 0.8, "white" ); // flash
173 }
174 
175 function ‪nuke_delay_spawning( n_spawn_delay )
176 {
177  level endon( "disable_nuke_delay_spawning" ); // kill the thread in situation where the thread is waiting for "nuke_complete" when we turn this off
178 
179  if( ‪IS_TRUE( level.disable_nuke_delay_spawning ) )
180  {
181  return;
182  }
183 
184  b_spawn_zombies_before_nuke = level ‪flag::get( "spawn_zombies" );
185 
186  level ‪flag::clear( "spawn_zombies" );
187 
188  level waittill( "nuke_complete" );
189 
190  if( ‪IS_TRUE( level.disable_nuke_delay_spawning ) )
191  {
192  return;
193  }
194 
195  // A delay where there will be no zombies alive
196  wait( n_spawn_delay );
197 
198  if ( b_spawn_zombies_before_nuke )
199  {
200  // only spawn zombies again if it was spawning zombies before the nuke
201  level ‪flag::set( "spawn_zombies" );
202  }
203 }
‪screen_flash
‪function screen_flash(n_fadein_time, n_hold_time, n_fadeout_time, n_target_alpha=1, v_color, b_force_close_menu=false)
Definition: lui_shared.gsc:438
‪nuke_powerup
‪function nuke_powerup(drop_item, player_team)
Definition: _zm_powerup_nuke.gsc:63
‪player_add_points
‪function player_add_points(event, mod, hit_location, is_dog, zombie_team, damage_weapon)
Definition: _zm_score.gsc:129
‪increment_nuked_zombie
‪function increment_nuked_zombie()
Definition: _zm_daily_challenges.gsc:367
‪clear
‪function clear(str_flag)
Definition: flag_shared.csc:130
‪zombie_head_gib
‪function zombie_head_gib(attacker, means_of_death)
Definition: zombie_utility.gsc:2952
‪register_powerup
‪function register_powerup(str_powerup, func_grab_powerup, func_setup)
Definition: _zm_powerups.gsc:1956
‪nuke_flash
‪function nuke_flash(team)
Definition: _zm_powerup_nuke.gsc:158
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪get
‪function get(kvp_value, kvp_key="targetname")
Definition: struct.csc:13
‪NUKE_EFFECT
‪#define NUKE_EFFECT
Definition: _zm_powerup_nuke.gsc:27
‪VERSION_TU1
‪#define VERSION_TU1
Definition: version.gsh:39
‪__init__
‪function __init__()
Definition: _zm_powerup_nuke.gsc:42
‪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
‪increment
‪function increment(str_field_name, n_increment_count=1)
Definition: clientfield_shared.gsc:110
‪REGISTER_SYSTEM
‪#define REGISTER_SYSTEM(__sys, __func_init_preload, __reqs)
Definition: shared.gsh:204
‪set
‪function set(str_field_name, n_value)
Definition: clientfield_shared.gsc:34
‪grab_nuke
‪function grab_nuke(player)
Definition: _zm_powerup_nuke.gsc:50
‪func_should_always_drop
‪function func_should_always_drop()
Definition: _zm_powerups.gsc:1644
‪N_NUKE_SPAWN_DELAY
‪#define N_NUKE_SPAWN_DELAY
Definition: _zm_powerup_nuke.gsc:36
‪nuke_delay_spawning
‪function nuke_delay_spawning(n_spawn_delay)
Definition: _zm_powerup_nuke.gsc:175
‪register
‪function register()
Definition: _ai_tank.gsc:126
‪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
‪is_magic_bullet_shield_enabled
‪function is_magic_bullet_shield_enabled(ent)
Definition: _zm_utility.gsc:3474
‪PlayFx
‪function PlayFx(name)
Definition: _counteruav.gsc:390