checked 3 more scripts and added them to the untested category

Once all scripts in patch_zm/maps/mp/zombies have been checked the testing phase will begin.
This commit is contained in:
JezuzLizard
2020-04-26 03:58:38 -07:00
parent 64f0307bfd
commit 5142f1e035
4 changed files with 378 additions and 509 deletions

View File

@ -5,7 +5,7 @@
#include maps/mp/_utility; #include maps/mp/_utility;
#include common_scripts/utility; #include common_scripts/utility;
register_game_module( index, module_name, pre_init_func, post_init_func, pre_init_zombie_spawn_func, post_init_zombie_spawn_func, hub_start_func ) register_game_module( index, module_name, pre_init_func, post_init_func, pre_init_zombie_spawn_func, post_init_zombie_spawn_func, hub_start_func ) //checked partially changed to match cerberus output //did not change while loop to for loop to prevent the infinite loop bu caused by continues
{ {
if ( !isDefined( level._game_modules ) ) if ( !isDefined( level._game_modules ) )
{ {
@ -20,14 +20,13 @@ register_game_module( index, module_name, pre_init_func, post_init_func, pre_ini
i++; i++;
continue; continue;
} }
else
{
if ( isDefined( level._game_modules[ i ].index ) && level._game_modules[ i ].index == index ) if ( isDefined( level._game_modules[ i ].index ) && level._game_modules[ i ].index == index )
{ {
/*
/# /#
assert( level._game_modules[ i ].index != index, "A Game module is already registered for index (" + index + ")" ); assert( level._game_modules[ i ].index != index, "A Game module is already registered for index (" + index + ")" );
#/ #/
} */
} }
i++; i++;
} }
@ -42,7 +41,7 @@ register_game_module( index, module_name, pre_init_func, post_init_func, pre_ini
level._num_registered_game_modules++; level._num_registered_game_modules++;
} }
set_current_game_module( game_module_index ) set_current_game_module( game_module_index ) //checked matches cerberus output
{ {
if ( !isDefined( game_module_index ) ) if ( !isDefined( game_module_index ) )
{ {
@ -53,38 +52,38 @@ set_current_game_module( game_module_index )
game_module = get_game_module( game_module_index ); game_module = get_game_module( game_module_index );
if ( !isDefined( game_module ) ) if ( !isDefined( game_module ) )
{ {
/*
/# /#
assert( isDefined( game_module ), "unknown game module (" + game_module_index + ")" ); assert( isDefined( game_module ), "unknown game module (" + game_module_index + ")" );
#/ #/
*/
return; return;
} }
level.current_game_module = game_module_index; level.current_game_module = game_module_index;
} }
get_current_game_module() get_current_game_module() //checked matches cerberus output
{ {
return get_game_module( level.current_game_module ); return get_game_module( level.current_game_module );
} }
get_game_module( game_module_index ) get_game_module( game_module_index ) //checked changed to match cerberus output
{ {
if ( !isDefined( game_module_index ) ) if ( !isDefined( game_module_index ) )
{ {
return undefined; return undefined;
} }
i = 0; for ( i = 0; i < level._game_modules.size; i++ )
while ( i < level._game_modules.size )
{ {
if ( level._game_modules[ i ].index == game_module_index ) if ( level._game_modules[ i ].index == game_module_index )
{ {
return level._game_modules[ i ]; return level._game_modules[ i ];
} }
i++;
} }
return undefined; return undefined;
} }
game_module_pre_zombie_spawn_init() game_module_pre_zombie_spawn_init() //checked matches cerberus output
{ {
current_module = get_current_game_module(); current_module = get_current_game_module();
if ( !isDefined( current_module ) || !isDefined( current_module.pre_init_zombie_spawn_func ) ) if ( !isDefined( current_module ) || !isDefined( current_module.pre_init_zombie_spawn_func ) )
@ -94,7 +93,7 @@ game_module_pre_zombie_spawn_init()
self [[ current_module.pre_init_zombie_spawn_func ]](); self [[ current_module.pre_init_zombie_spawn_func ]]();
} }
game_module_post_zombie_spawn_init() game_module_post_zombie_spawn_init() //checked matches cerberus output
{ {
current_module = get_current_game_module(); current_module = get_current_game_module();
if ( !isDefined( current_module ) || !isDefined( current_module.post_init_zombie_spawn_func ) ) if ( !isDefined( current_module ) || !isDefined( current_module.post_init_zombie_spawn_func ) )
@ -104,69 +103,57 @@ game_module_post_zombie_spawn_init()
self [[ current_module.post_init_zombie_spawn_func ]](); self [[ current_module.post_init_zombie_spawn_func ]]();
} }
kill_all_zombies() kill_all_zombies() //checked changed to match cerberus output
{ {
ai = get_round_enemy_array(); ai = get_round_enemy_array();
_a115 = ai; foreach ( zombie in ai )
_k115 = getFirstArrayKey( _a115 );
while ( isDefined( _k115 ) )
{ {
zombie = _a115[ _k115 ];
if ( isDefined( zombie ) ) if ( isDefined( zombie ) )
{ {
zombie dodamage( zombie.maxhealth * 2, zombie.origin, zombie, zombie, "none", "MOD_SUICIDE" ); zombie dodamage( zombie.maxhealth * 2, zombie.origin, zombie, zombie, "none", "MOD_SUICIDE" );
wait 0,05; wait 0.05;
} }
_k115 = getNextArrayKey( _a115, _k115 );
} }
} }
freeze_players( freeze ) freeze_players( freeze ) //checked changed to match cerberus output
{ {
players = get_players(); players = get_players();
i = 0; for ( i = 0; i < players.size; i++ )
while ( i < players.size )
{ {
players[ i ] freeze_player_controls( freeze ); players[ i ] freeze_player_controls( freeze );
i++;
} }
} }
turn_power_on_and_open_doors() turn_power_on_and_open_doors() //checked changed at own discretion
{ {
level.local_doors_stay_open = 1; level.local_doors_stay_open = 1;
level.power_local_doors_globally = 1; level.power_local_doors_globally = 1;
flag_set( "power_on" ); flag_set( "power_on" );
level setclientfield( "zombie_power_on", 1 ); level setclientfield( "zombie_power_on", 1 );
zombie_doors = getentarray( "zombie_door", "targetname" ); zombie_doors = getentarray( "zombie_door", "targetname" );
_a144 = zombie_doors; i = 0;
_k144 = getFirstArrayKey( _a144 ); while ( i < zombie_doors.size )
while ( isDefined( _k144 ) )
{ {
door = _a144[ _k144 ];
if ( isDefined( door.script_noteworthy ) && door.script_noteworthy == "electric_door" ) if ( isDefined( door.script_noteworthy ) && door.script_noteworthy == "electric_door" )
{ {
door notify( "power_on" ); door notify( "power_on" );
i++;
continue;
} }
else
{
if ( isDefined( door.script_noteworthy ) && door.script_noteworthy == "local_electric_door" ) if ( isDefined( door.script_noteworthy ) && door.script_noteworthy == "local_electric_door" )
{ {
door notify( "local_power_on" ); door notify( "local_power_on" );
} }
} i++;
_k144 = getNextArrayKey( _a144, _k144 );
} }
} }
respawn_spectators_and_freeze_players() respawn_spectators_and_freeze_players() //checked changed to match cerberus output
{ {
players = get_players(); players = get_players();
_a161 = players; foreach ( player in players )
_k161 = getFirstArrayKey( _a161 );
while ( isDefined( _k161 ) )
{ {
player = _a161[ _k161 ];
if ( player.sessionstate == "spectator" ) if ( player.sessionstate == "spectator" )
{ {
if ( isDefined( player.spectate_hud ) ) if ( isDefined( player.spectate_hud ) )
@ -176,11 +163,10 @@ respawn_spectators_and_freeze_players()
player [[ level.spawnplayer ]](); player [[ level.spawnplayer ]]();
} }
player freeze_player_controls( 1 ); player freeze_player_controls( 1 );
_k161 = getNextArrayKey( _a161, _k161 );
} }
} }
damage_callback_no_pvp_damage( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime ) damage_callback_no_pvp_damage( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime ) //checked matches cerberus output
{ {
if ( isDefined( eattacker ) && isplayer( eattacker ) && eattacker == self ) if ( isDefined( eattacker ) && isplayer( eattacker ) && eattacker == self )
{ {
@ -197,21 +183,17 @@ damage_callback_no_pvp_damage( einflictor, eattacker, idamage, idflags, smeansof
return 0; return 0;
} }
respawn_players() respawn_players() //checked changed to match cerberus output
{ {
players = get_players(); players = get_players();
_a196 = players; foreach ( player in players )
_k196 = getFirstArrayKey( _a196 );
while ( isDefined( _k196 ) )
{ {
player = _a196[ _k196 ];
player [[ level.spawnplayer ]](); player [[ level.spawnplayer ]]();
player freeze_player_controls( 1 ); player freeze_player_controls( 1 );
_k196 = getNextArrayKey( _a196, _k196 );
} }
} }
zombie_goto_round( target_round ) zombie_goto_round( target_round ) //checked changed to match cerberus output
{ {
level notify( "restart_round" ); level notify( "restart_round" );
if ( target_round < 1 ) if ( target_round < 1 )
@ -221,20 +203,18 @@ zombie_goto_round( target_round )
level.zombie_total = 0; level.zombie_total = 0;
maps/mp/zombies/_zm::ai_calculate_health( target_round ); maps/mp/zombies/_zm::ai_calculate_health( target_round );
zombies = get_round_enemy_array(); zombies = get_round_enemy_array();
while ( isDefined( zombies ) ) if ( isDefined( zombies ) )
{ {
i = 0; for ( i = 0; i < zombies.size; i++ )
while ( i < zombies.size )
{ {
zombies[ i ] dodamage( zombies[ i ].health + 666, zombies[ i ].origin ); zombies[ i ] dodamage( zombies[ i ].health + 666, zombies[ i ].origin );
i++;
} }
} }
respawn_players(); respawn_players();
wait 1; wait 1;
} }
wait_for_team_death_and_round_end() wait_for_team_death_and_round_end() //checked partially changed to match cerberus output //did not use foreach with continue to prevent continue bug
{ {
level endon( "game_module_ended" ); level endon( "game_module_ended" );
level endon( "end_game" ); level endon( "end_game" );
@ -245,33 +225,31 @@ wait_for_team_death_and_round_end()
cdc_alive = 0; cdc_alive = 0;
cia_alive = 0; cia_alive = 0;
players = get_players(); players = get_players();
_a244 = players; while ( i < players.size )
_k244 = getFirstArrayKey( _a244 );
while ( isDefined( _k244 ) )
{ {
player = _a244[ _k244 ]; if ( !isDefined( players[ i ]._encounters_team ) )
if ( !isDefined( player._encounters_team ) )
{ {
i++;
continue;
} }
else if ( player._encounters_team == "A" ) if ( players[ i ]._encounters_team == "A" )
{ {
if ( is_player_valid( player ) ) if ( is_player_valid( players[ i ] ) )
{ {
cia_alive++; cia_alive++;
} }
i++;
continue;
} }
else if ( is_player_valid( players[ i ] ) )
{
if ( is_player_valid( player ) )
{ {
cdc_alive++; cdc_alive++;
} }
} i++;
_k244 = getNextArrayKey( _a244, _k244 );
} }
if ( cia_alive == 0 && cdc_alive == 0 && !level.isresetting_grief && isDefined( level.host_ended_game ) && !level.host_ended_game ) if ( cia_alive == 0 && cdc_alive == 0 && !level.isresetting_grief && isDefined( level.host_ended_game ) && !level.host_ended_game )
{ {
wait 0,5; wait 0.5;
if ( isDefined( level._grief_reset_message ) ) if ( isDefined( level._grief_reset_message ) )
{ {
level thread [[ level._grief_reset_message ]](); level thread [[ level._grief_reset_message ]]();
@ -285,42 +263,35 @@ wait_for_team_death_and_round_end()
level thread reset_grief(); level thread reset_grief();
level thread maps/mp/zombies/_zm::round_think( 1 ); level thread maps/mp/zombies/_zm::round_think( 1 );
} }
else else if ( !checking_for_round_end )
{
if ( !checking_for_round_end )
{ {
if ( cia_alive == 0 ) if ( cia_alive == 0 )
{ {
level thread check_for_round_end( "B" ); level thread check_for_round_end( "B" );
checking_for_round_end = 1; checking_for_round_end = 1;
break;
} }
else else if ( cdc_alive == 0 )
{
if ( cdc_alive == 0 )
{ {
level thread check_for_round_end( "A" ); level thread check_for_round_end( "A" );
checking_for_round_end = 1; checking_for_round_end = 1;
} }
} }
}
}
if ( cia_alive > 0 && cdc_alive > 0 ) if ( cia_alive > 0 && cdc_alive > 0 )
{ {
level notify( "stop_round_end_check" ); level notify( "stop_round_end_check" );
checking_for_round_end = 0; checking_for_round_end = 0;
} }
wait 0,05; wait 0.05;
} }
} }
reset_grief() reset_grief() //checked matches cerberus output
{ {
wait 1; wait 1;
level.isresetting_grief = 0; level.isresetting_grief = 0;
} }
check_for_round_end( winner ) check_for_round_end( winner ) //checked partially changed to match cerberus output //did not change while loop to for loop to prevent the infinite loop continue bug
{ {
level endon( "keep_griefing" ); level endon( "keep_griefing" );
level endon( "stop_round_end_check" ); level endon( "stop_round_end_check" );
@ -338,19 +309,16 @@ check_for_round_end( winner )
i++; i++;
continue; continue;
} }
else
{
players[ i ] thread maps/mp/zombies/_zm_audio_announcer::leaderdialogonplayer( "grief_lost" ); players[ i ] thread maps/mp/zombies/_zm_audio_announcer::leaderdialogonplayer( "grief_lost" );
}
i++; i++;
} }
level notify( "game_module_ended" ); level notify( "game_module_ended", winner );
level._game_module_game_end_check = undefined; level._game_module_game_end_check = undefined;
maps/mp/gametypes_zm/_zm_gametype::track_encounters_win_stats( level.gamemodulewinningteam ); maps/mp/gametypes_zm/_zm_gametype::track_encounters_win_stats( level.gamemodulewinningteam );
level notify( "end_game" ); level notify( "end_game" );
} }
wait_for_team_death() wait_for_team_death() //checked partially changed to match cerberus output //did not change while loop to foreach with continue to prevent infinite loop bug
{ {
wait 15; wait 15;
winner = undefined; winner = undefined;
@ -359,49 +327,42 @@ wait_for_team_death()
cdc_alive = 0; cdc_alive = 0;
cia_alive = 0; cia_alive = 0;
players = get_players(); players = get_players();
_a418 = players; while ( i < players.size )
_k418 = getFirstArrayKey( _a418 );
while ( isDefined( _k418 ) )
{ {
player = _a418[ _k418 ]; if ( players[ i ]._encounters_team == "A" )
if ( player._encounters_team == "A" )
{ {
if ( is_player_valid( player ) || isDefined( level.force_solo_quick_revive ) && level.force_solo_quick_revive && isDefined( player.lives ) && player.lives > 0 ) if ( is_player_valid( players[ i ] ) || isDefined( level.force_solo_quick_revive ) && level.force_solo_quick_revive && isDefined( players[ i ].lives ) && players[ i ].lives > 0 )
{ {
cia_alive++; cia_alive++;
i++;
continue;
} }
} }
else if ( is_player_valid( players[ i ] ) || isDefined( level.force_solo_quick_revive ) && level.force_solo_quick_revive && isDefined( players[ i ].lives ) && players[ i ].lives > 0 )
{
if ( is_player_valid( player ) || isDefined( level.force_solo_quick_revive ) && level.force_solo_quick_revive && isDefined( player.lives ) && player.lives > 0 )
{ {
cdc_alive++; cdc_alive++;
} }
} i++;
_k418 = getNextArrayKey( _a418, _k418 );
} }
if ( cia_alive == 0 ) if ( cia_alive == 0 )
{ {
winner = "B"; winner = "B";
} }
else else if ( cdc_alive == 0 )
{
if ( cdc_alive == 0 )
{ {
winner = "A"; winner = "A";
} }
wait 0.05;
} }
wait 0,05; level notify( "game_module_ended", winner );
}
level notify( "game_module_ended" );
} }
make_supersprinter() make_supersprinter() //checked matches cerberus output
{ {
self set_zombie_run_cycle( "super_sprint" ); self set_zombie_run_cycle( "super_sprint" );
} }
game_module_custom_intermission( intermission_struct ) game_module_custom_intermission( intermission_struct ) //checked matches cerberus output
{ {
self closemenu(); self closemenu();
self closeingamemenu(); self closeingamemenu();
@ -444,7 +405,7 @@ game_module_custom_intermission( intermission_struct )
self.game_over_bg thread maps/mp/zombies/_zm::fade_up_over_time( 1 ); self.game_over_bg thread maps/mp/zombies/_zm::fade_up_over_time( 1 );
} }
create_fireworks( launch_spots, min_wait, max_wait, randomize ) create_fireworks( launch_spots, min_wait, max_wait, randomize ) //checked changed to match cerberus output
{ {
level endon( "stop_fireworks" ); level endon( "stop_fireworks" );
while ( 1 ) while ( 1 )
@ -453,26 +414,22 @@ create_fireworks( launch_spots, min_wait, max_wait, randomize )
{ {
launch_spots = array_randomize( launch_spots ); launch_spots = array_randomize( launch_spots );
} }
_a516 = launch_spots; foreach ( spot in launch_spots )
_k516 = getFirstArrayKey( _a516 );
while ( isDefined( _k516 ) )
{ {
spot = _a516[ _k516 ];
level thread fireworks_launch( spot ); level thread fireworks_launch( spot );
wait randomfloatrange( min_wait, max_wait ); wait randomfloatrange( min_wait, max_wait );
_k516 = getNextArrayKey( _a516, _k516 );
} }
wait randomfloatrange( min_wait, max_wait ); wait randomfloatrange( min_wait, max_wait );
} }
} }
fireworks_launch( launch_spot ) fireworks_launch( launch_spot ) //checked matches cerberus output
{ {
firework = spawn( "script_model", launch_spot.origin + ( randomintrange( -60, 60 ), randomintrange( -60, 60 ), 0 ) ); firework = spawn( "script_model", launch_spot.origin + ( randomintrange( -60, 60 ), randomintrange( -60, 60 ), 0 ) );
firework setmodel( "tag_origin" ); firework setmodel( "tag_origin" );
wait_network_frame(); wait_network_frame();
playfxontag( level._effect[ "fw_trail_cheap" ], firework, "tag_origin" ); playfxontag( level._effect[ "fw_trail_cheap" ], firework, "tag_origin" );
firework playloopsound( "zmb_souls_loop", 0,75 ); firework playloopsound( "zmb_souls_loop", 0.75 );
dest = launch_spot; dest = launch_spot;
while ( isDefined( dest ) && isDefined( dest.target ) ) while ( isDefined( dest ) && isDefined( dest.target ) )
{ {
@ -489,3 +446,4 @@ fireworks_launch( launch_spot )
playfx( level._effect[ "fw_pre_burst" ], firework.origin ); playfx( level._effect[ "fw_pre_burst" ], firework.origin );
firework delete(); firework delete();
} }

View File

@ -8,7 +8,7 @@
#include maps/mp/_utility; #include maps/mp/_utility;
#include common_scripts/utility; #include common_scripts/utility;
init() init() //checked matches cerberus output
{ {
level.trap_kills = 0; level.trap_kills = 0;
traps = getentarray( "zombie_trap", "targetname" ); traps = getentarray( "zombie_trap", "targetname" );
@ -19,7 +19,7 @@ init()
level.elec_trap_cooldown_time = 60; level.elec_trap_cooldown_time = 60;
} }
trap_init() trap_init() //checked partially changed to match cerberus output //did not change for loop to while loop to prevent infinite loop bug caused by continue in a for loop
{ {
self ent_flag_init( "flag_active" ); self ent_flag_init( "flag_active" );
self ent_flag_init( "flag_cooldown" ); self ent_flag_init( "flag_cooldown" );
@ -30,10 +30,7 @@ trap_init()
if ( isDefined( level._zombiemode_trap_activate_funcs ) && isDefined( level._zombiemode_trap_activate_funcs[ self._trap_type ] ) ) if ( isDefined( level._zombiemode_trap_activate_funcs ) && isDefined( level._zombiemode_trap_activate_funcs[ self._trap_type ] ) )
{ {
self._trap_activate_func = level._zombiemode_trap_activate_funcs[ self._trap_type ]; self._trap_activate_func = level._zombiemode_trap_activate_funcs[ self._trap_type ];
break;
} }
else
{
switch( self.script_noteworthy ) switch( self.script_noteworthy )
{ {
case "rotating": case "rotating":
@ -49,7 +46,6 @@ trap_init()
default: default:
self._trap_activate_func = ::trap_activate_fire; self._trap_activate_func = ::trap_activate_fire;
} }
}
if ( isDefined( level._zombiemode_trap_use_funcs ) && isDefined( level._zombiemode_trap_use_funcs[ self._trap_type ] ) ) if ( isDefined( level._zombiemode_trap_use_funcs ) && isDefined( level._zombiemode_trap_use_funcs[ self._trap_type ] ) )
{ {
self._trap_use_func = level._zombiemode_trap_use_funcs[ self._trap_type ]; self._trap_use_func = level._zombiemode_trap_use_funcs[ self._trap_type ];
@ -58,16 +54,15 @@ trap_init()
{ {
self._trap_use_func = ::trap_use_think; self._trap_use_func = ::trap_use_think;
} }
} }
self trap_model_type_init(); self trap_model_type_init();
self._trap_use_trigs = []; self._trap_use_trigs = [];
self._trap_lights = []; self._trap_lights = [];
self._trap_movers = []; self._trap_movers = [];
self._trap_switches = []; self._trap_switches = [];
components = getentarray( self.target, "targetname" ); components = getentarray( self.target, "targetname" );
i = 0; for ( i = 0; i < components.size; i++ )
while ( i < components.size ) {
{
if ( isDefined( components[ i ].script_noteworthy ) ) if ( isDefined( components[ i ].script_noteworthy ) )
{ {
switch( components[ i ].script_noteworthy ) switch( components[ i ].script_noteworthy )
@ -75,33 +70,21 @@ while ( i < components.size )
case "counter_1s": case "counter_1s":
self.counter_1s = components[ i ]; self.counter_1s = components[ i ];
break; break;
i++;
continue;
case "counter_10s": case "counter_10s":
self.counter_10s = components[ i ]; self.counter_10s = components[ i ];
break; break;
i++;
continue;
case "counter_100s": case "counter_100s":
self.counter_100s = components[ i ]; self.counter_100s = components[ i ];
break; break;
i++;
continue;
case "mover": case "mover":
self._trap_movers[ self._trap_movers.size ] = components[ i ]; self._trap_movers[ self._trap_movers.size ] = components[ i ];
break; break;
i++;
continue;
case "switch": case "switch":
self._trap_switches[ self._trap_switches.size ] = components[ i ]; self._trap_switches[ self._trap_switches.size ] = components[ i ];
break; break;
i++;
continue;
case "light": case "light":
self._trap_lightes[ self._trap_lightes.size ] = components[ i ]; self._trap_lightes[ self._trap_lightes.size ] = components[ i ];
break; break;
i++;
continue;
} }
} }
if ( isDefined( components[ i ].script_string ) ) if ( isDefined( components[ i ].script_string ) )
@ -111,38 +94,24 @@ while ( i < components.size )
case "flipper1": case "flipper1":
self.flipper1 = components[ i ]; self.flipper1 = components[ i ];
break; break;
i++;
continue;
case "flipper2": case "flipper2":
self.flipper2 = components[ i ]; self.flipper2 = components[ i ];
break; break;
i++;
continue;
case "flipper1_radius_check": case "flipper1_radius_check":
self.flipper1_radius_check = components[ i ]; self.flipper1_radius_check = components[ i ];
break; break;
i++;
continue;
case "flipper2_radius_check": case "flipper2_radius_check":
self.flipper2_radius_check = components[ i ]; self.flipper2_radius_check = components[ i ];
break; break;
i++;
continue;
case "target1": case "target1":
self.target1 = components[ i ]; self.target1 = components[ i ];
break; break;
i++;
continue;
case "target2": case "target2":
self.target2 = components[ i ]; self.target2 = components[ i ];
break; break;
i++;
continue;
case "target3": case "target3":
self.target3 = components[ i ]; self.target3 = components[ i ];
break; break;
i++;
continue;
} }
} }
switch( components[ i ].classname ) switch( components[ i ].classname )
@ -150,8 +119,6 @@ while ( i < components.size )
case "trigger_use": case "trigger_use":
self._trap_use_trigs[ self._trap_use_trigs.size ] = components[ i ]; self._trap_use_trigs[ self._trap_use_trigs.size ] = components[ i ];
break; break;
i++;
continue;
case "script_model": case "script_model":
if ( components[ i ].model == self._trap_light_model_off ) if ( components[ i ].model == self._trap_light_model_off )
{ {
@ -162,74 +129,63 @@ while ( i < components.size )
self._trap_switches[ self._trap_switches.size ] = components[ i ]; self._trap_switches[ self._trap_switches.size ] = components[ i ];
} }
} }
i++; }
} self._trap_fx_structs = [];
self._trap_fx_structs = []; components = getstructarray( self.target, "targetname" );
components = getstructarray( self.target, "targetname" ); i = 0;
i = 0; while ( i < components.size )
while ( i < components.size ) {
{
if ( isDefined( components[ i ].script_string ) && components[ i ].script_string == "use_this_angle" ) if ( isDefined( components[ i ].script_string ) && components[ i ].script_string == "use_this_angle" )
{ {
self.use_this_angle = components[ i ]; self.use_this_angle = components[ i ];
i++; i++;
continue; continue;
} }
else
{
self._trap_fx_structs[ self._trap_fx_structs.size ] = components[ i ]; self._trap_fx_structs[ self._trap_fx_structs.size ] = components[ i ];
i++;
} }
i++; /*
} /#
/# assert( self._trap_use_trigs.size > 0, "_zm_traps::init no use triggers found for " + self.target );
assert( self._trap_use_trigs.size > 0, "_zm_traps::init no use triggers found for " + self.target ); #/
#/ */
if ( !isDefined( self.zombie_cost ) ) if ( !isDefined( self.zombie_cost ) )
{ {
self.zombie_cost = 1000; self.zombie_cost = 1000;
} }
self._trap_in_use = 0; self._trap_in_use = 0;
self._trap_cooling_down = 0; self._trap_cooling_down = 0;
self thread trap_dialog(); self thread trap_dialog();
flag_wait( "start_zombie_round_logic" ); flag_wait( "start_zombie_round_logic" );
self trap_lights_red(); self trap_lights_red();
i = 0; for ( i = 0; i < self._trap_use_trigs.size; i++ )
while ( i < self._trap_use_trigs.size ) {
{
self._trap_use_trigs[ i ] setcursorhint( "HINT_NOICON" ); self._trap_use_trigs[ i ] setcursorhint( "HINT_NOICON" );
i++; }
} if ( !isDefined( self.script_flag_wait ) )
if ( !isDefined( self.script_flag_wait ) ) {
{
self trap_set_string( &"ZOMBIE_NEED_POWER" ); self trap_set_string( &"ZOMBIE_NEED_POWER" );
flag_wait( "power_on" ); flag_wait( "power_on" );
} }
else else if ( !isDefined( level.flag[ self.script_flag_wait ] ) )
{
if ( !isDefined( level.flag[ self.script_flag_wait ] ) )
{ {
flag_init( self.script_flag_wait ); flag_init( self.script_flag_wait );
} }
flag_wait( self.script_flag_wait ); flag_wait( self.script_flag_wait );
} self trap_set_string( &"ZOMBIE_BUTTON_BUY_TRAP", self.zombie_cost );
self trap_set_string( &"ZOMBIE_BUTTON_BUY_TRAP", self.zombie_cost ); self trap_lights_green();
self trap_lights_green(); for ( i = 0; i < self._trap_use_trigs.size; i++ )
i = 0; {
while ( i < self._trap_use_trigs.size )
{
self._trap_use_trigs[ i ] thread [[ self._trap_use_func ]]( self ); self._trap_use_trigs[ i ] thread [[ self._trap_use_func ]]( self );
i++; }
}
} }
trap_use_think( trap ) trap_use_think( trap ) //checked changed to match cerberus output
{ {
for ( ;; )
{
while ( 1 ) while ( 1 )
{ {
self waittill( "trigger", who ); self waittill( "trigger", who );
while ( who in_revive_trigger() ) if ( who in_revive_trigger() )
{ {
continue; continue;
} }
@ -238,11 +194,10 @@ trap_use_think( trap )
if ( who.score >= trap.zombie_cost ) if ( who.score >= trap.zombie_cost )
{ {
who maps/mp/zombies/_zm_score::minus_to_player_score( trap.zombie_cost ); who maps/mp/zombies/_zm_score::minus_to_player_score( trap.zombie_cost );
break;
} }
else else
{ {
} continue;
} }
trap._trap_in_use = 1; trap._trap_in_use = 1;
trap trap_set_string( &"ZOMBIE_TRAP_ACTIVE" ); trap trap_set_string( &"ZOMBIE_TRAP_ACTIVE" );
@ -258,12 +213,14 @@ trap_use_think( trap )
trap trigger_off(); trap trigger_off();
trap._trap_cooling_down = 1; trap._trap_cooling_down = 1;
trap trap_set_string( &"ZOMBIE_TRAP_COOLDOWN" ); trap trap_set_string( &"ZOMBIE_TRAP_COOLDOWN" );
/# /*
/#
if ( getDvarInt( "zombie_cheat" ) >= 1 ) if ( getDvarInt( "zombie_cheat" ) >= 1 )
{ {
trap._trap_cooldown_time = 5; trap._trap_cooldown_time = 5;
#/ #/
} }
*/
wait trap._trap_cooldown_time; wait trap._trap_cooldown_time;
trap._trap_cooling_down = 0; trap._trap_cooling_down = 0;
trap notify( "available" ); trap notify( "available" );
@ -273,10 +230,9 @@ trap_use_think( trap )
} }
} }
trap_lights_red() trap_lights_red() //checked changed to match cerberus output
{ {
i = 0; for ( i = 0; i < self._trap_lights.size; i++ )
while ( i < self._trap_lights.size )
{ {
light = self._trap_lights[ i ]; light = self._trap_lights[ i ];
light setmodel( self._trap_light_model_red ); light setmodel( self._trap_light_model_red );
@ -288,11 +244,10 @@ trap_lights_red()
light.fx setmodel( "tag_origin" ); light.fx setmodel( "tag_origin" );
light.fx.angles = light.angles; light.fx.angles = light.angles;
playfxontag( level._effect[ "zapper_light_notready" ], light.fx, "tag_origin" ); playfxontag( level._effect[ "zapper_light_notready" ], light.fx, "tag_origin" );
i++;
} }
} }
trap_lights_green() trap_lights_green() //checked partially changed to match cerberus output //did not change while loop to for loop to prevent infinite loop bug
{ {
i = 0; i = 0;
while ( i < self._trap_lights.size ) while ( i < self._trap_lights.size )
@ -303,8 +258,6 @@ trap_lights_green()
i++; i++;
continue; continue;
} }
else
{
light setmodel( self._trap_light_model_green ); light setmodel( self._trap_light_model_green );
if ( isDefined( light.fx ) ) if ( isDefined( light.fx ) )
{ {
@ -314,12 +267,11 @@ trap_lights_green()
light.fx setmodel( "tag_origin" ); light.fx setmodel( "tag_origin" );
light.fx.angles = light.angles; light.fx.angles = light.angles;
playfxontag( level._effect[ "zapper_light_ready" ], light.fx, "tag_origin" ); playfxontag( level._effect[ "zapper_light_ready" ], light.fx, "tag_origin" );
}
i++; i++;
} }
} }
trap_set_string( string, param1, param2 ) trap_set_string( string, param1, param2 ) //checked partially changed to match cerberus output //did not change while loop to for loop to prevent infinite loop bug with continues
{ {
i = 0; i = 0;
while ( i < self._trap_use_trigs.size ) while ( i < self._trap_use_trigs.size )
@ -330,44 +282,37 @@ trap_set_string( string, param1, param2 )
i++; i++;
continue; continue;
} }
else if ( !isDefined( param2 ) ) if ( !isDefined( param2 ) )
{ {
self._trap_use_trigs[ i ] sethintstring( string, param1 ); self._trap_use_trigs[ i ] sethintstring( string, param1 );
i++; i++;
continue; continue;
} }
else
{
self._trap_use_trigs[ i ] sethintstring( string, param1, param2 ); self._trap_use_trigs[ i ] sethintstring( string, param1, param2 );
}
i++; i++;
} }
} }
trap_move_switches() trap_move_switches() //checked checked changed to match cerberus output
{ {
self trap_lights_red(); self trap_lights_red();
i = 0; for ( i = 0; i < self._trap_switches.size; i++ )
while ( i < self._trap_switches.size )
{ {
self._trap_switches[ i ] rotatepitch( 180, 0,5 ); self._trap_switches[ i ] rotatepitch( 180, 0,5 );
self._trap_switches[ i ] playsound( "amb_sparks_l_b" ); self._trap_switches[ i ] playsound( "amb_sparks_l_b" );
i++;
} }
self._trap_switches[ 0 ] waittill( "rotatedone" ); self._trap_switches[ 0 ] waittill( "rotatedone" );
self notify( "switch_activated" ); self notify( "switch_activated" );
self waittill( "available" ); self waittill( "available" );
i = 0; for ( i = 0; i < self._trap_switches.size; i++ )
while ( i < self._trap_switches.size )
{ {
self._trap_switches[ i ] rotatepitch( -180, 0,5 ); self._trap_switches[ i ] rotatepitch( -180, 0,5 );
i++;
} }
self._trap_switches[ 0 ] waittill( "rotatedone" ); self._trap_switches[ 0 ] waittill( "rotatedone" );
self trap_lights_green(); self trap_lights_green();
} }
trap_activate_electric() trap_activate_electric() //checked changed to match cerberus output
{ {
self._trap_duration = 40; self._trap_duration = 40;
self._trap_cooldown_time = 60; self._trap_cooldown_time = 60;
@ -385,12 +330,10 @@ trap_activate_electric()
} }
} }
fx_points = getstructarray( self.target, "targetname" ); fx_points = getstructarray( self.target, "targetname" );
i = 0; for ( i = 0; i < fx_points.size; i++ )
while ( i < fx_points.size )
{ {
wait_network_frame(); wait_network_frame();
fx_points[ i ] thread trap_audio_fx( self ); fx_points[ i ] thread trap_audio_fx( self );
i++;
} }
self thread trap_damage(); self thread trap_damage();
wait self._trap_duration; wait self._trap_duration;
@ -401,19 +344,17 @@ trap_activate_electric()
} }
} }
trap_activate_fire() trap_activate_fire() //checked changed to match cerberus output
{ {
self._trap_duration = 40; self._trap_duration = 40;
self._trap_cooldown_time = 60; self._trap_cooldown_time = 60;
clientnotify( self.script_string + "1" ); clientnotify( self.script_string + "1" );
clientnotify( self.script_parameters ); clientnotify( self.script_parameters );
fx_points = getstructarray( self.target, "targetname" ); fx_points = getstructarray( self.target, "targetname" );
i = 0; while ( i = 0; i < fx_points.size; i++ )
while ( i < fx_points.size )
{ {
wait_network_frame(); wait_network_frame();
fx_points[ i ] thread trap_audio_fx( self ); fx_points[ i ] thread trap_audio_fx( self );
i++;
} }
self thread trap_damage(); self thread trap_damage();
wait self._trap_duration; wait self._trap_duration;
@ -422,7 +363,7 @@ trap_activate_fire()
clientnotify( self.script_parameters ); clientnotify( self.script_parameters );
} }
trap_activate_rotating() trap_activate_rotating() //checked partially changed to match cerberus output
{ {
self endon( "trap_done" ); self endon( "trap_done" );
self._trap_duration = 30; self._trap_duration = 30;
@ -430,47 +371,39 @@ trap_activate_rotating()
self thread trap_damage(); self thread trap_damage();
self thread trig_update( self._trap_movers[ 0 ] ); self thread trig_update( self._trap_movers[ 0 ] );
old_angles = self._trap_movers[ 0 ].angles; old_angles = self._trap_movers[ 0 ].angles;
i = 0; for ( i = 0; i < self._trap_movers.size; i++ )
while ( i < self._trap_movers.size )
{ {
self._trap_movers[ i ] rotateyaw( 360, 5, 4,5 ); self._trap_movers[ i ] rotateyaw( 360, 5, 4.5 );
i++;
} }
wait 5; wait 5;
step = 1,5; step = 1.5;
t = 0; t = 0;
while ( t < self._trap_duration ) while ( t < self._trap_duration ) //this would not make sense as a for loop leaving as a while loop
{ {
i = 0; for ( i = 0; i < self._trap_movers.size; i++ )
while ( i < self._trap_movers.size )
{ {
self._trap_movers[ i ] rotateyaw( 360, step ); self._trap_movers[ i ] rotateyaw( 360, step );
i++;
} }
wait step; wait step;
t += step; t += step;
} }
i = 0; for ( i = 0; i < self._trap_movers.size i++ )
while ( i < self._trap_movers.size )
{ {
self._trap_movers[ i ] rotateyaw( 360, 5, 0, 4,5 ); self._trap_movers[ i ] rotateyaw( 360, 5, 0, 4.5 );
i++;
} }
wait 5; wait 5;
i = 0; for ( i = 0; i < self._trap_movers.size; i++ )
while ( i < self._trap_movers.size )
{ {
self._trap_movers[ i ].angles = old_angles; self._trap_movers[ i ].angles = old_angles;
i++;
} }
self notify( "trap_done" ); self notify( "trap_done" );
} }
trap_activate_flipper() trap_activate_flipper() //checked matches cerberus output
{ {
} }
trap_audio_fx( trap ) trap_audio_fx( trap ) //checked matches cerberus output
{ {
sound_origin = undefined; sound_origin = undefined;
if ( trap.script_noteworthy == "electric" ) if ( trap.script_noteworthy == "electric" )
@ -497,22 +430,22 @@ trap_audio_fx( trap )
playsoundatposition( "zmb_firetrap_end", sound_origin.origin ); playsoundatposition( "zmb_firetrap_end", sound_origin.origin );
} }
sound_origin stoploopsound(); sound_origin stoploopsound();
wait 0,05; wait 0.05;
sound_origin delete(); sound_origin delete();
} }
} }
play_electrical_sound( trap ) play_electrical_sound( trap ) //checked matches cerberus output
{ {
trap endon( "trap_done" ); trap endon( "trap_done" );
while ( 1 ) while ( 1 )
{ {
wait randomfloatrange( 0,1, 0,5 ); wait randomfloatrange( 0.1, 0.5 );
playsoundatposition( "zmb_elec_arc", self.origin ); playsoundatposition( "zmb_elec_arc", self.origin );
} }
} }
trap_damage() trap_damage() //checked partially changed to match cerberus output
{ {
self endon( "trap_done" ); self endon( "trap_done" );
while ( 1 ) while ( 1 )
@ -537,8 +470,7 @@ trap_damage()
} }
break; break;
} }
break; //break; //this doesn't make much sense commenting out
continue;
} }
else if ( !isDefined( ent.marked_for_death ) ) else if ( !isDefined( ent.marked_for_death ) )
{ {
@ -557,24 +489,23 @@ trap_damage()
default: default:
ent thread zombie_trap_death( self, randomint( 100 ) ); ent thread zombie_trap_death( self, randomint( 100 ) );
break; break;
break;
} }
} }
} }
} }
trig_update( parent ) trig_update( parent ) //checked matches cerberus output
{ {
self endon( "trap_done" ); self endon( "trap_done" );
start_angles = self.angles; start_angles = self.angles;
while ( 1 ) while ( 1 )
{ {
self.angles = parent.angles; self.angles = parent.angles;
wait 0,05; wait 0.05;
} }
} }
player_elec_damage() player_elec_damage() //checked changed to match cerberus output
{ {
self endon( "death" ); self endon( "death" );
self endon( "disconnect" ); self endon( "disconnect" );
@ -587,35 +518,34 @@ player_elec_damage()
self.is_burning = 1; self.is_burning = 1;
if ( is_true( level.trap_electric_visionset_registered ) ) if ( is_true( level.trap_electric_visionset_registered ) )
{ {
maps/mp/_visionset_mgr::vsmgr_activate( "overlay", "zm_trap_electric", self, 1,25, 1,25 ); maps/mp/_visionset_mgr::vsmgr_activate( "overlay", "zm_trap_electric", self, 1.25, 1.25 );
} }
else else
{ {
self setelectrified( 1,25 ); self setelectrified( 1.25 );
} }
shocktime = 2,5; shocktime = 2.5;
self shellshock( "electrocution", shocktime ); self shellshock( "electrocution", shocktime );
if ( level.elec_loop == 0 ) if ( level.elec_loop == 0 )
{ {
elec_loop = 1; elec_loop = 1;
self playsound( "zmb_zombie_arc" ); self playsound( "zmb_zombie_arc" );
} }
if ( !self hasperk( "specialty_armorvest" ) || ( self.health - 100 ) < 1 ) if ( !self hasperk( "specialty_armorvest" ) || self.health - 100 < 1 )
{ {
radiusdamage( self.origin, 10, self.health + 100, self.health + 100 ); radiusdamage( self.origin, 10, self.health + 100, self.health + 100 );
self.is_burning = undefined; self.is_burning = undefined;
return;
} }
else else
{ {
self dodamage( 50, self.origin ); self dodamage( 50, self.origin );
wait 0,1; wait 0.1;
self.is_burning = undefined; self.is_burning = undefined;
} }
} }
} }
player_fire_damage() player_fire_damage() //checked changed to match cerberus output
{ {
self endon( "death" ); self endon( "death" );
self endon( "disconnect" ); self endon( "disconnect" );
@ -624,29 +554,28 @@ player_fire_damage()
self.is_burning = 1; self.is_burning = 1;
if ( is_true( level.trap_fire_visionset_registered ) ) if ( is_true( level.trap_fire_visionset_registered ) )
{ {
maps/mp/_visionset_mgr::vsmgr_activate( "overlay", "zm_trap_burn", self, 1,25, 1,25 ); maps/mp/_visionset_mgr::vsmgr_activate( "overlay", "zm_trap_burn", self, 1.25, 1.25 );
} }
else else
{ {
self setburn( 1,25 ); self setburn( 1.25 );
} }
self notify( "burned" ); self notify( "burned" );
if ( !self hasperk( "specialty_armorvest" ) || ( self.health - 100 ) < 1 ) if ( !self hasperk( "specialty_armorvest" ) || self.health - 100 < 1 )
{ {
radiusdamage( self.origin, 10, self.health + 100, self.health + 100 ); radiusdamage( self.origin, 10, self.health + 100, self.health + 100 );
self.is_burning = undefined; self.is_burning = undefined;
return;
} }
else else
{ {
self dodamage( 50, self.origin ); self dodamage( 50, self.origin );
wait 0,1; wait 0.1;
self.is_burning = undefined; self.is_burning = undefined;
} }
} }
} }
zombie_trap_death( trap, param ) zombie_trap_death( trap, param ) //checked matches cerberus output
{ {
self endon( "death" ); self endon( "death" );
self.marked_for_death = 1; self.marked_for_death = 1;
@ -664,7 +593,7 @@ zombie_trap_death( trap, param )
self playsound( "ignite" ); self playsound( "ignite" );
self thread maps/mp/animscripts/zm_death::flame_death_fx(); self thread maps/mp/animscripts/zm_death::flame_death_fx();
playfxontag( level._effect[ "character_fire_death_torso" ], self, "J_SpineLower" ); playfxontag( level._effect[ "character_fire_death_torso" ], self, "J_SpineLower" );
wait randomfloat( 1,25 ); wait randomfloat( 1.25 );
} }
else else
{ {
@ -685,7 +614,7 @@ zombie_trap_death( trap, param )
self thread play_elec_vocals(); self thread play_elec_vocals();
} }
} }
wait randomfloat( 1,25 ); wait randomfloat( 1.25 );
self playsound( "zmb_zombie_arc" ); self playsound( "zmb_zombie_arc" );
} }
} }
@ -717,26 +646,26 @@ zombie_trap_death( trap, param )
} }
} }
zombie_flame_watch() zombie_flame_watch() //checked matches cerberus output
{ {
self waittill( "death" ); self waittill( "death" );
self stoploopsound(); self stoploopsound();
arrayremovevalue( level.burning_zombies, self ); arrayremovevalue( level.burning_zombies, self );
} }
play_elec_vocals() play_elec_vocals() //checked matches cerberus output
{ {
if ( isDefined( self ) ) if ( isDefined( self ) )
{ {
org = self.origin; org = self.origin;
wait 0,15; wait 0.15;
playsoundatposition( "zmb_elec_vocals", org ); playsoundatposition( "zmb_elec_vocals", org );
playsoundatposition( "zmb_zombie_arc", org ); playsoundatposition( "zmb_zombie_arc", org );
playsoundatposition( "zmb_exp_jib_zombie", org ); playsoundatposition( "zmb_exp_jib_zombie", org );
} }
} }
electroctute_death_fx() electroctute_death_fx() //checked matches cerberus output
{ {
self endon( "death" ); self endon( "death" );
if ( isDefined( self.is_electrocuted ) && self.is_electrocuted ) if ( isDefined( self.is_electrocuted ) && self.is_electrocuted )
@ -784,7 +713,7 @@ electroctute_death_fx()
} }
} }
electrocute_timeout() electrocute_timeout() //checked matches cerberus output
{ {
self endon( "death" ); self endon( "death" );
self playloopsound( "fire_manager_0" ); self playloopsound( "fire_manager_0" );
@ -797,14 +726,14 @@ electrocute_timeout()
} }
} }
trap_dialog() trap_dialog() //checked partially changed to match cerberus output //did not change while loop to for loop to prevent in the infinite for loop bug caused by continues
{ {
self endon( "warning_dialog" ); self endon( "warning_dialog" );
level endon( "switch_flipped" ); level endon( "switch_flipped" );
timer = 0; timer = 0;
while ( 1 ) while ( 1 )
{ {
wait 0,5; wait 0.5;
players = get_players(); players = get_players();
i = 0; i = 0;
while ( i < players.size ) while ( i < players.size )
@ -816,11 +745,9 @@ trap_dialog()
i++; i++;
continue; continue;
} }
else
{
if ( dist < 4900 && timer < 3 ) if ( dist < 4900 && timer < 3 )
{ {
wait 0,5; wait 0.5;
timer++; timer++;
} }
if ( dist < 4900 && timer == 3 ) if ( dist < 4900 && timer == 3 )
@ -830,35 +757,32 @@ trap_dialog()
wait 3; wait 3;
self notify( "warning_dialog" ); self notify( "warning_dialog" );
} }
}
i++; i++;
} }
} }
} }
get_trap_array( trap_type ) get_trap_array( trap_type ) //checked changed to match cerberus output
{ {
ents = getentarray( "zombie_trap", "targetname" ); ents = getentarray( "zombie_trap", "targetname" );
traps = []; traps = [];
i = 0; for ( i = 0; i < ents.size i++ )
while ( i < ents.size )
{ {
if ( ents[ i ].script_noteworthy == trap_type ) if ( ents[ i ].script_noteworthy == trap_type )
{ {
traps[ traps.size ] = ents[ i ]; traps[ traps.size ] = ents[ i ];
} }
i++;
} }
return traps; return traps;
} }
trap_disable() trap_disable() //checked matches cerberus output
{ {
cooldown = self._trap_cooldown_time; cooldown = self._trap_cooldown_time;
if ( self._trap_in_use ) if ( self._trap_in_use )
{ {
self notify( "trap_done" ); self notify( "trap_done" );
self._trap_cooldown_time = 0,05; self._trap_cooldown_time = 0.05;
self waittill( "available" ); self waittill( "available" );
} }
array_thread( self._trap_use_trigs, ::trigger_off ); array_thread( self._trap_use_trigs, ::trigger_off );
@ -866,13 +790,13 @@ trap_disable()
self._trap_cooldown_time = cooldown; self._trap_cooldown_time = cooldown;
} }
trap_enable() trap_enable() //checked matches cerberus output
{ {
array_thread( self._trap_use_trigs, ::trigger_on ); array_thread( self._trap_use_trigs, ::trigger_on );
self trap_lights_green(); self trap_lights_green();
} }
trap_model_type_init() trap_model_type_init() //checked matches cerberus output
{ {
if ( !isDefined( self.script_parameters ) ) if ( !isDefined( self.script_parameters ) )
{ {
@ -896,14 +820,11 @@ trap_model_type_init()
} }
} }
register_visionsets( a_traps ) register_visionsets( a_traps ) //checked changed to match cerberus output
{ {
a_registered_traps = []; a_registered_traps = [];
_a1177 = a_traps; foreach ( trap in a_traps )
_k1177 = getFirstArrayKey( _a1177 );
while ( isDefined( _k1177 ) )
{ {
trap = _a1177[ _k1177 ];
if ( isDefined( trap.script_noteworthy ) ) if ( isDefined( trap.script_noteworthy ) )
{ {
if ( !trap is_trap_registered( a_registered_traps ) ) if ( !trap is_trap_registered( a_registered_traps ) )
@ -911,14 +832,10 @@ register_visionsets( a_traps )
a_registered_traps[ trap.script_noteworthy ] = 1; a_registered_traps[ trap.script_noteworthy ] = 1;
} }
} }
_k1177 = getNextArrayKey( _a1177, _k1177 );
} }
keys = getarraykeys( a_registered_traps ); keys = getarraykeys( a_registered_traps );
_a1190 = keys; foreach ( key in keys )
_k1190 = getFirstArrayKey( _a1190 );
while ( isDefined( _k1190 ) )
{ {
key = _a1190[ _k1190 ];
switch( key ) switch( key )
{ {
case "electric": case "electric":
@ -938,11 +855,11 @@ register_visionsets( a_traps )
level.trap_fire_visionset_registered = 1; level.trap_fire_visionset_registered = 1;
break; break;
} }
_k1190 = getNextArrayKey( _a1190, _k1190 );
} }
} }
is_trap_registered( a_registered_traps ) is_trap_registered( a_registered_traps ) //checked matches cerberus output
{ {
return isDefined( a_registered_traps[ self.script_noteworthy ] ); return isDefined( a_registered_traps[ self.script_noteworthy ] );
} }

