1 #using scripts\codescripts\struct;
3 #using scripts\shared\array_shared;
4 #using scripts\shared\clientfield_shared;
5 #using scripts\shared\flag_shared;
6 #using scripts\shared\trigger_shared;
7 #using scripts\shared\util_shared;
8 #using scripts\shared\weapons\_weaponobjects;
10 #insert scripts\shared\shared.gsh;
11 #using scripts\shared\system_shared;
13 #using scripts\zm\_zm_audio;
14 #using scripts\zm\_zm_equipment;
15 #using scripts\zm\_zm_score;
16 #using scripts\zm\_zm_stats;
17 #using scripts\zm\_zm_utility;
18 #using scripts\zm\_zm_weapons;
20 #insert scripts\zm\_zm_utility.gsh;
22 #namespace zm_placeable_mine;
29 if ( isdefined( level.placeable_mines ) )
37 if ( isdefined( level.placeable_mines ) )
42 level.placeable_mines = [];
47 level.placeable_mine_planted_callbacks = [];
52 if ( isdefined( level.placeable_mines ) && level.placeable_mines.size > 0 )
54 str_key = GetArrayKeys( level.placeable_mines )[0];
55 return level.placeable_mines[str_key];
58 return level.weaponNone;
67 level.placeable_mines[ mine_name ] = GetWeapon( mine_name );
68 level.placeable_mine_planted_callbacks[mine_name] = [];
77 level.placeable_mines[ mine_name ] = GetWeapon( mine_name );
78 level.placeable_mine_planted_callbacks[mine_name] = [];
79 DEFAULT(level.placeable_mines_in_name_only,[]);
80 level.placeable_mines_in_name_only[ mine_name ] = GetWeapon( mine_name );
85 level.placeable_mines_max_per_player = n_max_per_player;
90 ARRAY_ADD( level.placeable_mine_planted_callbacks[wpn_name], fn_planted_cb );
95 foreach ( fn
in level.placeable_mine_planted_callbacks[
self.weapon.name] )
97 self thread [[fn]]( e_planter );
103 if ( isdefined( level.placeable_mines_max_per_player ) &&
self.owner.placeable_mines.size >= level.placeable_mines_max_per_player )
120 self endon(
"death" );
121 self notify(
"mine_watch" );
122 self endon(
"mine_watch" );
126 self waittill(
"grenade_fire", mine, fired_weapon );
127 if ( fired_weapon == wpn_type )
130 mine.team =
self.team;
131 mine.weapon = fired_weapon;
133 self notify(
"zmb_enable_" + fired_weapon.name +
"_prompt" );
153 if ( !isdefined(level.placeable_mines_in_name_only ) )
155 if ( !isdefined(level.placeable_mines_in_name_only[ mine_name ] ) )
163 if ( !isdefined(
self.placeable_mines ) )
165 self.placeable_mines = [];
168 if ( isdefined(
self.last_placeable_mine_uimodel ) )
178 self giveweapon( wpn_type );
180 self setactionslot( 4,
"weapon", wpn_type );
181 startammo = wpn_type.startammo;
184 self setweaponammostock( wpn_type, startammo );
187 if ( isdefined( ui_model ) )
191 self.last_placeable_mine_uimodel = ui_model;
196 self notify(
"zmb_disable_" + wpn_type.name +
"_prompt" );
201 foreach( mine
in level.placeable_mines )
210 wpn_type =
self.weapon;
218 if ( current_player_mine != wpn_type )
220 player TakeWeapon( current_player_mine );
224 if ( !player HasWeapon( wpn_type ) )
228 player giveweapon(wpn_type);
230 player setactionslot(4,
"weapon",wpn_type);
231 player setweaponammoclip(wpn_type,0);
232 player notify(
"zmb_enable_" + wpn_type.name +
"_prompt" );
236 clip_ammo = player GetWeaponAmmoClip( wpn_type );
237 clip_max_ammo = wpn_type.clipSize;
238 if ( clip_ammo >= clip_max_ammo )
248 clip_ammo = player GetWeaponAmmoClip( wpn_type );
249 clip_max_ammo = wpn_type.clipSize;
250 if ( clip_ammo >= clip_max_ammo )
267 self endon(
"delete" );
268 self endon(
"death" );
272 player
util::waittill_any(
"zmb_enable_" +
self.weapon.name +
"_prompt",
"spawned_player" );
274 if ( !isDefined( trigger ) )
279 trigger TriggerEnable(
true );
280 trigger linkto(
self );
286 self endon(
"delete" );
287 self endon(
"death" );
291 player waittill(
"zmb_disable_" +
self.weapon.name +
"_prompt" );
293 if ( !isDefined( trigger ) )
299 trigger TriggerEnable(
false );
305 self endon(
"death" );
307 self setcandamage(
true);
308 self.health = 100000;
309 self.maxhealth =
self.health;
311 attacker = undefined;
315 self waittill(
"damage", amount, attacker);
317 if ( !isdefined(
self ) )
322 self.health =
self.maxhealth;
323 if ( !isplayer(attacker) )
326 if ( isdefined(
self.owner ) && attacker ==
self.owner )
329 if( isDefined( attacker.pers ) && isDefined( attacker.pers[
"team"] ) && attacker.pers[
"team"] != level.zombie_team )
335 if ( level.satchelexplodethisframe )
336 wait .1 + randomfloat(.4);
340 if (!isdefined(
self))
343 level.satchelexplodethisframe =
true;
354 level.satchelexplodethisframe =
false;
361 level waittill(
"between_round_over" );
363 if ( isdefined( level.func_custom_placeable_mine_round_replenish ) )
365 [[ level.func_custom_placeable_mine_round_replenish ]]();
371 players = GetPlayers();
372 for ( i = 0;i < players.size;i++ )
374 foreach( mine
in level.placeable_mines )
379 players[ i ] giveweapon( mine );
381 players[ i ] setactionslot( 4,
"weapon", mine );
382 players[ i ] setweaponammoclip( mine, 2 );
393 if ( isdefined( level.placeable_mines ) )
395 foreach( mine_type
in level.placeable_mines )
400 watcher.pickup = level.pickup_placeable_mine;
401 watcher.pickup_trigger_listener = level.pickup_placeable_mine_trigger_listener;
402 watcher.skip_weapon_object_damage =
true;
403 watcher.headIcon =
false;
404 watcher.watchForFire =
true;
406 watcher.onDamage = level.placeable_mines_on_damage;
414 if (isdefined(
self.pickUpTrigger))
415 self.pickUpTrigger SetHintLowPriority(
false );
420 origin = origin + (0,0,20);
432 if ( IsDefined( attacker ) )
434 self Detonate( attacker );
436 else if ( isdefined(
self.owner ) && isplayer(
self.owner ) )
438 self Detonate(
self.owner );