‪Black Ops 3 Source Code Explorer  0.1
‪An script explorer for Black Ops 3 by ZeRoY
_zm_powerup_bonfire_sale.gsc
Go to the documentation of this file.
1 #using scripts\codescripts\struct;
2 
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\system_shared;
5 #using scripts\shared\util_shared;
6 
7 #insert scripts\shared\shared.gsh;
8 #insert scripts\shared\version.gsh;
9 
10 #using scripts\shared\ai\zombie_death;
11 
12 #using scripts\zm\_zm_bgb;
13 #using scripts\zm\_zm_magicbox;
14 #using scripts\zm\_zm_pers_upgrades_functions;
15 #using scripts\zm\_zm_powerups;
16 #using scripts\zm\_zm_score;
17 #using scripts\zm\_zm_spawner;
18 #using scripts\zm\_zm_utility;
19 
20 #insert scripts\zm\_zm_powerups.gsh;
21 #insert scripts\zm\_zm_utility.gsh;
22 
23 #precache( "string", "ZOMBIE_POWERUP_MAX_AMMO" );
24 
25 #namespace zm_powerup_bonfire_sale;
26 
27 //
28 // This powerup is deprecated - use it at your own risk
29 //
30 
31 ‪REGISTER_SYSTEM_EX( "zm_powerup_bonfire_sale", &‪__init__, &‪__main__, undefined )
32 
33 
34 //-----------------------------------------------------------------------------------
35 // setup
36 //-----------------------------------------------------------------------------------
37 function ‪__init__()
38 {
40  if( ToLower( GetDvarString( "g_gametype" ) ) != "zcleansed" )
41  {
42  ‪zm_powerups::add_zombie_powerup( "bonfire_sale", "zombie_bonfiresale", &"ZOMBIE_POWERUP_MAX_AMMO", &‪zm_powerups::func_should_never_drop, !‪POWERUP_ONLY_AFFECTS_GRABBER, !‪POWERUP_ANY_TEAM, !‪POWERUP_ZOMBIE_GRABBABLE, undefined, ‪CLIENTFIELD_POWERUP_BON_FIRE, "zombie_powerup_bonfire_sale_time", "zombie_powerup_bonfire_sale_on" );
44  }
45 }
46 
47 function ‪__main__()
48 {
49  level thread ‪setup_bonfiresale_audio();
50 }
51 
52 function ‪grab_bonfire_sale( player )
53 {
54  level thread ‪start_bonfire_sale( self );
55  player thread ‪zm_powerups::powerup_vo("firesale");
56 }
57 
58 function ‪start_bonfire_sale( item )
59 {
60  level notify ("powerup bonfire sale");
61  level endon ("powerup bonfire sale");
62 
63  temp_ent = ‪spawn("script_origin", (0,0,0));
64  temp_ent playloopsound ("zmb_double_point_loop");
65 
66  level.zombie_vars["zombie_powerup_bonfire_sale_on"] = true;
67  level thread ‪toggle_bonfire_sale_on();
68  level.zombie_vars["zombie_powerup_bonfire_sale_time"] = ‪N_POWERUP_DEFAULT_TIME;
69 
70  if( ‪bgb::is_team_enabled( "zm_bgb_temporal_gift" ) )
71  {
72  level.zombie_vars["zombie_powerup_bonfire_sale_time"] += ‪N_POWERUP_DEFAULT_TIME;//Doubles the amount of time
73  }
74 
75  while ( level.zombie_vars["zombie_powerup_bonfire_sale_time"] > 0)
76  {
78  level.zombie_vars["zombie_powerup_bonfire_sale_time"] = level.zombie_vars["zombie_powerup_bonfire_sale_time"] - 0.05;
79  }
80 
81  level.zombie_vars["zombie_powerup_bonfire_sale_on"] = false;
82  level notify ( "bonfire_sale_off" );
83 
84  players = GetPlayers();
85  for (i = 0; i < players.size; i++)
86  {
87  players[i] playsound("zmb_points_loop_off");
88  }
89 
90  temp_ent Delete();
91 }
92 
94 {
95  level endon ("powerup bonfire sale");
96 
97  if( !isdefined ( level.zombie_vars["zombie_powerup_bonfire_sale_on"] ) )
98  {
99  return;
100  }
101 
102  if( level.zombie_vars["zombie_powerup_bonfire_sale_on"] )
103  {
104  if ( isdefined( level.bonfire_init_func ) )
105  {
106  level thread [[ level.bonfire_init_func ]]();
107  }
108  level waittill( "bonfire_sale_off" );
109  }
110 }
111 
113 {
114  wait(2);
115 
116  intercom = getentarray ("intercom", "targetname");
117  while(1)
118  {
119  while( level.zombie_vars["zombie_powerup_fire_sale_on"] == false)
120  {
121  wait(0.2);
122  }
123  for(i=0;i<intercom.size;i++)
124  {
125  intercom[i] thread ‪play_bonfiresale_audio();
126  //PlaySoundatposition( "zmb_vox_ann_firesale", intercom[i].origin );
127  }
128  while( level.zombie_vars["zombie_powerup_fire_sale_on"] == true)
129  {
130  wait (0.1);
131  }
132  level notify ("firesale_over");
133  }
134 }
135 
137 {
138  if( ‪IS_TRUE( level.sndFiresaleMusOff ) )
139  {
140  return;
141  }
142 
143  if( ‪IS_TRUE( level.sndAnnouncerIsRich ) )
144  {
145  self playloopsound ("mus_fire_sale_rich");
146  }
147  else
148  {
149  self playloopsound ("mus_fire_sale");
150  }
151 
152  level waittill ("firesale_over");
153  self stoploopsound ();
154 }
‪setup_bonfiresale_audio
‪function setup_bonfiresale_audio()
Definition: _zm_powerup_bonfire_sale.gsc:112
‪func_should_never_drop
‪function func_should_never_drop()
Definition: _zm_powerups.gsc:1639
‪start_bonfire_sale
‪function start_bonfire_sale(item)
Definition: _zm_powerup_bonfire_sale.gsc:58
‪grab_bonfire_sale
‪function grab_bonfire_sale(player)
Definition: _zm_powerup_bonfire_sale.gsc:52
‪powerup_set_statless_powerup
‪function powerup_set_statless_powerup(powerup_name)
Definition: _zm_powerups.gsc:544
‪register_powerup
‪function register_powerup(str_powerup, func_grab_powerup, func_setup)
Definition: _zm_powerups.gsc:1956
‪spawn
‪function spawn(v_origin=(0, 0, 0), v_angles=(0, 0, 0))
Definition: struct.csc:23
‪toggle_bonfire_sale_on
‪function toggle_bonfire_sale_on()
Definition: _zm_powerup_bonfire_sale.gsc:93
‪IS_TRUE
‪#define IS_TRUE(__a)
Definition: shared.gsh:251
‪CLIENTFIELD_POWERUP_BON_FIRE
‪#define CLIENTFIELD_POWERUP_BON_FIRE
Definition: _zm_powerups.gsh:16
‪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
‪__main__
‪function __main__()
Definition: _zm_powerup_bonfire_sale.gsc:47
‪REGISTER_SYSTEM_EX
‪#define REGISTER_SYSTEM_EX(__sys, __func_init_preload, __func_init_postload, __reqs)
Definition: shared.gsh:209
‪powerup_vo
‪function powerup_vo(type)
Definition: _zm_powerups.gsc:1216
‪__init__
‪function __init__()
Definition: _zm_powerup_bonfire_sale.gsc:37
‪is_team_enabled
‪function is_team_enabled(str_name)
Definition: _zm_bgb.gsc:13
‪N_POWERUP_DEFAULT_TIME
‪#define N_POWERUP_DEFAULT_TIME
Definition: _zm_powerups.gsh:36
‪play_bonfiresale_audio
‪function play_bonfiresale_audio()
Definition: _zm_powerup_bonfire_sale.gsc:136
‪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
‪WAIT_SERVER_FRAME
‪#define WAIT_SERVER_FRAME
Definition: shared.gsh:265