View File

@ -4,17 +4,19 @@
#include maps/mp/_utility; #include maps/mp/_utility;
#include common_scripts/utility; #include common_scripts/utility;
#using_animtree( "zombie_cymbal_monkey" ); //#using_animtree( "zombie_cymbal_monkey" );
init() init() //checked matches cerberus output
{ {
if ( !cymbal_monkey_exists() ) if ( !cymbal_monkey_exists() )
{ {
return; return;
} }
/*
/# /#
level.zombiemode_devgui_cymbal_monkey_give = ::player_give_cymbal_monkey; level.zombiemode_devgui_cymbal_monkey_give = ::player_give_cymbal_monkey;
#/ #/
*/
if ( isDefined( level.legacy_cymbal_monkey ) && level.legacy_cymbal_monkey ) if ( isDefined( level.legacy_cymbal_monkey ) && level.legacy_cymbal_monkey )
{ {
level.cymbal_monkey_model = "weapon_zombie_monkey_bomb"; level.cymbal_monkey_model = "weapon_zombie_monkey_bomb";
@ -29,14 +31,14 @@ init()
scriptmodelsuseanimtree( -1 ); scriptmodelsuseanimtree( -1 );
} }
player_give_cymbal_monkey() player_give_cymbal_monkey() //checked matches cerberus output
{ {
self giveweapon( "cymbal_monkey_zm" ); self giveweapon( "cymbal_monkey_zm" );
self set_player_tactical_grenade( "cymbal_monkey_zm" ); self set_player_tactical_grenade( "cymbal_monkey_zm" );
self thread player_handle_cymbal_monkey(); self thread player_handle_cymbal_monkey();
} }
player_handle_cymbal_monkey() player_handle_cymbal_monkey() //checked matches cerberus output
{ {
self notify( "starting_monkey_watch" ); self notify( "starting_monkey_watch" );
self endon( "disconnect" ); self endon( "disconnect" );
@ -64,7 +66,7 @@ player_handle_cymbal_monkey()
} }
} }
watch_for_dud( model, actor ) watch_for_dud( model, actor ) //checked matches cerberus output
{ {
self endon( "death" ); self endon( "death" );
self waittill( "grenade_dud" ); self waittill( "grenade_dud" );
@ -90,7 +92,7 @@ watch_for_dud( model, actor )
} }
} }
watch_for_emp( model, actor ) watch_for_emp( model, actor ) //checked changed to match cerberus output
{ {
self endon( "death" ); self endon( "death" );
if ( !should_watch_for_emp() ) if ( !should_watch_for_emp() )
@ -100,20 +102,17 @@ watch_for_emp( model, actor )
while ( 1 ) while ( 1 )
{ {
level waittill( "emp_detonate", origin, radius ); level waittill( "emp_detonate", origin, radius );
if ( distancesquared( origin, self.origin ) < ( radius * radius ) ) if ( distancesquared( origin, self.origin ) < radius * radius )
{ {
break; break;
} }
else
{
}
} }
self.stun_fx = 1; self.stun_fx = 1;
if ( isDefined( level._equipment_emp_destroy_fx ) ) if ( isDefined( level._equipment_emp_destroy_fx ) )
{ {
playfx( level._equipment_emp_destroy_fx, self.origin + vectorScale( ( 0, 0, -1 ), 5 ), ( 0, randomfloat( 360 ), 0 ) ); playfx( level._equipment_emp_destroy_fx, self.origin + vectorScale( ( 0, 0, 1 ), 5 ), ( 0, randomfloat( 360 ), 0 ) );
} }
wait 0,15; wait 0.15;
self.attract_to_origin = 0; self.attract_to_origin = 0;
self deactivate_zombie_point_of_interest(); self deactivate_zombie_point_of_interest();
model clearanim( %o_monkey_bomb, 0 ); model clearanim( %o_monkey_bomb, 0 );
@ -138,18 +137,18 @@ watch_for_emp( model, actor )
} }
} }
clone_player_angles( owner ) clone_player_angles( owner ) //checked matches cerberus output
{ {
self endon( "death" ); self endon( "death" );
owner endon( "death" ); owner endon( "death" );
while ( isDefined( self ) ) while ( isDefined( self ) )
{ {
self.angles = owner.angles; self.angles = owner.angles;
wait 0,05; wait 0.05;
} }
} }
show_briefly( showtime ) show_briefly( showtime ) //checked matches cerberus output
{ {
self endon( "show_owner" ); self endon( "show_owner" );
if ( isDefined( self.show_for_time ) ) if ( isDefined( self.show_for_time ) )
@ -161,14 +160,14 @@ show_briefly( showtime )
self setvisibletoall(); self setvisibletoall();
while ( self.show_for_time > 0 ) while ( self.show_for_time > 0 )
{ {
self.show_for_time -= 0,05; self.show_for_time -= 0.05;
wait 0,05; wait 0.05;
} }
self setvisibletoallexceptteam( level.zombie_team ); self setvisibletoallexceptteam( level.zombie_team );
self.show_for_time = undefined; self.show_for_time = undefined;
} }
show_owner_on_attack( owner ) show_owner_on_attack( owner ) //checked matches cerberus output
{ {
owner endon( "hide_owner" ); owner endon( "hide_owner" );
owner endon( "show_owner" ); owner endon( "show_owner" );
@ -179,11 +178,11 @@ show_owner_on_attack( owner )
for ( ;; ) for ( ;; )
{ {
owner waittill( "weapon_fired" ); owner waittill( "weapon_fired" );
owner thread show_briefly( 0,5 ); owner thread show_briefly( 0.5 );
} }
} }
hide_owner( owner ) hide_owner( owner ) //checked matches cerberus output
{ {
owner notify( "hide_owner" ); owner notify( "hide_owner" );
owner endon( "hide_owner" ); owner endon( "hide_owner" );
@ -198,9 +197,11 @@ hide_owner( owner )
} }
self thread show_owner_on_attack( owner ); self thread show_owner_on_attack( owner );
evt = self waittill_any_return( "explode", "death", "grenade_dud" ); evt = self waittill_any_return( "explode", "death", "grenade_dud" );
/*
/# /#
println( "ZMCLONE: Player visible again because of " + evt ); println( "ZMCLONE: Player visible again because of " + evt );
#/ #/
*/
owner notify( "show_owner" ); owner notify( "show_owner" );
owner unsetperk( "specialty_immunemms" ); owner unsetperk( "specialty_immunemms" );
if ( isDefined( level._effect[ "human_disappears" ] ) ) if ( isDefined( level._effect[ "human_disappears" ] ) )
@ -213,16 +214,16 @@ hide_owner( owner )
owner show(); owner show();
} }
proximity_detonate( owner ) proximity_detonate( owner ) //checked changed to match cerberus output
{ {
wait 1,5; wait 1.5;
if ( !isDefined( self ) ) if ( !isDefined( self ) )
{ {
return; return;
} }
detonateradius = 96; detonateradius = 96;
explosionradius = detonateradius * 2; explosionradius = detonateradius * 2;
damagearea = spawn( "trigger_radius", self.origin + ( 0, 0, 0 - detonateradius ), 4, detonateradius, detonateradius * 1,5 ); damagearea = spawn( "trigger_radius", self.origin + ( 0, 0, 0 - detonateradius ), 4, detonateradius, detonateradius * 1.5 );
damagearea setexcludeteamfortrigger( owner.team ); damagearea setexcludeteamfortrigger( owner.team );
damagearea enablelinkto(); damagearea enablelinkto();
damagearea linkto( self ); damagearea linkto( self );
@ -240,7 +241,7 @@ proximity_detonate( owner )
} }
self playsound( "wpn_claymore_alert" ); self playsound( "wpn_claymore_alert" );
dist = distance( self.origin, ent.origin ); dist = distance( self.origin, ent.origin );
radiusdamage( self.origin + vectorScale( ( 0, 0, -1 ), 12 ), explosionradius, 1, 1, owner, "MOD_GRENADE_SPLASH", "cymbal_monkey_zm" ); radiusdamage( self.origin + vectorScale( ( 0, 0, 1 ), 12 ), explosionradius, 1, 1, owner, "MOD_GRENADE_SPLASH", "cymbal_monkey_zm" );
if ( isDefined( owner ) ) if ( isDefined( owner ) )
{ {
self detonate( owner ); self detonate( owner );
@ -257,7 +258,7 @@ proximity_detonate( owner )
} }
} }
player_throw_cymbal_monkey( grenade, num_attractors, max_attract_dist, attract_dist_diff ) player_throw_cymbal_monkey( grenade, num_attractors, max_attract_dist, attract_dist_diff ) //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
self endon( "starting_monkey_watch" ); self endon( "starting_monkey_watch" );
@ -353,7 +354,7 @@ player_throw_cymbal_monkey( grenade, num_attractors, max_attract_dist, attract_d
} }
} }
grenade_stolen_by_sam( ent_grenade, ent_model, ent_actor ) grenade_stolen_by_sam( ent_grenade, ent_model, ent_actor ) //checked changed to match cerberus output
{ {
if ( !isDefined( ent_model ) ) if ( !isDefined( ent_model ) )
{ {
@ -373,18 +374,16 @@ grenade_stolen_by_sam( ent_grenade, ent_model, ent_actor )
} }
} }
players = get_players(); players = get_players();
i = 0; for ( i = 0; i < players.size; i++ )
while ( i < players.size )
{ {
if ( isalive( players[ i ] ) ) if ( isalive( players[ i ] ) )
{ {
players[ i ] playlocalsound( level.zmb_laugh_alias ); players[ i ] playlocalsound( level.zmb_laugh_alias );
} }
i++;
} }
playfxontag( level._effect[ "grenade_samantha_steal" ], ent_model, "tag_origin" ); playfxontag( level._effect[ "grenade_samantha_steal" ], ent_model, "tag_origin" );
ent_model movez( 60, 1, 0,25, 0,25 ); ent_model movez( 60, 1, 0.25, 0.25 );
ent_model vibrate( direction, 1,5, 2,5, 1 ); ent_model vibrate( direction, 1.5, 2.5, 1 );
ent_model waittill( "movedone" ); ent_model waittill( "movedone" );
if ( isDefined( self.damagearea ) ) if ( isDefined( self.damagearea ) )
{ {
@ -405,13 +404,13 @@ grenade_stolen_by_sam( ent_grenade, ent_model, ent_actor )
} }
} }
wait_for_attractor_positions_complete() wait_for_attractor_positions_complete() //checked matches cerberus output
{ {
self waittill( "attractor_positions_generated" ); self waittill( "attractor_positions_generated" );
self.attract_to_origin = 0; self.attract_to_origin = 0;
} }
monkey_cleanup( parent ) monkey_cleanup( parent ) //checked matches cerberus output
{ {
while ( 1 ) while ( 1 )
{ {
@ -428,16 +427,16 @@ monkey_cleanup( parent )
self_delete(); self_delete();
return; return;
} }
wait 0,05; wait 0.05;
} }
} }
do_monkey_sound( model, info ) do_monkey_sound( model, info ) //checked changed to match cerberus output
{ {
self.monk_scream_vox = 0; self.monk_scream_vox = 0;
if ( isDefined( level.grenade_safe_to_bounce ) ) if ( isDefined( level.grenade_safe_to_bounce ) )
{ {
if ( !( [[ level.grenade_safe_to_bounce ]]( self.owner, "cymbal_monkey_zm" ) ) ) if ( ![[ level.grenade_safe_to_bounce ]]( self.owner, "cymbal_monkey_zm" ) )
{ {
self playsound( "zmb_vox_monkey_scream" ); self playsound( "zmb_vox_monkey_scream" );
self.monk_scream_vox = 1; self.monk_scream_vox = 1;
@ -459,20 +458,15 @@ do_monkey_sound( model, info )
self thread play_delayed_explode_vox(); self thread play_delayed_explode_vox();
} }
self waittill( "explode", position ); self waittill( "explode", position );
level notify( "grenade_exploded" ); level notify( "grenade_exploded", position, 100, 5000, 450 );
monkey_index = -1; monkey_index = -1;
i = 0; for ( i = 0; i < level.cymbal_monkeys.size; i++ )
while ( i < level.cymbal_monkeys.size )
{ {
if ( !isDefined( level.cymbal_monkeys[ i ] ) ) if ( !isDefined( level.cymbal_monkeys[ i ] ) )
{ {
monkey_index = i; monkey_index = i;
break; break;
} }
else
{
i++;
}
} }
if ( monkey_index >= 0 ) if ( monkey_index >= 0 )
{ {
@ -482,27 +476,25 @@ do_monkey_sound( model, info )
{ {
model clearanim( %o_monkey_bomb, 0,2 ); model clearanim( %o_monkey_bomb, 0,2 );
} }
i = 0; for ( i = 0; i < info.sound_attractors.size; i++ )
while ( i < info.sound_attractors.size )
{ {
if ( isDefined( info.sound_attractors[ i ] ) ) if ( isDefined( info.sound_attractors[ i ] ) )
{ {
info.sound_attractors[ i ] notify( "monkey_blown_up" ); info.sound_attractors[ i ] notify( "monkey_blown_up" );
} }
i++;
} }
} }
play_delayed_explode_vox() play_delayed_explode_vox() //checked matches cerberus output
{ {
wait 6,5; wait 6.5;
if ( isDefined( self ) ) if ( isDefined( self ) )
{ {
self playsound( "zmb_vox_monkey_explode" ); self playsound( "zmb_vox_monkey_explode" );
} }
} }
get_thrown_monkey() get_thrown_monkey() //checked matches cerberus output
{ {
self endon( "disconnect" ); self endon( "disconnect" );
self endon( "starting_monkey_watch" ); self endon( "starting_monkey_watch" );
@ -515,11 +507,11 @@ get_thrown_monkey()
grenade.grenade_multiattack_bookmark_count = 1; grenade.grenade_multiattack_bookmark_count = 1;
return grenade; return grenade;
} }
wait 0,05; wait 0.05;
} }
} }
monitor_zombie_groans( info ) monitor_zombie_groans( info ) //checked changed to match cerberus output
{ {
self endon( "explode" ); self endon( "explode" );
while ( 1 ) while ( 1 )
@ -528,12 +520,12 @@ monitor_zombie_groans( info )
{ {
return; return;
} }
while ( !isDefined( self.attractor_array ) ) if ( !isDefined( self.attractor_array ) )
{ {
wait 0,05; wait 0.05;
continue;
} }
i = 0; for ( i = 0; i < self.attractor_array.size; i++ )
while ( i < self.attractor_array.size )
{ {
if ( array_check_for_dupes( info.sound_attractors, self.attractor_array[ i ] ) ) if ( array_check_for_dupes( info.sound_attractors, self.attractor_array[ i ] ) )
{ {
@ -546,13 +538,12 @@ monitor_zombie_groans( info )
} }
} }
} }
i++;
} }
wait 0,05; wait 0.05;
} }
} }
play_zombie_groans() play_zombie_groans() //checked changed to match cerberus output
{ {
self endon( "death" ); self endon( "death" );
self endon( "monkey_blown_up" ); self endon( "monkey_blown_up" );
@ -562,7 +553,6 @@ play_zombie_groans()
{ {
self playsound( "zmb_vox_zombie_groan" ); self playsound( "zmb_vox_zombie_groan" );
wait randomfloatrange( 2, 3 ); wait randomfloatrange( 2, 3 );
continue;
} }
else else
{ {
@ -571,7 +561,8 @@ play_zombie_groans()
} }
} }
cymbal_monkey_exists() cymbal_monkey_exists() //checked matches cerberus output
{ {
return isDefined( level.zombie_weapons[ "cymbal_monkey_zm" ] ); return isDefined( level.zombie_weapons[ "cymbal_monkey_zm" ] );
} }

