diff --git a/functions descriptions and locations.md b/functions descriptions and locations.md new file mode 100644 index 0000000..0d2e783 --- /dev/null +++ b/functions descriptions and locations.md @@ -0,0 +1,61 @@ +# Black Ops 2 Functions Descriptions and Locations List + +### Built in Functions: + +isthrowinggrenade() - returns 1 if the player is currently throwing a grenade or 0 if they are not +- must be called on a player + +loadfx( effect ) - loads an effect in +usage - level._effect[ "building_dust" ] = loadfx( "maps/zombie/fx_zmb_buildable_assemble_dust" ); + +### Functions in _zm_utility.gsc: + +convertsecondstomilliseconds( seconds ) - returns seconds multiplied by 1000 +usage - use this to compare actual seconds with getTime() which uses milliseconds + +in_revive_trigger() - returns 1 if the player is currently in a revive trigger or 0 if they are not +- must be called on a player + +is_classic() - returns 1 if the value of getDvar( "ui_zm_gamemodegroup" ) is "zclassic" returns 0 otherwise + +is_player() - returns 0 if not called on a player, returns 0 if called on a bot, returns 1 otherwise + +is_standard() - returns 1 if the value of getDvar( "ui_gametype" ) is "zstandard" returns 0 otherwise + +lerp( chunk ) - + +clear_mature_blood() - deletes blood patches if is_mature() returns 0 + +recalc_zombie_array() - empty function + +clear_all_corpses() - deletes all corpses when called + +get_current_corpse_count() - returns the number of corpses, if corpses are not defined returns 0 + +get_current_actor_count() - returns the number of alive zombies and corpses combined + +get_round_enemy_array() - returns an array of the enemies on the level.zombie_team if an enemy has the property .ignore_enemy_count +they are not included + +init_zombie_run_cycle() - picks whether a zombie should have different speed on spawn +- must be called on a zombie + +change_zombie_run_cycle() - sets a zombies speed depending on the difficulty on easy zombies are sprinters on normal they are walkers +- must be called on a zombie + +speed_change_watcher() - reduces the counter that tracks the number of zombies with unique speeds such as walkers or sprinters when they die +- must be called on a zombie + +set_zombie_run_cycle( new_move_speed ) - sets a zombies speed to the new_move_speed input +- valid inputs are walk, run, sprint, super_sprint, and bus_sprint( tranzit maps only ) +- must be called on a zombie + +set_run_speed() - sets a zombies movespeed randomly on spawn on normal difficulty +- must be called on a zombie + +set_run_speed_easy() = sets a zombies movespeed randomly on spawn on easy difficulty +- must be called on a zombie + +spawn_zombie( spawner, target_name, spawn_point, round_number ) +- + diff --git a/patch_zm/maps/mp/zombies/_zm_buildables.gsc b/patch_zm/maps/mp/zombies/_zm_buildables.gsc index ac5a68f..c3f2588 100644 --- a/patch_zm/maps/mp/zombies/_zm_buildables.gsc +++ b/patch_zm/maps/mp/zombies/_zm_buildables.gsc @@ -9,7 +9,7 @@ #include maps/mp/_utility; #include common_scripts/utility; -init() +init() //checked matches cerberus output { precachestring( &"ZOMBIE_BUILDING" ); precachestring( &"ZOMBIE_BUILD_PIECE_MISSING" ); @@ -33,9 +33,9 @@ init() } } -anystub_update_prompt( player ) +anystub_update_prompt( player ) //checked matches cerberus output { - if ( player maps/mp/zombies/_zm_laststand::player_is_in_laststand() || player in_revive_trigger() ) + if ( player maps/mp/zombies/_zm_laststand::player_is_in_laststand() || player maps/mp/zombies/_zm_utility::in_revive_trigger() ) { self.hint_string = ""; return 0; @@ -58,7 +58,7 @@ anystub_update_prompt( player ) return 1; } -anystub_get_unitrigger_origin() +anystub_get_unitrigger_origin() //checked matches cerberus output { if ( isDefined( self.origin_parent ) ) { @@ -67,7 +67,7 @@ anystub_get_unitrigger_origin() return self.origin; } -anystub_on_spawn_trigger( trigger ) +anystub_on_spawn_trigger( trigger ) //checked matches cerberus output { if ( isDefined( self.link_parent ) ) { @@ -77,7 +77,7 @@ anystub_on_spawn_trigger( trigger ) } } -buildables_watch_swipes() +buildables_watch_swipes() //checked changed to match cerberus output { self endon( "disconnect" ); self notify( "buildables_watch_swipes" ); @@ -85,7 +85,7 @@ buildables_watch_swipes() while ( 1 ) { self waittill( "melee_swipe", zombie ); - while ( distancesquared( zombie.origin, self.origin ) > ( zombie.meleeattackdist * zombie.meleeattackdist ) ) + if ( distancesquared( zombie.origin, self.origin ) > zombie.meleeattackdist * zombie.meleeattackdist ) { continue; } @@ -112,15 +112,17 @@ buildables_watch_swipes() } } -explosiondamage( damage, pos ) +explosiondamage( damage, pos ) //checked matches cerberus output { + /* /# println( "ZM BUILDABLE Explode do " + damage + " damage to " + self.name + "\n" ); #/ + */ self dodamage( damage, pos ); } -add_zombie_buildable( buildable_name, hint, building, bought ) +add_zombie_buildable( buildable_name, hint, building, bought ) //checked matches cerberus output { if ( !isDefined( level.zombie_include_buildables ) ) { @@ -147,9 +149,11 @@ add_zombie_buildable( buildable_name, hint, building, bought ) buildable_struct.hint = hint; buildable_struct.building = building; buildable_struct.bought = bought; + /* /# println( "ZM >> Looking for buildable - " + buildable_struct.name ); #/ + */ level.zombie_buildables[ buildable_struct.name ] = buildable_struct; if ( !level.createfx_enabled ) { @@ -160,23 +164,24 @@ add_zombie_buildable( buildable_name, hint, building, bought ) } } -register_clientfields() +register_clientfields() //checked changed to match cerberus output { if ( isDefined( level.buildable_slot_count ) ) { - i = 0; - while ( i < level.buildable_slot_count ) + for ( i = 0; i < level.buildable_slot_count; i++ ) { bits = getminbitcountfornum( level.buildable_piece_counts[ i ] ); registerclientfield( "toplayer", level.buildable_clientfields[ i ], 12000, bits, "int" ); - i++; } } - else bits = getminbitcountfornum( level.buildable_piece_count ); - registerclientfield( "toplayer", "buildable", 1, bits, "int" ); + else + { + bits = getminbitcountfornum( level.buildable_piece_count ); + registerclientfield( "toplayer", "buildable", 1, bits, "int" ); + } } -set_buildable_clientfield( slot, newvalue ) +set_buildable_clientfield( slot, newvalue ) //checked matches cerberus output { if ( isDefined( level.buildable_slot_count ) ) { @@ -188,24 +193,26 @@ set_buildable_clientfield( slot, newvalue ) } } -clear_buildable_clientfield( slot ) +clear_buildable_clientfield( slot ) //checked matches cerberus output { self set_buildable_clientfield( slot, 0 ); } -include_zombie_buildable( buiildable_struct ) +include_zombie_buildable( buiildable_struct ) //checked matches cerberus output { if ( !isDefined( level.zombie_include_buildables ) ) { level.zombie_include_buildables = []; } + /* /# println( "ZM >> Including buildable - " + buiildable_struct.name ); #/ + */ level.zombie_include_buildables[ buiildable_struct.name ] = buiildable_struct; } -generate_zombie_buildable_piece( buildablename, modelname, radius, height, drop_offset, hud_icon, onpickup, ondrop, use_spawn_num, part_name, can_reuse, client_field_state, buildable_slot ) +generate_zombie_buildable_piece( buildablename, modelname, radius, height, drop_offset, hud_icon, onpickup, ondrop, use_spawn_num, part_name, can_reuse, client_field_state, buildable_slot ) //checked changed to match cerberus output { precachemodel( modelname ); if ( isDefined( hud_icon ) ) @@ -214,21 +221,19 @@ generate_zombie_buildable_piece( buildablename, modelname, radius, height, drop_ } piece = spawnstruct(); buildable_pieces = []; - buildable_pieces_structs = getstructarray( ( buildablename + "_" ) + modelname, "targetname" ); + buildable_pieces_structs = patch_zm\common_scripts\utility::getstructarray( buildablename + "_" + modelname, "targetname" ); + /* /# if ( buildable_pieces_structs.size < 1 ) { println( "ERROR: Missing buildable piece <" + buildablename + "> <" + modelname + ">\n" ); #/ } - _a240 = buildable_pieces_structs; - index = getFirstArrayKey( _a240 ); - while ( isDefined( index ) ) + */ + foreach ( struct in buildable_pieces_structs ) { - struct = _a240[ index ]; buildable_pieces[ index ] = struct; buildable_pieces[ index ].hasspawned = 0; - index = getNextArrayKey( _a240, index ); } piece.spawns = buildable_pieces; piece.buildablename = buildablename; @@ -255,7 +260,7 @@ generate_zombie_buildable_piece( buildablename, modelname, radius, height, drop_ return piece; } -manage_multiple_pieces( max_instances, min_instances ) +manage_multiple_pieces( max_instances, min_instances ) //checked matches cerberus output { self.max_instances = max_instances; self.min_instances = min_instances; @@ -263,19 +268,19 @@ manage_multiple_pieces( max_instances, min_instances ) self.piece_allocated = []; } -buildable_set_force_spawn_location( str_kvp, str_name ) +buildable_set_force_spawn_location( str_kvp, str_name ) //checked matches cerberus output { self.str_force_spawn_kvp = str_kvp; self.str_force_spawn_name = str_name; } -buildable_use_cyclic_spawns( randomize_start_location ) +buildable_use_cyclic_spawns( randomize_start_location ) //checked matches cerberus output { self.use_cyclic_spawns = 1; self.randomize_cyclic_index = randomize_start_location; } -combine_buildable_pieces( piece1, piece2, piece3 ) +combine_buildable_pieces( piece1, piece2, piece3 ) //checked matches cerberus output { spawns1 = piece1.spawns; spawns2 = piece2.spawns; @@ -295,7 +300,7 @@ combine_buildable_pieces( piece1, piece2, piece3 ) piece2.spawns = spawns; } -add_buildable_piece( piece, part_name, can_reuse ) +add_buildable_piece( piece, part_name, can_reuse ) //checked matches cerberus output { if ( !isDefined( self.buildablepieces ) ) { @@ -316,24 +321,26 @@ add_buildable_piece( piece, part_name, can_reuse ) } else { + /* /# assert( self.buildable_slot == piece.buildable_slot ); #/ + */ } } -create_zombie_buildable_piece( modelname, radius, height, hud_icon ) +create_zombie_buildable_piece( modelname, radius, height, hud_icon ) //checked matches cerberus output { piece = generate_zombie_buildable_piece( self.name, modelname, radius, height, hud_icon ); self add_buildable_piece( piece ); } -onplayerlaststand() +onplayerlaststand() //checked partially changed to match cerberus output { pieces = self player_get_buildable_pieces(); spawn_pos = []; spawn_pos[ 0 ] = self.origin; - while ( pieces.size >= 2 ) + if ( pieces.size >= 2 ) { nodes = getnodesinradiussorted( self.origin + vectorScale( ( 0, 0, 1 ), 30 ), 120, 30, 72, "path", 5 ); i = 0; @@ -345,19 +352,13 @@ onplayerlaststand() i++; continue; } - else - { - spawn_pos[ i ] = self.origin + vectorScale( ( 0, 0, 1 ), 5 ); - } + spawn_pos[ i ] = self.origin + vectorScale( ( 0, 0, 1 ), 5 ); i++; } } spawnidx = 0; - _a366 = pieces; - _k366 = getFirstArrayKey( _a366 ); - while ( isDefined( _k366 ) ) + foreach ( piece in pieces ) { - piece = _a366[ _k366 ]; slot = piece.buildable_slot; if ( isDefined( piece ) ) { @@ -375,7 +376,7 @@ onplayerlaststand() } else if ( pieces.size < 2 ) { - piece piece_spawn_at( self.origin + vectorScale( ( 0, 0, 1 ), 5 ), self.angles ); + piece piece_spawn_at( self.origin + vectorScale( ( 1, 1, 0 ), 5 ), self.angles ); } else { @@ -390,11 +391,10 @@ onplayerlaststand() } self player_set_buildable_piece( undefined, slot ); self notify( "piece_released" + slot ); - _k366 = getNextArrayKey( _a366, _k366 ); } } -piecestub_get_unitrigger_origin() +piecestub_get_unitrigger_origin() //checked matches cerberus output { if ( isDefined( self.origin_parent ) ) { @@ -403,7 +403,7 @@ piecestub_get_unitrigger_origin() return self.origin; } -generate_piece_unitrigger( classname, origin, angles, flags, radius, script_height, moving ) +generate_piece_unitrigger( classname, origin, angles, flags, radius, script_height, moving ) //checked matches cerberus output { if ( !isDefined( radius ) ) { @@ -484,7 +484,7 @@ generate_piece_unitrigger( classname, origin, angles, flags, radius, script_heig return unitrigger_stub; } -piecetrigger_update_prompt( player ) +piecetrigger_update_prompt( player ) //checked matches cerberus output { can_use = self.stub piecestub_update_prompt( player ); self setinvisibletoplayer( player, !can_use ); @@ -510,7 +510,7 @@ piecetrigger_update_prompt( player ) return can_use; } -piecestub_update_prompt( player ) +piecestub_update_prompt( player ) //checked changed to match cerberus output { if ( !self anystub_update_prompt( player ) ) { @@ -544,44 +544,41 @@ piecestub_update_prompt( player ) self.cursor_hint_weapon = self.piece.cursor_hint_weapon; } } + else if ( isDefined( self.piece.hint_grab ) ) + { + self.hint_string = self.piece.hint_grab; + self.hint_parm1 = self.piece.hint_grab_parm1; + } else { - if ( isDefined( self.piece.hint_grab ) ) - { - self.hint_string = self.piece.hint_grab; - self.hint_parm1 = self.piece.hint_grab_parm1; - } - else - { - self.hint_string = &"ZOMBIE_BUILD_PIECE_GRAB"; - } - if ( isDefined( self.piece.cursor_hint ) ) - { - self.cursor_hint = self.piece.cursor_hint; - } - if ( isDefined( self.piece.cursor_hint_weapon ) ) - { - self.cursor_hint_weapon = self.piece.cursor_hint_weapon; - } + self.hint_string = &"ZOMBIE_BUILD_PIECE_GRAB"; + } + if ( isDefined( self.piece.cursor_hint ) ) + { + self.cursor_hint = self.piece.cursor_hint; + } + if ( isDefined( self.piece.cursor_hint_weapon ) ) + { + self.cursor_hint_weapon = self.piece.cursor_hint_weapon; } return 1; } -piece_unitrigger_think() +piece_unitrigger_think() //checked changed to match cerberus output { self endon( "kill_trigger" ); while ( 1 ) { self waittill( "trigger", player ); - while ( player != self.parent_player ) + if ( player != self.parent_player ) { continue; } - while ( isDefined( player.screecher_weapon ) ) + if ( isDefined( player.screecher_weapon ) ) { continue; } - while ( !is_player_valid( player ) ) + if ( !is_player_valid( player ) ) { player thread ignore_triggers( 0,5 ); } @@ -590,7 +587,6 @@ piece_unitrigger_think() { self.stub.hint_string = ""; self sethintstring( self.stub.hint_string ); - continue; } else { @@ -599,7 +595,7 @@ piece_unitrigger_think() } } -player_get_buildable_pieces() +player_get_buildable_pieces() //checked matches cerberus output { if ( !isDefined( self.current_buildable_pieces ) ) { @@ -608,7 +604,7 @@ player_get_buildable_pieces() return self.current_buildable_pieces; } -player_get_buildable_piece( slot ) +player_get_buildable_piece( slot ) //checked matches cerberus output { if ( !isDefined( slot ) ) { @@ -621,18 +617,20 @@ player_get_buildable_piece( slot ) return self.current_buildable_pieces[ slot ]; } -player_set_buildable_piece( piece, slot ) +player_set_buildable_piece( piece, slot ) //checked matches cerberus output { if ( !isDefined( slot ) ) { slot = 0; } + /* /# if ( isDefined( slot ) && isDefined( piece ) && isDefined( piece.buildable_slot ) ) { assert( slot == piece.buildable_slot ); #/ } + */ if ( !isDefined( self.current_buildable_pieces ) ) { self.current_buildable_pieces = []; @@ -640,7 +638,7 @@ player_set_buildable_piece( piece, slot ) self.current_buildable_pieces[ slot ] = piece; } -player_can_take_piece( piece ) +player_can_take_piece( piece ) //checked matches cerberus output { if ( !isDefined( piece ) ) { @@ -649,29 +647,35 @@ player_can_take_piece( piece ) return 1; } -dbline( from, to ) +dbline( from, to ) //checked matches cerberus output { + /* /# time = 20; while ( time > 0 ) { line( from, to, ( 0, 0, 1 ), 0, 1 ); - time -= 0,05; - wait 0,05; + time -= 0.05; + wait 0.05; #/ } + */ } -player_throw_piece( piece, origin, dir, return_to_spawn, return_time, endangles ) +player_throw_piece( piece, origin, dir, return_to_spawn, return_time, endangles ) //checked changed to match cerberus output { + /* /# assert( isDefined( piece ) ); #/ + */ if ( isDefined( piece ) ) { + /* /# thread dbline( origin, origin + dir ); #/ + */ pass = 0; done = 0; altmodel = undefined; @@ -687,7 +691,7 @@ player_throw_piece( piece, origin, dir, return_to_spawn, return_time, endangles } altmodel.origin = grenade.angles; altmodel.angles = grenade.angles; - altmodel linkto( grenade, "", ( 0, 0, 1 ), ( 0, 0, 1 ) ); + altmodel linkto( grenade, "", ( 0, 0, 0 ), ( 0, 0, 0 ) ); grenade.altmodel = altmodel; grenade waittill( "stationary" ); grenade_origin = grenade.origin; @@ -697,7 +701,6 @@ player_throw_piece( piece, origin, dir, return_to_spawn, return_time, endangles if ( isDefined( landed_on ) && landed_on == level ) { done = 1; - continue; } else { @@ -726,7 +729,7 @@ player_throw_piece( piece, origin, dir, return_to_spawn, return_time, endangles } } -watch_hit_players() +watch_hit_players() //checked matches cerberus output { self endon( "death" ); self endon( "stationary" ); @@ -740,10 +743,10 @@ watch_hit_players() } } -piece_wait_and_return( return_time ) +piece_wait_and_return( return_time ) //checked matches cerberus output { self endon( "pickup" ); - wait 0,15; + wait 0.15; if ( isDefined( level.exploding_jetgun_fx ) ) { playfxontag( level.exploding_jetgun_fx, self.model, "tag_origin" ); @@ -770,7 +773,7 @@ piece_wait_and_return( return_time ) self piece_spawn_at(); } -player_return_piece_to_original_spawn( slot ) +player_return_piece_to_original_spawn( slot ) //checked matches cerberus output { if ( !isDefined( slot ) ) { @@ -786,7 +789,7 @@ player_return_piece_to_original_spawn( slot ) } } -player_drop_piece_on_death( slot ) +player_drop_piece_on_death( slot ) //checked matches cerberus output { self notify( "piece_released" + slot ); self endon( "piece_released" + slot ); @@ -805,7 +808,7 @@ player_drop_piece_on_death( slot ) } } -player_drop_piece( piece, slot ) +player_drop_piece( piece, slot ) //checked matches cerberus output { if ( !isDefined( slot ) ) { @@ -846,7 +849,7 @@ player_drop_piece( piece, slot ) self notify( "piece_released" + slot ); } -player_take_piece( piece ) +player_take_piece( piece ) //checked matches cerberus output { piece_slot = piece.buildable_slot; damage = piece.damage; @@ -875,7 +878,7 @@ player_take_piece( piece ) } } -player_destroy_piece( piece ) +player_destroy_piece( piece ) //checked matches cerberus output { if ( !isDefined( piece ) ) { @@ -894,7 +897,7 @@ player_destroy_piece( piece ) } } -claim_location( location ) +claim_location( location ) //checked matches cerberus output { if ( !isDefined( level.buildable_claimed_locations ) ) { @@ -908,46 +911,39 @@ claim_location( location ) return 0; } -is_point_in_build_trigger( point ) +is_point_in_build_trigger( point ) //checked changed to match cerberus output { candidate_list = []; - _a911 = level.zones; - _k911 = getFirstArrayKey( _a911 ); - while ( isDefined( _k911 ) ) + foreach ( zone in level.zones ) { - zone = _a911[ _k911 ]; if ( isDefined( zone.unitrigger_stubs ) ) { candidate_list = arraycombine( candidate_list, zone.unitrigger_stubs, 1, 0 ); } - _k911 = getNextArrayKey( _a911, _k911 ); } valid_range = 128; closest = maps/mp/zombies/_zm_unitrigger::get_closest_unitriggers( point, candidate_list, valid_range ); - index = 0; - while ( index < closest.size ) + for ( index = 0; index < closest.size; index++ ) { if ( isDefined( closest[ index ].registered ) && closest[ index ].registered && isDefined( closest[ index ].piece ) ) { return 1; } - index++; } return 0; } -piece_allocate_spawn( piecespawn ) +piece_allocate_spawn( piecespawn ) //checked changed to match cerberus output { self.current_spawn = 0; self.managed_spawn = 1; self.piecespawn = piecespawn; - while ( isDefined( piecespawn.str_force_spawn_kvp ) ) + if ( isDefined( piecespawn.str_force_spawn_kvp ) ) { - s_struct = getstruct( piecespawn.str_force_spawn_name, piecespawn.str_force_spawn_kvp ); - while ( isDefined( s_struct ) ) + s_struct = patch_zm\common_scripts\utility::getstruct( piecespawn.str_force_spawn_name, piecespawn.str_force_spawn_kvp ); + if ( isDefined( s_struct ) ) { - i = 0; - while ( i < self.spawns.size ) + for ( i = 0; i < self.spawns.size; i++ ) { if ( s_struct == self.spawns[ i ] ) { @@ -957,11 +953,10 @@ piece_allocate_spawn( piecespawn ) piecespawn.str_force_spawn_name = undefined; return; } - i++; } } } - if ( isDefined( piecespawn.use_cyclic_spawns ) ) + else if ( isDefined( piecespawn.use_cyclic_spawns ) ) { piece_allocate_cyclic( piecespawn ); return; @@ -972,93 +967,81 @@ piece_allocate_spawn( piecespawn ) any_okay = 0; totalweight = 0; spawnweights = []; - i = 0; - while ( i < self.spawns.size ) + for ( i = 0; i < self.spawns.size; i++ ) { if ( isDefined( piecespawn.piece_allocated[ i ] ) && piecespawn.piece_allocated[ i ] ) { spawnweights[ i ] = 0; } + else if ( isDefined( self.spawns[ i ].script_forcespawn ) && self.spawns[ i ].script_forcespawn ) + { + switch( self.spawns[ i ].script_forcespawn ) + { + case 4: + spawnweights[ i ] = 0; + break; + case 1: + self.spawns[ i ].script_forcespawn = 0; + case 2: + self.current_spawn = i; + piecespawn.piece_allocated[ self.current_spawn ] = 1; + return; + case 3: + self.spawns[ i ].script_forcespawn = 4; + self.current_spawn = i; + piecespawn.piece_allocated[ self.current_spawn ] = 1; + return; + default: + any_okay = 1; + spawnweights[ i ] = 0.01; + break; + } + } + else if ( is_point_in_build_trigger( self.spawns[ i ].origin ) ) + { + any_okay = 1; + spawnweights[ i ] = 0,01; + break; + } else { - if ( isDefined( self.spawns[ i ].script_forcespawn ) && self.spawns[ i ].script_forcespawn ) - { - switch( self.spawns[ i ].script_forcespawn ) - { - case 4: - spawnweights[ i ] = 0; - break; - case 1: - self.spawns[ i ].script_forcespawn = 0; - case 2: - self.current_spawn = i; - piecespawn.piece_allocated[ self.current_spawn ] = 1; - return; - case 3: - self.spawns[ i ].script_forcespawn = 4; - self.current_spawn = i; - piecespawn.piece_allocated[ self.current_spawn ] = 1; - return; - default: - any_okay = 1; - spawnweights[ i ] = 0,01; - break; - } - break; - } - else - { - if ( is_point_in_build_trigger( self.spawns[ i ].origin ) ) - { - any_okay = 1; - spawnweights[ i ] = 0,01; - break; - } - else - { - any_good = 1; - spawnweights[ i ] = 1; - } - } - } - totalweight += spawnweights[ i ]; - i++; - } + any_good = 1; + spawnweights[ i ] = 1; + } + totalweight += spawnweights[ i ]; + } + /* /# - if ( !any_good ) - { - assert( any_okay, "There is nowhere to spawn this piece" ); - } + if ( !any_good ) + { + assert( any_okay, "There is nowhere to spawn this piece" ); + } #/ - if ( any_good ) - { - totalweight = float( int( totalweight ) ); - } - r = randomfloat( totalweight ); - i = 0; - while ( i < self.spawns.size ) - { - if ( !any_good || spawnweights[ i ] >= 1 ) - { - r -= spawnweights[ i ]; - if ( r < 0 ) - { - self.current_spawn = i; - piecespawn.piece_allocated[ self.current_spawn ] = 1; - return; - } - } - i++; - } - self.current_spawn = randomint( self.spawns.size ); + */ + if ( any_good ) + { + totalweight = float( int( totalweight ) ); + } + r = randomfloat( totalweight ); + for ( i = 0; i < self.spawns.size; i++ ) + { + if ( !any_good || spawnweights[ i ] >= 1 ) + { + r -= spawnweights[ i ]; + if ( r < 0 ) + { + self.current_spawn = i; piecespawn.piece_allocated[ self.current_spawn ] = 1; + return; } } } + self.current_spawn = randomint( self.spawns.size ); + piecespawn.piece_allocated[ self.current_spawn ] = 1; } } -piece_allocate_cyclic( piecespawn ) +piece_allocate_cyclic( piecespawn ) //checked matches cerberus output { if ( self.spawns.size > 1 ) { @@ -1085,7 +1068,7 @@ piece_allocate_cyclic( piecespawn ) piecespawn.piece_allocated[ self.current_spawn ] = 1; } -piece_deallocate_spawn() +piece_deallocate_spawn() //checked matches cerberus output { if ( isDefined( self.current_spawn ) ) { @@ -1095,10 +1078,10 @@ piece_deallocate_spawn() self.start_origin = undefined; } -piece_pick_random_spawn() +piece_pick_random_spawn() //checked partially changed to match cerberus output did not change while loop to for loop { self.current_spawn = 0; - while ( self.spawns.size >= 1 && self.spawns.size > 1 ) + if ( self.spawns.size >= 1 && self.spawns.size > 1 ) { self.current_spawn = randomint( self.spawns.size ); while ( isDefined( self.spawns[ self.current_spawn ].claim_location ) && !claim_location( self.spawns[ self.current_spawn ].claim_location ) ) @@ -1107,9 +1090,11 @@ piece_pick_random_spawn() if ( self.spawns.size < 1 ) { self.current_spawn = 0; + /* /# println( "ERROR: All buildable spawn locations claimed" ); #/ + */ return; } self.current_spawn = randomint( self.spawns.size ); @@ -1117,7 +1102,7 @@ piece_pick_random_spawn() } } -piece_set_spawn( num ) +piece_set_spawn( num ) //checked matches cerberus output { self.current_spawn = 0; if ( self.spawns.size >= 1 && self.spawns.size > 1 ) @@ -1126,7 +1111,7 @@ piece_set_spawn( num ) } } -piece_spawn_in( piecespawn ) +piece_spawn_in( piecespawn ) //checked matches cerberus output { if ( self.spawns.size < 1 ) { @@ -1181,7 +1166,7 @@ piece_spawn_in( piecespawn ) } } -piece_spawn_at_with_notify_delay( origin, angles, str_notify, unbuild_respawn_fn ) +piece_spawn_at_with_notify_delay( origin, angles, str_notify, unbuild_respawn_fn ) //checked matches cerberus output { level waittill( str_notify ); piece_spawn_at( origin, angles ); @@ -1191,7 +1176,7 @@ piece_spawn_at_with_notify_delay( origin, angles, str_notify, unbuild_respawn_fn } } -piece_spawn_at( origin, angles ) +piece_spawn_at( origin, angles ) //checked changed to match cerberus output { if ( self.spawns.size < 1 ) { @@ -1207,12 +1192,9 @@ piece_spawn_at( origin, angles ) self.start_angles = spawndef.angles; } } - else + else if ( !isDefined( self.current_spawn ) ) { - if ( !isDefined( self.current_spawn ) ) - { - self.current_spawn = 0; - } + self.current_spawn = 0; } unitrigger_offset = vectorScale( ( 0, 0, 1 ), 12 ); if ( !isDefined( origin ) ) @@ -1228,6 +1210,7 @@ piece_spawn_at( origin, angles ) { angles = self.start_angles; } + /* /# if ( !isDefined( level.drop_offset ) ) { @@ -1236,6 +1219,7 @@ piece_spawn_at( origin, angles ) origin += ( 0, 0, level.drop_offset ); unitrigger_offset -= ( 0, 0, level.drop_offset ); #/ + */ self.model = spawn( "script_model", origin ); if ( isDefined( angles ) ) { @@ -1244,7 +1228,7 @@ piece_spawn_at( origin, angles ) self.model setmodel( self.modelname ); if ( isDefined( level.equipment_safe_to_drop ) ) { - if ( !( [[ level.equipment_safe_to_drop ]]( self.model ) ) ) + if ( ![[ level.equipment_safe_to_drop ]]( self.model ) ) { origin = self.start_origin; angles = self.start_angles; @@ -1266,7 +1250,7 @@ piece_spawn_at( origin, angles ) } } -piece_unspawn() +piece_unspawn() //checked matches cerberus output { if ( isDefined( self.onunspawn ) ) { @@ -1288,7 +1272,7 @@ piece_unspawn() self.unitrigger = undefined; } -piece_hide() +piece_hide() //checked matches cerberus output { if ( isDefined( self.model ) ) { @@ -1296,7 +1280,7 @@ piece_hide() } } -piece_show() +piece_show() //checked matches cerberus output { if ( isDefined( self.model ) ) { @@ -1304,7 +1288,7 @@ piece_show() } } -piece_destroy() +piece_destroy() //checked matches cerberus output { if ( isDefined( self.ondestroy ) ) { @@ -1312,7 +1296,7 @@ piece_destroy() } } -generate_piece( buildable_piece_spawns ) +generate_piece( buildable_piece_spawns ) //checked changed to match cerberus output { piece = spawnstruct(); piece.spawns = buildable_piece_spawns.spawns; @@ -1320,16 +1304,13 @@ generate_piece( buildable_piece_spawns ) { piece piece_allocate_spawn( buildable_piece_spawns ); } + else if ( isDefined( buildable_piece_spawns.use_spawn_num ) ) + { + piece piece_set_spawn( buildable_piece_spawns.use_spawn_num ); + } else { - if ( isDefined( buildable_piece_spawns.use_spawn_num ) ) - { - piece piece_set_spawn( buildable_piece_spawns.use_spawn_num ); - } - else - { - piece piece_pick_random_spawn(); - } + piece piece_pick_random_spawn(); } piece piece_spawn_in( buildable_piece_spawns ); if ( piece.spawns.size >= 1 ) @@ -1355,14 +1336,16 @@ generate_piece( buildable_piece_spawns ) return piece; } -buildable_piece_unitriggers( buildable_name, origin ) +buildable_piece_unitriggers( buildable_name, origin ) //checked changed to match cerberus output { + /* /# assert( isDefined( buildable_name ) ); #/ /# assert( isDefined( level.zombie_buildables[ buildable_name ] ), "Called buildable_think() without including the buildable - " + buildable_name ); #/ + */ buildable = level.zombie_buildables[ buildable_name ]; if ( !isDefined( buildable.buildablepieces ) ) { @@ -1377,11 +1360,8 @@ buildable_piece_unitriggers( buildable_name, origin ) buildablezone.pieces = []; } buildablepickups = []; - _a1362 = buildable.buildablepieces; - _k1362 = getFirstArrayKey( _a1362 ); - while ( isDefined( _k1362 ) ) + foreach ( buildablepiece in buildable.buildablepieces ) { - buildablepiece = _a1362[ _k1362 ]; if ( !isDefined( buildablepiece.generated_instances ) ) { buildablepiece.generated_instances = 0; @@ -1389,38 +1369,32 @@ buildable_piece_unitriggers( buildable_name, origin ) if ( isDefined( buildablepiece.generated_piece ) && isDefined( buildablepiece.can_reuse ) && buildablepiece.can_reuse ) { piece = buildablepiece.generated_piece; + break; } - else + if ( buildablepiece.generated_instances >= buildablepiece.max_instances ) { - if ( buildablepiece.generated_instances >= buildablepiece.max_instances ) - { - piece = buildablepiece.generated_piece; - break; - } - else + piece = buildablepiece.generated_piece; + break; + } + piece = generate_piece( buildablepiece ); + buildablepiece.generated_piece = piece; + buildablepiece.generated_instances++; + if ( isDefined( buildablepiece.min_instances ) ) + { + while ( buildablepiece.generated_instances < buildablepiece.min_instances ) { piece = generate_piece( buildablepiece ); buildablepiece.generated_piece = piece; buildablepiece.generated_instances++; - while ( isDefined( buildablepiece.min_instances ) ) - { - while ( buildablepiece.generated_instances < buildablepiece.min_instances ) - { - piece = generate_piece( buildablepiece ); - buildablepiece.generated_piece = piece; - buildablepiece.generated_instances++; - } - } } } buildablezone.pieces[ buildablezone.pieces.size ] = piece; - _k1362 = getNextArrayKey( _a1362, _k1362 ); } buildablezone.stub = self; return buildablezone; } -hide_buildable_table_model( trigger_targetname ) +hide_buildable_table_model( trigger_targetname ) //checked matches cerberus output { trig = getent( trigger_targetname, "targetname" ); if ( !isDefined( trig ) ) @@ -1438,7 +1412,7 @@ hide_buildable_table_model( trigger_targetname ) } } -setup_unitrigger_buildable( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) +setup_unitrigger_buildable( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) //checked matches cerberus output { trig = getent( trigger_targetname, "targetname" ); if ( !isDefined( trig ) ) @@ -1448,22 +1422,18 @@ setup_unitrigger_buildable( trigger_targetname, equipname, weaponname, trigger_h return setup_unitrigger_buildable_internal( trig, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ); } -setup_unitrigger_buildable_array( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) +setup_unitrigger_buildable_array( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) //checked changed to match cerberus output { triggers = getentarray( trigger_targetname, "targetname" ); stubs = []; - _a1431 = triggers; - _k1431 = getFirstArrayKey( _a1431 ); - while ( isDefined( _k1431 ) ) + foreach ( trig in triggers ) { - trig = _a1431[ _k1431 ]; stubs[ stubs.size ] = setup_unitrigger_buildable_internal( trig, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ); - _k1431 = getNextArrayKey( _a1431, _k1431 ); } return stubs; } -setup_unitrigger_buildable_internal( trig, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) +setup_unitrigger_buildable_internal( trig, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) //checked changed to match cerberus output { if ( !isDefined( trig ) ) { @@ -1474,7 +1444,7 @@ setup_unitrigger_buildable_internal( trig, equipname, weaponname, trigger_hintst angles = trig.script_angles; if ( !isDefined( angles ) ) { - angles = ( 0, 0, 1 ); + angles = ( 0, 0, 0 ); } unitrigger_stub.origin = trig.origin + ( anglesToRight( angles ) * -6 ); unitrigger_stub.angles = trig.angles; @@ -1556,48 +1526,42 @@ setup_unitrigger_buildable_internal( trig, equipname, weaponname, trigger_hintst return unitrigger_stub; } -buildable_has_piece( piece ) +buildable_has_piece( piece ) //checked changed to match cerberus output { - i = 0; - while ( i < self.pieces.size ) + for ( i = 0; i < self.pieces.size; i++ ) { if ( self.pieces[ i ].modelname == piece.modelname && self.pieces[ i ].buildablename == piece.buildablename ) { return 1; } - i++; } return 0; } -buildable_set_piece_built( piece ) +buildable_set_piece_built( piece ) //checked changed to match cerberus output { - i = 0; - while ( i < self.pieces.size ) + for ( i = 0; i < self.pieces.size; i++ ) { if ( self.pieces[ i ].modelname == piece.modelname && self.pieces[ i ].buildablename == piece.buildablename ) { self.pieces[ i ].built = 1; } - i++; } } -buildable_set_piece_building( piece ) +buildable_set_piece_building( piece ) //checked changed to match cerberus output { - i = 0; - while ( i < self.pieces.size ) + for ( i = 0; i < self.pieces.size; i++ ) { if ( self.pieces[ i ].modelname == piece.modelname && self.pieces[ i ].buildablename == piece.buildablename ) { self.pieces[ i ] = piece; self.pieces[ i ].building = 1; } - i++; } } -buildable_clear_piece_building( piece ) +buildable_clear_piece_building( piece ) //checked matches cerberus output { if ( isDefined( piece ) ) { @@ -1605,52 +1569,47 @@ buildable_clear_piece_building( piece ) } } -buildable_is_piece_built( piece ) +buildable_is_piece_built( piece ) //checked partially changed to match cerberus output //changed at own discretion { - i = 0; - while ( i < self.pieces.size ) + for ( i = 0; i < self.pieces.size; i++ ) { if ( self.pieces[ i ].modelname == piece.modelname && self.pieces[ i ].buildablename == piece.buildablename ) { - if ( isDefined( self.pieces[ i ].built ) ) + if ( isDefined( self.pieces[ i ].built ) && self.pieces[ i ].built ) { - return self.pieces[ i ].built; + return 1; } } - i++; } return 0; } buildable_is_piece_building( piece ) { - i = 0; - while ( i < self.pieces.size ) + for ( i = 0; i < self.pieces.size; i++ ) { if ( self.pieces[ i ].modelname == piece.modelname && self.pieces[ i ].buildablename == piece.buildablename ) { - if ( isDefined( self.pieces[ i ].building ) && self.pieces[ i ].building ) + if ( isDefined( self.pieces[ i ].building ) && self.pieces[ i ].building && self.pieces[ i ] == piece ) { - return self.pieces[ i ] == piece; + return 1; } } - i++; } return 0; } -buildable_is_piece_built_or_building( piece ) +buildable_is_piece_built_or_building( piece ) //checked partially changed to match cerberus output //changed at own discretion { - i = 0; - while ( i < self.pieces.size ) + for ( i = 0; i < self.pieces.size; i++ ) { if ( self.pieces[ i ].modelname == piece.modelname && self.pieces[ i ].buildablename == piece.buildablename ) { if ( isDefined( self.pieces[ i ].built ) && !self.pieces[ i ].built ) { - if ( isDefined( self.pieces[ i ].building ) ) + if ( isDefined( self.pieces[ i ].building ) && self.pieces[ i ].building ) { - return self.pieces[ i ].building; + return 1; } } } @@ -1659,21 +1618,19 @@ buildable_is_piece_built_or_building( piece ) return 0; } -buildable_all_built() +buildable_all_built() //checked changed to match cerberus output { - i = 0; - while ( i < self.pieces.size ) + for ( i = 0; i < self.pieces.size; i++ ) { if ( isDefined( self.pieces[ i ].built ) && !self.pieces[ i ].built ) { return 0; } - i++; } return 1; } -player_can_build( buildable, continuing ) +player_can_build( buildable, continuing ) //checked changed to match cerberus output { if ( !isDefined( buildable ) ) { @@ -1694,12 +1651,9 @@ player_can_build( buildable, continuing ) return 0; } } - else + else if ( buildable buildable_is_piece_built_or_building( self player_get_buildable_piece( buildable.buildable_slot ) ) ) { - if ( buildable buildable_is_piece_built_or_building( self player_get_buildable_piece( buildable.buildable_slot ) ) ) - { - return 0; - } + return 0; } if ( isDefined( buildable.stub ) && isDefined( buildable.stub.custom_buildablestub_update_prompt ) && isDefined( buildable.stub.playertrigger[ 0 ] ) && isDefined( buildable.stub.playertrigger[ 0 ].stub ) && !( buildable.stub.playertrigger[ 0 ].stub [[ buildable.stub.custom_buildablestub_update_prompt ]]( self, 1, buildable.stub.playertrigger[ 0 ] ) ) ) { @@ -1708,21 +1662,22 @@ player_can_build( buildable, continuing ) return 1; } -player_build( buildable, pieces ) +player_build( buildable, pieces ) //checked partially changed to match cerberus output { if ( isDefined( pieces ) ) { - i = 0; - while ( i < pieces.size ) + for ( i = 0; i < pieces.size; i++ ) { buildable buildable_set_piece_built( pieces[ i ] ); player_destroy_piece( pieces[ i ] ); - i++; } } - else buildable buildable_set_piece_built( self player_get_buildable_piece( buildable.buildable_slot ) ); - player_destroy_piece( self player_get_buildable_piece( buildable.buildable_slot ) ); - while ( isDefined( buildable.stub.model ) ) + else + { + buildable buildable_set_piece_built( self player_get_buildable_piece( buildable.buildable_slot ) ); + player_destroy_piece( self player_get_buildable_piece( buildable.buildable_slot ) ); + } + if ( isDefined( buildable.stub.model ) ) { i = 0; while ( i < buildable.pieces.size ) @@ -1736,16 +1691,13 @@ player_build( buildable, pieces ) i++; continue; } - else - { - buildable.stub.model show(); - buildable.stub.model showpart( buildable.pieces[ i ].part_name ); - } + buildable.stub.model show(); + buildable.stub.model showpart( buildable.pieces[ i ].part_name ); } i++; } } - if ( isplayer( self ) ) + else if ( isplayer( self ) ) { self track_buildable_pieces_built( buildable ); } @@ -1767,9 +1719,11 @@ player_build( buildable, pieces ) else { self playsound( "zmb_buildable_piece_add" ); + /* /# assert( isDefined( level.zombie_buildables[ buildable.buildable_name ].building ), "Missing builing hint" ); #/ + */ if ( isDefined( level.zombie_buildables[ buildable.buildable_name ].building ) ) { return level.zombie_buildables[ buildable.buildable_name ].building; @@ -1778,7 +1732,7 @@ player_build( buildable, pieces ) return ""; } -sndbuildablecompletealias( name ) +sndbuildablecompletealias( name ) //checked matches cerberus output { alias = undefined; switch( name ) @@ -1793,7 +1747,7 @@ sndbuildablecompletealias( name ) return alias; } -player_finish_buildable( buildable ) +player_finish_buildable( buildable ) //checked matches cerberus output { buildable.built = 1; buildable.stub.built = 1; @@ -1802,17 +1756,17 @@ player_finish_buildable( buildable ) level notify( buildable.buildable_name + "_built" ); } -buildablestub_finish_build( player ) +buildablestub_finish_build( player ) //checked matches cerberus output { player player_finish_buildable( self.buildablezone ); } -buildablestub_remove() +buildablestub_remove() //checked matches cerberus output { arrayremovevalue( level.buildable_stubs, self ); } -buildabletrigger_update_prompt( player ) +buildabletrigger_update_prompt( player ) //checked matches cerberus output { can_use = self.stub buildablestub_update_prompt( player ); self sethintstring( self.stub.hint_string ); @@ -1830,7 +1784,7 @@ buildabletrigger_update_prompt( player ) return can_use; } -buildablestub_update_prompt( player ) +buildablestub_update_prompt( player ) //checked changed to match cerberus output { if ( !self anystub_update_prompt( player ) ) { @@ -1845,7 +1799,7 @@ buildablestub_update_prompt( player ) return 0; } } - if ( isDefined( self.custom_buildablestub_update_prompt ) && !( self [[ self.custom_buildablestub_update_prompt ]]( player ) ) ) + if ( isDefined( self.custom_buildablestub_update_prompt ) && !self [[ self.custom_buildablestub_update_prompt ]]( player ) ) { return 0; } @@ -1866,90 +1820,85 @@ buildablestub_update_prompt( player ) } return 0; } - else + else if ( !self.buildablezone buildable_has_piece( player player_get_buildable_piece( slot ) ) ) { - if ( !self.buildablezone buildable_has_piece( player player_get_buildable_piece( slot ) ) ) + if ( isDefined( level.zombie_buildables[ self.equipname ].hint_wrong ) ) { - if ( isDefined( level.zombie_buildables[ self.equipname ].hint_wrong ) ) - { - self.hint_string = level.zombie_buildables[ self.equipname ].hint_wrong; - } - else - { - self.hint_string = &"ZOMBIE_BUILD_PIECE_WRONG"; - } - return 0; + self.hint_string = level.zombie_buildables[ self.equipname ].hint_wrong; } else { -/# - assert( isDefined( level.zombie_buildables[ self.equipname ].hint ), "Missing buildable hint" ); -#/ - if ( isDefined( level.zombie_buildables[ self.equipname ].hint ) ) - { - self.hint_string = level.zombie_buildables[ self.equipname ].hint; - } - else - { - self.hint_string = "Missing buildable hint"; - } + self.hint_string = &"ZOMBIE_BUILD_PIECE_WRONG"; + } + return 0; + } + else + { + /* + /# + assert( isDefined( level.zombie_buildables[ self.equipname ].hint ), "Missing buildable hint" ); + #/ + */ + if ( isDefined( level.zombie_buildables[ self.equipname ].hint ) ) + { + self.hint_string = level.zombie_buildables[ self.equipname ].hint; + } + else + { + self.hint_string = "Missing buildable hint"; } } } - else + else if ( self.persistent == 1 ) { - if ( self.persistent == 1 ) + if ( maps/mp/zombies/_zm_equipment::is_limited_equipment( self.weaponname ) && maps/mp/zombies/_zm_equipment::limited_equipment_in_use( self.weaponname ) ) { - if ( maps/mp/zombies/_zm_equipment::is_limited_equipment( self.weaponname ) && maps/mp/zombies/_zm_equipment::limited_equipment_in_use( self.weaponname ) ) - { - self.hint_string = &"ZOMBIE_BUILD_PIECE_ONLY_ONE"; - return 0; - } - if ( player has_player_equipment( self.weaponname ) ) - { - self.hint_string = &"ZOMBIE_BUILD_PIECE_HAVE_ONE"; - return 0; - } - if ( getDvarInt( #"1F0A2129" ) ) - { - self.cursor_hint = "HINT_WEAPON"; - self.cursor_hint_weapon = self.weaponname; - } - self.hint_string = self.trigger_hintstring; - } - else if ( self.persistent == 2 ) - { - if ( !maps/mp/zombies/_zm_weapons::limited_weapon_below_quota( self.weaponname, undefined ) ) - { - self.hint_string = &"ZOMBIE_GO_TO_THE_BOX_LIMITED"; - return 0; - } - else - { - if ( isDefined( self.bought ) && self.bought ) - { - self.hint_string = &"ZOMBIE_GO_TO_THE_BOX"; - return 0; - } - } - self.hint_string = self.trigger_hintstring; - } - else - { - self.hint_string = ""; + self.hint_string = &"ZOMBIE_BUILD_PIECE_ONLY_ONE"; return 0; } + if ( player has_player_equipment( self.weaponname ) ) + { + self.hint_string = &"ZOMBIE_BUILD_PIECE_HAVE_ONE"; + return 0; + } + /* + if ( getDvarInt( #"1F0A2129" ) ) + { + self.cursor_hint = "HINT_WEAPON"; + self.cursor_hint_weapon = self.weaponname; + } + */ + self.hint_string = self.trigger_hintstring; + } + else if ( self.persistent == 2 ) + { + if ( !maps/mp/zombies/_zm_weapons::limited_weapon_below_quota( self.weaponname, undefined ) ) + { + self.hint_string = &"ZOMBIE_GO_TO_THE_BOX_LIMITED"; + return 0; + } + else if ( isDefined( self.bought ) && self.bought ) + { + self.hint_string = &"ZOMBIE_GO_TO_THE_BOX"; + return 0; + } + self.hint_string = self.trigger_hintstring; + } + else + { + self.hint_string = ""; + return 0; } return 1; } -player_continue_building( buildablezone, build_stub ) +player_continue_building( buildablezone, build_stub ) //checked matches cerberus output { if ( !isDefined( build_stub ) ) { build_stub = buildablezone.stub; } - if ( self maps/mp/zombies/_zm_laststand::player_is_in_laststand() || self in_revive_trigger() ) + if ( self maps/mp/zombies/_zm_laststand::player_is_in_laststand() || self maps/mp/zombies/_zm_utility::in_revive_trigger() ) { return 0; } @@ -1979,7 +1928,7 @@ player_continue_building( buildablezone, build_stub ) { torigin = build_stub unitrigger_origin(); porigin = self geteye(); - radius_sq = 2,25 * build_stub.test_radius_sq; + radius_sq = 2.25 * build_stub.test_radius_sq; if ( distance2dsquared( torigin, porigin ) > radius_sq ) { return 0; @@ -1992,14 +1941,14 @@ player_continue_building( buildablezone, build_stub ) return 0; } } - if ( isDefined( build_stub.require_look_at ) && build_stub.require_look_at && !self is_player_looking_at( trigger.origin, 0,4 ) ) + if ( isDefined( build_stub.require_look_at ) && build_stub.require_look_at && !self is_player_looking_at( trigger.origin, 0.4 ) ) { return 0; } return 1; } -player_progress_bar_update( start_time, build_time ) +player_progress_bar_update( start_time, build_time ) //checked partially matches cerberus output but order of operations may need to be adjusted { self endon( "entering_last_stand" ); self endon( "death" ); @@ -2017,11 +1966,11 @@ player_progress_bar_update( start_time, build_time ) progress = 1; } self.usebar updatebar( progress ); - wait 0,05; + wait 0.05; } } -player_progress_bar( start_time, build_time, building_prompt ) +player_progress_bar( start_time, build_time, building_prompt ) //checked matches cerberus output { self.usebar = self createprimaryprogressbar(); self.usebartext = self createprimaryprogressbartext(); @@ -2041,13 +1990,13 @@ player_progress_bar( start_time, build_time, building_prompt ) self.usebar destroyelem(); } -buildable_use_hold_think_internal( player, bind_stub ) +buildable_use_hold_think_internal( player, bind_stub ) //checked changed to match cerberus output order of operations may need to be checked { if ( !isDefined( bind_stub ) ) { bind_stub = self.stub; } - wait 0,01; + wait 0.01; if ( !isDefined( self ) ) { self notify( "build_failed" ); @@ -2085,7 +2034,7 @@ buildable_use_hold_think_internal( player, bind_stub ) } while ( isDefined( self ) && player player_continue_building( bind_stub.buildablezone, self.stub ) && ( getTime() - self.build_start_time ) < self.build_time ) { - wait 0,05; + wait 0.05; } player notify( "buildable_progress_end" ); player maps/mp/zombies/_zm_weapons::switch_back_primary_weapon( orgweapon ); @@ -2100,19 +2049,16 @@ buildable_use_hold_think_internal( player, bind_stub ) buildable_clear_piece_building( player player_get_buildable_piece( slot ) ); self notify( "build_succeed" ); } - else + else if ( isDefined( player.buildableaudio ) ) { - if ( isDefined( player.buildableaudio ) ) - { - player.buildableaudio delete(); - player.buildableaudio = undefined; - } - buildable_clear_piece_building( player player_get_buildable_piece( slot ) ); - self notify( "build_failed" ); + player.buildableaudio delete(); + player.buildableaudio = undefined; } + buildable_clear_piece_building( player player_get_buildable_piece( slot ) ); + self notify( "build_failed" ); } -buildable_play_build_fx( player ) +buildable_play_build_fx( player ) //checked matches cerberus output { self endon( "kill_trigger" ); self endon( "build_succeed" ); @@ -2120,11 +2066,11 @@ buildable_play_build_fx( player ) while ( 1 ) { playfx( level._effect[ "building_dust" ], player getplayercamerapos(), player.angles ); - wait 0,5; + wait 0.5; } } -buildable_use_hold_think( player, bind_stub ) +buildable_use_hold_think( player, bind_stub ) //checked matches cerberus output { if ( !isDefined( bind_stub ) ) { @@ -2140,24 +2086,24 @@ buildable_use_hold_think( player, bind_stub ) return 0; } -buildable_place_think() +buildable_place_think() //checked partially changed to match cerberus output //changed at own discretion { self endon( "kill_trigger" ); player_built = undefined; while ( isDefined( self.stub.built ) && !self.stub.built ) { self waittill( "trigger", player ); - while ( player != self.parent_player ) + if ( player != self.parent_player ) { continue; } - while ( isDefined( player.screecher_weapon ) ) + if ( isDefined( player.screecher_weapon ) ) { continue; } - while ( !is_player_valid( player ) ) + if ( !is_player_valid( player ) ) { - player thread ignore_triggers( 0,5 ); + player thread ignore_triggers( 0.5 ); } status = player player_can_build( self.stub.buildablezone ); if ( !status ) @@ -2168,73 +2114,70 @@ buildable_place_think() { self.stub [[ self.stub.oncantuse ]]( player ); } + //continue; + } + else if ( isDefined( self.stub.onbeginuse ) ) + { + self.stub [[ self.stub.onbeginuse ]]( player ); + } + result = self buildable_use_hold_think( player ); + team = player.pers[ "team" ]; + if ( isDefined( self.stub.onenduse ) ) + { + self.stub [[ self.stub.onenduse ]]( team, player, result ); + } + if ( !result ) + { continue; } - else + if ( isDefined( self.stub.onuse ) ) { - if ( isDefined( self.stub.onbeginuse ) ) - { - self.stub [[ self.stub.onbeginuse ]]( player ); - } - result = self buildable_use_hold_think( player ); - team = player.pers[ "team" ]; - if ( isDefined( self.stub.onenduse ) ) - { - self.stub [[ self.stub.onenduse ]]( team, player, result ); - } - while ( !result ) - { - continue; - } - if ( isDefined( self.stub.onuse ) ) - { - self.stub [[ self.stub.onuse ]]( player ); - } - slot = self.stub.buildablestruct.buildable_slot; - if ( isDefined( player player_get_buildable_piece( slot ) ) ) - { - prompt = player player_build( self.stub.buildablezone ); - player_built = player; - self.stub.hint_string = prompt; - } - self sethintstring( self.stub.hint_string ); + self.stub [[ self.stub.onuse ]]( player ); } + slot = self.stub.buildablestruct.buildable_slot; + if ( isDefined( player player_get_buildable_piece( slot ) ) ) + { + prompt = player player_build( self.stub.buildablezone ); + player_built = player; + self.stub.hint_string = prompt; + } + self sethintstring( self.stub.hint_string ); } if ( isDefined( player_built ) ) { - } - switch( self.stub.persistent ) - { - case 1: - self bptrigger_think_persistent( player_built ); - break; - case 0: - self bptrigger_think_one_time( player_built ); - break; - case 3: - self bptrigger_think_unbuild( player_built ); - break; - case 2: - self bptrigger_think_one_use_and_fly( player_built ); - break; - case 4: - self [[ self.stub.custom_completion_callback ]]( player_built ); - break; + switch( self.stub.persistent ) + { + case 1: + self bptrigger_think_persistent( player_built ); + break; + case 0: + self bptrigger_think_one_time( player_built ); + break; + case 3: + self bptrigger_think_unbuild( player_built ); + break; + case 2: + self bptrigger_think_one_use_and_fly( player_built ); + break; + case 4: + self [[ self.stub.custom_completion_callback ]]( player_built ); + break; + } } } -bptrigger_think_one_time( player_built ) +bptrigger_think_one_time( player_built ) //checked matches cerberus output { self.stub buildablestub_remove(); thread maps/mp/zombies/_zm_unitrigger::unregister_unitrigger( self.stub ); } -bptrigger_think_unbuild( player_built ) +bptrigger_think_unbuild( player_built ) //checked matches cerberus output { stub_unbuild_buildable( self.stub, 1 ); } -bptrigger_think_one_use_and_fly( player_built ) +bptrigger_think_one_use_and_fly( player_built ) //checked changed to match cerberus output { if ( isDefined( player_built ) ) { @@ -2276,11 +2219,11 @@ bptrigger_think_one_use_and_fly( player_built ) self sethintstring( self.stub.hint_string ); return; } - while ( player != self.parent_player ) + if ( player != self.parent_player ) { continue; } - while ( !is_player_valid( player ) ) + if ( !is_player_valid( player ) ) { player thread ignore_triggers( 0,5 ); } @@ -2307,9 +2250,9 @@ bptrigger_think_one_use_and_fly( player_built ) } } -bptrigger_think_persistent( player_built ) +bptrigger_think_persistent( player_built ) //checked changed to match cerberus output { - while ( !isDefined( player_built ) || self [[ self.stub.prompt_and_visibility_func ]]( player_built ) ) + if ( !isDefined( player_built ) || self [[ self.stub.prompt_and_visibility_func ]]( player_built ) ) { if ( isDefined( self.stub.model ) ) { @@ -2319,7 +2262,7 @@ bptrigger_think_persistent( player_built ) while ( self.stub.persistent == 1 ) { self waittill( "trigger", player ); - while ( isDefined( player.screecher_weapon ) ) + if ( isDefined( player.screecher_weapon ) ) { continue; } @@ -2330,15 +2273,15 @@ bptrigger_think_persistent( player_built ) self setcursorhint( "HINT_NOICON" ); return; } - while ( player != self.parent_player ) + if ( player != self.parent_player ) { continue; } - while ( !is_player_valid( player ) ) + if ( !is_player_valid( player ) ) { - player thread ignore_triggers( 0,5 ); + player thread ignore_triggers( 0.5 ); } - while ( player has_player_equipment( self.stub.weaponname ) ) + if ( player has_player_equipment( self.stub.weaponname ) ) { continue; } @@ -2373,7 +2316,6 @@ bptrigger_think_persistent( player_built ) } self sethintstring( self.stub.hint_string ); player track_buildables_pickedup( self.stub.weaponname ); - continue; } else { @@ -2387,18 +2329,18 @@ bptrigger_think_persistent( player_built ) } } -bptrigger_think_unbuild_no_return( player ) +bptrigger_think_unbuild_no_return( player ) //checked matches cerberus output { stub_unbuild_buildable( self.stub, 0 ); } -bpstub_set_custom_think_callback( callback ) +bpstub_set_custom_think_callback( callback ) //checked matches cerberus output { self.persistent = 4; self.custom_completion_callback = callback; } -model_fly_away() +model_fly_away() //checked changed to match cerberus output { self moveto( self.origin + vectorScale( ( 0, 0, 1 ), 40 ), 3 ); direction = self.origin; @@ -2407,42 +2349,35 @@ model_fly_away() { direction = ( direction[ 0 ], direction[ 1 ] * -1, 0 ); } - else + else if ( direction[ 0 ] < 0 ) { - if ( direction[ 0 ] < 0 ) - { - direction = ( direction[ 0 ] * -1, direction[ 1 ], 0 ); - } + direction = ( direction[ 0 ] * -1, direction[ 1 ], 0 ); } - self vibrate( direction, 10, 0,5, 4 ); + self vibrate( direction, 10, 0.5, 4 ); self waittill( "movedone" ); self hide(); playfx( level._effect[ "poltergeist" ], self.origin ); } -find_buildable_stub( equipname ) +find_buildable_stub( equipname ) //checked changed to match cerberus output { - _a2343 = level.buildable_stubs; - _k2343 = getFirstArrayKey( _a2343 ); - while ( isDefined( _k2343 ) ) + foreach ( stub in level.buildable_stubs ) { - stub = _a2343[ _k2343 ]; if ( stub.equipname == equipname ) { return stub; } - _k2343 = getNextArrayKey( _a2343, _k2343 ); } return undefined; } -unbuild_buildable( equipname, return_pieces, origin, angles ) +unbuild_buildable( equipname, return_pieces, origin, angles ) //checked matches cerberus output { stub = find_buildable_stub( equipname ); stub_unbuild_buildable( stub, return_pieces, origin, angles ); } -stub_unbuild_buildable( stub, return_pieces, origin, angles ) +stub_unbuild_buildable( stub, return_pieces, origin, angles ) //checked partially changed to match cerberus output //did not change while loop to for loop { if ( isDefined( stub ) ) { @@ -2462,7 +2397,6 @@ stub_unbuild_buildable( stub, return_pieces, origin, angles ) if ( isDefined( buildable.pieces[ i ].built ) && !buildable.pieces[ i ].built ) { buildable.stub.model hidepart( buildable.pieces[ i ].part_name ); - break; } else { @@ -2478,10 +2412,7 @@ stub_unbuild_buildable( stub, return_pieces, origin, angles ) i++; continue; } - else - { - buildable.pieces[ i ] piece_spawn_at( origin, angles ); - } + buildable.pieces[ i ] piece_spawn_at( origin, angles ); } i++; } @@ -2492,7 +2423,7 @@ stub_unbuild_buildable( stub, return_pieces, origin, angles ) } } -player_explode_buildable( equipname, origin, speed, return_to_spawn, return_time ) +player_explode_buildable( equipname, origin, speed, return_to_spawn, return_time ) //checked changed to match cerberus output { self explosiondamage( 50, origin ); stub = find_buildable_stub( equipname ); @@ -2504,8 +2435,7 @@ player_explode_buildable( equipname, origin, speed, return_to_spawn, return_time buildable notify( "unbuilt" ); level.buildables_built[ buildable.buildable_name ] = 0; level notify( buildable.buildable_name + "_unbuilt" ); - i = 0; - while ( i < buildable.pieces.size ) + for ( i = 0; i < buildable.pieces.size; i++ ) { buildable.pieces[ i ].built = 0; if ( isDefined( buildable.pieces[ i ].part_name ) ) @@ -2514,7 +2444,6 @@ player_explode_buildable( equipname, origin, speed, return_to_spawn, return_time if ( isDefined( buildable.pieces[ i ].built ) && !buildable.pieces[ i ].built ) { buildable.stub.model hidepart( buildable.pieces[ i ].part_name ); - break; } else { @@ -2523,50 +2452,45 @@ player_explode_buildable( equipname, origin, speed, return_to_spawn, return_time } } ang = randomfloat( 360 ); - h = 0,25 + randomfloat( 0,5 ); + h = 0.25 + randomfloat( 0.5 ); dir = ( sin( ang ), cos( ang ), h ); self thread player_throw_piece( buildable.pieces[ i ], origin, speed * dir, return_to_spawn, return_time ); - i++; } buildable.stub.model hide(); } } -think_buildables() +think_buildables() //checked changed to match cerberus output { - _a2447 = level.zombie_include_buildables; - _k2447 = getFirstArrayKey( _a2447 ); - while ( isDefined( _k2447 ) ) + foreach ( buildable in level.zombie_include_buildables ) { - buildable = _a2447[ _k2447 ]; if ( isDefined( buildable.triggerthink ) ) { level [[ buildable.triggerthink ]](); wait_network_frame(); } - _k2447 = getNextArrayKey( _a2447, _k2447 ); } level notify( "buildables_setup" ); } -buildable_trigger_think( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) +buildable_trigger_think( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) //checked matches cerberus output { return setup_unitrigger_buildable( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ); } -buildable_trigger_think_array( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) +buildable_trigger_think_array( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) //checked matches cerberus output { return setup_unitrigger_buildable_array( trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ); } -buildable_set_unbuild_notify_delay( str_equipname, str_unbuild_notify, unbuild_respawn_fn ) +buildable_set_unbuild_notify_delay( str_equipname, str_unbuild_notify, unbuild_respawn_fn ) //checked matches cerberus output { stub = find_buildable_stub( str_equipname ); stub.str_unbuild_notify = str_unbuild_notify; stub.unbuild_respawn_fn = unbuild_respawn_fn; } -setup_vehicle_unitrigger_buildable( parent, trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) +setup_vehicle_unitrigger_buildable( parent, trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) //checked matches cerberus output { trig = getent( trigger_targetname, "targetname" ); if ( !isDefined( trig ) ) @@ -2650,12 +2574,12 @@ setup_vehicle_unitrigger_buildable( parent, trigger_targetname, equipname, weapo return unitrigger_stub; } -vehicle_buildable_trigger_think( vehicle, trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) +vehicle_buildable_trigger_think( vehicle, trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ) //checked matches cerberus output { return setup_vehicle_unitrigger_buildable( vehicle, trigger_targetname, equipname, weaponname, trigger_hintstring, delete_trigger, persistent ); } -ai_buildable_trigger_think( parent, equipname, weaponname, trigger_hintstring, persistent ) +ai_buildable_trigger_think( parent, equipname, weaponname, trigger_hintstring, persistent ) //checked matches cerberus output { unitrigger_stub = spawnstruct(); unitrigger_stub.buildablestruct = level.zombie_include_buildables[ equipname ]; @@ -2695,35 +2619,41 @@ ai_buildable_trigger_think( parent, equipname, weaponname, trigger_hintstring, p return unitrigger_stub; } -onpickuputs( player ) +onpickuputs( player ) //checked matches cerberus output { + /* /# if ( isDefined( player ) && isDefined( player.name ) ) { println( "ZM >> Buildable piece recovered by - " + player.name ); #/ } + */ } -ondroputs( player ) +ondroputs( player ) //checked matches cerberus output { + /* /# if ( isDefined( player ) && isDefined( player.name ) ) { println( "ZM >> Buildable piece dropped by - " + player.name ); #/ } + */ player notify( "event_ended" ); } -onbeginuseuts( player ) +onbeginuseuts( player ) //checked matches cerberus output { + /* /# if ( isDefined( player ) && isDefined( player.name ) ) { println( "ZM >> Buildable piece begin use by - " + player.name ); #/ } + */ if ( isDefined( self.buildablestruct.onbeginuse ) ) { self [[ self.buildablestruct.onbeginuse ]]( player ); @@ -2736,7 +2666,7 @@ onbeginuseuts( player ) } } -sndbuildableusealias( name ) +sndbuildableusealias( name ) //checked matches cerberus output { alias = undefined; switch( name ) @@ -2757,14 +2687,16 @@ sndbuildableusealias( name ) return alias; } -onenduseuts( team, player, result ) +onenduseuts( team, player, result ) //checked matches cerberus output { + /* /# if ( isDefined( player ) && isDefined( player.name ) ) { println( "ZM >> Buildable piece end use by - " + player.name ); #/ } + */ if ( !isDefined( player ) ) { return; @@ -2780,29 +2712,33 @@ onenduseuts( team, player, result ) } player notify( "event_ended" ); } - -oncantuseuts( player ) + +oncantuseuts( player ) //checked matches cerberus output { + /* /# if ( isDefined( player ) && isDefined( player.name ) ) { println( "ZM >> Buildable piece can't use by - " + player.name ); #/ } + */ if ( isDefined( self.buildablestruct.oncantuse ) ) { self [[ self.buildablestruct.oncantuse ]]( player ); } } -onuseplantobjectuts( player ) +onuseplantobjectuts( player ) //checked matches cerberus output { + /* /# if ( isDefined( player ) && isDefined( player.name ) ) { println( "ZM >> Buildable piece crafted by - " + player.name ); #/ } + */ if ( isDefined( self.buildablestruct.onuseplantobject ) ) { self [[ self.buildablestruct.onuseplantobject ]]( player ); @@ -2810,20 +2746,20 @@ onuseplantobjectuts( player ) player notify( "bomb_planted" ); } -add_zombie_buildable_vox_category( buildable_name, vox_id ) +add_zombie_buildable_vox_category( buildable_name, vox_id ) //checked matches cerberus output { buildable_struct = level.zombie_include_buildables[ buildable_name ]; buildable_struct.vox_id = vox_id; } -add_zombie_buildable_piece_vox_category( buildable_name, vox_id, timer ) +add_zombie_buildable_piece_vox_category( buildable_name, vox_id, timer ) //checked matches cerberus output { buildable_struct = level.zombie_include_buildables[ buildable_name ]; buildable_struct.piece_vox_id = vox_id; buildable_struct.piece_vox_timer = timer; } -is_buildable() +is_buildable() //checked matches cerberus output { if ( !isDefined( level.zombie_buildables ) ) { @@ -2844,13 +2780,13 @@ is_buildable() return 0; } -buildable_crafted() +buildable_crafted() //checked matches cerberus output { self.pieces--; } -buildable_complete() +buildable_complete() //checked matches cerberus output { if ( self.pieces <= 0 ) { @@ -2859,15 +2795,17 @@ buildable_complete() return 0; } -get_buildable_hint( buildable_name ) +get_buildable_hint( buildable_name ) //checked matches cerberus output { + /* /# assert( isDefined( level.zombie_buildables[ buildable_name ] ), buildable_name + " was not included or is not part of the zombie weapon list." ); #/ + */ return level.zombie_buildables[ buildable_name ].hint; } -delete_on_disconnect( buildable, self_notify, skip_delete ) +delete_on_disconnect( buildable, self_notify, skip_delete ) //checked matches cerberus output { buildable endon( "death" ); self waittill( "disconnect" ); @@ -2889,29 +2827,27 @@ delete_on_disconnect( buildable, self_notify, skip_delete ) } } -get_buildable_pickup( buildablename, modelname ) +get_buildable_pickup( buildablename, modelname ) //checked changed to match cerberus output { - _a2858 = level.buildablepickups; - _k2858 = getFirstArrayKey( _a2858 ); - while ( isDefined( _k2858 ) ) + foreach ( buildablepickup in level.buildablepickups ) { - buildablepickup = _a2858[ _k2858 ]; if ( buildablepickup[ 0 ].buildablestruct.name == buildablename && buildablepickup[ 0 ].visuals[ 0 ].model == modelname ) { return buildablepickup[ 0 ]; } - _k2858 = getNextArrayKey( _a2858, _k2858 ); } return undefined; } -track_buildable_piece_pickedup( piece ) +track_buildable_piece_pickedup( piece ) //checked matches cerberus output { if ( !isDefined( piece ) || !isDefined( piece.buildablename ) ) { + /* /# println( "STAT TRACKING FAILURE: NOT DEFINED IN track_buildable_piece_pickedup() \n" ); #/ + */ return; } self add_map_buildable_stat( piece.buildablename, "pieces_pickedup", 1 ); @@ -2934,7 +2870,7 @@ track_buildable_piece_pickedup( piece ) } } -buildable_piece_pickedup_vox_cooldown( piece_vox_id, timer ) +buildable_piece_pickedup_vox_cooldown( piece_vox_id, timer ) //checked matches cerberus output { self endon( "disconnect" ); if ( !isDefined( self.a_buildable_piece_pickedup_vox_cooldown ) ) @@ -2946,13 +2882,15 @@ buildable_piece_pickedup_vox_cooldown( piece_vox_id, timer ) arrayremovevalue( self.a_buildable_piece_pickedup_vox_cooldown, piece_vox_id ); } -track_buildable_pieces_built( buildable ) +track_buildable_pieces_built( buildable ) //checked matches cerberus output { if ( !isDefined( buildable ) || !isDefined( buildable.buildable_name ) ) { + /* /# println( "STAT TRACKING FAILURE: NOT DEFINED IN track_buildable_pieces_built() \n" ); #/ + */ return; } bname = buildable.buildable_name; @@ -2975,13 +2913,15 @@ track_buildable_pieces_built( buildable ) } } -track_buildables_built( buildable ) +track_buildables_built( buildable ) //checked matches cerberus output { if ( !isDefined( buildable ) || !isDefined( buildable.buildable_name ) ) { + /* /# println( "STAT TRACKING FAILURE: NOT DEFINED IN track_buildables_built() \n" ); #/ + */ return; } bname = buildable.buildable_name; @@ -2998,34 +2938,40 @@ track_buildables_built( buildable ) } } -track_buildables_pickedup( buildable ) +track_buildables_pickedup( buildable ) //checked matches cerberus output { if ( !isDefined( buildable ) ) { + /* /# println( "STAT TRACKING FAILURE: NOT DEFINED IN track_buildables_pickedup() \n" ); #/ + */ return; } stat_name = get_buildable_stat_name( buildable ); if ( !isDefined( stat_name ) ) { + /* /# println( "STAT TRACKING FAILURE: NO STAT NAME FOR " + buildable + "\n" ); #/ + */ return; } self add_map_buildable_stat( stat_name, "buildable_pickedup", 1 ); self say_pickup_buildable_vo( buildable, 0 ); } -track_buildables_planted( equipment ) +track_buildables_planted( equipment ) //checked matches cerberus output { if ( !isDefined( equipment ) ) { + /* /# println( "STAT TRACKING FAILURE: NOT DEFINED for track_buildables_planted() \n" ); #/ + */ return; } buildable_name = undefined; @@ -3035,9 +2981,11 @@ track_buildables_planted( equipment ) } if ( !isDefined( buildable_name ) ) { + /* /# println( "STAT TRACKING FAILURE: NO BUILDABLE NAME FOR track_buildables_planted() " + equipment.name + "\n" ); #/ + */ return; } maps/mp/_demo::bookmark( "zm_player_buildable_placed", getTime(), self ); @@ -3054,7 +3002,7 @@ track_buildables_planted( equipment ) } } -placed_buildable_vo_timer() +placed_buildable_vo_timer() //checked matches cerberus output { self endon( "disconnect" ); self.buildable_timer = 1; @@ -3062,7 +3010,7 @@ placed_buildable_vo_timer() self.buildable_timer = 0; } -buildable_pickedup_timer() +buildable_pickedup_timer() //checked matches cerberus output { self endon( "disconnect" ); self.buildable_pickedup_timer = 1; @@ -3070,13 +3018,13 @@ buildable_pickedup_timer() self.buildable_pickedup_timer = 0; } -track_planted_buildables_pickedup( equipment ) +track_planted_buildables_pickedup( equipment ) //checked changed to match cerberus output { if ( !isDefined( equipment ) ) { return; } - if ( equipment != "equip_turbine_zm" && equipment != "equip_turret_zm" || equipment == "equip_electrictrap_zm" && equipment == "riotshield_zm" ) + if ( equipment == "equip_turbine_zm" || equipment == "equip_turret_zm" || equipment == "equip_electrictrap_zm" || equipment == "riotshield_zm" ) { self maps/mp/zombies/_zm_stats::increment_client_stat( "planted_buildables_pickedup", 0 ); self maps/mp/zombies/_zm_stats::increment_player_stat( "planted_buildables_pickedup" ); @@ -3088,7 +3036,7 @@ track_planted_buildables_pickedup( equipment ) } } -track_placed_buildables( buildable_name ) +track_placed_buildables( buildable_name ) //checked matches cerberus output { if ( !isDefined( buildable_name ) ) { @@ -3107,20 +3055,20 @@ track_placed_buildables( buildable_name ) self thread do_player_general_vox( "general", vo_name ); } -add_map_buildable_stat( piece_name, stat_name, value ) +add_map_buildable_stat( piece_name, stat_name, value ) //checked changed to match cerberus output { - if ( isDefined( piece_name ) && piece_name != "sq_common" || piece_name == "keys_zm" && piece_name == "oillamp_zm" ) + if ( isDefined( piece_name ) || piece_name == "sq_common" || piece_name == "keys_zm" || piece_name == "oillamp_zm" ) { return; } - if ( isDefined( level.zm_disable_recording_stats ) || level.zm_disable_recording_stats && isDefined( level.zm_disable_recording_buildable_stats ) && level.zm_disable_recording_buildable_stats ) + if ( isDefined( level.zm_disable_recording_stats ) && level.zm_disable_recording_stats || isDefined( level.zm_disable_recording_buildable_stats ) && level.zm_disable_recording_buildable_stats ) { return; } self adddstat( "buildables", piece_name, stat_name, value ); } -say_pickup_buildable_vo( buildable_name, world ) +say_pickup_buildable_vo( buildable_name, world ) //checked matches cerberus output { if ( isDefined( self.buildable_pickedup_timer ) && self.buildable_pickedup_timer ) { @@ -3143,7 +3091,7 @@ say_pickup_buildable_vo( buildable_name, world ) } } -get_buildable_vo_name( buildable_name ) +get_buildable_vo_name( buildable_name ) //checked matches cerberus output { switch( buildable_name ) { @@ -3169,7 +3117,7 @@ get_buildable_vo_name( buildable_name ) return undefined; } -get_buildable_stat_name( buildable ) +get_buildable_stat_name( buildable ) //checked matches cerberus output { if ( isDefined( buildable ) ) { @@ -3193,3 +3141,5 @@ get_buildable_stat_name( buildable ) return undefined; } } + + diff --git a/patch_zm/maps/mp/zombies/_zm_unitrigger.gsc b/patch_zm/maps/mp/zombies/_zm_unitrigger.gsc index 0fa35ef..44dd485 100644 --- a/patch_zm/maps/mp/zombies/_zm_unitrigger.gsc +++ b/patch_zm/maps/mp/zombies/_zm_unitrigger.gsc @@ -3,7 +3,7 @@ #include maps/mp/_utility; #include common_scripts/utility; -init() +init() //checked changed to match cerberus output { level._unitriggers = spawnstruct(); level._unitriggers._deferredinitlist = []; @@ -14,26 +14,22 @@ init() level._unitriggers.largest_radius = 64; stubs_keys = array( "unitrigger_radius", "unitrigger_radius_use", "unitrigger_box", "unitrigger_box_use" ); stubs = []; - i = 0; - while ( i < stubs_keys.size ) + for ( i = 0; i < stubs_keys.size; i++ ) { stubs = arraycombine( stubs, getstructarray( stubs_keys[ i ], "script_unitrigger_type" ), 1, 0 ); - i++; } - i = 0; - while ( i < stubs.size ) + for ( i = 0; i < stubs.size; i++ ) { register_unitrigger( stubs[ i ] ); - i++; } } -register_unitrigger_system_func( system, trigger_func ) +register_unitrigger_system_func( system, trigger_func ) //checked matches cerberus output { level._unitriggers.system_trigger_funcs[ system ] = trigger_func; } -unitrigger_force_per_player_triggers( unitrigger_stub, opt_on_off ) +unitrigger_force_per_player_triggers( unitrigger_stub, opt_on_off ) //checked matches cerberus output { if ( !isDefined( opt_on_off ) ) { @@ -42,7 +38,7 @@ unitrigger_force_per_player_triggers( unitrigger_stub, opt_on_off ) unitrigger_stub.trigger_per_player = opt_on_off; } -unitrigger_trigger( player ) +unitrigger_trigger( player ) //checked matches cerberus output { if ( self.trigger_per_player ) { @@ -54,7 +50,7 @@ unitrigger_trigger( player ) } } -unitrigger_origin() +unitrigger_origin() //checked matches cerberus output { if ( isDefined( self.originfunc ) ) { @@ -67,25 +63,24 @@ unitrigger_origin() return origin; } -register_unitrigger_internal( unitrigger_stub, trigger_func ) +register_unitrigger_internal( unitrigger_stub, trigger_func ) //checked changed to match cerberus output { if ( !isDefined( unitrigger_stub.script_unitrigger_type ) ) { + /* /# println( "Cannot register a unitrigger with no script_unitrigger_type. Ignoring." ); #/ + */ return; } if ( isDefined( trigger_func ) ) { unitrigger_stub.trigger_func = trigger_func; } - else + else if ( isDefined( unitrigger_stub.unitrigger_system ) && isDefined( level._unitriggers.system_trigger_funcs[ unitrigger_stub.unitrigger_system ] ) ) { - if ( isDefined( unitrigger_stub.unitrigger_system ) && isDefined( level._unitriggers.system_trigger_funcs[ unitrigger_stub.unitrigger_system ] ) ) - { - unitrigger_stub.trigger_func = level._unitriggers.system_trigger_funcs[ unitrigger_stub.unitrigger_system ]; - } + unitrigger_stub.trigger_func = level._unitriggers.system_trigger_funcs[ unitrigger_stub.unitrigger_system ]; } switch( unitrigger_stub.script_unitrigger_type ) { @@ -123,9 +118,11 @@ register_unitrigger_internal( unitrigger_stub, trigger_func ) unitrigger_stub.test_radius_sq = ( box_radius + 15 ) * ( box_radius + 15 ); break; default: + /* /# println( "Unknown unitrigger type registered : " + unitrigger_stub.targetname + " - ignoring." ); #/ + */ return; } if ( unitrigger_stub.radius > level._unitriggers.largest_radius ) @@ -138,30 +135,27 @@ register_unitrigger_internal( unitrigger_stub, trigger_func ) setdvar( "player_useRadius_zm", level.fixed_max_player_use_radius ); } } - else + else if ( level._unitriggers.largest_radius > getDvarFloat( "player_useRadius_zm" ) ) { - if ( level._unitriggers.largest_radius > getDvarFloat( "player_useRadius_zm" ) ) - { - setdvar( "player_useRadius_zm", level._unitriggers.largest_radius ); - } + setdvar( "player_useRadius_zm", level._unitriggers.largest_radius ); } } level._unitriggers.trigger_stubs[ level._unitriggers.trigger_stubs.size ] = unitrigger_stub; unitrigger_stub.registered = 1; } -register_unitrigger( unitrigger_stub, trigger_func ) +register_unitrigger( unitrigger_stub, trigger_func ) //checked matches cerberus output { register_unitrigger_internal( unitrigger_stub, trigger_func ); level._unitriggers.dynamic_stubs[ level._unitriggers.dynamic_stubs.size ] = unitrigger_stub; } -unregister_unitrigger( unitrigger_stub ) +unregister_unitrigger( unitrigger_stub ) //checked matches cerberus output { thread unregister_unitrigger_internal( unitrigger_stub ); } -unregister_unitrigger_internal( unitrigger_stub ) +unregister_unitrigger_internal( unitrigger_stub ) //checked changed to match cerberus output { if ( !isDefined( unitrigger_stub ) ) { @@ -173,31 +167,24 @@ unregister_unitrigger_internal( unitrigger_stub ) if ( isDefined( unitrigger_stub.playertrigger ) && unitrigger_stub.playertrigger.size > 0 ) { keys = getarraykeys( unitrigger_stub.playertrigger ); - _a181 = keys; - _k181 = getFirstArrayKey( _a181 ); - while ( isDefined( _k181 ) ) + foreach ( key in keys ) { - key = _a181[ _k181 ]; trigger = unitrigger_stub.playertrigger[ key ]; trigger notify( "kill_trigger" ); if ( isDefined( trigger ) ) { trigger delete(); } - _k181 = getNextArrayKey( _a181, _k181 ); } unitrigger_stub.playertrigger = []; } } - else + else if ( isDefined( unitrigger_stub.trigger ) ) { - if ( isDefined( unitrigger_stub.trigger ) ) - { - trigger = unitrigger_stub.trigger; - trigger notify( "kill_trigger" ); - trigger.stub.trigger = undefined; - trigger delete(); - } + trigger = unitrigger_stub.trigger; + trigger notify( "kill_trigger" ); + trigger.stub.trigger = undefined; + trigger delete(); } if ( isDefined( unitrigger_stub.in_zone ) ) { @@ -208,13 +195,13 @@ unregister_unitrigger_internal( unitrigger_stub ) arrayremovevalue( level._unitriggers.dynamic_stubs, unitrigger_stub ); } -delay_delete_contact_ent() +delay_delete_contact_ent() //checked matches cerberus output { self.last_used_time = 0; while ( 1 ) { wait 1; - if ( ( getTime() - self.last_used_time ) > 1000 ) + if ( getTime() - self.last_used_time > 1000 ) { self delete(); level._unitriggers.contact_ent = undefined; @@ -223,7 +210,7 @@ delay_delete_contact_ent() } } -register_static_unitrigger( unitrigger_stub, trigger_func, recalculate_zone ) +register_static_unitrigger( unitrigger_stub, trigger_func, recalculate_zone ) //checked changed to match cerberus output { if ( level.zones.size == 0 ) { @@ -233,11 +220,11 @@ register_static_unitrigger( unitrigger_stub, trigger_func, recalculate_zone ) } if ( !isDefined( level._unitriggers.contact_ent ) ) { - level._unitriggers.contact_ent = spawn( "script_origin", ( 0, 0, 1 ) ); + level._unitriggers.contact_ent = spawn( "script_origin", ( 0, 0, 0 ) ); level._unitriggers.contact_ent thread delay_delete_contact_ent(); } register_unitrigger_internal( unitrigger_stub, trigger_func ); - while ( !isDefined( level._no_static_unitriggers ) ) + if ( !isDefined( level._no_static_unitriggers ) ) { level._unitriggers.contact_ent.last_used_time = getTime(); level._unitriggers.contact_ent.origin = unitrigger_stub.origin; @@ -247,8 +234,7 @@ register_static_unitrigger( unitrigger_stub, trigger_func, recalculate_zone ) return; } keys = getarraykeys( level.zones ); - i = 0; - while ( i < keys.size ) + for ( i = 0; i < keys.size; i++ ) { if ( level._unitriggers.contact_ent maps/mp/zombies/_zm_zonemgr::entity_in_zone( keys[ i ], 1 ) ) { @@ -260,45 +246,45 @@ register_static_unitrigger( unitrigger_stub, trigger_func, recalculate_zone ) unitrigger_stub.in_zone = keys[ i ]; return; } - i++; } } level._unitriggers.dynamic_stubs[ level._unitriggers.dynamic_stubs.size ] = unitrigger_stub; unitrigger_stub.registered = 1; } -reregister_unitrigger_as_dynamic( unitrigger_stub ) +reregister_unitrigger_as_dynamic( unitrigger_stub ) //checked matches cerberus output { unregister_unitrigger_internal( unitrigger_stub ); register_unitrigger( unitrigger_stub, unitrigger_stub.trigger_func ); } -debug_unitriggers() +debug_unitriggers() //checked changed to match cerberus output { + /* /# while ( 1 ) { + //dvar name is unknown in both dumps while ( getDvarInt( #"D256F24B" ) > 0 ) { - i = 0; - while ( i < level._unitriggers.trigger_stubs.size ) + for ( i = 0; i < level._unitriggers.trigger_stubs.size; i++ ) { triggerstub = level._unitriggers.trigger_stubs[ i ]; - color = vectorScale( ( 0, 0, 1 ), 0,75 ); + color = vectorScale( ( 1, 0, 0 ), 0.75 ); if ( !isDefined( triggerstub.in_zone ) ) { - color = vectorScale( ( 0, 0, 1 ), 0,65 ); + color = vectorScale( ( 1, 1, 0 ), 0.65 ); } else { if ( level.zones[ triggerstub.in_zone ].is_active ) { - color = ( 0, 0, 1 ); + color = ( 1, 1, 0 ); } } if ( isDefined( triggerstub.trigger ) || isDefined( triggerstub.playertrigger ) && triggerstub.playertrigger.size > 0 ) { - color = ( 0, 0, 1 ); + color = ( 0, 1, 0 ); if ( isDefined( triggerstub.playertrigger ) && triggerstub.playertrigger.size > 0 ) { print3d( triggerstub.origin, triggerstub.playertrigger.size, color, 1, 1, 1 ); @@ -318,38 +304,36 @@ debug_unitriggers() line( origin, origin + ( 0, 0, triggerstub.script_height ), color, 0, 1 ); } break; - i++; - continue; case "unitrigger_box": case "unitrigger_box_use": vec = ( triggerstub.script_width / 2, triggerstub.script_length / 2, triggerstub.script_height / 2 ); box( origin, vec * -1, vec, triggerstub.angles[ 1 ], color, 1, 0, 1 ); break; - i++; - continue; } - i++; } } - wait 0,05; + wait 0.05; #/ } + */ } -cleanup_trigger( trigger, player ) +cleanup_trigger( trigger, player ) //checked changed to match cerberus output { trigger notify( "kill_trigger" ); if ( isDefined( trigger.stub.trigger_per_player ) && trigger.stub.trigger_per_player ) { + trigger.stub.playertrigger[player getentitynumber()] = undefined; } else { trigger.stub.trigger = undefined; } trigger delete(); + level._unitriggers.trigger_pool[player getentitynumber()] = undefined; } -assess_and_apply_visibility( trigger, stub, player, default_keep ) +assess_and_apply_visibility( trigger, stub, player, default_keep ) //checked changed to match cerberus output { if ( !isDefined( trigger ) || !isDefined( stub ) ) { @@ -369,40 +353,34 @@ assess_and_apply_visibility( trigger, stub, player, default_keep ) trigger.reassess_time = undefined; } } + else if ( isDefined( trigger.thread_running ) && trigger.thread_running ) + { + keep_thread = 0; + } + trigger.thread_running = 0; + if ( isDefined( stub.inactive_reasses_time ) ) + { + trigger.reassess_time = stub.inactive_reasses_time; + } else { - if ( isDefined( trigger.thread_running ) && trigger.thread_running ) - { - keep_thread = 0; - } - trigger.thread_running = 0; - if ( isDefined( stub.inactive_reasses_time ) ) - { - trigger.reassess_time = stub.inactive_reasses_time; - } - else - { - trigger.reassess_time = 1; - } + trigger.reassess_time = 1; } return keep_thread; } -main() +main() //checked against bo3 _zm_unitrigger.gsc and cerberus output changed at own discretion { level thread debug_unitriggers(); if ( level._unitriggers._deferredinitlist.size ) { - i = 0; - while ( i < level._unitriggers._deferredinitlist.size ) + for ( i = 0; i < level._unitriggers._deferredinitlist.size; i++ ) { register_static_unitrigger( level._unitriggers._deferredinitlist[ i ], level._unitriggers._deferredinitlist[ i ].trigger_func ); - i++; } - i = 0; - while ( i < level._unitriggers._deferredinitlist.size ) + for ( i = 0; i < level._unitriggers._deferredinitlist.size; i++ ) { - i++; + level._unitriggers._deferredinitlist[i] = undefined; } level._unitriggers._deferredinitlist = undefined; } @@ -410,21 +388,19 @@ main() valid_range_sq = valid_range * valid_range; while ( !isDefined( level.active_zone_names ) ) { - wait 0,1; + wait 0.1; } while ( 1 ) { waited = 0; active_zone_names = level.active_zone_names; candidate_list = []; - j = 0; - while ( j < active_zone_names.size ) + for ( j = 0; j < active_zone_names.size; j++ ) { if ( isDefined( level.zones[ active_zone_names[ j ] ].unitrigger_stubs ) ) { candidate_list = arraycombine( candidate_list, level.zones[ active_zone_names[ j ] ].unitrigger_stubs, 1, 0 ); } - j++; } candidate_list = arraycombine( candidate_list, level._unitriggers.dynamic_stubs, 1, 0 ); players = getplayers(); @@ -437,7 +413,7 @@ main() i++; continue; } - else player_origin = player.origin + vectorScale( ( 0, 0, 1 ), 35 ); + player_origin = player.origin + vectorScale( ( 0, 0, 1 ), 35 ); trigger = level._unitriggers.trigger_pool[ player getentitynumber() ]; closest = []; if ( isDefined( trigger ) ) @@ -450,21 +426,17 @@ main() { if ( isDefined( trigger.reassess_time ) ) { - trigger.reassess_time -= 0,05; + trigger.reassess_time -= 0.05; if ( trigger.reassess_time > 0 ) { i++; continue; } - else time_to_ressess = 1; - break; - } - else - { + time_to_ressess = 1; } } - else closest = get_closest_unitriggers( player_origin, candidate_list, valid_range ); - if ( isDefined( trigger ) && time_to_ressess || closest.size < 2 && isDefined( trigger.thread_running ) && trigger.thread_running ) + closest = get_closest_unitriggers( player_origin, candidate_list, valid_range ); + if ( isDefined( trigger ) && time_to_ressess && closest.size < 2 || isDefined( trigger.thread_running ) && trigger.thread_running ) { if ( assess_and_apply_visibility( trigger, trigger.stub, player, 1 ) ) { @@ -485,13 +457,15 @@ main() last_trigger = undefined; while ( index < closest.size ) { - while ( !is_player_valid( player ) && isDefined( closest[ index ].ignore_player_valid ) && !closest[ index ].ignore_player_valid ) + if ( !maps/mp/zombies/_zm_utility::is_player_valid( player ) && isDefined( closest[ index ].ignore_player_valid ) && !closest[ index ].ignore_player_valid ) { index++; + continue; } - while ( isDefined( closest[ index ].registered ) && !closest[ index ].registered ) + if ( isDefined( closest[ index ].registered ) && !closest[ index ].registered ) { index++; + continue; } if ( isDefined( last_trigger ) ) { @@ -511,41 +485,34 @@ main() level._unitriggers.trigger_pool[ player getentitynumber() ] = trigger; } } - else + else if ( !isDefined( closest[ index ].trigger ) ) { - if ( !isDefined( closest[ index ].trigger ) ) - { - trigger = build_trigger_from_unitrigger_stub( closest[ index ], player ); - level._unitriggers.trigger_pool[ player getentitynumber() ] = trigger; - } + trigger = build_trigger_from_unitrigger_stub( closest[ index ], player ); + level._unitriggers.trigger_pool[ player getentitynumber() ] = trigger; } if ( isDefined( trigger ) ) { trigger.parent_player = player; if ( assess_and_apply_visibility( trigger, closest[ index ], player, 0 ) ) { - i++; - continue; + break; } - else - { - last_trigger = trigger; - } - index++; - waited = 1; - wait 0,05; + last_trigger = trigger; } + index++; + waited = 1; + wait 0.05; } i++; } if ( !waited ) { - wait 0,05; + wait 0.05; } } } -run_visibility_function_for_all_triggers() +run_visibility_function_for_all_triggers() //checked changed to match cerberus output { if ( !isDefined( self.prompt_and_visibility_func ) ) { @@ -558,14 +525,12 @@ run_visibility_function_for_all_triggers() return; } players = getplayers(); - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { if ( isDefined( self.playertrigger[ players[ i ] getentitynumber() ] ) ) { self.playertrigger[ players[ i ] getentitynumber() ] [[ self.prompt_and_visibility_func ]]( players[ i ] ); } - i++; } } else if ( isDefined( self.trigger ) ) @@ -574,7 +539,7 @@ run_visibility_function_for_all_triggers() } } -build_trigger_from_unitrigger_stub( stub, player ) +build_trigger_from_unitrigger_stub( stub, player ) //checked matches cerberus output { if ( isDefined( level._zm_build_trigger_from_unitrigger_stub_override ) ) { @@ -689,7 +654,7 @@ build_trigger_from_unitrigger_stub( stub, player ) return trigger; } -copy_zombie_keys_onto_trigger( trig, stub ) +copy_zombie_keys_onto_trigger( trig, stub ) //checked matches cerberus output { trig.script_noteworthy = stub.script_noteworthy; trig.targetname = stub.targetname; @@ -699,7 +664,7 @@ copy_zombie_keys_onto_trigger( trig, stub ) trig.usetime = stub.usetime; } -trigger_thread( trigger_func ) +trigger_thread( trigger_func ) //checked matches cerberus output { self endon( "kill_trigger" ); if ( isDefined( trigger_func ) ) @@ -708,7 +673,7 @@ trigger_thread( trigger_func ) } } -get_closest_unitrigger_index( org, array, dist ) +get_closest_unitrigger_index( org, array, dist ) //checked partially changed to match cerberus output //did not change while loop to for loop to prevent infinite loop due to continue { if ( !isDefined( dist ) ) { @@ -736,17 +701,14 @@ get_closest_unitrigger_index( org, array, dist ) i++; continue; } - else - { - distsq = newdistsq; - index = i; - } + distsq = newdistsq; + index = i; i++; } return index; } -get_closest_unitriggers( org, array, dist ) +get_closest_unitriggers( org, array, dist ) //checked partially changed to match cerberus output did not change while loop to for loop to prevent infinite loop due to continue { triggers = []; if ( !isDefined( dist ) ) @@ -767,7 +729,7 @@ get_closest_unitriggers( org, array, dist ) i++; continue; } - else origin = array[ i ] unitrigger_origin(); + origin = array[ i ] unitrigger_origin(); radius_sq = array[ i ].test_radius_sq; newdistsq = distance2dsquared( origin, org ); if ( newdistsq >= radius_sq ) @@ -775,26 +737,23 @@ get_closest_unitriggers( org, array, dist ) i++; continue; } - else if ( abs( origin[ 2 ] - org[ 2 ] ) > 42 ) + if ( abs( origin[ 2 ] - org[ 2 ] ) > 42 ) { i++; continue; } - else + array[ i ].dsquared = newdistsq; + for ( j = 0; j < triggers.size && newdistsq > triggers[j].dsquared; j++ ) { - array[ i ].dsquared = newdistsq; - j = 0; - while ( j < triggers.size && newdistsq > triggers[ j ].dsquared ) - { - j++; - } - arrayinsert( triggers, array[ i ], j ); - if ( ( i % 10 ) == 9 ) - { - wait 0,05; - } + } + arrayinsert( triggers, array[ i ], j ); + if ( ( i % 10 ) == 9 ) + { + wait 0.05; } i++; } return triggers; } + + diff --git a/patch_zm/maps/mp/zombies/_zm_utility.gsc b/patch_zm/maps/mp/zombies/_zm_utility.gsc index c6bc2e5..69ee134 100644 --- a/patch_zm/maps/mp/zombies/_zm_utility.gsc +++ b/patch_zm/maps/mp/zombies/_zm_utility.gsc @@ -12,11 +12,19 @@ #include common_scripts/utility; #include maps/mp/_utility; -init_utility() +init_utility() //checked matches cerberus output { + //begin debug code + level.custom_zm_utility_loaded = 1; + maps/mp/zombies/_zm_bot::init(); + if ( !isDefined( level.debugLogging_zm_utility ) ) + { + level.debugLogging_zm_utility = 0; + } + //end debug code } -is_classic() +is_classic() //checked matches cerberus output { var = getDvar( "ui_zm_gamemodegroup" ); if ( var == "zclassic" ) @@ -26,7 +34,7 @@ is_classic() return 0; } -is_standard() +is_standard() //checked matches cerberus output { var = getDvar( "ui_gametype" ); if ( var == "zstandard" ) @@ -36,26 +44,25 @@ is_standard() return 0; } -convertsecondstomilliseconds( seconds ) +convertsecondstomilliseconds( seconds ) //checked matches cerberus output { return seconds * 1000; } -is_player() +is_player() //checked does not match cerberus output changed at own discretion { if ( !isplayer( self ) ) { - if ( isDefined( self.pers ) ) - { - if ( isDefined( self.pers[ "isBot" ] ) ) - { - return self.pers[ "isBot" ]; - } - } + return 0; } + if ( isDefined( self.pers ) && isDefined( self.pers[ "isBot" ] ) && self.pers[ "isBot" ] ) + { + return 0; + } + return 1; } -lerp( chunk ) +lerp( chunk ) //checked matches cerberus output { link = spawn( "script_origin", self getorigin() ); link.angles = self.first_node.angles; @@ -68,43 +75,39 @@ lerp( chunk ) return; } -clear_mature_blood() +clear_mature_blood() //checked changed to match cerberus output { blood_patch = getentarray( "mature_blood", "targetname" ); if ( is_mature() ) { return; } - while ( isDefined( blood_patch ) ) + if ( isDefined( blood_patch ) ) { - i = 0; - while ( i < blood_patch.size ) + for ( i = 0; i < blood_patch.size; i++ ) { blood_patch[ i ] delete(); - i++; } } } -recalc_zombie_array() +recalc_zombie_array() //checked matches cerberus output { } -clear_all_corpses() +clear_all_corpses() //checked changed to match cerberus output { corpse_array = getcorpsearray(); - i = 0; - while ( i < corpse_array.size ) + for ( i = 0; i < corpse_array.size; i++ ) { if ( isDefined( corpse_array[ i ] ) ) { corpse_array[ i ] delete(); } - i++; } } -get_current_corpse_count() +get_current_corpse_count() //checked matches cerberus output { corpse_array = getcorpsearray(); if ( isDefined( corpse_array ) ) @@ -114,7 +117,7 @@ get_current_corpse_count() return 0; } -get_current_actor_count() +get_current_actor_count() //checked matches cerberus output { count = 0; actors = getaispeciesarray( level.zombie_team, "all" ); @@ -126,13 +129,13 @@ get_current_actor_count() return count; } -get_current_zombie_count() +get_current_zombie_count() //checked matches cerberus output { enemies = get_round_enemy_array(); return enemies.size; } -get_round_enemy_array() +get_round_enemy_array() //checked partially changed to match cerberus output//did not change while loop to for loop to prevent infinite continue loop bug { enemies = []; valid_enemies = []; @@ -145,22 +148,19 @@ get_round_enemy_array() i++; continue; } - else - { - valid_enemies[ valid_enemies.size ] = enemies[ i ]; - } + valid_enemies[ valid_enemies.size ] = enemies[ i ]; i++; } return valid_enemies; } -init_zombie_run_cycle() +init_zombie_run_cycle() //checked matches cerberus output { if ( isDefined( level.speed_change_round ) ) { if ( level.round_number >= level.speed_change_round ) { - speed_percent = 0,2 + ( ( level.round_number - level.speed_change_round ) * 0,2 ); + speed_percent = 0.2 + ( ( level.round_number - level.speed_change_round ) * 0.2 ); speed_percent = min( speed_percent, 1 ); change_round_max = int( level.speed_change_max * speed_percent ); change_left = change_round_max - level.speed_change_num; @@ -187,7 +187,7 @@ init_zombie_run_cycle() self set_zombie_run_cycle(); } -change_zombie_run_cycle() +change_zombie_run_cycle() //checked matches cerberus output { level.speed_change_num++; if ( level.gamedifficulty == 0 ) @@ -201,17 +201,16 @@ change_zombie_run_cycle() self thread speed_change_watcher(); } -speed_change_watcher() +speed_change_watcher() //checked matches cerberus output { self waittill( "death" ); if ( level.speed_change_num > 0 ) { level.speed_change_num--; - } } -set_zombie_run_cycle( new_move_speed ) +set_zombie_run_cycle( new_move_speed ) //checked matches cerberus output { self.zombie_move_speed_original = self.zombie_move_speed; if ( isDefined( new_move_speed ) ) @@ -230,7 +229,7 @@ set_zombie_run_cycle( new_move_speed ) self.deathanim = self maps/mp/animscripts/zm_utility::append_missing_legs_suffix( "zm_death" ); } -set_run_speed() +set_run_speed() //checked matches cerberus output { rand = randomintrange( level.zombie_move_speed, level.zombie_move_speed + 35 ); if ( rand <= 35 ) @@ -247,7 +246,7 @@ set_run_speed() } } -set_run_speed_easy() +set_run_speed_easy() //checked matches cerberus output { rand = randomintrange( level.zombie_move_speed, level.zombie_move_speed + 25 ); if ( rand <= 35 ) @@ -260,18 +259,20 @@ set_run_speed_easy() } } -spawn_zombie( spawner, target_name, spawn_point, round_number ) +spawn_zombie( spawner, target_name, spawn_point, round_number ) //checked matches cerberus output { if ( !isDefined( spawner ) ) { + /* /# println( "ZM >> spawn_zombie - NO SPAWNER DEFINED" ); #/ + */ return undefined; } while ( getfreeactorcount() < 1 ) { - wait 0,05; + wait 0.05; } spawner.script_moveoverride = 1; if ( isDefined( spawner.script_forcespawn ) && spawner.script_forcespawn ) @@ -305,39 +306,39 @@ spawn_zombie( spawner, target_name, spawn_point, round_number ) return undefined; } -run_spawn_functions() +run_spawn_functions() //checked changed to match cerberus output { self endon( "death" ); waittillframeend; - i = 0; - while ( i < level.spawn_funcs[ self.team ].size ) + for ( i = 0; i < level.spawn_funcs[ self.team ].size; i++ ) { func = level.spawn_funcs[ self.team ][ i ]; single_thread( self, func[ "function" ], func[ "param1" ], func[ "param2" ], func[ "param3" ], func[ "param4" ], func[ "param5" ] ); - i++; } if ( isDefined( self.spawn_funcs ) ) { - i = 0; - while ( i < self.spawn_funcs.size ) + for ( i = 0; i < self.spawn_funcs.size; i++ ) { func = self.spawn_funcs[ i ]; single_thread( self, func[ "function" ], func[ "param1" ], func[ "param2" ], func[ "param3" ], func[ "param4" ] ); - i++; } + /* /# self.saved_spawn_functions = self.spawn_funcs; #/ + */ self.spawn_funcs = undefined; + /* /# self.spawn_funcs = self.saved_spawn_functions; self.saved_spawn_functions = undefined; #/ + */ self.spawn_funcs = undefined; } } -create_simple_hud( client, team ) +create_simple_hud( client, team ) //checked matches cerberus output { if ( isDefined( team ) ) { @@ -359,14 +360,14 @@ create_simple_hud( client, team ) return hud; } -destroy_hud() +destroy_hud() //checked matches cerberus output { level.hudelem_count--; self destroy(); } -all_chunks_intact( barrier, barrier_chunks ) +all_chunks_intact( barrier, barrier_chunks ) //checked changed to match cerberus output { if ( isDefined( barrier.zbarrier ) ) { @@ -376,22 +377,17 @@ all_chunks_intact( barrier, barrier_chunks ) return 0; } } - else + for ( i = 0; i < barrier_chunks.size; i++ ) { - i = 0; - while ( i < barrier_chunks.size ) + if ( barrier_chunks[ i ] get_chunk_state() != "repaired" ) { - if ( barrier_chunks[ i ] get_chunk_state() != "repaired" ) - { - return 0; - } - i++; + return 0; } } return 1; } -no_valid_repairable_boards( barrier, barrier_chunks ) +no_valid_repairable_boards( barrier, barrier_chunks ) //checked changed to match cerberus output { if ( isDefined( barrier.zbarrier ) ) { @@ -401,22 +397,17 @@ no_valid_repairable_boards( barrier, barrier_chunks ) return 0; } } - else + for ( i = 0; i < barrier_chunks.size; i++ ) { - i = 0; - while ( i < barrier_chunks.size ) + if ( barrier_chunks[ i ] get_chunk_state() == "destroyed" ) { - if ( barrier_chunks[ i ] get_chunk_state() == "destroyed" ) - { - return 0; - } - i++; + return 0; } } return 1; } -is_survival() +is_survival() //checked matches cerberus output { var = getDvar( "ui_zm_gamemodegroup" ); if ( var == "zsurvival" ) @@ -426,7 +417,7 @@ is_survival() return 0; } -is_encounter() +is_encounter() //checked matches cerberus output { if ( isDefined( level._is_encounter ) && level._is_encounter ) { @@ -441,7 +432,7 @@ is_encounter() return 0; } -all_chunks_destroyed( barrier, barrier_chunks ) +all_chunks_destroyed( barrier, barrier_chunks ) //checked changed to match cerberus output { if ( isDefined( barrier.zbarrier ) ) { @@ -451,46 +442,41 @@ all_chunks_destroyed( barrier, barrier_chunks ) return 0; } } - else + if ( isDefined( barrier_chunks ) ) { - while ( isDefined( barrier_chunks ) ) - { + /* /# - assert( isDefined( barrier_chunks ), "_zm_utility::all_chunks_destroyed - Barrier chunks undefined" ); + assert( isDefined( barrier_chunks ), "_zm_utility::all_chunks_destroyed - Barrier chunks undefined" ); #/ - i = 0; - while ( i < barrier_chunks.size ) + */ + for ( i = 0; i < barrier_chunks.size; i++ ) + { + if ( barrier_chunks[ i ] get_chunk_state() != "destroyed" ) { - if ( barrier_chunks[ i ] get_chunk_state() != "destroyed" ) - { - return 0; - } - i++; + return 0; } } } return 1; } -check_point_in_playable_area( origin ) +check_point_in_playable_area( origin ) //checked changed to match cerberus output { playable_area = getentarray( "player_volume", "script_noteworthy" ); check_model = spawn( "script_model", origin + vectorScale( ( 0, 0, 1 ), 40 ) ); valid_point = 0; - i = 0; - while ( i < playable_area.size ) + for ( i = 0; i < playable_area.size; i++ ) { if ( check_model istouching( playable_area[ i ] ) ) { valid_point = 1; } - i++; } check_model delete(); return valid_point; } -check_point_in_enabled_zone( origin, zone_is_active, player_zones ) +check_point_in_enabled_zone( origin, zone_is_active, player_zones ) //checked partially changed to match cerberus output //did not change while loop to for loop to prevent infinite continue bug { if ( !isDefined( player_zones ) ) { @@ -515,25 +501,19 @@ check_point_in_enabled_zone( origin, zone_is_active, player_zones ) i++; continue; } - else - { - one_valid_zone = 1; - break; - } + one_valid_zone = 1; + break; } } - else - { - i++; - } + i++; } scr_org delete(); return one_valid_zone; } -round_up_to_ten( score ) +round_up_to_ten( score ) //checked matches cerberus output { - new_score = score - ( score % 10 ); + new_score = score - score % 10; if ( new_score < score ) { new_score += 10; @@ -541,10 +521,10 @@ round_up_to_ten( score ) return new_score; } -round_up_score( score, value ) +round_up_score( score, value ) //checked matches cerberus output { score = int( score ); - new_score = score - ( score % value ); + new_score = score - score % value; if ( new_score < score ) { new_score += value; @@ -552,7 +532,7 @@ round_up_score( score, value ) return new_score; } -random_tan() +random_tan() //checked matches cerberus output { rand = randomint( 100 ); if ( isDefined( level.char_percent_override ) ) @@ -565,13 +545,13 @@ random_tan() } } -places_before_decimal( num ) +places_before_decimal( num ) //checked matches cerberus output { abs_num = abs( num ); count = 0; while ( 1 ) { - abs_num *= 0,1; + abs_num *= 0.1; count += 1; if ( abs_num < 1 ) { @@ -580,7 +560,7 @@ places_before_decimal( num ) } } -create_zombie_point_of_interest( attract_dist, num_attractors, added_poi_value, start_turned_on, initial_attract_func, arrival_attract_func, poi_team ) +create_zombie_point_of_interest( attract_dist, num_attractors, added_poi_value, start_turned_on, initial_attract_func, arrival_attract_func, poi_team ) //checked matches cerberus output { if ( !isDefined( added_poi_value ) ) { @@ -623,10 +603,10 @@ create_zombie_point_of_interest( attract_dist, num_attractors, added_poi_value, } } -create_zombie_point_of_interest_attractor_positions( num_attract_dists, diff_per_dist, attractor_width ) +create_zombie_point_of_interest_attractor_positions( num_attract_dists, diff_per_dist, attractor_width ) //checked partially changed to match cerberus output //did not change while loop to for loop to prevent infinite loop bug with continue { self endon( "death" ); - forward = ( 0, 0, 1 ); + forward = ( 0, 1, 0 ); if ( !isDefined( self.num_poi_attracts ) || isDefined( self.script_noteworthy ) && self.script_noteworthy != "zombie_poi" ) { return; @@ -646,28 +626,22 @@ create_zombie_point_of_interest_attractor_positions( num_attract_dists, diff_per self.attract_to_origin = 0; self.num_attract_dists = num_attract_dists; self.last_index = []; - i = 0; - while ( i < num_attract_dists ) + for ( i = 0; i < num_attract_dists; i++ ) { self.last_index[ i ] = -1; - i++; } self.attract_dists = []; - i = 0; - while ( i < self.num_attract_dists ) + for ( i = 0; i < self.num_attract_dists; i++ ) { self.attract_dists[ i ] = diff_per_dist * ( i + 1 ); - i++; } max_positions = []; - i = 0; - while ( i < self.num_attract_dists ) + for ( i = 0; i < self.num_attract_dists; i++ ) { - max_positions[ i ] = int( ( 6,28 * self.attract_dists[ i ] ) / attractor_width ); - i++; + max_positions[ i ] = int( ( 6.28 * self.attract_dists[ i ] ) / attractor_width ); } num_attracts_per_dist = self.num_poi_attracts / self.num_attract_dists; - self.max_attractor_dist = self.attract_dists[ self.attract_dists.size - 1 ] * 1,1; + self.max_attractor_dist = self.attract_dists[ self.attract_dists.size - 1 ] * 1.1; diff = 0; actual_num_positions = []; i = 0; @@ -680,51 +654,43 @@ create_zombie_point_of_interest_attractor_positions( num_attract_dists, diff_per i++; continue; } - else - { - actual_num_positions[ i ] = num_attracts_per_dist + diff; - diff = 0; - } + actual_num_positions[ i ] = num_attracts_per_dist + diff; + diff = 0; i++; } self.attractor_positions = []; failed = 0; angle_offset = 0; prev_last_index = -1; - j = 0; - while ( j < 4 ) + for ( j = 0; j < 4; j++) { if ( ( actual_num_positions[ j ] + failed ) < max_positions[ j ] ) { actual_num_positions[ j ] += failed; failed = 0; } - else + else if ( actual_num_positions[ j ] < max_positions[ j ] ) { - if ( actual_num_positions[ j ] < max_positions[ j ] ) - { - actual_num_positions[ j ] = max_positions[ j ]; - failed = max_positions[ j ] - actual_num_positions[ j ]; - } + actual_num_positions[ j ] = max_positions[ j ]; + failed = max_positions[ j ] - actual_num_positions[ j ]; } failed += self generated_radius_attract_positions( forward, angle_offset, actual_num_positions[ j ], self.attract_dists[ j ] ); angle_offset += 15; self.last_index[ j ] = int( ( actual_num_positions[ j ] - failed ) + prev_last_index ); prev_last_index = self.last_index[ j ]; - j++; } self notify( "attractor_positions_generated" ); level notify( "attractor_positions_generated" ); } -generated_radius_attract_positions( forward, offset, num_positions, attract_radius ) +generated_radius_attract_positions( forward, offset, num_positions, attract_radius ) //checked partially changed to match cerberus output //did not change while loop to for loop because it doesn't make sense as a for loop { self endon( "death" ); - epsilon = 0,1; + epsilon = 0.1; failed = 0; degs_per_pos = 360 / num_positions; i = offset; - while ( i < ( 360 + offset ) ) + while ( i < 360 + offset ) { altforward = forward * attract_radius; rotated_forward = ( ( cos( i ) * altforward[ 0 ] ) - ( sin( i ) * altforward[ 1 ] ), ( sin( i ) * altforward[ 0 ] ) + ( cos( i ) * altforward[ 1 ] ), altforward[ 2 ] ); @@ -761,54 +727,47 @@ generated_radius_attract_positions( forward, offset, num_positions, attract_radi failed++; } } + else if ( abs( pos[ 2 ] - self.origin[ 2 ] ) < 60 ) + { + pos_array = []; + pos_array[ 0 ] = pos; + pos_array[ 1 ] = self; + self.attractor_positions[ self.attractor_positions.size ] = pos_array; + } else { - if ( abs( pos[ 2 ] - self.origin[ 2 ] ) < 60 ) - { - pos_array = []; - pos_array[ 0 ] = pos; - pos_array[ 1 ] = self; - self.attractor_positions[ self.attractor_positions.size ] = pos_array; - break; - } - else - { - failed++; - } + failed++; } i += degs_per_pos; } return failed; } -debug_draw_attractor_positions() +debug_draw_attractor_positions() //checked changed to match cerberus output { + /* /# while ( 1 ) { - for ( ;; ) + while ( !isDefined( self.attractor_positions ) ) { - while ( !isDefined( self.attractor_positions ) ) - { - wait 0,05; - } + wait 0.05; } - i = 0; - while ( i < self.attractor_positions.size ) + for ( i = 0; i < self.attractor_positions.size; i++ ) { - line( self.origin, self.attractor_positions[ i ][ 0 ], ( 0, 0, 1 ), 1, 1 ); - i++; + line( self.origin, self.attractor_positions[ i ][ 0 ], ( 1, 0, 0 ), 1, 1 ); } - wait 0,05; + wait 0.05; if ( !isDefined( self ) ) { return; } #/ } + */ } -get_zombie_point_of_interest( origin, poi_array ) +get_zombie_point_of_interest( origin, poi_array ) //checked partially changed to match cerberus output //did not change while loop to for loop because continues cause infinite loops in for loops { if ( isDefined( self.ignore_all_poi ) && self.ignore_all_poi ) { @@ -834,48 +793,18 @@ get_zombie_point_of_interest( origin, poi_array ) i++; continue; } - else + if ( isDefined( self.ignore_poi_targetname ) && self.ignore_poi_targetname.size > 0 ) { - if ( isDefined( self.ignore_poi_targetname ) && self.ignore_poi_targetname.size > 0 ) - { - if ( isDefined( ent_array[ i ].targetname ) ) - { - ignore = 0; - j = 0; - while ( j < self.ignore_poi_targetname.size ) - { - if ( ent_array[ i ].targetname == self.ignore_poi_targetname[ j ] ) - { - ignore = 1; - break; - } - else - { - j++; - } - } - if ( ignore ) - { - i++; - continue; - } - } - } - else if ( isDefined( self.ignore_poi ) && self.ignore_poi.size > 0 ) + if ( isDefined( ent_array[ i ].targetname ) ) { ignore = 0; - j = 0; - while ( j < self.ignore_poi.size ) + for ( j = 0; j < self.ignore_poi_targetname.size; j++ ) { - if ( self.ignore_poi[ j ] == ent_array[ i ] ) + if ( ent_array[ i ].targetname == self.ignore_poi_targetname[ j ] ) { ignore = 1; break; } - else - { - j++; - } } if ( ignore ) { @@ -883,20 +812,34 @@ get_zombie_point_of_interest( origin, poi_array ) continue; } } - else + } + if ( isDefined( self.ignore_poi ) && self.ignore_poi.size > 0 ) + { + ignore = 0; + for ( j = 0; j < self.ignore_poi.size; j++ ) { - dist = distancesquared( origin, ent_array[ i ].origin ); - dist -= ent_array[ i ].added_poi_value; - if ( isDefined( ent_array[ i ].poi_radius ) ) + if ( self.ignore_poi[ j ] == ent_array[ i ] ) { - curr_radius = ent_array[ i ].poi_radius; - } - if ( isDefined( curr_radius ) && dist < curr_radius && dist < best_dist && ent_array[ i ] can_attract( self ) ) - { - best_poi = ent_array[ i ]; - best_dist = dist; + ignore = 1; + break; } } + if ( ignore ) + { + i++; + continue; + } + } + dist = distancesquared( origin, ent_array[ i ].origin ); + dist -= ent_array[ i ].added_poi_value; + if ( isDefined( ent_array[ i ].poi_radius ) ) + { + curr_radius = ent_array[ i ].poi_radius; + } + if ( isDefined( curr_radius ) && dist < curr_radius && dist < best_dist && ent_array[ i ] can_attract( self ) ) + { + best_poi = ent_array[ i ]; + best_dist = dist; } i++; } @@ -915,18 +858,15 @@ get_zombie_point_of_interest( origin, poi_array ) position[ 0 ] = groundpos_ignore_water_new( best_poi.origin + vectorScale( ( 0, 0, 1 ), 100 ) ); position[ 1 ] = self; } + else if ( isDefined( best_poi.attract_to_origin ) && best_poi.attract_to_origin ) + { + position = []; + position[ 0 ] = groundpos( best_poi.origin + vectorScale( ( 0, 0, 1 ), 100 ) ); + position[ 1 ] = self; + } else { - if ( isDefined( best_poi.attract_to_origin ) && best_poi.attract_to_origin ) - { - position = []; - position[ 0 ] = groundpos( best_poi.origin + vectorScale( ( 0, 0, 1 ), 100 ) ); - position[ 1 ] = self; - } - else - { - position = self add_poi_attractor( best_poi ); - } + position = self add_poi_attractor( best_poi ); } if ( isDefined( best_poi.initial_attract_func ) ) { @@ -940,7 +880,7 @@ get_zombie_point_of_interest( origin, poi_array ) return position; } -activate_zombie_point_of_interest() +activate_zombie_point_of_interest() //checked matches cerberus output { if ( self.script_noteworthy != "zombie_poi" ) { @@ -949,24 +889,22 @@ activate_zombie_point_of_interest() self.poi_active = 1; } -deactivate_zombie_point_of_interest() +deactivate_zombie_point_of_interest() //checked changed to match cerberus output { if ( self.script_noteworthy != "zombie_poi" ) { return; } - i = 0; - while ( i < self.attractor_array.size ) + for ( i = 0; i < self.attractor_array.size; i++ ) { self.attractor_array[ i ] notify( "kill_poi" ); - i++; } self.attractor_array = []; self.claimed_attractor_positions = []; self.poi_active = 0; } -assign_zombie_point_of_interest( origin, poi ) +assign_zombie_point_of_interest( origin, poi ) //checked matches cerberus output { position = undefined; doremovalthread = 0; @@ -985,14 +923,13 @@ assign_zombie_point_of_interest( origin, poi ) return position; } -remove_poi_attractor( zombie_poi ) +remove_poi_attractor( zombie_poi ) //checked changed to match cerberus output { if ( !isDefined( zombie_poi.attractor_array ) ) { return; } - i = 0; - while ( i < zombie_poi.attractor_array.size ) + for ( i = 0; i < zombie_poi.attractor_array.size; i++ ) { if ( zombie_poi.attractor_array[ i ] == self ) { @@ -1000,30 +937,27 @@ remove_poi_attractor( zombie_poi ) arrayremovevalue( zombie_poi.attractor_array, zombie_poi.attractor_array[ i ] ); arrayremovevalue( zombie_poi.claimed_attractor_positions, zombie_poi.claimed_attractor_positions[ i ] ); } - i++; } } -array_check_for_dupes_using_compare( array, single, is_equal_fn ) +array_check_for_dupes_using_compare( array, single, is_equal_fn ) //checked changed to match cerberus output { - i = 0; - while ( i < array.size ) + for ( i = 0; i < array.size; i++ ) { if ( [[ is_equal_fn ]]( array[ i ], single ) ) { return 0; } - i++; } return 1; } -poi_locations_equal( loc1, loc2 ) +poi_locations_equal( loc1, loc2 ) //checked matches cerberus output { return loc1[ 0 ] == loc2[ 0 ]; } -add_poi_attractor( zombie_poi ) +add_poi_attractor( zombie_poi ) //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { if ( !isDefined( zombie_poi ) ) { @@ -1046,8 +980,7 @@ add_poi_attractor( zombie_poi ) start = -1; end = -1; last_index = -1; - i = 0; - while ( i < 4 ) + for ( i = 0; i < 4; i++ ) { if ( zombie_poi.claimed_attractor_positions.size < zombie_poi.last_index[ i ] ) { @@ -1055,11 +988,7 @@ add_poi_attractor( zombie_poi ) end = zombie_poi.last_index[ i ]; break; } - else - { - last_index = zombie_poi.last_index[ i ]; - i++; - } + last_index = zombie_poi.last_index[ i ]; } best_dist = 100000000; best_pos = undefined; @@ -1079,18 +1008,15 @@ add_poi_attractor( zombie_poi ) i++; continue; } - else + if ( array_check_for_dupes_using_compare( zombie_poi.claimed_attractor_positions, zombie_poi.attractor_positions[ i ], ::poi_locations_equal ) ) { - if ( array_check_for_dupes_using_compare( zombie_poi.claimed_attractor_positions, zombie_poi.attractor_positions[ i ], ::poi_locations_equal ) ) + if ( isDefined( zombie_poi.attractor_positions[ i ][ 0 ] ) && isDefined( self.origin ) ) { - if ( isDefined( zombie_poi.attractor_positions[ i ][ 0 ] ) && isDefined( self.origin ) ) + dist = distancesquared( zombie_poi.attractor_positions[ i ][ 0 ], self.origin ); + if ( dist < best_dist || !isDefined( best_pos ) ) { - dist = distancesquared( zombie_poi.attractor_positions[ i ][ 0 ], self.origin ); - if ( dist < best_dist || !isDefined( best_pos ) ) - { - best_dist = dist; - best_pos = zombie_poi.attractor_positions[ i ]; - } + best_dist = dist; + best_pos = zombie_poi.attractor_positions[ i ]; } } } @@ -1105,25 +1031,20 @@ add_poi_attractor( zombie_poi ) zombie_poi.claimed_attractor_positions[ zombie_poi.claimed_attractor_positions.size ] = best_pos; return best_pos; } - else + for ( i = 0; i < zombie_poi.attractor_array.size; i++ ) { - i = 0; - while ( i < zombie_poi.attractor_array.size ) + if ( zombie_poi.attractor_array[ i ] == self ) { - if ( zombie_poi.attractor_array[ i ] == self ) + if ( isDefined( zombie_poi.claimed_attractor_positions ) && isDefined( zombie_poi.claimed_attractor_positions[ i ] ) ) { - if ( isDefined( zombie_poi.claimed_attractor_positions ) && isDefined( zombie_poi.claimed_attractor_positions[ i ] ) ) - { - return zombie_poi.claimed_attractor_positions[ i ]; - } + return zombie_poi.claimed_attractor_positions[ i ]; } - i++; } } return undefined; } -can_attract( attractor ) +can_attract( attractor ) //checked matches cerberus output { if ( !isDefined( self.attractor_array ) ) { @@ -1144,124 +1065,111 @@ can_attract( attractor ) return 1; } -update_poi_on_death( zombie_poi ) +update_poi_on_death( zombie_poi ) //checked matches cerberus output { self endon( "kill_poi" ); self waittill( "death" ); self remove_poi_attractor( zombie_poi ); } -update_on_poi_removal( zombie_poi ) +update_on_poi_removal( zombie_poi ) //checked changed to match cerberus output { zombie_poi waittill( "death" ); if ( !isDefined( zombie_poi.attractor_array ) ) { return; } - i = 0; - while ( i < zombie_poi.attractor_array.size ) + for ( i = 0; i < zombie_poi.attractor_array.size; i++ ) { if ( zombie_poi.attractor_array[ i ] == self ) { arrayremoveindex( zombie_poi.attractor_array, i ); arrayremoveindex( zombie_poi.claimed_attractor_positions, i ); } - i++; } } -invalidate_attractor_pos( attractor_pos, zombie ) +invalidate_attractor_pos( attractor_pos, zombie ) //checked changed to match cerberus output { if ( !isDefined( self ) || !isDefined( attractor_pos ) ) { - wait 0,1; + wait 0.1; return undefined; } if ( isDefined( self.attractor_positions ) && !array_check_for_dupes_using_compare( self.attractor_positions, attractor_pos, ::poi_locations_equal ) ) { index = 0; - i = 0; - while ( i < self.attractor_positions.size ) + for ( i = 0; i < self.attractor_positions.size; i++ ) { if ( poi_locations_equal( self.attractor_positions[ i ], attractor_pos ) ) { index = i; } - i++; } - i = 0; - while ( i < self.last_index.size ) + for ( i = 0; i < self.last_index.size; i++ ) { if ( index <= self.last_index[ i ] ) { self.last_index[ i ]--; - } - i++; } arrayremovevalue( self.attractor_array, zombie ); arrayremovevalue( self.attractor_positions, attractor_pos ); - i = 0; - while ( i < self.claimed_attractor_positions.size ) + for ( i = 0; i < self.claimed_attractor_positions.size; i++ ) { if ( self.claimed_attractor_positions[ i ][ 0 ] == attractor_pos[ 0 ] ) { arrayremovevalue( self.claimed_attractor_positions, self.claimed_attractor_positions[ i ] ); } - i++; } } - else wait 0,1; + else + { + wait 0.1; + } return get_zombie_point_of_interest( zombie.origin ); } -remove_poi_from_ignore_list( poi ) +remove_poi_from_ignore_list( poi ) //checked changed to match cerberus output { - while ( isDefined( self.ignore_poi ) && self.ignore_poi.size > 0 ) + if ( isDefined( self.ignore_poi ) && self.ignore_poi.size > 0 ) { - i = 0; - while ( i < self.ignore_poi.size ) + for ( i = 0; i < self.ignore_poi.size; i++ ) { if ( self.ignore_poi[ i ] == poi ) { arrayremovevalue( self.ignore_poi, self.ignore_poi[ i ] ); return; } - i++; } } } -add_poi_to_ignore_list( poi ) +add_poi_to_ignore_list( poi ) //checked changed to match cerberus output { if ( !isDefined( self.ignore_poi ) ) { self.ignore_poi = []; } add_poi = 1; - while ( self.ignore_poi.size > 0 ) + if ( self.ignore_poi.size > 0 ) { - i = 0; - while ( i < self.ignore_poi.size ) + for ( i = 0; i < self.ignore_poi.size; i++ ) { if ( self.ignore_poi[ i ] == poi ) { add_poi = 0; break; } - else - { - i++; - } } } - if ( add_poi ) + else if ( add_poi ) { self.ignore_poi[ self.ignore_poi.size ] = poi; } } -default_validate_enemy_path_length( player ) +default_validate_enemy_path_length( player ) //checked matches cerberus output { max_dist = 1296; d = distancesquared( self.origin, player.origin ); @@ -1272,13 +1180,13 @@ default_validate_enemy_path_length( player ) return 0; } -get_path_length_to_enemy( enemy ) +get_path_length_to_enemy( enemy ) //checked matches cerberus output { path_length = self calcpathlength( enemy.origin ); return path_length; } -get_closest_player_using_paths( origin, players ) +get_closest_player_using_paths( origin, players ) //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { min_length_to_player = 9999999; n_2d_distance_squared = 9999999; @@ -1300,7 +1208,7 @@ get_closest_player_using_paths( origin, players ) } } } - else if ( length_to_player < min_length_to_player ) + if ( length_to_player < min_length_to_player ) { min_length_to_player = length_to_player; player_to_return = player; @@ -1308,17 +1216,14 @@ get_closest_player_using_paths( origin, players ) i++; continue; } - else + if ( length_to_player == min_length_to_player && length_to_player <= 5 ) { - if ( length_to_player == min_length_to_player && length_to_player <= 5 ) + n_new_distance = distance2dsquared( self.origin, player.origin ); + if ( n_new_distance < n_2d_distance_squared ) { - n_new_distance = distance2dsquared( self.origin, player.origin ); - if ( n_new_distance < n_2d_distance_squared ) - { - min_length_to_player = length_to_player; - player_to_return = player; - n_2d_distance_squared = n_new_distance; - } + min_length_to_player = length_to_player; + player_to_return = player; + n_2d_distance_squared = n_new_distance; } } i++; @@ -1326,7 +1231,7 @@ get_closest_player_using_paths( origin, players ) return player_to_return; } -get_closest_valid_player( origin, ignore_player ) +get_closest_valid_player( origin, ignore_player ) //checked changed to match cerberus output { valid_player_found = 0; players = get_players(); @@ -1334,21 +1239,18 @@ get_closest_valid_player( origin, ignore_player ) { players = arraycombine( players, level._zombie_human_array, 0, 0 ); } - while ( isDefined( ignore_player ) ) + if ( isDefined( ignore_player ) ) { - i = 0; - while ( i < ignore_player.size ) + for ( i = 0; i < ignore_player.size; i++ ) { arrayremovevalue( players, ignore_player[ i ] ); - i++; } } done = 0; while ( players.size && !done ) { done = 1; - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { player = players[ i ]; if ( !is_player_valid( player, 1 ) ) @@ -1357,10 +1259,6 @@ get_closest_valid_player( origin, ignore_player ) done = 0; break; } - else - { - i++; - } } } if ( players.size == 0 ) @@ -1393,7 +1291,7 @@ get_closest_valid_player( origin, ignore_player ) { return player; } - while ( !is_player_valid( player, 1 ) ) + if ( !is_player_valid( player, 1 ) ) { arrayremovevalue( players, player ); if ( players.size == 0 ) @@ -1405,7 +1303,7 @@ get_closest_valid_player( origin, ignore_player ) } } -is_player_valid( player, checkignoremeflag, ignore_laststand_players ) +is_player_valid( player, checkignoremeflag, ignore_laststand_players ) //checked matches cerberus output { if ( !isDefined( player ) ) { @@ -1453,23 +1351,21 @@ is_player_valid( player, checkignoremeflag, ignore_laststand_players ) return 1; } -get_number_of_valid_players() +get_number_of_valid_players() //checked changed to match cerberus output { players = get_players(); num_player_valid = 0; - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { if ( is_player_valid( players[ i ] ) ) { num_player_valid += 1; } - i++; } return num_player_valid; } -in_revive_trigger() +in_revive_trigger() //checked changed to match cerberus output { if ( isDefined( self.rt_time ) && ( self.rt_time + 100 ) >= getTime() ) { @@ -1477,8 +1373,7 @@ in_revive_trigger() } self.rt_time = getTime(); players = level.players; - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { current_player = players[ i ]; if ( isDefined( current_player ) && isDefined( current_player.revivetrigger ) && isalive( current_player ) ) @@ -1489,18 +1384,17 @@ in_revive_trigger() return 1; } } - i++; } self.in_rt_cached = 0; return 0; } -get_closest_node( org, nodes ) +get_closest_node( org, nodes ) //checked matches cerberus output { return getclosest( org, nodes ); } -non_destroyed_bar_board_order( origin, chunks ) +non_destroyed_bar_board_order( origin, chunks ) //checked partially changed to match cerberus output //did not change while loop with continue to for loop to prevent infinite continue loop bug { first_bars = []; first_bars1 = []; @@ -1514,30 +1408,25 @@ non_destroyed_bar_board_order( origin, chunks ) { return get_closest_2d( origin, chunks ); } - else + else if ( isDefined( chunks[ i ].script_team ) && chunks[ i ].script_team != "bar_board_variant1" && chunks[ i ].script_team != "bar_board_variant2" || chunks[ i ].script_team == "bar_board_variant4" && chunks[ i ].script_team == "bar_board_variant5" ) { - if ( isDefined( chunks[ i ].script_team ) && chunks[ i ].script_team != "bar_board_variant1" && chunks[ i ].script_team != "bar_board_variant2" || chunks[ i ].script_team == "bar_board_variant4" && chunks[ i ].script_team == "bar_board_variant5" ) - { - return undefined; - } + return undefined; } + i++; + continue; } - else + if ( isDefined( chunks[ i ].script_team ) && chunks[ i ].script_team == "new_barricade" ) { - if ( isDefined( chunks[ i ].script_team ) && chunks[ i ].script_team == "new_barricade" ) + if ( isDefined( chunks[ i ].script_parameters ) || chunks[ i ].script_parameters == "repair_board" && chunks[ i ].script_parameters == "barricade_vents" ) { - if ( isDefined( chunks[ i ].script_parameters ) || chunks[ i ].script_parameters == "repair_board" && chunks[ i ].script_parameters == "barricade_vents" ) - { - return get_closest_2d( origin, chunks ); - } + return get_closest_2d( origin, chunks ); } } i++; } - i = 0; - while ( i < chunks.size ) + for ( i = 0; i < chunks.size; i++ ) { - if ( isDefined( chunks[ i ].script_team ) || chunks[ i ].script_team == "6_bars_bent" && chunks[ i ].script_team == "6_bars_prestine" ) + if ( isDefined( chunks[ i ].script_team ) && chunks[ i ].script_team == "6_bars_bent" || chunks[ i ].script_team == "6_bars_prestine" ) { if ( isDefined( chunks[ i ].script_parameters ) && chunks[ i ].script_parameters == "bar" ) { @@ -1550,12 +1439,10 @@ non_destroyed_bar_board_order( origin, chunks ) } } } - i++; } - i = 0; - while ( i < first_bars.size ) + for ( i = 0; i < chunks.size; i++ ) { - if ( isDefined( chunks[ i ].script_team ) || chunks[ i ].script_team == "6_bars_bent" && chunks[ i ].script_team == "6_bars_prestine" ) + if ( isDefined( chunks[ i ].script_team ) && chunks[ i ].script_team == "6_bars_bent" || chunks[ i ].script_team == "6_bars_prestine" ) { if ( isDefined( chunks[ i ].script_parameters ) && chunks[ i ].script_parameters == "bar" ) { @@ -1565,12 +1452,10 @@ non_destroyed_bar_board_order( origin, chunks ) } } } - i++; } - i = 0; - while ( i < chunks.size ) + for ( i = 0; i < chunks.size; i++ ) { - if ( isDefined( chunks[ i ].script_team ) || chunks[ i ].script_team == "6_bars_bent" && chunks[ i ].script_team == "6_bars_prestine" ) + if ( isDefined( chunks[ i ].script_team ) && chunks[ i ].script_team == "6_bars_bent" || chunks[ i ].script_team == "6_bars_prestine" ) { if ( isDefined( chunks[ i ].script_parameters ) && chunks[ i ].script_parameters == "bar" ) { @@ -1580,11 +1465,10 @@ non_destroyed_bar_board_order( origin, chunks ) } } } - i++; } } -non_destroyed_grate_order( origin, chunks_grate ) +non_destroyed_grate_order( origin, chunks_grate ) //checked partially changed to match cerberus output //did not include continues because they would be redundant { grate_order = []; grate_order1 = []; @@ -1593,10 +1477,9 @@ non_destroyed_grate_order( origin, chunks_grate ) grate_order4 = []; grate_order5 = []; grate_order6 = []; - while ( isDefined( chunks_grate ) ) + if ( isDefined( chunks_grate ) ) { - i = 0; - while ( i < chunks_grate.size ) + for ( i = 0; i < chunks_grate.size; i++ ) { if ( isDefined( chunks_grate[ i ].script_parameters ) && chunks_grate[ i ].script_parameters == "grate" ) { @@ -1625,10 +1508,8 @@ non_destroyed_grate_order( origin, chunks_grate ) grate_order6[ grate_order6.size ] = chunks_grate[ i ]; } } - i++; } - i = 0; - while ( i < chunks_grate.size ) + for ( i = 0; i < chunks_grate.size; i++ ) { if ( isDefined( chunks_grate[ i ].script_parameters ) && chunks_grate[ i ].script_parameters == "grate" ) { @@ -1641,60 +1522,55 @@ non_destroyed_grate_order( origin, chunks_grate ) } if ( grate_order2[ i ].state == "repaired" ) { + /* /# iprintlnbold( " pull bar2 " ); #/ + */ grate_order3[ i ] thread show_grate_pull(); return grate_order2[ i ]; } - else + if ( grate_order3[ i ].state == "repaired" ) { - if ( grate_order3[ i ].state == "repaired" ) - { + /* /# - iprintlnbold( " pull bar3 " ); + iprintlnbold( " pull bar3 " ); #/ - grate_order4[ i ] thread show_grate_pull(); - return grate_order3[ i ]; - } - else - { - if ( grate_order4[ i ].state == "repaired" ) - { + */ + grate_order4[ i ] thread show_grate_pull(); + return grate_order3[ i ]; + } + if ( grate_order4[ i ].state == "repaired" ) + { + /* /# - iprintlnbold( " pull bar4 " ); + iprintlnbold( " pull bar4 " ); #/ - grate_order5[ i ] thread show_grate_pull(); - return grate_order4[ i ]; - } - else - { - if ( grate_order5[ i ].state == "repaired" ) - { + */ + grate_order5[ i ] thread show_grate_pull(); + return grate_order4[ i ]; + } + if ( grate_order5[ i ].state == "repaired" ) + { + /* /# - iprintlnbold( " pull bar5 " ); + iprintlnbold( " pull bar5 " ); #/ - grate_order6[ i ] thread show_grate_pull(); - return grate_order5[ i ]; - } - else - { - if ( grate_order6[ i ].state == "repaired" ) - { - return grate_order6[ i ]; - } - } - } - } + */ + grate_order6[ i ] thread show_grate_pull(); + return grate_order5[ i ]; + } + if ( grate_order6[ i ].state == "repaired" ) + { + return grate_order6[ i ]; } } } - i++; } } } -non_destroyed_variant1_order( origin, chunks_variant1 ) +non_destroyed_variant1_order( origin, chunks_variant1 ) //checked partially changed to match cerberus output //did not include continues because they would be redundant { variant1_order = []; variant1_order1 = []; @@ -1703,10 +1579,9 @@ non_destroyed_variant1_order( origin, chunks_variant1 ) variant1_order4 = []; variant1_order5 = []; variant1_order6 = []; - while ( isDefined( chunks_variant1 ) ) + if ( isDefined( chunks_variant1 ) ) { - i = 0; - while ( i < chunks_variant1.size ) + for ( i = 0; i < chunks_variant1.size; i++ ) { if ( isDefined( chunks_variant1[ i ].script_team ) && chunks_variant1[ i ].script_team == "bar_board_variant1" ) { @@ -1738,10 +1613,8 @@ non_destroyed_variant1_order( origin, chunks_variant1 ) } } } - i++; } - i = 0; - while ( i < chunks_variant1.size ) + for ( i = 0; i < chunks_variant1.size; i++ ) { if ( isDefined( chunks_variant1[ i ].script_team ) && chunks_variant1[ i ].script_team == "bar_board_variant1" ) { @@ -1751,49 +1624,33 @@ non_destroyed_variant1_order( origin, chunks_variant1 ) { return variant1_order2[ i ]; } - else + if ( variant1_order3[ i ].state == "repaired" ) { - if ( variant1_order3[ i ].state == "repaired" ) - { - return variant1_order3[ i ]; - } - else - { - if ( variant1_order4[ i ].state == "repaired" ) - { - return variant1_order4[ i ]; - } - else - { - if ( variant1_order6[ i ].state == "repaired" ) - { - return variant1_order6[ i ]; - } - else - { - if ( variant1_order5[ i ].state == "repaired" ) - { - return variant1_order5[ i ]; - } - else - { - if ( variant1_order1[ i ].state == "repaired" ) - { - return variant1_order1[ i ]; - } - } - } - } - } + return variant1_order3[ i ]; + } + if ( variant1_order4[ i ].state == "repaired" ) + { + return variant1_order4[ i ]; + } + if ( variant1_order6[ i ].state == "repaired" ) + { + return variant1_order6[ i ]; + } + if ( variant1_order5[ i ].state == "repaired" ) + { + return variant1_order5[ i ]; + } + if ( variant1_order1[ i ].state == "repaired" ) + { + return variant1_order1[ i ]; } } } - i++; } } } -non_destroyed_variant2_order( origin, chunks_variant2 ) +non_destroyed_variant2_order( origin, chunks_variant2 ) //checked partially changed to match cerberus output //did not include continues because they would be redundant { variant2_order = []; variant2_order1 = []; @@ -1802,10 +1659,9 @@ non_destroyed_variant2_order( origin, chunks_variant2 ) variant2_order4 = []; variant2_order5 = []; variant2_order6 = []; - while ( isDefined( chunks_variant2 ) ) + if ( isDefined( chunks_variant2 ) ) { - i = 0; - while ( i < chunks_variant2.size ) + for ( i = 0; i < chunks_variant2.size; i++ ) { if ( isDefined( chunks_variant2[ i ].script_team ) && chunks_variant2[ i ].script_team == "bar_board_variant2" ) { @@ -1834,10 +1690,8 @@ non_destroyed_variant2_order( origin, chunks_variant2 ) variant2_order6[ variant2_order6.size ] = chunks_variant2[ i ]; } } - i++; } - i = 0; - while ( i < chunks_variant2.size ) + for ( i = 0; i < chunks_variant2.size; i++ ) { if ( isDefined( chunks_variant2[ i ].script_team ) && chunks_variant2[ i ].script_team == "bar_board_variant2" ) { @@ -1847,49 +1701,33 @@ non_destroyed_variant2_order( origin, chunks_variant2 ) { return variant2_order1[ i ]; } - else + if ( variant2_order2[ i ].state == "repaired" ) { - if ( variant2_order2[ i ].state == "repaired" ) - { - return variant2_order2[ i ]; - } - else - { - if ( variant2_order3[ i ].state == "repaired" ) - { - return variant2_order3[ i ]; - } - else - { - if ( variant2_order5[ i ].state == "repaired" ) - { - return variant2_order5[ i ]; - } - else - { - if ( variant2_order4[ i ].state == "repaired" ) - { - return variant2_order4[ i ]; - } - else - { - if ( variant2_order6[ i ].state == "repaired" ) - { - return variant2_order6[ i ]; - } - } - } - } - } + return variant2_order2[ i ]; + } + if ( variant2_order3[ i ].state == "repaired" ) + { + return variant2_order3[ i ]; + } + if ( variant2_order5[ i ].state == "repaired" ) + { + return variant2_order5[ i ]; + } + if ( variant2_order4[ i ].state == "repaired" ) + { + return variant2_order4[ i ]; + } + if ( variant2_order6[ i ].state == "repaired" ) + { + return variant2_order6[ i ]; } } } - i++; } } } -non_destroyed_variant4_order( origin, chunks_variant4 ) +non_destroyed_variant4_order( origin, chunks_variant4 ) //checked partially changed to match cerberus output //did not include continues because they would be redundant { variant4_order = []; variant4_order1 = []; @@ -1898,10 +1736,9 @@ non_destroyed_variant4_order( origin, chunks_variant4 ) variant4_order4 = []; variant4_order5 = []; variant4_order6 = []; - while ( isDefined( chunks_variant4 ) ) + if ( isDefined( chunks_variant4 ) ) { - i = 0; - while ( i < chunks_variant4.size ) + for ( i = 0; i < chunks_variant4.size; i++ ) { if ( isDefined( chunks_variant4[ i ].script_team ) && chunks_variant4[ i ].script_team == "bar_board_variant4" ) { @@ -1930,10 +1767,8 @@ non_destroyed_variant4_order( origin, chunks_variant4 ) variant4_order6[ variant4_order6.size ] = chunks_variant4[ i ]; } } - i++; } - i = 0; - while ( i < chunks_variant4.size ) + for ( i = 0; i < chunks_variant4.size; i++ ) { if ( isDefined( chunks_variant4[ i ].script_team ) && chunks_variant4[ i ].script_team == "bar_board_variant4" ) { @@ -1943,49 +1778,33 @@ non_destroyed_variant4_order( origin, chunks_variant4 ) { return variant4_order1[ i ]; } - else + if ( variant4_order6[ i ].state == "repaired" ) { - if ( variant4_order6[ i ].state == "repaired" ) - { - return variant4_order6[ i ]; - } - else - { - if ( variant4_order3[ i ].state == "repaired" ) - { - return variant4_order3[ i ]; - } - else - { - if ( variant4_order4[ i ].state == "repaired" ) - { - return variant4_order4[ i ]; - } - else - { - if ( variant4_order2[ i ].state == "repaired" ) - { - return variant4_order2[ i ]; - } - else - { - if ( variant4_order5[ i ].state == "repaired" ) - { - return variant4_order5[ i ]; - } - } - } - } - } + return variant4_order6[ i ]; + } + if ( variant4_order3[ i ].state == "repaired" ) + { + return variant4_order3[ i ]; + } + if ( variant4_order4[ i ].state == "repaired" ) + { + return variant4_order4[ i ]; + } + if ( variant4_order2[ i ].state == "repaired" ) + { + return variant4_order2[ i ]; + } + if ( variant4_order5[ i ].state == "repaired" ) + { + return variant4_order5[ i ]; } } } - i++; } } } -non_destroyed_variant5_order( origin, chunks_variant5 ) +non_destroyed_variant5_order( origin, chunks_variant5 ) //checked partially changed to match cerberus output //did not include continues because they would be redundant { variant5_order = []; variant5_order1 = []; @@ -1994,10 +1813,9 @@ non_destroyed_variant5_order( origin, chunks_variant5 ) variant5_order4 = []; variant5_order5 = []; variant5_order6 = []; - while ( isDefined( chunks_variant5 ) ) + if ( isDefined( chunks_variant5 ) ) { - i = 0; - while ( i < chunks_variant5.size ) + for ( i = 0; i < chunks_variant5.size; i++ ) { if ( isDefined( chunks_variant5[ i ].script_team ) && chunks_variant5[ i ].script_team == "bar_board_variant5" ) { @@ -2029,10 +1847,8 @@ non_destroyed_variant5_order( origin, chunks_variant5 ) } } } - i++; } - i = 0; - while ( i < chunks_variant5.size ) + for ( i = 0; i < chunks_variant5.size; i++ ) { if ( isDefined( chunks_variant5[ i ].script_team ) && chunks_variant5[ i ].script_team == "bar_board_variant5" ) { @@ -2042,56 +1858,40 @@ non_destroyed_variant5_order( origin, chunks_variant5 ) { return variant5_order1[ i ]; } - else + if ( variant5_order6[ i ].state == "repaired" ) { - if ( variant5_order6[ i ].state == "repaired" ) - { - return variant5_order6[ i ]; - } - else - { - if ( variant5_order3[ i ].state == "repaired" ) - { - return variant5_order3[ i ]; - } - else - { - if ( variant5_order2[ i ].state == "repaired" ) - { - return variant5_order2[ i ]; - } - else - { - if ( variant5_order5[ i ].state == "repaired" ) - { - return variant5_order5[ i ]; - } - else - { - if ( variant5_order4[ i ].state == "repaired" ) - { - return variant5_order4[ i ]; - } - } - } - } - } + return variant5_order6[ i ]; + } + if ( variant5_order3[ i ].state == "repaired" ) + { + return variant5_order3[ i ]; + } + if ( variant5_order2[ i ].state == "repaired" ) + { + return variant5_order2[ i ]; + } + if ( variant5_order5[ i ].state == "repaired" ) + { + return variant5_order5[ i ]; + } + if ( variant5_order4[ i ].state == "repaired" ) + { + return variant5_order4[ i ]; } } } - i++; } } } -show_grate_pull() +show_grate_pull() //checked changed to match cerberus output { - wait 0,53; + wait 0.53; self show(); - self vibrate( vectorScale( ( 0, 0, 1 ), 270 ), 0,2, 0,4, 0,4 ); + self vibrate( vectorScale( ( 0, 1, 0 ), 270 ), 0.2, 0.4, 0.4 ); } -get_closest_2d( origin, ents ) +get_closest_2d( origin, ents ) //checked changed to match cerberus output { if ( !isDefined( ents ) ) { @@ -2100,15 +1900,13 @@ get_closest_2d( origin, ents ) dist = distance2d( origin, ents[ 0 ].origin ); index = 0; temp_array = []; - i = 1; - while ( i < ents.size ) + for ( i = 1; i < ents.size; i++ ) { if ( isDefined( ents[ i ].unbroken ) && ents[ i ].unbroken == 1 ) { ents[ i ].index = i; temp_array[ temp_array.size ] = ents[ i ]; } - i++; } if ( temp_array.size > 0 ) { @@ -2117,8 +1915,7 @@ get_closest_2d( origin, ents ) } else { - i = 1; - while ( i < ents.size ) + for ( i = 1; i < ents.size; i++ ) { temp_dist = distance2d( origin, ents[ i ].origin ); if ( temp_dist < dist ) @@ -2126,13 +1923,12 @@ get_closest_2d( origin, ents ) dist = temp_dist; index = i; } - i++; } return ents[ index ]; } } -disable_trigger() +disable_trigger() //checked matches cerberus output { if ( !isDefined( self.disabled ) || !self.disabled ) { @@ -2141,7 +1937,7 @@ disable_trigger() } } -enable_trigger() +enable_trigger() //checked matches cerberus output { if ( !isDefined( self.disabled ) || !self.disabled ) { @@ -2151,29 +1947,29 @@ enable_trigger() self.origin += vectorScale( ( 0, 0, 1 ), 10000 ); } -in_playable_area() +in_playable_area() //checked changed to match cerberus output { playable_area = getentarray( "player_volume", "script_noteworthy" ); if ( !isDefined( playable_area ) ) { + /* /# println( "No playable area playable_area found! Assume EVERYWHERE is PLAYABLE" ); #/ + */ return 1; } - i = 0; - while ( i < playable_area.size ) + for ( i = 0; i < playable_area.size; i++ ) { if ( self istouching( playable_area[ i ] ) ) { return 1; } - i++; } return 0; } -get_closest_non_destroyed_chunk( origin, barrier, barrier_chunks ) +get_closest_non_destroyed_chunk( origin, barrier, barrier_chunks ) //checked changed to match cerberus output { chunks = undefined; chunks_grate = undefined; @@ -2190,24 +1986,18 @@ get_closest_non_destroyed_chunk( origin, barrier, barrier_chunks ) return array_randomize( chunks_grate )[ 0 ]; } } - else + else if ( isDefined( chunks ) ) { - if ( isDefined( chunks ) ) - { - return non_destroyed_bar_board_order( origin, chunks ); - } - else - { - if ( isDefined( chunks_grate ) ) - { - return non_destroyed_grate_order( origin, chunks_grate ); - } - } + return non_destroyed_bar_board_order( origin, chunks ); + } + else if ( isDefined( chunks_grate ) ) + { + return non_destroyed_grate_order( origin, chunks_grate ); } return undefined; } -get_random_destroyed_chunk( barrier, barrier_chunks ) +get_random_destroyed_chunk( barrier, barrier_chunks ) //checked changed to match cerberus output { if ( isDefined( barrier.zbarrier ) ) { @@ -2229,22 +2019,18 @@ get_random_destroyed_chunk( barrier, barrier_chunks ) { return chunks[ randomint( chunks.size ) ]; } - else + else if ( isDefined( chunks_repair_grate ) ) { - if ( isDefined( chunks_repair_grate ) ) - { - return grate_order_destroyed( chunks_repair_grate ); - } + return grate_order_destroyed( chunks_repair_grate ); } return undefined; } } -get_destroyed_repair_grates( barrier_chunks ) +get_destroyed_repair_grates( barrier_chunks ) //checked changed to match cerberus output { array = []; - i = 0; - while ( i < barrier_chunks.size ) + for ( i = 0; i < barrier_chunks.size; i++ ) { if ( isDefined( barrier_chunks[ i ] ) ) { @@ -2253,7 +2039,6 @@ get_destroyed_repair_grates( barrier_chunks ) array[ array.size ] = barrier_chunks[ i ]; } } - i++; } if ( array.size == 0 ) { @@ -2262,7 +2047,7 @@ get_destroyed_repair_grates( barrier_chunks ) return array; } -get_non_destroyed_chunks( barrier, barrier_chunks ) +get_non_destroyed_chunks( barrier, barrier_chunks ) //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { if ( isDefined( barrier.zbarrier ) ) { @@ -2289,7 +2074,7 @@ get_non_destroyed_chunks( barrier, barrier_chunks ) } if ( isDefined( barrier_chunks[ i ].script_team ) && barrier_chunks[ i ].script_team == "new_barricade" ) { - if ( isDefined( barrier_chunks[ i ].script_parameters ) || barrier_chunks[ i ].script_parameters == "repair_board" && barrier_chunks[ i ].script_parameters == "barricade_vents" ) + if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "repair_board" || barrier_chunks[ i ].script_parameters == "barricade_vents" ) { if ( barrier_chunks[ i ] get_chunk_state() == "repaired" ) { @@ -2302,36 +2087,30 @@ get_non_destroyed_chunks( barrier, barrier_chunks ) i++; continue; } - else + if ( isDefined( barrier_chunks[ i ].script_team ) && barrier_chunks[ i ].script_team == "6_bars_bent" ) { - if ( isDefined( barrier_chunks[ i ].script_team ) && barrier_chunks[ i ].script_team == "6_bars_bent" ) + if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "bar" ) { - if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "bar" ) + if ( barrier_chunks[ i ] get_chunk_state() == "repaired" ) { - if ( barrier_chunks[ i ] get_chunk_state() == "repaired" ) + if ( barrier_chunks[ i ].origin == barrier_chunks[ i ].og_origin ) { - if ( barrier_chunks[ i ].origin == barrier_chunks[ i ].og_origin ) - { - array[ array.size ] = barrier_chunks[ i ]; - } + array[ array.size ] = barrier_chunks[ i ]; } } - i++; - continue; } - else + i++; + continue; + } + if ( isDefined( barrier_chunks[ i ].script_team ) && barrier_chunks[ i ].script_team == "6_bars_prestine" ) + { + if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "bar" ) { - if ( isDefined( barrier_chunks[ i ].script_team ) && barrier_chunks[ i ].script_team == "6_bars_prestine" ) + if ( barrier_chunks[ i ] get_chunk_state() == "repaired" ) { - if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "bar" ) + if ( barrier_chunks[ i ].origin == barrier_chunks[ i ].og_origin ) { - if ( barrier_chunks[ i ] get_chunk_state() == "repaired" ) - { - if ( barrier_chunks[ i ].origin == barrier_chunks[ i ].og_origin ) - { - array[ array.size ] = barrier_chunks[ i ]; - } - } + array[ array.size ] = barrier_chunks[ i ]; } } } @@ -2346,7 +2125,7 @@ get_non_destroyed_chunks( barrier, barrier_chunks ) } } -get_non_destroyed_chunks_grate( barrier, barrier_chunks ) +get_non_destroyed_chunks_grate( barrier, barrier_chunks ) //checked changed to match cerberus output { if ( isDefined( barrier.zbarrier ) ) { @@ -2355,8 +2134,7 @@ get_non_destroyed_chunks_grate( barrier, barrier_chunks ) else { array = []; - i = 0; - while ( i < barrier_chunks.size ) + for ( i = 0; i < barrier_chunks.size; i++ ) { if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "grate" ) { @@ -2365,7 +2143,6 @@ get_non_destroyed_chunks_grate( barrier, barrier_chunks ) array[ array.size ] = barrier_chunks[ i ]; } } - i++; } if ( array.size == 0 ) { @@ -2375,11 +2152,10 @@ get_non_destroyed_chunks_grate( barrier, barrier_chunks ) } } -get_non_destroyed_variant1( barrier_chunks ) +get_non_destroyed_variant1( barrier_chunks ) //checked changed to match cerberus output { array = []; - i = 0; - while ( i < barrier_chunks.size ) + for ( i = 0; i < barrier_chunks.size; i++ ) { if ( isDefined( barrier_chunks[ i ].script_team ) && barrier_chunks[ i ].script_team == "bar_board_variant1" ) { @@ -2388,7 +2164,6 @@ get_non_destroyed_variant1( barrier_chunks ) array[ array.size ] = barrier_chunks[ i ]; } } - i++; } if ( array.size == 0 ) { @@ -2397,11 +2172,10 @@ get_non_destroyed_variant1( barrier_chunks ) return array; } -get_non_destroyed_variant2( barrier_chunks ) +get_non_destroyed_variant2( barrier_chunks ) //checked changed to match cerberus output { array = []; - i = 0; - while ( i < barrier_chunks.size ) + for ( i = 0; i < barrier_chunks.size; i++ ) { if ( isDefined( barrier_chunks[ i ].script_team ) && barrier_chunks[ i ].script_team == "bar_board_variant2" ) { @@ -2410,7 +2184,6 @@ get_non_destroyed_variant2( barrier_chunks ) array[ array.size ] = barrier_chunks[ i ]; } } - i++; } if ( array.size == 0 ) { @@ -2419,11 +2192,10 @@ get_non_destroyed_variant2( barrier_chunks ) return array; } -get_non_destroyed_variant4( barrier_chunks ) +get_non_destroyed_variant4( barrier_chunks ) //checked changed to match cerberus output { array = []; - i = 0; - while ( i < barrier_chunks.size ) + for ( i = 0; i < barrier_chunks.size; i++ ) { if ( isDefined( barrier_chunks[ i ].script_team ) && barrier_chunks[ i ].script_team == "bar_board_variant4" ) { @@ -2432,7 +2204,6 @@ get_non_destroyed_variant4( barrier_chunks ) array[ array.size ] = barrier_chunks[ i ]; } } - i++; } if ( array.size == 0 ) { @@ -2441,11 +2212,10 @@ get_non_destroyed_variant4( barrier_chunks ) return array; } -get_non_destroyed_variant5( barrier_chunks ) +get_non_destroyed_variant5( barrier_chunks ) //checked changed to match cerberus output { array = []; - i = 0; - while ( i < barrier_chunks.size ) + for ( i = 0; i < barrier_chunks.size; i++ ) { if ( isDefined( barrier_chunks[ i ].script_team ) && barrier_chunks[ i ].script_team == "bar_board_variant5" ) { @@ -2454,7 +2224,6 @@ get_non_destroyed_variant5( barrier_chunks ) array[ array.size ] = barrier_chunks[ i ]; } } - i++; } if ( array.size == 0 ) { @@ -2463,7 +2232,7 @@ get_non_destroyed_variant5( barrier_chunks ) return array; } -get_destroyed_chunks( barrier_chunks ) +get_destroyed_chunks( barrier_chunks ) //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { array = []; i = 0; @@ -2477,30 +2246,21 @@ get_destroyed_chunks( barrier_chunks ) i++; continue; } - else + if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "repair_board" || barrier_chunks[ i ].script_parameters == "barricade_vents" ) { - if ( isDefined( barrier_chunks[ i ].script_parameters ) || barrier_chunks[ i ].script_parameters == "repair_board" && barrier_chunks[ i ].script_parameters == "barricade_vents" ) - { - array[ array.size ] = barrier_chunks[ i ]; - i++; - continue; - } - else - { - if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "bar" ) - { - array[ array.size ] = barrier_chunks[ i ]; - i++; - continue; - } - else - { - if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "grate" ) - { - return undefined; - } - } - } + array[ array.size ] = barrier_chunks[ i ]; + i++; + continue; + } + if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "bar" ) + { + array[ array.size ] = barrier_chunks[ i ]; + i++; + continue; + } + if ( isDefined( barrier_chunks[ i ].script_parameters ) && barrier_chunks[ i ].script_parameters == "grate" ) + { + return undefined; } } i++; @@ -2512,7 +2272,7 @@ get_destroyed_chunks( barrier_chunks ) return array; } -grate_order_destroyed( chunks_repair_grate ) +grate_order_destroyed( chunks_repair_grate ) //checked changed to match cerberus output { grate_repair_order = []; grate_repair_order1 = []; @@ -2521,8 +2281,7 @@ grate_order_destroyed( chunks_repair_grate ) grate_repair_order4 = []; grate_repair_order5 = []; grate_repair_order6 = []; - i = 0; - while ( i < chunks_repair_grate.size ) + for ( i = 0; i < chunks_repair_grate.size; i++ ) { if ( isDefined( chunks_repair_grate[ i ].script_parameters ) && chunks_repair_grate[ i ].script_parameters == "grate" ) { @@ -2551,10 +2310,8 @@ grate_order_destroyed( chunks_repair_grate ) grate_repair_order6[ grate_repair_order6.size ] = chunks_repair_grate[ i ]; } } - i++; } - i = 0; - while ( i < chunks_repair_grate.size ) + for ( i = 0; i < chunks_repair_grate.size; i++ ) { if ( isDefined( chunks_repair_grate[ i ].script_parameters ) && chunks_repair_grate[ i ].script_parameters == "grate" ) { @@ -2562,84 +2319,85 @@ grate_order_destroyed( chunks_repair_grate ) { if ( grate_repair_order6[ i ].state == "destroyed" ) { + /* /# iprintlnbold( " Fix grate6 " ); #/ + */ return grate_repair_order6[ i ]; } if ( grate_repair_order5[ i ].state == "destroyed" ) { + /* /# iprintlnbold( " Fix grate5 " ); #/ + */ grate_repair_order6[ i ] thread show_grate_repair(); return grate_repair_order5[ i ]; } - else + if ( grate_repair_order4[ i ].state == "destroyed" ) { - if ( grate_repair_order4[ i ].state == "destroyed" ) - { + /* /# - iprintlnbold( " Fix grate4 " ); + iprintlnbold( " Fix grate4 " ); #/ - grate_repair_order5[ i ] thread show_grate_repair(); - return grate_repair_order4[ i ]; - } - else - { - if ( grate_repair_order3[ i ].state == "destroyed" ) - { + */ + grate_repair_order5[ i ] thread show_grate_repair(); + return grate_repair_order4[ i ]; + } + if ( grate_repair_order3[ i ].state == "destroyed" ) + { + /* /# - iprintlnbold( " Fix grate3 " ); + iprintlnbold( " Fix grate3 " ); #/ - grate_repair_order4[ i ] thread show_grate_repair(); - return grate_repair_order3[ i ]; - } - else - { - if ( grate_repair_order2[ i ].state == "destroyed" ) - { + */ + grate_repair_order4[ i ] thread show_grate_repair(); + return grate_repair_order3[ i ]; + } + if ( grate_repair_order2[ i ].state == "destroyed" ) + { + /* /# - iprintlnbold( " Fix grate2 " ); + iprintlnbold( " Fix grate2 " ); #/ - grate_repair_order3[ i ] thread show_grate_repair(); - return grate_repair_order2[ i ]; - } - else - { - if ( grate_repair_order1[ i ].state == "destroyed" ) - { + */ + grate_repair_order3[ i ] thread show_grate_repair(); + return grate_repair_order2[ i ]; + } + if ( grate_repair_order1[ i ].state == "destroyed" ) + { + /* /# - iprintlnbold( " Fix grate1 " ); + iprintlnbold( " Fix grate1 " ); #/ - grate_repair_order2[ i ] thread show_grate_repair(); - return grate_repair_order1[ i ]; - } - } - } - } + */ + grate_repair_order2[ i ] thread show_grate_repair(); + return grate_repair_order1[ i ]; } } } - i++; } } -show_grate_repair() +show_grate_repair() //checked matches cerberus output { - wait 0,34; + wait 0.34; self hide(); } -get_chunk_state() +get_chunk_state() //checked matches cerberus output { + /* /# assert( isDefined( self.state ) ); #/ + */ return self.state; } -is_float( num ) +is_float( num ) //checked matches cerberus output { val = num - int( num ); if ( val != 0 ) @@ -2652,22 +2410,20 @@ is_float( num ) } } -array_limiter( array, total ) +array_limiter( array, total ) //checked changed to match cerberus output { new_array = []; - i = 0; - while ( i < array.size ) + for ( i = 0; i < array.size; i++ ) { if ( i < total ) { new_array[ new_array.size ] = array[ i ]; } - i++; } return new_array; } -array_validate( array ) +array_validate( array ) //checked matches cerberus output { if ( isDefined( array ) && array.size > 0 ) { @@ -2679,7 +2435,7 @@ array_validate( array ) } } -add_spawner( spawner ) +add_spawner( spawner ) //checked matches cerberus output { if ( isDefined( spawner.script_start ) && level.round_number < spawner.script_start ) { @@ -2697,21 +2453,21 @@ add_spawner( spawner ) level.zombie_spawn_locations[ level.zombie_spawn_locations.size ] = spawner; } -fake_physicslaunch( target_pos, power ) +fake_physicslaunch( target_pos, power ) //checked matches cerberus output { start_pos = self.origin; gravity = getDvarInt( "bg_gravity" ) * -1; dist = distance( start_pos, target_pos ); time = dist / power; delta = target_pos - start_pos; - drop = ( 0,5 * gravity ) * ( time * time ); + drop = ( 0.5 * gravity ) * ( time * time ); velocity = ( delta[ 0 ] / time, delta[ 1 ] / time, ( delta[ 2 ] - drop ) / time ); level thread draw_line_ent_to_pos( self, target_pos ); self movegravity( velocity, time ); return time; } -add_zombie_hint( ref, text ) +add_zombie_hint( ref, text ) //checked matches cerberus output { if ( !isDefined( level.zombie_hints ) ) { @@ -2721,19 +2477,21 @@ add_zombie_hint( ref, text ) level.zombie_hints[ ref ] = text; } -get_zombie_hint( ref ) +get_zombie_hint( ref ) //checked matches cerberus output { if ( isDefined( level.zombie_hints[ ref ] ) ) { return level.zombie_hints[ ref ]; } + /* /# println( "UNABLE TO FIND HINT STRING " + ref ); #/ + */ return level.zombie_hints[ "undefined" ]; } -set_hint_string( ent, default_ref, cost ) +set_hint_string( ent, default_ref, cost ) //checked matches cerberus output { ref = default_ref; if ( isDefined( ent.script_hint ) ) @@ -2742,7 +2500,7 @@ set_hint_string( ent, default_ref, cost ) } if ( isDefined( level.legacy_hint_system ) && level.legacy_hint_system ) { - ref = ( ref + "_" ) + cost; + ref = ref + "_" + cost; self sethintstring( get_zombie_hint( ref ) ); } else @@ -2760,7 +2518,7 @@ set_hint_string( ent, default_ref, cost ) } } -get_hint_string( ent, default_ref, cost ) +get_hint_string( ent, default_ref, cost ) //checked matches cerberus output { ref = default_ref; if ( isDefined( ent.script_hint ) ) @@ -2769,12 +2527,12 @@ get_hint_string( ent, default_ref, cost ) } if ( isDefined( level.legacy_hint_system ) && level.legacy_hint_system && isDefined( cost ) ) { - ref = ( ref + "_" ) + cost; + ref = ref + "_" + cost; } return get_zombie_hint( ref ); } -unitrigger_set_hint_string( ent, default_ref, cost ) +unitrigger_set_hint_string( ent, default_ref, cost ) //checked partially changed to match cerberus output //did not change while loop to foreach to prevent infinite loop related to continues { triggers = []; if ( self.trigger_per_player ) @@ -2785,11 +2543,9 @@ unitrigger_set_hint_string( ent, default_ref, cost ) { triggers[ 0 ] = self.trigger; } - _a3000 = triggers; - _k3000 = getFirstArrayKey( _a3000 ); - while ( isDefined( _k3000 ) ) + i = 0; + while ( i < triggers.size ) { - trigger = _a3000[ _k3000 ]; ref = default_ref; if ( isDefined( ent.script_hint ) ) { @@ -2797,27 +2553,24 @@ unitrigger_set_hint_string( ent, default_ref, cost ) } if ( isDefined( level.legacy_hint_system ) && level.legacy_hint_system ) { - ref = ( ref + "_" ) + cost; - trigger sethintstring( get_zombie_hint( ref ) ); + ref = ref + "_" + cost; + triggers[ i ] sethintstring( get_zombie_hint( ref ) ); + i++; + continue; } - else + hint = get_zombie_hint( ref ); + if ( isDefined( cost ) ) { - hint = get_zombie_hint( ref ); - if ( isDefined( cost ) ) - { - trigger sethintstring( hint, cost ); - break; - } - else - { - trigger sethintstring( hint ); - } + triggers[ i ] sethintstring( hint, cost ); + i++; + continue; } - _k3000 = getNextArrayKey( _a3000, _k3000 ); + triggers[ i ] sethintstring( hint ); + i++; } } -add_sound( ref, alias ) +add_sound( ref, alias ) //checked matches cerberus output { if ( !isDefined( level.zombie_sounds ) ) { @@ -2826,7 +2579,7 @@ add_sound( ref, alias ) level.zombie_sounds[ ref ] = alias; } -play_sound_at_pos( ref, pos, ent ) +play_sound_at_pos( ref, pos, ent ) //checked matches cerberus output { if ( isDefined( ent ) ) { @@ -2846,15 +2599,17 @@ play_sound_at_pos( ref, pos, ent ) } if ( !isDefined( level.zombie_sounds[ ref ] ) ) { + /* /# assertmsg( "Sound "" + ref + "" was not put to the zombie sounds list, please use add_sound( ref, alias ) at the start of your level." ); #/ + */ return; } playsoundatposition( level.zombie_sounds[ ref ], pos ); } -play_sound_on_ent( ref ) +play_sound_on_ent( ref ) //checked matches cerberus output { if ( isDefined( self.script_soundalias ) ) { @@ -2871,15 +2626,17 @@ play_sound_on_ent( ref ) } if ( !isDefined( level.zombie_sounds[ ref ] ) ) { + /* /# assertmsg( "Sound "" + ref + "" was not put to the zombie sounds list, please use add_sound( ref, alias ) at the start of your level." ); #/ + */ return; } self playsound( level.zombie_sounds[ ref ] ); } -play_loopsound_on_ent( ref ) +play_loopsound_on_ent( ref ) //checked matches cerberus output { if ( isDefined( self.script_firefxsound ) ) { @@ -2891,15 +2648,17 @@ play_loopsound_on_ent( ref ) } if ( !isDefined( level.zombie_sounds[ ref ] ) ) { + /* /# assertmsg( "Sound "" + ref + "" was not put to the zombie sounds list, please use add_sound( ref, alias ) at the start of your level." ); #/ + */ return; } self playsound( level.zombie_sounds[ ref ] ); } -string_to_float( string ) +string_to_float( string ) //checked changed to match cerberus output { floatparts = strtok( string, "." ); if ( floatparts.size == 1 ) @@ -2908,12 +2667,9 @@ string_to_float( string ) } whole = int( floatparts[ 0 ] ); decimal = 0; - i = floatparts[ 1 ].size - 1; - while ( i >= 0 ) + for ( i = floatparts[1].size - 1; i >= 0; i-- ) { decimal = ( decimal / 10 ) + ( int( floatparts[ 1 ][ i ] ) / 10 ); - i--; - } if ( whole >= 0 ) { @@ -2925,17 +2681,17 @@ string_to_float( string ) } } -onplayerconnect_callback( func ) +onplayerconnect_callback( func ) //checked matches cerberus output { addcallback( "on_player_connect", func ); } -onplayerdisconnect_callback( func ) +onplayerdisconnect_callback( func ) //checked matches cerberus output { addcallback( "on_player_disconnect", func ); } -set_zombie_var( var, value, is_float, column, is_team_based ) +set_zombie_var( var, value, is_float, column, is_team_based ) //checked changed to match cerberus output { if ( !isDefined( is_float ) ) { @@ -2960,20 +2716,16 @@ set_zombie_var( var, value, is_float, column, is_team_based ) } if ( isDefined( is_team_based ) && is_team_based ) { - _a3185 = level.teams; - _k3185 = getFirstArrayKey( _a3185 ); - while ( isDefined( _k3185 ) ) + foreach ( team in level.teams ) { - team = _a3185[ _k3185 ]; level.zombie_vars[ team ][ var ] = value; - _k3185 = getNextArrayKey( _a3185, _k3185 ); } } else level.zombie_vars[ var ] = value; return value; } -get_table_var( table, var_name, value, is_float, column ) +get_table_var( table, var_name, value, is_float, column ) //checked matches cerberus output { if ( !isDefined( table ) ) { @@ -3002,8 +2754,9 @@ get_table_var( table, var_name, value, is_float, column ) return value; } -hudelem_count() +hudelem_count() //checked matches cerberus output { + /* /# max = 0; curr_total = 0; @@ -3014,13 +2767,15 @@ hudelem_count() max = level.hudelem_count; } println( "HudElems: " + level.hudelem_count + "[Peak: " + max + "]" ); - wait 0,05; + wait 0.05; #/ } + */ } -debug_round_advancer() +debug_round_advancer() //checked changed to match cerberus output { + /* /# while ( 1 ) { @@ -3028,28 +2783,32 @@ debug_round_advancer() i = 0; while ( i < zombs.size ) { - zombs[ i ] dodamage( zombs[ i ].health + 666, ( 0, 0, 1 ) ); - wait 0,5; + zombs[ i ] dodamage( zombs[ i ].health + 666, ( 0, 0, 0 ) ); + wait 0.5; i++; } #/ } + */ } -print_run_speed( speed ) +print_run_speed( speed ) //checked changed to match cerberus output { + /* /# self endon( "death" ); while ( 1 ) { - print3d( self.origin + vectorScale( ( 0, 0, 1 ), 64 ), speed, ( 0, 0, 1 ) ); - wait 0,05; + print3d( self.origin + vectorScale( ( 0, 0, 1 ), 64 ), speed, ( 1, 1, 1 ) ); + wait 0.05; #/ } + */ } -draw_line_ent_to_ent( ent1, ent2 ) +draw_line_ent_to_ent( ent1, ent2 ) //checked matches cerberus output { + /* /# if ( getDvarInt( "zombie_debug" ) != 1 ) { @@ -3060,13 +2819,15 @@ draw_line_ent_to_ent( ent1, ent2 ) while ( 1 ) { line( ent1.origin, ent2.origin ); - wait 0,05; + wait 0.05; #/ } + */ } -draw_line_ent_to_pos( ent, pos, end_on ) +draw_line_ent_to_pos( ent, pos, end_on ) //checked changed to match cerberus output { + /* /# if ( getDvarInt( "zombie_debug" ) != 1 ) { @@ -3082,23 +2843,27 @@ draw_line_ent_to_pos( ent, pos, end_on ) while ( 1 ) { line( ent.origin, pos ); - wait 0,05; + wait 0.05; #/ } + */ } -debug_print( msg ) +debug_print( msg ) //checked matches cerberus output { + /* /# if ( getDvarInt( "zombie_debug" ) > 0 ) { println( "######### ZOMBIE: " + msg ); #/ } + */ } -debug_blocker( pos, rad, height ) +debug_blocker( pos, rad, height ) //checked matches cerberus output { + /* /# self notify( "stop_debug_blocker" ); self endon( "stop_debug_blocker" ); @@ -3108,32 +2873,34 @@ debug_blocker( pos, rad, height ) { return; } - wait 0,05; + wait 0.05; drawcylinder( pos, rad, height ); #/ } + */ } -drawcylinder( pos, rad, height ) +drawcylinder( pos, rad, height ) //checked changed to match cerberus output { + /* /# currad = rad; curheight = height; - r = 0; - while ( r < 20 ) + for ( r = 0; r < 20; r++ ) { theta = ( r / 20 ) * 360; theta2 = ( ( r + 1 ) / 20 ) * 360; line( pos + ( cos( theta ) * currad, sin( theta ) * currad, 0 ), pos + ( cos( theta2 ) * currad, sin( theta2 ) * currad, 0 ) ); line( pos + ( cos( theta ) * currad, sin( theta ) * currad, curheight ), pos + ( cos( theta2 ) * currad, sin( theta2 ) * currad, curheight ) ); line( pos + ( cos( theta ) * currad, sin( theta ) * currad, 0 ), pos + ( cos( theta ) * currad, sin( theta ) * currad, curheight ) ); - r++; #/ } + */ } -print3d_at_pos( msg, pos, thread_endon, offset ) +print3d_at_pos( msg, pos, thread_endon, offset ) //checked changed to match cerberus output { + /* /# self endon( "death" ); if ( isDefined( thread_endon ) ) @@ -3143,18 +2910,20 @@ print3d_at_pos( msg, pos, thread_endon, offset ) } if ( !isDefined( offset ) ) { - offset = ( 0, 0, 1 ); + offset = ( 0, 0, 0 ); } while ( 1 ) { print3d( self.origin + offset, msg ); - wait 0,05; + wait 0.05; #/ } + */ } -debug_breadcrumbs() +debug_breadcrumbs() //checked changed to match cerberus output { + /* /# self endon( "disconnect" ); self notify( "stop_debug_breadcrumbs" ); @@ -3165,29 +2934,30 @@ debug_breadcrumbs() { wait 1; } - i = 0; - while ( i < self.zombie_breadcrumbs.size ) + for ( i = 0; i < self.zombie_breadcrumbs.size; i++ ) { drawcylinder( self.zombie_breadcrumbs[ i ], 5, 5 ); - i++; } - wait 0,05; + wait 0.05; #/ } + */ } -debug_attack_spots_taken() +debug_attack_spots_taken() //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { + /* /# self notify( "stop_debug_breadcrumbs" ); self endon( "stop_debug_breadcrumbs" ); while ( 1 ) { - while ( getDvarInt( "zombie_debug" ) != 2 ) + if ( getDvarInt( "zombie_debug" ) != 2 ) { wait 1; + continue; } - wait 0,05; + wait 0.05; count = 0; i = 0; while ( i < self.attack_spots_taken.size ) @@ -3195,24 +2965,23 @@ debug_attack_spots_taken() if ( self.attack_spots_taken[ i ] ) { count++; - circle( self.attack_spots[ i ], 12, ( 0, 0, 1 ), 0, 1, 1 ); + circle( self.attack_spots[ i ], 12, ( 1, 0, 0 ), 0, 1, 1 ); i++; continue; } - else - { - circle( self.attack_spots[ i ], 12, ( 0, 0, 1 ), 0, 1, 1 ); - } + circle( self.attack_spots[ i ], 12, ( 0, 1, 0 ), 0, 1, 1 ); i++; } msg = "" + count + " / " + self.attack_spots_taken.size; print3d( self.origin, msg ); #/ } + */ } -float_print3d( msg, time ) +float_print3d( msg, time ) //checked changed to match cerberus output { + /* /# self endon( "death" ); time = getTime() + ( time * 1000 ); @@ -3220,19 +2989,20 @@ float_print3d( msg, time ) while ( getTime() < time ) { offset += vectorScale( ( 0, 0, 1 ), 2 ); - print3d( self.origin + offset, msg, ( 0, 0, 1 ) ); - wait 0,05; + print3d( self.origin + offset, msg, ( 1, 1, 1 ) ); + wait 0.05; #/ } + */ } -do_player_vo( snd, variation_count ) +do_player_vo( snd, variation_count ) //checked matches cerberus output { index = maps/mp/zombies/_zm_weapons::get_player_index( self ); sound = "zmb_vox_plr_" + index + "_" + snd; if ( isDefined( variation_count ) ) { - sound = ( sound + "_" ) + randomintrange( 0, variation_count ); + sound = sound + "_" + randomintrange( 0, variation_count ); } if ( !isDefined( level.player_is_speaking ) ) { @@ -3248,7 +3018,7 @@ do_player_vo( snd, variation_count ) } } -stop_magic_bullet_shield() +stop_magic_bullet_shield() //checked matches cerberus output { self.attackeraccuracy = 1; self notify( "stop_magic_bullet_shield" ); @@ -3256,42 +3026,48 @@ stop_magic_bullet_shield() self._mbs = undefined; } -magic_bullet_shield() +magic_bullet_shield() //checked matches cerberus output { if ( isDefined( self.magic_bullet_shield ) && !self.magic_bullet_shield ) { if ( isai( self ) || isplayer( self ) ) { self.magic_bullet_shield = 1; + /* /# level thread debug_magic_bullet_shield_death( self ); #/ + */ if ( !isDefined( self._mbs ) ) { self._mbs = spawnstruct(); } if ( isai( self ) ) { + /* /# assert( isalive( self ), "Tried to do magic_bullet_shield on a dead or undefined guy." ); #/ + */ self._mbs.last_pain_time = 0; self._mbs.ignore_time = 2; self._mbs.turret_ignore_time = 5; } - self.attackeraccuracy = 0,1; + self.attackeraccuracy = 0.1; return; } else { + /* /# assertmsg( "magic_bullet_shield does not support entity of classname '" + self.classname + "'." ); #/ + */ } } } -debug_magic_bullet_shield_death( guy ) +debug_magic_bullet_shield_death( guy ) //checked matches cerberus output { targetname = "none"; if ( isDefined( guy.targetname ) ) @@ -3300,42 +3076,46 @@ debug_magic_bullet_shield_death( guy ) } guy endon( "stop_magic_bullet_shield" ); guy waittill( "death" ); + /* /# assert( !isDefined( guy ), "Guy died with magic bullet shield on with targetname: " + targetname ); #/ + */ } -is_magic_bullet_shield_enabled( ent ) +is_magic_bullet_shield_enabled( ent ) //checked changed at own discretion { if ( !isDefined( ent ) ) { return 0; } - if ( isDefined( ent.magic_bullet_shield ) ) + if ( isDefined( ent.magic_bullet_shield ) && ent.magic_bullet_shield == 1 ) { - return ent.magic_bullet_shield == 1; + return 1; } } -really_play_2d_sound( sound ) +really_play_2d_sound( sound ) //checked changed to match cerberus output { - temp_ent = spawn( "script_origin", ( 0, 0, 1 ) ); + temp_ent = spawn( "script_origin", ( 0, 0, 0 ) ); temp_ent playsoundwithnotify( sound, sound + "wait" ); temp_ent waittill( sound + "wait" ); - wait 0,05; + wait 0.05; temp_ent delete(); } -play_sound_2d( sound ) +play_sound_2d( sound ) //checked matches cerberus output { level thread really_play_2d_sound( sound ); } -include_weapon( weapon_name, in_box, collector, weighting_func ) +include_weapon( weapon_name, in_box, collector, weighting_func ) //checked matches cerberus output { + /* /# println( "ZM >> include_weapon = " + weapon_name ); #/ + */ if ( !isDefined( in_box ) ) { in_box = 1; @@ -3347,15 +3127,17 @@ include_weapon( weapon_name, in_box, collector, weighting_func ) maps/mp/zombies/_zm_weapons::include_zombie_weapon( weapon_name, in_box, collector, weighting_func ); } -include_buildable( buildable_struct ) +include_buildable( buildable_struct ) //checked matches cerberus output { + /* /# println( "ZM >> include_buildable = " + buildable_struct.name ); #/ + */ maps/mp/zombies/_zm_buildables::include_zombie_buildable( buildable_struct ); } -is_buildable_included( name ) +is_buildable_included( name ) //checked matches cerberus output { if ( isDefined( level.zombie_include_buildables[ name ] ) ) { @@ -3364,71 +3146,71 @@ is_buildable_included( name ) return 0; } -create_zombie_buildable_piece( modelname, radius, height, hud_icon ) +create_zombie_buildable_piece( modelname, radius, height, hud_icon ) //checked matches cerberus output { + /* /# println( "ZM >> create_zombie_buildable_piece = " + modelname ); #/ + */ self maps/mp/zombies/_zm_buildables::create_zombie_buildable_piece( modelname, radius, height, hud_icon ); } -is_buildable() +is_buildable() //checked matches cerberus output { return self maps/mp/zombies/_zm_buildables::is_buildable(); } -wait_for_buildable( buildable_name ) +wait_for_buildable( buildable_name ) //checked matches cerberus output { level waittill( buildable_name + "_built", player ); return player; } -include_powered_item( power_on_func, power_off_func, range_func, cost_func, power_sources, start_power, target ) +include_powered_item( power_on_func, power_off_func, range_func, cost_func, power_sources, start_power, target ) //checked matches cerberus output { return maps/mp/zombies/_zm_power::add_powered_item( power_on_func, power_off_func, range_func, cost_func, power_sources, start_power, target ); } -include_powerup( powerup_name ) +include_powerup( powerup_name ) //checked matches cerberus output { maps/mp/zombies/_zm_powerups::include_zombie_powerup( powerup_name ); } -include_equipment( equipment_name ) +include_equipment( equipment_name ) //checked matches cerberus output { maps/mp/zombies/_zm_equipment::include_zombie_equipment( equipment_name ); } -limit_equipment( equipment_name, limited ) +limit_equipment( equipment_name, limited ) //checked matches cerberus output { maps/mp/zombies/_zm_equipment::limit_zombie_equipment( equipment_name, limited ); } -trigger_invisible( enable ) +trigger_invisible( enable ) //checked changed to match cerberus output { players = get_players(); - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { if ( isDefined( players[ i ] ) ) { self setinvisibletoplayer( players[ i ], enable ); } - i++; } } -print3d_ent( text, color, scale, offset, end_msg, overwrite ) +print3d_ent( text, color, scale, offset, end_msg, overwrite ) //checked changed to match cerberus output { self endon( "death" ); if ( isDefined( overwrite ) && overwrite && isDefined( self._debug_print3d_msg ) ) { self notify( "end_print3d" ); - wait 0,05; + wait 0.05; } self endon( "end_print3d" ); if ( !isDefined( color ) ) { - color = ( 0, 0, 1 ); + color = ( 1, 1, 1 ); } if ( !isDefined( scale ) ) { @@ -3436,13 +3218,14 @@ print3d_ent( text, color, scale, offset, end_msg, overwrite ) } if ( !isDefined( offset ) ) { - offset = ( 0, 0, 1 ); + offset = ( 0, 0, 0 ); } if ( isDefined( end_msg ) ) { self endon( end_msg ); } self._debug_print3d_msg = text; + /* /# while ( 1 ) { @@ -3450,9 +3233,10 @@ print3d_ent( text, color, scale, offset, end_msg, overwrite ) wait 0,05; #/ } + */ } -isexplosivedamage( meansofdeath ) +isexplosivedamage( meansofdeath ) //checked matches cerberus output { explosivedamage = "MOD_GRENADE MOD_GRENADE_SPLASH MOD_PROJECTILE_SPLASH MOD_EXPLOSIVE"; if ( issubstr( explosivedamage, meansofdeath ) ) @@ -3462,7 +3246,7 @@ isexplosivedamage( meansofdeath ) return 0; } -isprimarydamage( meansofdeath ) +isprimarydamage( meansofdeath ) //checked matches cerberus output { if ( meansofdeath == "MOD_RIFLE_BULLET" || meansofdeath == "MOD_PISTOL_BULLET" ) { @@ -3471,16 +3255,28 @@ isprimarydamage( meansofdeath ) return 0; } -isfiredamage( weapon, meansofdeath ) +isfiredamage( weapon, meansofdeath ) //checked changed to match cerberus output { - if ( !issubstr( weapon, "flame" ) && !issubstr( weapon, "molotov_" ) && issubstr( weapon, "napalmblob_" ) && meansofdeath != "MOD_BURNED" || meansofdeath == "MOD_GRENADE" && meansofdeath == "MOD_GRENADE_SPLASH" ) + if ( ( issubstr( weapon, "flame" ) || issubstr( weapon, "molotov_" ) ) && ( meansofdeath == "MOD_BURNED" || meansofdeath == "MOD_GRENADE" ) ) + { + return 1; + } + else if ( ( issubstr( weapon, "flame" ) || issubstr( weapon, "molotov_" ) ) && meansofdeath == "MOD_GRENADE_SPLASH" ) + { + return 1; + } + else if ( ( meansofdeath == "MOD_BURNED" || meansofdeath == "MOD_GRENADE" ) && issubstr( weapon, "napalmblob_" ) ) + { + return 1; + } + else if ( issubstr( weapon, "napalmblob_" ) && meansofdeath == "MOD_GRENADE_SPLASH" ) { return 1; } return 0; } -isplayerexplosiveweapon( weapon, meansofdeath ) +isplayerexplosiveweapon( weapon, meansofdeath ) //checked matches cerberus output { if ( !isexplosivedamage( meansofdeath ) ) { @@ -3497,7 +3293,7 @@ isplayerexplosiveweapon( weapon, meansofdeath ) return 1; } -create_counter_hud( x ) +create_counter_hud( x ) //checked changed to match cerberus output { if ( !isDefined( x ) ) { @@ -3508,7 +3304,7 @@ create_counter_hud( x ) hud.aligny = "top"; hud.horzalign = "user_left"; hud.vertalign = "user_top"; - hud.color = ( 0, 0, 1 ); + hud.color = ( 1, 1, 1 ); hud.fontscale = 32; hud.x = x; hud.alpha = 0; @@ -3516,16 +3312,14 @@ create_counter_hud( x ) return hud; } -get_current_zone( return_zone ) +get_current_zone( return_zone ) //checked changed to match cerberus output { flag_wait( "zones_initialized" ); - z = 0; - while ( z < level.zone_keys.size ) + for ( z = 0; z < level.zone_keys.size; z++ ) { zone_name = level.zone_keys[ z ]; zone = level.zones[ zone_name ]; - i = 0; - while ( i < zone.volumes.size ) + for ( i = 0; i < zone.volumes.size; i++ ) { if ( self istouching( zone.volumes[ i ] ) ) { @@ -3535,53 +3329,49 @@ get_current_zone( return_zone ) } return zone_name; } - i++; } - z++; } return undefined; } -remove_mod_from_methodofdeath( mod ) +remove_mod_from_methodofdeath( mod ) //checked matches cerberus output { return mod; } -clear_fog_threads() +clear_fog_threads() //checked changed to match cerberus output { players = get_players(); - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { players[ i ] notify( "stop_fog" ); - i++; } } -display_message( titletext, notifytext, duration ) +display_message( titletext, notifytext, duration ) //checked changed to match cerberus output { notifydata = spawnstruct(); notifydata.titletext = notifytext; notifydata.notifytext = titletext; notifydata.sound = "mus_level_up"; notifydata.duration = duration; - notifydata.glowcolor = ( 0, 0, 1 ); - notifydata.color = ( 0, 0, 1 ); + notifydata.glowcolor = ( 1, 0, 0 ); + notifydata.color = ( 0, 0, 0 ); notifydata.iconname = "hud_zombies_meat"; self thread maps/mp/gametypes_zm/_hud_message::notifymessage( notifydata ); } -is_quad() +is_quad() //checked matches cerberus output { return self.animname == "quad_zombie"; } -is_leaper() +is_leaper() //checked matches cerberus output { return self.animname == "leaper_zombie"; } -shock_onpain() +shock_onpain() //checked changed to match cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -3591,29 +3381,27 @@ shock_onpain() { setdvar( "blurpain", "on" ); } - for ( ;; ) + while ( 1 ) { - while ( 1 ) + oldhealth = self.health; + self waittill( "damage", damage, attacker, direction_vec, point, mod ); + if ( isDefined( level.shock_onpain ) && !level.shock_onpain ) { - oldhealth = self.health; - self waittill( "damage", damage, attacker, direction_vec, point, mod ); - if ( isDefined( level.shock_onpain ) && !level.shock_onpain ) - { - continue; - } - if ( isDefined( self.shock_onpain ) && !self.shock_onpain ) - { - continue; - } - while ( self.health < 1 ) - { - continue; - } - if ( mod == "MOD_PROJECTILE" || mod == "MOD_PROJECTILE_SPLASH" ) - { - } + continue; } - else if ( mod != "MOD_GRENADE_SPLASH" || mod == "MOD_GRENADE" && mod == "MOD_EXPLOSIVE" ) + if ( isDefined( self.shock_onpain ) && !self.shock_onpain ) + { + continue; + } + if ( self.health < 1 ) + { + continue; + } + if ( mod == "MOD_PROJECTILE" || mod == "MOD_PROJECTILE_SPLASH" ) + { + continue; + } + else if ( mod == "MOD_GRENADE_SPLASH" || mod == "MOD_GRENADE" || mod == "MOD_EXPLOSIVE" ) { shocktype = undefined; shocklight = undefined; @@ -3623,19 +3411,15 @@ shock_onpain() shocklight = "lava_small"; } self shock_onexplosion( damage, shocktype, shocklight ); - continue; } - else + else if ( getDvar( "blurpain" ) == "on" ) { - if ( getDvar( "blurpain" ) == "on" ) - { - self shellshock( "pain", 0,5 ); - } + self shellshock( "pain", 0.5 ); } } } -shock_onexplosion( damage, shocktype, shocklight ) +shock_onexplosion( damage, shocktype, shocklight ) //checked changed to match cerberus output { time = 0; scaled_damage = ( 100 * damage ) / self.maxhealth; @@ -3651,12 +3435,9 @@ shock_onexplosion( damage, shocktype, shocklight ) { time = 2; } - else + else if ( scaled_damage > 10 ) { - if ( scaled_damage > 10 ) - { - time = 1; - } + time = 1; } if ( time ) { @@ -3666,17 +3447,15 @@ shock_onexplosion( damage, shocktype, shocklight ) } self shellshock( shocktype, time ); } - else + else if ( isDefined( shocklight ) ) { - if ( isDefined( shocklight ) ) - { - self shellshock( shocklight, time ); - } + self shellshock( shocklight, time ); } } -increment_is_drinking() +increment_is_drinking() //checked matches cerberus output { + /* /# if ( isDefined( level.devgui_dpad_watch ) && level.devgui_dpad_watch ) { @@ -3684,6 +3463,7 @@ increment_is_drinking() return; #/ } + */ if ( !isDefined( self.is_drinking ) ) { self.is_drinking = 0; @@ -3696,12 +3476,12 @@ increment_is_drinking() self.is_drinking++; } -is_multiple_drinking() +is_multiple_drinking() //checked matches cerberus output { return self.is_drinking > 1; } -decrement_is_drinking() +decrement_is_drinking() //checked matches cerberus output { if ( self.is_drinking > 0 ) { @@ -3710,9 +3490,11 @@ decrement_is_drinking() } else { + /* /# assertmsg( "making is_drinking less than 0" ); #/ + */ } if ( self.is_drinking == 0 ) { @@ -3721,18 +3503,20 @@ decrement_is_drinking() } } -clear_is_drinking() +clear_is_drinking() //checked matches cerberus output { self.is_drinking = 0; self enableoffhandweapons(); self enableweaponcycling(); } -getweaponclasszm( weapon ) +getweaponclasszm( weapon ) //checked matches cerberus output { + /* /# assert( isDefined( weapon ) ); #/ + */ if ( !isDefined( weapon ) ) { return undefined; @@ -3751,7 +3535,7 @@ getweaponclasszm( weapon ) return weaponclass; } -spawn_weapon_model( weapon, model, origin, angles, options ) +spawn_weapon_model( weapon, model, origin, angles, options ) //checked matches cerberus output { if ( !isDefined( model ) ) { @@ -3773,7 +3557,7 @@ spawn_weapon_model( weapon, model, origin, angles, options ) return weapon_model; } -is_limited_weapon( weapname ) +is_limited_weapon( weapname ) //checked matches cerberus output { if ( isDefined( level.limited_weapons ) ) { @@ -3785,7 +3569,7 @@ is_limited_weapon( weapname ) return 0; } -is_alt_weapon( weapname ) +is_alt_weapon( weapname ) //checked matches cerberus output { if ( getsubstr( weapname, 0, 3 ) == "gl_" ) { @@ -3802,17 +3586,14 @@ is_alt_weapon( weapname ) return 0; } -is_grenade_launcher( weapname ) +is_grenade_launcher( weapname ) //checked changed to match cerberus output { - if ( weapname != "m32_zm" ) - { - return weapname == "m32_upgraded_zm"; - } + return weapname == "m32_zm" || weapname == "m32_upgraded_zm"; } -register_lethal_grenade_for_level( weaponname ) +register_lethal_grenade_for_level( weaponname ) //checked changed at own discretion { - if ( is_lethal_grenade( weaponname ) ) + if ( !is_lethal_grenade( weaponname ) ) { return; } @@ -3823,7 +3604,7 @@ register_lethal_grenade_for_level( weaponname ) level.zombie_lethal_grenade_list[ weaponname ] = weaponname; } -is_lethal_grenade( weaponname ) +is_lethal_grenade( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( level.zombie_lethal_grenade_list ) ) { @@ -3832,7 +3613,7 @@ is_lethal_grenade( weaponname ) return isDefined( level.zombie_lethal_grenade_list[ weaponname ] ); } -is_player_lethal_grenade( weaponname ) +is_player_lethal_grenade( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( self.current_lethal_grenade ) ) { @@ -3841,7 +3622,7 @@ is_player_lethal_grenade( weaponname ) return self.current_lethal_grenade == weaponname; } -get_player_lethal_grenade() +get_player_lethal_grenade() //checked matches cerberus output { grenade = ""; if ( isDefined( self.current_lethal_grenade ) ) @@ -3851,19 +3632,19 @@ get_player_lethal_grenade() return grenade; } -set_player_lethal_grenade( weaponname ) +set_player_lethal_grenade( weaponname ) //checked matches cerberus output { self.current_lethal_grenade = weaponname; } -init_player_lethal_grenade() +init_player_lethal_grenade() //checked matches cerberus output { self set_player_lethal_grenade( level.zombie_lethal_grenade_player_init ); } -register_tactical_grenade_for_level( weaponname ) +register_tactical_grenade_for_level( weaponname ) //checked changed at own discretion { - if ( is_tactical_grenade( weaponname ) ) + if ( !is_tactical_grenade( weaponname ) ) { return; } @@ -3874,7 +3655,7 @@ register_tactical_grenade_for_level( weaponname ) level.zombie_tactical_grenade_list[ weaponname ] = weaponname; } -is_tactical_grenade( weaponname ) +is_tactical_grenade( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( level.zombie_tactical_grenade_list ) ) { @@ -3883,7 +3664,7 @@ is_tactical_grenade( weaponname ) return isDefined( level.zombie_tactical_grenade_list[ weaponname ] ); } -is_player_tactical_grenade( weaponname ) +is_player_tactical_grenade( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( self.current_tactical_grenade ) ) { @@ -3892,7 +3673,7 @@ is_player_tactical_grenade( weaponname ) return self.current_tactical_grenade == weaponname; } -get_player_tactical_grenade() +get_player_tactical_grenade() //checked matches cerberus output { tactical = ""; if ( isDefined( self.current_tactical_grenade ) ) @@ -3902,20 +3683,20 @@ get_player_tactical_grenade() return tactical; } -set_player_tactical_grenade( weaponname ) +set_player_tactical_grenade( weaponname ) //checked changed to match cerberus output { - self notify( "new_tactical_grenade" ); + self notify( "new_tactical_grenade", weaponname ); self.current_tactical_grenade = weaponname; } -init_player_tactical_grenade() +init_player_tactical_grenade() //checked matches cerberus output { self set_player_tactical_grenade( level.zombie_tactical_grenade_player_init ); } -register_placeable_mine_for_level( weaponname ) +register_placeable_mine_for_level( weaponname ) //checked changed at own discretion { - if ( is_placeable_mine( weaponname ) ) + if ( !is_placeable_mine( weaponname ) ) { return; } @@ -3926,7 +3707,7 @@ register_placeable_mine_for_level( weaponname ) level.zombie_placeable_mine_list[ weaponname ] = weaponname; } -is_placeable_mine( weaponname ) +is_placeable_mine( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( level.zombie_placeable_mine_list ) ) { @@ -3935,7 +3716,7 @@ is_placeable_mine( weaponname ) return isDefined( level.zombie_placeable_mine_list[ weaponname ] ); } -is_player_placeable_mine( weaponname ) +is_player_placeable_mine( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( self.current_placeable_mine ) ) { @@ -3944,24 +3725,24 @@ is_player_placeable_mine( weaponname ) return self.current_placeable_mine == weaponname; } -get_player_placeable_mine() +get_player_placeable_mine() //checked matches cerberus output { return self.current_placeable_mine; } -set_player_placeable_mine( weaponname ) +set_player_placeable_mine( weaponname ) //checked matches cerberus output { self.current_placeable_mine = weaponname; } -init_player_placeable_mine() +init_player_placeable_mine() //checked matches cerberus output { self set_player_placeable_mine( level.zombie_placeable_mine_player_init ); } -register_melee_weapon_for_level( weaponname ) +register_melee_weapon_for_level( weaponname ) //checked matches cerberus output { - if ( is_melee_weapon( weaponname ) ) + if ( !is_melee_weapon( weaponname ) ) { return; } @@ -3972,7 +3753,7 @@ register_melee_weapon_for_level( weaponname ) level.zombie_melee_weapon_list[ weaponname ] = weaponname; } -is_melee_weapon( weaponname ) +is_melee_weapon( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( level.zombie_melee_weapon_list ) ) { @@ -3981,7 +3762,7 @@ is_melee_weapon( weaponname ) return isDefined( level.zombie_melee_weapon_list[ weaponname ] ); } -is_player_melee_weapon( weaponname ) +is_player_melee_weapon( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( self.current_melee_weapon ) ) { @@ -3990,27 +3771,27 @@ is_player_melee_weapon( weaponname ) return self.current_melee_weapon == weaponname; } -get_player_melee_weapon() +get_player_melee_weapon() //checked matches cerberus output { return self.current_melee_weapon; } -set_player_melee_weapon( weaponname ) +set_player_melee_weapon( weaponname ) //checked matches cerberus output { self.current_melee_weapon = weaponname; } -init_player_melee_weapon() +init_player_melee_weapon() //checked matches cerberus output { self set_player_melee_weapon( level.zombie_melee_weapon_player_init ); } -should_watch_for_emp() +should_watch_for_emp() //checked matches cerberus output { return isDefined( level.zombie_weapons[ "emp_grenade_zm" ] ); } -register_equipment_for_level( weaponname ) +register_equipment_for_level( weaponname ) //checked matches cerberus output { if ( is_equipment( weaponname ) ) { @@ -4023,7 +3804,7 @@ register_equipment_for_level( weaponname ) level.zombie_equipment_list[ weaponname ] = weaponname; } -is_equipment( weaponname ) +is_equipment( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( level.zombie_equipment_list ) ) { @@ -4032,12 +3813,12 @@ is_equipment( weaponname ) return isDefined( level.zombie_equipment_list[ weaponname ] ); } -is_equipment_that_blocks_purchase( weaponname ) +is_equipment_that_blocks_purchase( weaponname ) //checked matches cerberus output { return is_equipment( weaponname ); } -is_player_equipment( weaponname ) +is_player_equipment( weaponname ) //checked matches cerberus output { if ( !isDefined( weaponname ) || !isDefined( self.current_equipment ) ) { @@ -4046,43 +3827,42 @@ is_player_equipment( weaponname ) return self.current_equipment == weaponname; } -has_deployed_equipment( weaponname ) +has_deployed_equipment( weaponname ) //checked changed to match cerberus output { - if ( isDefined( weaponname ) || !isDefined( self.deployed_equipment ) && self.deployed_equipment.size < 1 ) + if ( !isDefined( weaponname ) || !isDefined( self.deployed_equipment ) || self.deployed_equipment.size < 1 ) { return 0; } - i = 0; - while ( i < self.deployed_equipment.size ) + for ( i = 0; i < self.deployed_equipment.size; i++ ) { if ( self.deployed_equipment[ i ] == weaponname ) { return 1; } - i++; } return 0; } -has_player_equipment( weaponname ) +has_player_equipment( weaponname ) //checked changed at own discretion { - if ( !self is_player_equipment( weaponname ) ) + if ( self is_player_equipment( weaponname ) || self has_deployed_equipment( weaponname ) ) { - return self has_deployed_equipment( weaponname ); + return 1; } + return 0; } -get_player_equipment() +get_player_equipment() //checked matches cerberus output { return self.current_equipment; } -hacker_active() +hacker_active() //checked matches cerberus output { return self maps/mp/zombies/_zm_equipment::is_equipment_active( "equip_hacker_zm" ); } -set_player_equipment( weaponname ) +set_player_equipment( weaponname ) //checked matches cerberus output { if ( !isDefined( self.current_equipment_active ) ) { @@ -4103,12 +3883,12 @@ set_player_equipment( weaponname ) self.current_equipment = weaponname; } -init_player_equipment() +init_player_equipment() //checked matches cerberus output { self set_player_equipment( level.zombie_equipment_player_init ); } -register_offhand_weapons_for_level_defaults() +register_offhand_weapons_for_level_defaults() //checked matches cerberus output { if ( isDefined( level.register_offhand_weapons_for_level_defaults_override ) ) { @@ -4127,7 +3907,7 @@ register_offhand_weapons_for_level_defaults() level.zombie_equipment_player_init = undefined; } -init_player_offhand_weapons() +init_player_offhand_weapons() //checked matches cerberus output { init_player_lethal_grenade(); init_player_tactical_grenade(); @@ -4136,31 +3916,34 @@ init_player_offhand_weapons() init_player_equipment(); } -is_offhand_weapon( weaponname ) +is_offhand_weapon( weaponname ) //checked changed at own discretion { - if ( !is_lethal_grenade( weaponname ) && !is_tactical_grenade( weaponname ) && !is_placeable_mine( weaponname ) && !is_melee_weapon( weaponname ) ) + if ( is_lethal_grenade( weaponname ) || is_tactical_grenade( weaponname ) || is_placeable_mine( weaponname ) || is_melee_weapon( weaponname ) || is_equipment( weaponname ) ) { - return is_equipment( weaponname ); + return 1; } + return 0; } -is_player_offhand_weapon( weaponname ) +is_player_offhand_weapon( weaponname ) //checked changed at own discretion { - if ( !self is_player_lethal_grenade( weaponname ) && !self is_player_tactical_grenade( weaponname ) && !self is_player_placeable_mine( weaponname ) && !self is_player_melee_weapon( weaponname ) ) + if ( self is_player_lethal_grenade( weaponname ) || self is_player_tactical_grenade( weaponname ) || self is_player_placeable_mine( weaponname ) || self is_player_melee_weapon( weaponname ) || self is_player_equipment( weaponname ) ) { - return self is_player_equipment( weaponname ); + return 1; } + return 0; } -has_powerup_weapon() +has_powerup_weapon() //checked changed at own discretion { - if ( isDefined( self.has_powerup_weapon ) ) + if ( isDefined( self.has_powerup_weapon ) && self.has_powerup_weapon ) { - return self.has_powerup_weapon; + return 1; } + return 0; } -give_start_weapon( switch_to_weapon ) +give_start_weapon( switch_to_weapon ) //checked matches cerberus output { self giveweapon( level.start_weapon ); self givestartammo( level.start_weapon ); @@ -4170,7 +3953,7 @@ give_start_weapon( switch_to_weapon ) } } -array_flag_wait_any( flag_array ) +array_flag_wait_any( flag_array ) //checked changed to match cerberus output { if ( !isDefined( level._array_flag_wait_any_calls ) ) { @@ -4181,23 +3964,21 @@ array_flag_wait_any( flag_array ) level._n_array_flag_wait_any_calls++; } str_condition = "array_flag_wait_call_" + level._n_array_flag_wait_any_calls; - index = 0; - while ( index < flag_array.size ) + for ( index = 0; index < flag_array.size; index++ ) { level thread array_flag_wait_any_thread( flag_array[ index ], str_condition ); - index++; } level waittill( str_condition ); } -array_flag_wait_any_thread( flag_name, condition ) +array_flag_wait_any_thread( flag_name, condition ) //checked matches cerberus output { level endon( condition ); flag_wait( flag_name ); level notify( condition ); } -array_removedead( array ) +array_removedead( array ) //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { newarray = []; if ( !isDefined( array ) ) @@ -4212,38 +3993,35 @@ array_removedead( array ) i++; continue; } - else - { - newarray[ newarray.size ] = array[ i ]; - } + newarray[ newarray.size ] = array[ i ]; i++; } return newarray; } -groundpos( origin ) +groundpos( origin ) //checked matches cerberus output { - return bullettrace( origin, origin + vectorScale( ( 0, 0, 1 ), 100000 ), 0, self )[ "position" ]; + return bullettrace( origin, origin + vectorScale( ( 0, 0, -1 ), 100000 ), 0, self )[ "position" ]; } -groundpos_ignore_water( origin ) +groundpos_ignore_water( origin ) //checked matches cerberus output { - return bullettrace( origin, origin + vectorScale( ( 0, 0, 1 ), 100000 ), 0, self, 1 )[ "position" ]; + return bullettrace( origin, origin + vectorScale( ( 0, 0, -1 ), 100000 ), 0, self, 1 )[ "position" ]; } -groundpos_ignore_water_new( origin ) +groundpos_ignore_water_new( origin ) //checked matches cerberus output { - return groundtrace( origin, origin + vectorScale( ( 0, 0, 1 ), 100000 ), 0, self, 1 )[ "position" ]; + return groundtrace( origin, origin + vectorScale( ( 0, 0, -1 ), 100000 ), 0, self, 1 )[ "position" ]; } -waittill_notify_or_timeout( msg, timer ) +waittill_notify_or_timeout( msg, timer ) //checked matches cerberus output { self endon( msg ); wait timer; return timer; } -self_delete() +self_delete() //checked matches cerberus output { if ( isDefined( self ) ) { @@ -4251,25 +4029,22 @@ self_delete() } } -script_delay() +script_delay() //checked changed to match cerberus output { if ( isDefined( self.script_delay ) ) { wait self.script_delay; return 1; } - else + else if ( isDefined( self.script_delay_min ) && isDefined( self.script_delay_max ) ) { - if ( isDefined( self.script_delay_min ) && isDefined( self.script_delay_max ) ) - { - wait randomfloatrange( self.script_delay_min, self.script_delay_max ); - return 1; - } + wait randomfloatrange( self.script_delay_min, self.script_delay_max ); + return 1; } return 0; } -button_held_think( which_button ) +button_held_think( which_button ) //checked changed to match cerberus output { self endon( "disconnect" ); if ( !isDefined( self._holding_button ) ) @@ -4299,18 +4074,15 @@ button_held_think( which_button ) self._holding_button[ which_button ] = 1; } } - else + else if ( time_started != 0 ) { - if ( time_started != 0 ) - { - time_started = 0; - } + time_started = 0; } - wait 0,05; + wait 0.05; } } -use_button_held() +use_button_held() //checked matches cerberus output { init_button_wrappers(); if ( !isDefined( self._use_button_think_threaded ) ) @@ -4321,7 +4093,7 @@ use_button_held() return self._holding_button[ level.button_use ]; } -ads_button_held() +ads_button_held() //checked matches cerberus output { init_button_wrappers(); if ( !isDefined( self._ads_button_think_threaded ) ) @@ -4332,7 +4104,7 @@ ads_button_held() return self._holding_button[ level.button_ads ]; } -attack_button_held() +attack_button_held() //checked matches cerberus output { init_button_wrappers(); if ( !isDefined( self._attack_button_think_threaded ) ) @@ -4343,22 +4115,22 @@ attack_button_held() return self._holding_button[ level.button_attack ]; } -use_button_pressed() +use_button_pressed() //checked matches cerberus output { return self usebuttonpressed(); } -ads_button_pressed() +ads_button_pressed() //checked matches cerberus output { return self adsbuttonpressed(); } -attack_button_pressed() +attack_button_pressed() //checked matches cerberus output { return self attackbuttonpressed(); } -init_button_wrappers() +init_button_wrappers() //checked matches cerberus output { if ( !isDefined( level._button_funcs ) ) { @@ -4371,7 +4143,7 @@ init_button_wrappers() } } -wait_network_frame() +wait_network_frame() //checked partially changed to match cerberus output //did not change while loop to for loop { if ( numremoteclients() ) { @@ -4383,10 +4155,13 @@ wait_network_frame() acked = snapshotacknowledged( snapshot_ids ); } } - else wait 0,1; + else + { + wait 0.1; + } } -ignore_triggers( timer ) +ignore_triggers( timer ) //checked matches cerberus output { self endon( "death" ); self.ignoretriggers = 1; @@ -4396,12 +4171,12 @@ ignore_triggers( timer ) } else { - wait 0,5; + wait 0.5; } self.ignoretriggers = 0; } -giveachievement_wrapper( achievement, all_players ) +giveachievement_wrapper( achievement, all_players ) //checked changed to match cerberus output { if ( achievement == "" ) { @@ -4416,8 +4191,7 @@ giveachievement_wrapper( achievement, all_players ) if ( isDefined( all_players ) && all_players ) { players = get_players(); - i = 0; - while ( i < players.size ) + for ( i = 0; i < players.size; i++ ) { players[ i ] giveachievement( achievement ); has_achievement = players[ i ] maps/mp/zombies/_zm_stats::get_global_stat( achievement_lower ); @@ -4426,21 +4200,22 @@ giveachievement_wrapper( achievement, all_players ) global_counter++; } players[ i ] maps/mp/zombies/_zm_stats::increment_client_stat( achievement_lower, 0 ); - if ( issplitscreen() || i == 0 && !issplitscreen() ) + if ( issplitscreen() && i == 0 || !issplitscreen() ) { if ( isDefined( level.achievement_sound_func ) ) { players[ i ] thread [[ level.achievement_sound_func ]]( achievement_lower ); } } - i++; } } else if ( !isplayer( self ) ) { + /* /# println( "^1self needs to be a player for _utility::giveachievement_wrapper()" ); #/ + */ return; } self giveachievement( achievement ); @@ -4460,7 +4235,7 @@ giveachievement_wrapper( achievement, all_players ) } } -spawn_failed( spawn ) +spawn_failed( spawn ) //checked matches cerberus output { if ( isDefined( spawn ) && isalive( spawn ) ) { @@ -4472,28 +4247,30 @@ spawn_failed( spawn ) return 1; } -getyaw( org ) +getyaw( org ) //checked matches cerberus output { - angles = vectorToAngle( org - self.origin ); + angles = vectorToAngles( org - self.origin ); return angles[ 1 ]; } -getyawtospot( spot ) +getyawtospot( spot ) //checked matches cerberus output { pos = spot; yaw = self.angles[ 1 ] - getyaw( pos ); - yaw = angleClamp180( yaw ); + yaw = AbsAngleClamp180( yaw ); return yaw; } -add_spawn_function( function, param1, param2, param3, param4 ) +add_spawn_function( function, param1, param2, param3, param4 ) //checked matches cerberus output { + /* /# if ( isDefined( level._loadstarted ) ) { assert( !isalive( self ), "Tried to add_spawn_function to a living guy." ); } #/ + */ func = []; func[ "function" ] = function; func[ "param1" ] = param1; @@ -4507,25 +4284,29 @@ add_spawn_function( function, param1, param2, param3, param4 ) self.spawn_funcs[ self.spawn_funcs.size ] = func; } -disable_react() +disable_react() //checked matches cerberus output { + /* /# assert( isalive( self ), "Tried to disable react on a non ai" ); #/ + */ self.a.disablereact = 1; self.allowreact = 0; } -enable_react() +enable_react() //checked matches cerberus output { + /* /# assert( isalive( self ), "Tried to enable react on a non ai" ); #/ + */ self.a.disablereact = 0; self.allowreact = 1; } -flag_wait_or_timeout( flagname, timer ) +flag_wait_or_timeout( flagname, timer ) //not sure what to do here { start_time = getTime(); for ( ;; ) @@ -4545,18 +4326,18 @@ flag_wait_or_timeout( flagname, timer ) } } -wait_for_flag_or_time_elapses( flagname, timer ) +wait_for_flag_or_time_elapses( flagname, timer ) //checked matches cerberus output { level endon( flagname ); wait timer; } -isads( player ) +isads( player ) //checked matches cerberus output { - return player playerads() > 0,5; + return player playerads() > 0.5; } -bullet_attack( type ) +bullet_attack( type ) //checked matches cerberus output { if ( type == "MOD_PISTOL_BULLET" ) { @@ -4565,7 +4346,7 @@ bullet_attack( type ) return type == "MOD_RIFLE_BULLET"; } -pick_up() +pick_up() //checked matches cerberus output { player = self.owner; self destroy_ent(); @@ -4578,12 +4359,12 @@ pick_up() player setweaponammoclip( self.name, clip_ammo ); } -destroy_ent() +destroy_ent() //checked matches cerberus output { self delete(); } -waittill_not_moving() +waittill_not_moving() //checked changed to match cerberus output { self endon( "death" ); self endon( "disconnect" ); @@ -4593,29 +4374,26 @@ waittill_not_moving() { self waittill( "stationary" ); } - else prevorigin = self.origin; + prevorigin = self.origin; while ( 1 ) { - wait 0,15; + wait 0.15; if ( self.origin == prevorigin ) { return; } - else - { - prevorigin = self.origin; - } + prevorigin = self.origin; } } -get_closest_player( org ) +get_closest_player( org ) //checked matches cerberus output { players = []; players = get_players(); return getclosest( org, players ); } -ent_flag_wait( msg ) +ent_flag_wait( msg ) //checked matches cerberus output { self endon( "death" ); while ( !self.ent_flag[ msg ] ) @@ -4624,7 +4402,7 @@ ent_flag_wait( msg ) } } -ent_flag_wait_either( flag1, flag2 ) +ent_flag_wait_either( flag1, flag2 ) //no idea what to do here { self endon( "death" ); for ( ;; ) @@ -4641,13 +4419,13 @@ ent_flag_wait_either( flag1, flag2 ) } } -ent_wait_for_flag_or_time_elapses( flagname, timer ) +ent_wait_for_flag_or_time_elapses( flagname, timer ) //checked matches cerberus output { self endon( flagname ); wait timer; } -ent_flag_wait_or_timeout( flagname, timer ) +ent_flag_wait_or_timeout( flagname, timer ) //no idea what to do here { self endon( "death" ); start_time = getTime(); @@ -4668,7 +4446,7 @@ ent_flag_wait_or_timeout( flagname, timer ) } } -ent_flag_waitopen( msg ) +ent_flag_waitopen( msg ) //checked matches cerberus output { self endon( "death" ); while ( self.ent_flag[ msg ] ) @@ -4677,7 +4455,7 @@ ent_flag_waitopen( msg ) } } -ent_flag_init( message, val ) +ent_flag_init( message, val ) //checked matches cerberus output { if ( !isDefined( self.ent_flag ) ) { @@ -4686,27 +4464,33 @@ ent_flag_init( message, val ) } if ( !isDefined( level.first_frame ) ) { + /* /# assert( !isDefined( self.ent_flag[ message ] ), "Attempt to reinitialize existing flag '" + message + "' on entity." ); #/ + */ } if ( isDefined( val ) && val ) { self.ent_flag[ message ] = 1; + /* /# self.ent_flags_lock[ message ] = 1; #/ + */ } else { self.ent_flag[ message ] = 0; + /* /# self.ent_flags_lock[ message ] = 0; #/ + */ } } -ent_flag_exist( message ) +ent_flag_exist( message ) //checked matches cerberus output { if ( isDefined( self.ent_flag ) && isDefined( self.ent_flag[ message ] ) ) { @@ -4715,25 +4499,27 @@ ent_flag_exist( message ) return 0; } -ent_flag_set_delayed( message, delay ) +ent_flag_set_delayed( message, delay ) //checked matches cerberus output { wait delay; self ent_flag_set( message ); } -ent_flag_set( message ) +ent_flag_set( message ) //checked matches cerberus output { + /* /# assert( isDefined( self ), "Attempt to set a flag on entity that is not defined" ); assert( isDefined( self.ent_flag[ message ] ), "Attempt to set a flag before calling flag_init: '" + message + "'." ); assert( self.ent_flag[ message ] == self.ent_flags_lock[ message ] ); self.ent_flags_lock[ message ] = 1; #/ + */ self.ent_flag[ message ] = 1; self notify( message ); } -ent_flag_toggle( message ) +ent_flag_toggle( message ) //checked matches cerberus output { if ( self ent_flag( message ) ) { @@ -4745,14 +4531,16 @@ ent_flag_toggle( message ) } } -ent_flag_clear( message ) +ent_flag_clear( message ) //checked matches cerberus output { + /* /# assert( isDefined( self ), "Attempt to clear a flag on entity that is not defined" ); assert( isDefined( self.ent_flag[ message ] ), "Attempt to set a flag before calling flag_init: '" + message + "'." ); assert( self.ent_flag[ message ] == self.ent_flags_lock[ message ] ); self.ent_flags_lock[ message ] = 0; #/ + */ if ( self.ent_flag[ message ] ) { self.ent_flag[ message ] = 0; @@ -4760,20 +4548,22 @@ ent_flag_clear( message ) } } -ent_flag_clear_delayed( message, delay ) +ent_flag_clear_delayed( message, delay ) //checked matches cerberus output { wait delay; self ent_flag_clear( message ); } -ent_flag( message ) +ent_flag( message ) //checked matches cerberus output { + /* /# assert( isDefined( message ), "Tried to check flag but the flag was not defined." ); #/ /# assert( isDefined( self.ent_flag[ message ] ), "Tried to check entity flag '" + message + "', but the flag was not initialized." ); #/ + */ if ( !self.ent_flag[ message ] ) { return 0; @@ -4781,38 +4571,38 @@ ent_flag( message ) return 1; } -ent_flag_init_ai_standards() +ent_flag_init_ai_standards() //checked changed to match cerberus output { message_array = []; message_array[ message_array.size ] = "goal"; message_array[ message_array.size ] = "damage"; - i = 0; - while ( i < message_array.size ) + for ( i = 0; i < message_array.size; i++ ) { self ent_flag_init( message_array[ i ] ); self thread ent_flag_wait_ai_standards( message_array[ i ] ); - i++; } } -ent_flag_wait_ai_standards( message ) +ent_flag_wait_ai_standards( message ) //checked matches cerberus output { self endon( "death" ); self waittill( message ); self.ent_flag[ message ] = 1; } -flat_angle( angle ) +flat_angle( angle ) //checked matches cerberus output { rangle = ( 0, angle[ 1 ], 0 ); return rangle; } -waittill_any_or_timeout( timer, string1, string2, string3, string4, string5 ) +waittill_any_or_timeout( timer, string1, string2, string3, string4, string5 ) //checked matches cerberus output { + /* /# assert( isDefined( string1 ) ); #/ + */ self endon( string1 ); if ( isDefined( string2 ) ) { @@ -4833,7 +4623,7 @@ waittill_any_or_timeout( timer, string1, string2, string3, string4, string5 ) wait timer; } -clear_run_anim() +clear_run_anim() //checked matches cerberus output { self.alwaysrunforward = undefined; self.a.combatrunanim = undefined; @@ -4843,7 +4633,7 @@ clear_run_anim() self.precombatrunenabled = 1; } -track_players_intersection_tracker() +track_players_intersection_tracker() //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { self endon( "disconnect" ); self endon( "death" ); @@ -4861,69 +4651,62 @@ track_players_intersection_tracker() i++; continue; } - else + j = 0; + while ( j < players.size ) { - j = 0; - while ( j < players.size ) + if ( j == i || players[ j ] maps/mp/zombies/_zm_laststand::player_is_in_laststand() || players[ j ].sessionstate != "playing" ) { - if ( j != i || players[ j ] maps/mp/zombies/_zm_laststand::player_is_in_laststand() && players[ j ].sessionstate != "playing" ) + j++; + continue; + } + if ( isDefined( level.player_intersection_tracker_override ) ) + { + if ( players[ i ] [[ level.player_intersection_tracker_override ]]( players[ j ] ) ) { j++; continue; } - else - { - if ( isDefined( level.player_intersection_tracker_override ) ) - { - if ( players[ i ] [[ level.player_intersection_tracker_override ]]( players[ j ] ) ) - { - j++; - continue; - } - } - else playeri_origin = players[ i ].origin; - playerj_origin = players[ j ].origin; - if ( abs( playeri_origin[ 2 ] - playerj_origin[ 2 ] ) > 60 ) - { - j++; - continue; - } - else distance_apart = distance2d( playeri_origin, playerj_origin ); - if ( abs( distance_apart ) > 18 ) - { - j++; - continue; - } - else - { -/# - iprintlnbold( "PLAYERS ARE TOO FRIENDLY!!!!!" ); -#/ - players[ i ] dodamage( 1000, ( 0, 0, 1 ) ); - players[ j ] dodamage( 1000, ( 0, 0, 1 ) ); - if ( !killed_players ) - { - players[ i ] playlocalsound( level.zmb_laugh_alias ); - } - players[ i ] maps/mp/zombies/_zm_stats::increment_map_cheat_stat( "cheat_too_friendly" ); - players[ i ] maps/mp/zombies/_zm_stats::increment_client_stat( "cheat_too_friendly", 0 ); - players[ i ] maps/mp/zombies/_zm_stats::increment_client_stat( "cheat_total", 0 ); - players[ j ] maps/mp/zombies/_zm_stats::increment_map_cheat_stat( "cheat_too_friendly" ); - players[ j ] maps/mp/zombies/_zm_stats::increment_client_stat( "cheat_too_friendly", 0 ); - players[ j ] maps/mp/zombies/_zm_stats::increment_client_stat( "cheat_total", 0 ); - killed_players = 1; - } - } - j++; } + playeri_origin = players[ i ].origin; + playerj_origin = players[ j ].origin; + if ( abs( playeri_origin[ 2 ] - playerj_origin[ 2 ] ) > 60 ) + { + j++; + continue; + } + distance_apart = distance2d( playeri_origin, playerj_origin ); + if ( abs( distance_apart ) > 18 ) + { + j++; + continue; + } + /* +/# + iprintlnbold( "PLAYERS ARE TOO FRIENDLY!!!!!" ); +#/ + */ + players[ i ] dodamage( 1000, ( 0, 0, 1 ) ); + players[ j ] dodamage( 1000, ( 0, 0, 1 ) ); + if ( !killed_players ) + { + players[ i ] playlocalsound( level.zmb_laugh_alias ); + } + players[ i ] maps/mp/zombies/_zm_stats::increment_map_cheat_stat( "cheat_too_friendly" ); + players[ i ] maps/mp/zombies/_zm_stats::increment_client_stat( "cheat_too_friendly", 0 ); + players[ i ] maps/mp/zombies/_zm_stats::increment_client_stat( "cheat_total", 0 ); + players[ j ] maps/mp/zombies/_zm_stats::increment_map_cheat_stat( "cheat_too_friendly" ); + players[ j ] maps/mp/zombies/_zm_stats::increment_client_stat( "cheat_too_friendly", 0 ); + players[ j ] maps/mp/zombies/_zm_stats::increment_client_stat( "cheat_total", 0 ); + killed_players = 1; + j++; } i++; } - wait 0,5; + wait 0.5; } } -get_eye() +get_eye() //checked matches cerberus output { if ( isplayer( self ) ) { @@ -4941,21 +4724,23 @@ get_eye() return pos; } -is_player_looking_at( origin, dot, do_trace, ignore_ent ) +is_player_looking_at( origin, dot, do_trace, ignore_ent ) //checked matches cerberus output { + /* /# assert( isplayer( self ), "player_looking_at must be called on a player." ); #/ + */ if ( !isDefined( dot ) ) { - dot = 0,7; + dot = 0.7; } if ( !isDefined( do_trace ) ) { do_trace = 1; } eye = self get_eye(); - delta_vec = anglesToForward( vectorToAngle( origin - eye ) ); + delta_vec = anglesToForward( vectorToAngles( origin - eye ) ); view_vec = anglesToForward( self getplayerangles() ); new_dot = vectordot( delta_vec, view_vec ); if ( new_dot >= dot ) @@ -4972,15 +4757,15 @@ is_player_looking_at( origin, dot, do_trace, ignore_ent ) return 0; } -add_gametype( gt, dummy1, name, dummy2 ) +add_gametype( gt, dummy1, name, dummy2 ) //checked matches cerberus output { } -add_gameloc( gl, dummy1, name, dummy2 ) +add_gameloc( gl, dummy1, name, dummy2 ) //checked matches cerberus output { } -get_closest_index( org, array, dist ) +get_closest_index( org, array, dist ) //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { if ( !isDefined( dist ) ) { @@ -5001,17 +4786,14 @@ get_closest_index( org, array, dist ) i++; continue; } - else - { - distsq = newdistsq; - index = i; - } + distsq = newdistsq; + index = i; i++; } return index; } -is_valid_zombie_spawn_point( point ) +is_valid_zombie_spawn_point( point ) //checked matches cerberus output { liftedorigin = point.origin + vectorScale( ( 0, 0, 1 ), 5 ); size = 48; @@ -5027,7 +4809,7 @@ is_valid_zombie_spawn_point( point ) return 1; } -get_closest_index_to_entity( entity, array, dist, extra_check ) +get_closest_index_to_entity( entity, array, dist, extra_check ) //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { org = entity.origin; if ( !isDefined( dist ) ) @@ -5048,26 +4830,20 @@ get_closest_index_to_entity( entity, array, dist, extra_check ) i++; continue; } - else + newdistsq = distancesquared( array[ i ].origin, org ); + if ( newdistsq >= distsq ) { - newdistsq = distancesquared( array[ i ].origin, org ); - if ( newdistsq >= distsq ) - { - i++; - continue; - } - else - { - distsq = newdistsq; - index = i; - } + i++; + continue; } + distsq = newdistsq; + index = i; i++; } return index; } -set_gamemode_var( var, val ) +set_gamemode_var( var, val ) //checked matches cerberus output { if ( !isDefined( game[ "gamemode_match" ] ) ) { @@ -5076,7 +4852,7 @@ set_gamemode_var( var, val ) game[ "gamemode_match" ][ var ] = val; } -set_gamemode_var_once( var, val ) +set_gamemode_var_once( var, val ) //checked matches cerberus output { if ( !isDefined( game[ "gamemode_match" ] ) ) { @@ -5088,12 +4864,12 @@ set_gamemode_var_once( var, val ) } } -set_game_var( var, val ) +set_game_var( var, val ) //checked matches cerberus output { game[ var ] = val; } -set_game_var_once( var, val ) +set_game_var_once( var, val ) //checked matches cerberus output { if ( !isDefined( game[ var ] ) ) { @@ -5101,7 +4877,7 @@ set_game_var_once( var, val ) } } -get_game_var( var ) +get_game_var( var ) //checked matches cerberus output { if ( isDefined( game[ var ] ) ) { @@ -5110,7 +4886,7 @@ get_game_var( var ) return undefined; } -get_gamemode_var( var ) +get_gamemode_var( var ) //checked matches cerberus output { if ( isDefined( game[ "gamemode_match" ] ) && isDefined( game[ "gamemode_match" ][ var ] ) ) { @@ -5119,7 +4895,7 @@ get_gamemode_var( var ) return undefined; } -waittill_subset( min_num, string1, string2, string3, string4, string5 ) +waittill_subset( min_num, string1, string2, string3, string4, string5 ) //checked matches cerberus output { self endon( "death" ); ent = spawnstruct(); @@ -5160,49 +4936,46 @@ waittill_subset( min_num, string1, string2, string3, string4, string5 ) { break; } - else - { - } } ent notify( "die" ); } -is_headshot( sweapon, shitloc, smeansofdeath ) +is_headshot( sweapon, shitloc, smeansofdeath ) //checked changed at own diecretion { - if ( shitloc != "head" && shitloc != "helmet" ) + if ( shitloc == "head" && shitloc == "helmet" ) { - return 0; + return 1; } if ( smeansofdeath == "MOD_IMPACT" && issubstr( sweapon, "knife_ballistic" ) ) { return 1; } - if ( smeansofdeath != "MOD_MELEE" && smeansofdeath != "MOD_BAYONET" && smeansofdeath != "MOD_IMPACT" ) + if ( smeansofdeath != "MOD_MELEE" && smeansofdeath != "MOD_BAYONET" && smeansofdeath != "MOD_IMPACT" && smeansofdeath != "MOD_UNKNOWN" ) { - return smeansofdeath != "MOD_UNKNOWN"; + return 0; } } -is_jumping() +is_jumping() //checked matches cerberus output { ground_ent = self getgroundent(); return !isDefined( ground_ent ); } -is_explosive_damage( mod ) +is_explosive_damage( mod ) //checked changed to match cerberus output { if ( !isDefined( mod ) ) { return 0; } - if ( mod != "MOD_GRENADE" && mod != "MOD_GRENADE_SPLASH" && mod != "MOD_PROJECTILE" || mod == "MOD_PROJECTILE_SPLASH" && mod == "MOD_EXPLOSIVE" ) + if ( mod == "MOD_GRENADE" || mod == "MOD_GRENADE_SPLASH" || mod == "MOD_PROJECTILE" || mod == "MOD_PROJECTILE_SPLASH" || mod == "MOD_EXPLOSIVE" ) { return 1; } return 0; } -sndswitchannouncervox( who ) +sndswitchannouncervox( who ) //checked matches cerberus output { switch( who ) { @@ -5219,7 +4992,7 @@ sndswitchannouncervox( who ) } } -do_player_general_vox( category, type, timer, chance ) +do_player_general_vox( category, type, timer, chance ) //checked matches cerberus output { if ( isDefined( timer ) && isDefined( level.votimer[ type ] ) && level.votimer[ type ] > 0 ) { @@ -5240,12 +5013,14 @@ do_player_general_vox( category, type, timer, chance ) } } -general_vox_timer( timer, type ) +general_vox_timer( timer, type ) //checked matches cerberus output { level endon( "end_game" ); + /* /# println( "ZM >> VOX TIMER STARTED FOR " + type + " ( " + timer + ")" ); #/ + */ while ( timer > 0 ) { wait 1; @@ -5253,17 +5028,19 @@ general_vox_timer( timer, type ) } level.votimer[ type ] = timer; + /* /# println( "ZM >> VOX TIMER ENDED FOR " + type + " ( " + timer + ")" ); #/ + */ } -create_vox_timer( type ) +create_vox_timer( type ) //checked matches cerberus output { level.votimer[ type ] = 0; } -play_vox_to_player( category, type, force_variant ) +play_vox_to_player( category, type, force_variant ) //checked matches cerberus output { self thread maps/mp/zombies/_zm_audio::playvoxtoplayer( category, type, force_variant ); } @@ -5293,7 +5070,7 @@ add_vox_response_chance( event, chance ) level.response_chances[ event ] = chance; } -set_demo_intermission_point() +set_demo_intermission_point() //checked changed to match cerberus output { spawnpoints = getentarray( "mp_global_intermission", "classname" ); if ( !spawnpoints.size ) @@ -5303,52 +5080,42 @@ set_demo_intermission_point() spawnpoint = spawnpoints[ 0 ]; match_string = ""; location = level.scr_zm_map_start_location; - if ( location != "default" && location == "" && isDefined( level.default_start_location ) ) + if ( ( location != "default" || location == "" ) && isDefined( level.default_start_location ) ) { location = level.default_start_location; } - match_string = ( level.scr_zm_ui_gametype + "_" ) + location; - i = 0; - while ( i < spawnpoints.size ) + match_string = level.scr_zm_ui_gametype + "_" + location; + for ( i = 0; i < spawnpoints.size; i++ ) { - while ( isDefined( spawnpoints[ i ].script_string ) ) + if ( isDefined( spawnpoints[ i ].script_string ) ) { tokens = strtok( spawnpoints[ i ].script_string, " " ); - _a6214 = tokens; - _k6214 = getFirstArrayKey( _a6214 ); - while ( isDefined( _k6214 ) ) + foreach ( token in tokens ) { - token = _a6214[ _k6214 ]; if ( token == match_string ) { spawnpoint = spawnpoints[ i ]; i = spawnpoints.size; - i++; - continue; - } - else - { - _k6214 = getNextArrayKey( _a6214, _k6214 ); + break; } } } - i++; } setdemointermissionpoint( spawnpoint.origin, spawnpoint.angles ); } -register_map_navcard( navcard_on_map, navcard_needed_for_computer ) +register_map_navcard( navcard_on_map, navcard_needed_for_computer ) //checked matches cerberus output { level.navcard_needed = navcard_needed_for_computer; level.map_navcard = navcard_on_map; } -does_player_have_map_navcard( player ) +does_player_have_map_navcard( player ) //checked matches cerberus output { return player maps/mp/zombies/_zm_stats::get_global_stat( level.map_navcard ); } -does_player_have_correct_navcard( player ) +does_player_have_correct_navcard( player ) //checked matches cerberus output { if ( !isDefined( level.navcard_needed ) ) { @@ -5357,7 +5124,7 @@ does_player_have_correct_navcard( player ) return player maps/mp/zombies/_zm_stats::get_global_stat( level.navcard_needed ); } -place_navcard( str_model, str_stat, org, angles ) +place_navcard( str_model, str_stat, org, angles ) //checked changed to match cerberus output { navcard = spawn( "script_model", org ); navcard setmodel( str_model ); @@ -5375,18 +5142,14 @@ place_navcard( str_model, str_stat, org, angles ) navcard_pickup_trig waittill( "trigger", who ); if ( is_player_valid( who ) ) { - _a6274 = a_navcard_stats; - _k6274 = getFirstArrayKey( _a6274 ); - while ( isDefined( _k6274 ) ) + foreach ( str_cur_stat in a_navcard_stats ) { - str_cur_stat = _a6274[ _k6274 ]; if ( who maps/mp/zombies/_zm_stats::get_global_stat( str_cur_stat ) ) { str_placing_stat = str_cur_stat; is_holding_card = 1; who maps/mp/zombies/_zm_stats::set_global_stat( str_cur_stat, 0 ); } - _k6274 = getNextArrayKey( _a6274, _k6274 ); } who playsound( "zmb_buildable_piece_add" ); who maps/mp/zombies/_zm_stats::set_global_stat( str_stat, 1 ); @@ -5396,9 +5159,6 @@ place_navcard( str_model, str_stat, org, angles ) thread sq_refresh_player_navcard_hud(); break; } - else - { - } } navcard delete(); navcard_pickup_trig delete(); @@ -5408,29 +5168,24 @@ place_navcard( str_model, str_stat, org, angles ) } } -sq_refresh_player_navcard_hud() +sq_refresh_player_navcard_hud() //checked changed to match cerberus output { if ( !isDefined( level.navcards ) ) { return; } players = get_players(); - _a6311 = players; - _k6311 = getFirstArrayKey( _a6311 ); - while ( isDefined( _k6311 ) ) + foreach ( player in players ) { - player = _a6311[ _k6311 ]; player thread sq_refresh_player_navcard_hud_internal(); - _k6311 = getNextArrayKey( _a6311, _k6311 ); } } -sq_refresh_player_navcard_hud_internal() +sq_refresh_player_navcard_hud_internal() //checked changed to match cerberus output { self endon( "disconnect" ); navcard_bits = 0; - i = 0; - while ( i < level.navcards.size ) + for ( i = 0; i < level.navcards.size; i++ ) { hasit = self maps/mp/zombies/_zm_stats::get_global_stat( level.navcards[ i ] ); if ( isDefined( self.navcard_grabbed ) && self.navcard_grabbed == level.navcards[ i ] ) @@ -5439,9 +5194,8 @@ sq_refresh_player_navcard_hud_internal() } if ( hasit ) { - navcard_bits += 1 << i; + navcard_bits += 1; } - i++; } wait_network_frame(); self setclientfield( "navcard_held", 0 ); @@ -5452,7 +5206,7 @@ sq_refresh_player_navcard_hud_internal() } } -set_player_is_female( onoff ) +set_player_is_female( onoff ) //checked matches cerberus output { if ( isDefined( level.use_female_animations ) && level.use_female_animations ) { @@ -5469,7 +5223,7 @@ set_player_is_female( onoff ) } } -disable_player_move_states( forcestancechange ) +disable_player_move_states( forcestancechange ) //checked matches cerberus output { self allowcrouch( 1 ); self allowlean( 0 ); @@ -5486,7 +5240,7 @@ disable_player_move_states( forcestancechange ) } } -enable_player_move_states() +enable_player_move_states() //checked matches cerberus output { if ( !isDefined( self._allow_lean ) || self._allow_lean == 1 ) { @@ -5510,7 +5264,7 @@ enable_player_move_states() } } -check_and_create_node_lists() +check_and_create_node_lists() //checked matches cerberus output { if ( !isDefined( level._link_node_list ) ) { @@ -5522,7 +5276,7 @@ check_and_create_node_lists() } } -link_nodes( a, b, bdontunlinkonmigrate ) +link_nodes( a, b, bdontunlinkonmigrate ) //checked changed to match cerberus output { if ( !isDefined( bdontunlinkonmigrate ) ) { @@ -5551,12 +5305,14 @@ link_nodes( a, b, bdontunlinkonmigrate ) { if ( isDefined( level._unlink_node_list[ a_index_string ].links[ b_index_string ] ) ) { + level._unlink_node_list[a_index_string].links[b_index_string] = undefined; + level._unlink_node_list[a_index_string].ignore_on_migrate[b_index_string] = undefined; } } linknodes( a, b ); } -unlink_nodes( a, b, bdontlinkonmigrate ) +unlink_nodes( a, b, bdontlinkonmigrate ) //checked changed to match cerberus output { if ( !isDefined( bdontlinkonmigrate ) ) { @@ -5585,12 +5341,14 @@ unlink_nodes( a, b, bdontlinkonmigrate ) { if ( isDefined( level._link_node_list[ a_index_string ].links[ b_index_string ] ) ) { + level._link_node_list[a_index_string].links[b_index_string] = undefined; + level._link_node_list[a_index_string].ignore_on_migrate[b_index_string] = undefined; } } unlinknodes( a, b ); } -spawn_path_node( origin, angles, k1, v1, k2, v2 ) +spawn_path_node( origin, angles, k1, v1, k2, v2 ) //checked matches cerberus output { if ( !isDefined( level._spawned_path_nodes ) ) { @@ -5608,53 +5366,49 @@ spawn_path_node( origin, angles, k1, v1, k2, v2 ) return node.node; } -spawn_path_node_internal( origin, angles, k1, v1, k2, v2 ) +spawn_path_node_internal( origin, angles, k1, v1, k2, v2 ) //checked matches cerberus output { if ( isDefined( k2 ) ) { return spawnpathnode( "node_pathnode", origin, angles, k1, v1, k2, v2 ); } + else if ( isDefined( k1 ) ) + { + return spawnpathnode( "node_pathnode", origin, angles, k1, v1 ); + } else { - if ( isDefined( k1 ) ) - { - return spawnpathnode( "node_pathnode", origin, angles, k1, v1 ); - } - else - { - return spawnpathnode( "node_pathnode", origin, angles ); - } + return spawnpathnode( "node_pathnode", origin, angles ); } return undefined; } -delete_spawned_path_nodes() +delete_spawned_path_nodes() //checked matches cerberus output { } -respawn_path_nodes() +respawn_path_nodes() //checked changed to match cerberus output { if ( !isDefined( level._spawned_path_nodes ) ) { return; } - i = 0; - while ( i < level._spawned_path_nodes.size ) + for ( i = 0; i < level._spawned_path_nodes.size; i++ ) { node_struct = level._spawned_path_nodes[ i ]; + /* /# println( "Re-spawning spawned path node @ " + node_struct.origin ); #/ + */ node_struct.node = spawn_path_node_internal( node_struct.origin, node_struct.angles, node_struct.k1, node_struct.v1, node_struct.k2, node_struct.v2 ); - i++; } } -link_changes_internal_internal( list, func ) +link_changes_internal_internal( list, func ) //checked partially changed to match cerberus output //did not change while loop to for loop because continues in for loops go infinite { keys = getarraykeys( list ); - i = 0; - while ( i < keys.size ) + for ( i = 0; i < keys.size; i++ ) { node = list[ keys[ i ] ].node; node_keys = getarraykeys( list[ keys[ i ] ].links ); @@ -5665,45 +5419,49 @@ link_changes_internal_internal( list, func ) { if ( isDefined( list[ keys[ i ] ].ignore_on_migrate[ node_keys[ j ] ] ) && list[ keys[ i ] ].ignore_on_migrate[ node_keys[ j ] ] ) { + /* /# println( "Node at " + keys[ i ] + " to node at " + node_keys[ j ] + " - IGNORED" ); #/ + */ j++; continue; } - else - { + /* /# - println( "Node at " + keys[ i ] + " to node at " + node_keys[ j ] ); + println( "Node at " + keys[ i ] + " to node at " + node_keys[ j ] ); #/ - [[ func ]]( node, list[ keys[ i ] ].links[ node_keys[ j ] ] ); - } + */ + [[ func ]]( node, list[ keys[ i ] ].links[ node_keys[ j ] ] ); } j++; } - i++; } } -link_changes_internal( func_for_link_list, func_for_unlink_list ) +link_changes_internal( func_for_link_list, func_for_unlink_list ) //checked matches cerberus output { if ( isDefined( level._link_node_list ) ) { + /* /# println( "Link List" ); #/ + */ link_changes_internal_internal( level._link_node_list, func_for_link_list ); } if ( isDefined( level._unlink_node_list ) ) { + /* /# println( "UnLink List" ); #/ + */ link_changes_internal_internal( level._unlink_node_list, func_for_unlink_list ); } } -link_nodes_wrapper( a, b ) +link_nodes_wrapper( a, b ) //checked matches cerberus output { if ( !nodesarelinked( a, b ) ) { @@ -5711,7 +5469,7 @@ link_nodes_wrapper( a, b ) } } -unlink_nodes_wrapper( a, b ) +unlink_nodes_wrapper( a, b ) //checked matches cerberus output { if ( nodesarelinked( a, b ) ) { @@ -5719,29 +5477,33 @@ unlink_nodes_wrapper( a, b ) } } -undo_link_changes() +undo_link_changes() //checked matches cerberus output { + /* /# println( "***" ); println( "***" ); println( "*** Undoing link changes" ); #/ + */ link_changes_internal( ::unlink_nodes_wrapper, ::link_nodes_wrapper ); delete_spawned_path_nodes(); } -redo_link_changes() +redo_link_changes() //checked matches cerberus output { + /* /# println( "***" ); println( "***" ); println( "*** Redoing link changes" ); #/ + */ respawn_path_nodes(); link_changes_internal( ::link_nodes_wrapper, ::unlink_nodes_wrapper ); } -set_player_tombstone_index() +set_player_tombstone_index() //checked matches cerberus output { if ( !isDefined( level.tombstone_index ) ) { @@ -5754,7 +5516,7 @@ set_player_tombstone_index() } } -hotjoin_setup_player( viewmodel ) +hotjoin_setup_player( viewmodel ) //checked matches cerberus output { if ( is_true( level.passed_introscreen ) && !isDefined( self.first_spawn ) && !isDefined( self.characterindex ) ) { @@ -5765,43 +5527,42 @@ hotjoin_setup_player( viewmodel ) return 0; } -is_temporary_zombie_weapon( str_weapon ) +is_temporary_zombie_weapon( str_weapon ) //checked changed at own discretion { - if ( !is_zombie_perk_bottle( str_weapon ) && level.revive_tool != str_weapon && str_weapon != "zombie_builder_zm" && str_weapon != "chalk_draw_zm" && str_weapon != "no_hands_zm" ) + if ( is_zombie_perk_bottle(str_weapon) || str_weapon == level.revive_tool || str_weapon == "zombie_builder_zm" || str_weapon == "chalk_draw_zm" || str_weapon == "no_hands_zm" || str_weapon == level.machine_assets["packapunch"].weapon ) { - return str_weapon == level.machine_assets[ "packapunch" ].weapon; + return 1; } + return 0; } -is_gametype_active( a_gametypes ) +is_gametype_active( a_gametypes ) //checked changed to match cerberus output { b_is_gametype_active = 0; if ( !isarray( a_gametypes ) ) { a_gametypes = array( a_gametypes ); } - i = 0; - while ( i < a_gametypes.size ) + for ( i = 0; i < a_gametypes.size; i++ ) { if ( getDvar( "g_gametype" ) == a_gametypes[ i ] ) { b_is_gametype_active = 1; } - i++; } return b_is_gametype_active; } -is_createfx_active() +is_createfx_active() //checked changed at own discretion { if ( !isDefined( level.createfx_enabled ) ) { - level.createfx_enabled = getDvar( "createfx" ) != ""; + level.createfx_enabled = getDvar( "createfx" ); } return level.createfx_enabled; } -is_zombie_perk_bottle( str_weapon ) +is_zombie_perk_bottle( str_weapon ) //checked matches cerberus output { switch( str_weapon ) { @@ -5828,7 +5589,7 @@ is_zombie_perk_bottle( str_weapon ) return b_is_perk_bottle; } -register_custom_spawner_entry( spot_noteworthy, func ) +register_custom_spawner_entry( spot_noteworthy, func ) //checked matches cerberus output { if ( !isDefined( level.custom_spawner_entry ) ) { @@ -5837,7 +5598,7 @@ register_custom_spawner_entry( spot_noteworthy, func ) level.custom_spawner_entry[ spot_noteworthy ] = func; } -get_player_weapon_limit( player ) +get_player_weapon_limit( player ) //checked matches cerberus output { if ( isDefined( level.get_player_weapon_limit ) ) { @@ -5851,7 +5612,7 @@ get_player_weapon_limit( player ) return weapon_limit; } -get_player_perk_purchase_limit() +get_player_perk_purchase_limit() //checked matches cerberus output { if ( isDefined( level.get_player_perk_purchase_limit ) ) { @@ -5859,3 +5620,6 @@ get_player_perk_purchase_limit() } return level.perk_purchase_limit; } + + + diff --git a/patch_zm/readme.md b/patch_zm/readme.md index 84624c2..6803fc5 100644 --- a/patch_zm/readme.md +++ b/patch_zm/readme.md @@ -33,14 +33,13 @@ patch_zm/maps/mp/zombies/_zm_timer.gsc ### The following scripts compile and run successfully with major errors: ``` patch_zm/maps/mp/gametypes_zm/_zm_gametype.gsc -patch_zm/maps/mp/zombies/_zm_chugabud.gsc patch_zm/maps/mp/zombies/_zm_spawner.gsc +patch_zm/maps/mp/zombies/_zm_utility.gsc patch_zm/maps/mp/zombies/_zm_weapons.gsc ``` ### The following scripts compile and run serverside but clients cannot join due to exe_client_field_mismatch ``` patch_zm/maps/mp/zombies/_zm.gsc -patch_zm/maps/mp/zombies/_zm_equipment.gsc ``` ### The following scripts compile but cause a minidump or other severe error: ``` @@ -49,6 +48,7 @@ patch_zm/maps/mp/zombies/_zm_pers_upgrades_functions.gsc ``` ### The following scripts have been checked, but they have not been tested yet ``` +patch_zm/maps/mp/zombies/_zm_buildables.gsc patch_zm/maps/mp/zombies/_zm_game_module.gsc patch_zm/maps/mp/zombies/_zm_magicbox_lock.gsc patch_zm/maps/mp/zombies/_zm_playerhealth.gsc @@ -60,19 +60,19 @@ 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_buildables.gsc patch_zm/maps/mp/zombies/_zm_equip_turbine.gsc patch_zm/maps/mp/zombies/_zm_laststand.gsc patch_zm/maps/mp/zombies/_zm_sidequests.gsc patch_zm/maps/mp/zombies/_zm_stats.gsc patch_zm/maps/mp/zombies/_zm_unitrigger.gsc -patch_zm/maps/mp/zombies/_zm_utility.gsc ``` ### 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_chugabud.gsc +patch_zm/maps/mp/zombies/_zm_equipment.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_hackables_boards.gsc