1 #using scripts\codescripts\struct;
3 #using scripts\shared\clientfield_shared;
4 #using scripts\shared\system_shared;
5 #using scripts\shared\util_shared;
7 #insert scripts\shared\shared.gsh;
8 #insert scripts\shared\version.gsh;
10 #using scripts\shared\ai\zombie_death;
12 #using scripts\zm\_zm_audio;
13 #using scripts\zm\_zm_bgb;
14 #using scripts\zm\_zm_bgb_machine;
15 #using scripts\zm\_zm_magicbox;
16 #using scripts\zm\_zm_pers_upgrades_functions;
17 #using scripts\zm\_zm_powerups;
18 #using scripts\zm\_zm_score;
19 #using scripts\zm\_zm_spawner;
20 #using scripts\zm\_zm_utility;
22 #insert scripts\zm\_zm_powerups.gsh;
23 #insert scripts\zm\_zm_utility.gsh;
25 #precache( "material", "specialty_firesale_zombies");
26 #precache( "string", "ZOMBIE_POWERUP_MAX_AMMO" );
28 #namespace zm_powerup_fire_sale;
39 if( ToLower( GetDvarString(
"g_gametype" ) ) !=
"zcleansed" )
41 zm_powerups::add_zombie_powerup(
"fire_sale",
"p7_zm_power_up_firesale", &
"ZOMBIE_POWERUP_MAX_AMMO", &
func_should_drop_fire_sale, !
POWERUP_ONLY_AFFECTS_GRABBER, !
POWERUP_ANY_TEAM, !
POWERUP_ZOMBIE_GRABBABLE, undefined,
CLIENTFIELD_POWERUP_FIRE_SALE,
"zombie_powerup_fire_sale_time",
"zombie_powerup_fire_sale_on" );
55 if(
IS_TRUE( level.custom_firesale_box_leave ) )
63 if(level.zombie_vars[
"zombie_powerup_fire_sale_time"] > 0 &&
IS_TRUE(level.zombie_vars[
"zombie_powerup_fire_sale_on"] ) )
69 level notify (
"powerup fire sale");
70 level endon (
"powerup fire sale");
74 level.zombie_vars[
"zombie_powerup_fire_sale_on"] =
true;
75 level.disable_firesale_drop =
true;
85 while ( level.zombie_vars[
"zombie_powerup_fire_sale_time"] > 0)
88 level.zombie_vars[
"zombie_powerup_fire_sale_time"] = level.zombie_vars[
"zombie_powerup_fire_sale_time"] - 0.05;
93 level.zombie_vars[
"zombie_powerup_fire_sale_on"] =
false;
94 level notify (
"fire_sale_off" );
104 level.disable_firesale_drop = undefined;
114 for( i = 0; i < level.chests.size; i++ )
116 if( i !== level.chest_index )
118 if( level.chests[ i ].zbarrier.state ===
"leaving" || level.chests[ i ].zbarrier.state ===
"open" || level.chests[ i ].zbarrier.state ===
"close" || level.chests[ i ].zbarrier.state ===
"closing" )
130 level endon (
"powerup fire sale");
132 if( !isdefined ( level.zombie_vars[
"zombie_powerup_fire_sale_on"] ) )
141 for ( i = 0; i < level.chests.size; i++ )
143 show_firesale_box = level.chests[i] [[level._zombiemode_check_firesale_loc_valid_func]]();
145 if ( show_firesale_box )
147 level.chests[i].zombie_cost = 10;
149 if ( level.chest_index != i )
151 level.chests[i].was_temp =
true;
152 if (
IS_TRUE( level.chests[i].hidden ) )
160 level notify(
"fire_sale_on");
161 level waittill(
"fire_sale_off" );
170 for ( i = 0; i < level.chests.size; i++ )
172 show_firesale_box = level.chests[i] [[level._zombiemode_check_firesale_loc_valid_func]]();
174 if ( show_firesale_box )
176 if ( level.chest_index != i && IsDefined( level.chests[i].was_temp ) )
178 level.chests[i].was_temp = undefined;
182 level.chests[i].zombie_cost = level.chests[i].old_cost;
191 if(
self.zbarrier GetZBarrierPieceState(1) ==
"closing")
193 while(
self.zbarrier GetZBarrierPieceState(1) ==
"closing")
197 self.zbarrier waittill(
"left");
208 level.chests[chest_index].being_removed =
true;
210 while( isdefined( level.chests[chest_index].chest_user ) || (IsDefined(level.chests[chest_index]._box_open) && level.chests[chest_index]._box_open ==
true))
215 if ( level.zombie_vars[
"zombie_powerup_fire_sale_on"] )
217 level.chests[chest_index].was_temp =
true;
218 level.chests[chest_index].zombie_cost = 10;
219 level.chests[chest_index].being_removed =
false;
223 for( i=0; i<chest_index; i++ )
228 playfx(level._effect[
"poltergeist"], level.chests[chest_index].orig_origin);
229 level.chests[chest_index].zbarrier playsound (
"zmb_box_poof_land" );
230 level.chests[chest_index].zbarrier playsound(
"zmb_couch_slam" );
233 if (
IS_TRUE( level.custom_firesale_box_leave ) )
242 level.chests[chest_index].being_removed =
false;
247 if( level.zombie_vars[
"zombie_powerup_fire_sale_on"] ==
true || level.chest_moves < 1 ||
IS_TRUE(level.disable_firesale_drop))
260 if( !isdefined(
struct.sndEnt ) )
262 struct.sndEnt =
spawn(
"script_origin",
struct.origin+(0,0,100));
265 if(
IS_TRUE( level.player_4_vox_override ) )
266 struct.sndEnt playloopsound(
"mus_fire_sale_rich", 1 );
268 struct.sndEnt playloopsound(
"mus_fire_sale", 1 );
277 if( isdefined(
struct.sndEnt ) )
279 struct.sndEnt
delete();
280 struct.sndEnt = undefined;