View File

@ -47,30 +47,32 @@ patch_zm/maps/mp/zombies/_zm_equipment.gsc
patch_zm/maps/mp/zombies/_load.gsc patch_zm/maps/mp/zombies/_load.gsc
patch_zm/maps/mp/zombies/_zm_pers_upgrades_functions.gsc patch_zm/maps/mp/zombies/_zm_pers_upgrades_functions.gsc
``` ```
### The following scripts are not tested yet, uploaded to setup a baseline: ### The following scripts have been checked, but they have not been tested yet
```
patch_zm/maps/mp/zombies/_zm_traps.gsc
patch_zm/maps/mp/zombies/_zm_weap_cymbal_monkey.gsc
```
### The following scripts are not checked yet, uploaded to setup a baseline:
``` ```
patch_zm/maps/mp/zombies/_zm_blockers.gsc patch_zm/maps/mp/zombies/_zm_blockers.gsc
patch_zm/maps/mp/zombies/_zm_buildables.gsc patch_zm/maps/mp/zombies/_zm_buildables.gsc
patch_zm/maps/mp/zombies/_zm_devgui.gsc
patch_zm/maps/mp/zombies/_zm_equip_turbine.gsc patch_zm/maps/mp/zombies/_zm_equip_turbine.gsc
patch_zm/maps/mp/zombies/_zm_game_module.gsc patch_zm/maps/mp/zombies/_zm_game_module.gsc
patch_zm/maps/mp/zombies/_zm_jump_pad.gsc
patch_zm/maps/mp/zombies/_zm_laststand.gsc patch_zm/maps/mp/zombies/_zm_laststand.gsc
patch_zm/maps/mp/zombies/_zm_magicbox_lock.gsc patch_zm/maps/mp/zombies/_zm_magicbox_lock.gsc
patch_zm/maps/mp/zombies/_zm_mgturret.gsc
patch_zm/maps/mp/zombies/_zm_playerhealth.gsc patch_zm/maps/mp/zombies/_zm_playerhealth.gsc
patch_zm/maps/mp/zombies/_zm_power.gsc patch_zm/maps/mp/zombies/_zm_power.gsc
patch_zm/maps/mp/zombies/_zm_sidequests.gsc patch_zm/maps/mp/zombies/_zm_sidequests.gsc
patch_zm/maps/mp/zombies/_zm_stats.gsc patch_zm/maps/mp/zombies/_zm_stats.gsc
patch_zm/maps/mp/zombies/_zm_traps.gsc
patch_zm/maps/mp/zombies/_zm_turned.gsc patch_zm/maps/mp/zombies/_zm_turned.gsc
patch_zm/maps/mp/zombies/_zm_unitrigger.gsc patch_zm/maps/mp/zombies/_zm_unitrigger.gsc
patch_zm/maps/mp/zombies/_zm_utility.gsc patch_zm/maps/mp/zombies/_zm_utility.gsc
patch_zm/maps/mp/zombies/_zm_weap_cymbal_monkey.gsc
``` ```
### The following scripts have not been checked using the proper debugging methods: ### The following scripts have not been checked using the proper debugging methods:
``` ```
//I will put these off to towards much later since the hacker and gas mask are parts of the game that do not exist inside the game in any capacity whatsoever.
//Therefore, whether or not they work is irrelevant.
patch_zm/maps/mp/zombies/_zm_devgui.gsc
patch_zm/maps/mp/zombies/_zm_equip_hacker.gsc patch_zm/maps/mp/zombies/_zm_equip_hacker.gsc
patch_zm/maps/mp/zombies/_zm_equip_gasmask.gsc patch_zm/maps/mp/zombies/_zm_equip_gasmask.gsc
patch_zm/maps/mp/zombies/_zm_hackables_boards.gsc patch_zm/maps/mp/zombies/_zm_hackables_boards.gsc
@ -80,8 +82,9 @@ patch_zm/maps/mp/zombies/_zm_hackables_packapunch.gsc
patch_zm/maps/mp/zombies/_zm_hackables_perks.gsc patch_zm/maps/mp/zombies/_zm_hackables_perks.gsc
patch_zm/maps/mp/zombies/_zm_hackables_powerups.gsc patch_zm/maps/mp/zombies/_zm_hackables_powerups.gsc
patch_zm/maps/mp/zombies/_zm_hackables_wallbuys.gsc patch_zm/maps/mp/zombies/_zm_hackables_wallbuys.gsc
patch_zm/maps/mp/zombies/_zm_jump_pad.gsc
patch_zm/maps/mp/zombies/_zm_mgturret.gsc
``` ```
### notes: ### notes:
``` ```
The shaders that _zm_timer.gsc relies on do not exist. The shaders that _zm_timer.gsc relies on do not exist.