mirror of
https://github.com/JezuzLizard/Recompilable-gscs-for-BO2-zombies-and-multiplayer.git
synced 2025-06-08 18:07:54 -05:00
Update _zm_zonemgr.gsc
Currently not thoroughly tested could have some bugs but functional. No Known Errors.
This commit is contained in:
parent
7c553f72c5
commit
833dcdaa92
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
init() //checked matches cerberus output
|
init() //checked matches cerberus output
|
||||||
{
|
{
|
||||||
|
//thread gsc_restart(); //new addition to test map_restart
|
||||||
flag_init( "zones_initialized" );
|
flag_init( "zones_initialized" );
|
||||||
level.zones = [];
|
level.zones = [];
|
||||||
level.zone_flags = [];
|
level.zone_flags = [];
|
||||||
@ -18,7 +19,7 @@ init() //checked matches cerberus output
|
|||||||
|
|
||||||
zone_is_enabled( zone_name ) //checked matches cerberus output
|
zone_is_enabled( zone_name ) //checked matches cerberus output
|
||||||
{
|
{
|
||||||
if ( isDefined( level.zones ) || !isDefined( level.zones[ zone_name ] ) || !level.zones[ zone_name ].is_enabled )
|
if ( !isDefined( level.zones ) || !isDefined( level.zones[ zone_name ] ) || !level.zones[ zone_name ].is_enabled )
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -164,11 +165,22 @@ zone_init( zone_name ) //checked changed to match cerberus output
|
|||||||
}
|
}
|
||||||
level.zones[ zone_name ] = spawnstruct();
|
level.zones[ zone_name ] = spawnstruct();
|
||||||
zone = level.zones[ zone_name ];
|
zone = level.zones[ zone_name ];
|
||||||
zone.is_enabled = 0;
|
zone.is_enabled = 1; //has to be one otherwise most maps won't accept connections
|
||||||
zone.is_occupied = 0;
|
zone.is_occupied = 0; //normally 0
|
||||||
zone.is_active = 0;
|
zone.is_active = 0; //normally 0
|
||||||
zone.adjacent_zones = [];
|
zone.adjacent_zones = [];
|
||||||
zone.is_spawning_allowed = 0;
|
zone.is_spawning_allowed = 0; //normally 0;
|
||||||
|
|
||||||
|
spawn_points = maps/mp/gametypes_zm/_zm_gametype::get_player_spawns_for_gametype();
|
||||||
|
for( i = 0; i < spawn_points.size; i++ )
|
||||||
|
{
|
||||||
|
if ( spawn_points[ i ].script_noteworthy == zone_name )
|
||||||
|
{
|
||||||
|
spawn_points[ i ].locked = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
zone.volumes = [];
|
zone.volumes = [];
|
||||||
volumes = getentarray( zone_name, "targetname" );
|
volumes = getentarray( zone_name, "targetname" );
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -200,7 +212,7 @@ zone_init( zone_name ) //checked changed to match cerberus output
|
|||||||
for (i = 0; i < spots.size; i++)
|
for (i = 0; i < spots.size; i++)
|
||||||
{
|
{
|
||||||
spots[ i ].zone_name = zone_name;
|
spots[ i ].zone_name = zone_name;
|
||||||
if(isdefined(spots[i].is_blocked ) && !spots[i].is_blocked)
|
if ( isDefined( spots[ i ].is_blocked ) && !spots[ i ].is_blocked || !isDefined( spots[ i ].is_blocked ) ) //spots[ i ].isblocked is not defined
|
||||||
{
|
{
|
||||||
spots[ i ].is_enabled = 1;
|
spots[ i ].is_enabled = 1;
|
||||||
}
|
}
|
||||||
@ -215,44 +227,47 @@ zone_init( zone_name ) //checked changed to match cerberus output
|
|||||||
{
|
{
|
||||||
zone.dog_locations[ zone.dog_locations.size ] = spots[ i ];
|
zone.dog_locations[ zone.dog_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
if(token == "screecher_location")
|
else if ( token == "screecher_location" )
|
||||||
{
|
{
|
||||||
zone.screecher_locations[ zone.screecher_locations.size ] = spots[ i ];
|
zone.screecher_locations[ zone.screecher_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
if(token == "avogadro_location")
|
else if ( token == "avogadro_location" )
|
||||||
{
|
{
|
||||||
zone.avogadro_locations[ zone.avogadro_locations.size ] = spots[ i] ;
|
zone.avogadro_locations[ zone.avogadro_locations.size ] = spots[ i] ;
|
||||||
}
|
}
|
||||||
if(token == "inert_location")
|
else if ( token == "inert_location" )
|
||||||
{
|
{
|
||||||
zone.inert_locations[ zone.inert_locations.size ] = spots[ i ];
|
zone.inert_locations[ zone.inert_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
if(token == "quad_location")
|
else if ( token == "quad_location" )
|
||||||
{
|
{
|
||||||
zone.quad_locations[ zone.quad_locations.size ] = spots[ i ];
|
zone.quad_locations[ zone.quad_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
if(token == "leaper_location")
|
else if ( token == "leaper_location" )
|
||||||
{
|
{
|
||||||
zone.leaper_locations[ zone.leaper_locations.size ] = spots[ i ];
|
zone.leaper_locations[ zone.leaper_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
if(token == "brutus_location")
|
else if ( token == "brutus_location" )
|
||||||
{
|
{
|
||||||
zone.brutus_locations[ zone.brutus_locations.size ] = spots[ i ];
|
zone.brutus_locations[ zone.brutus_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
if(token == "mechz_location")
|
else if ( token == "mechz_location" )
|
||||||
{
|
{
|
||||||
zone.mechz_locations[ zone.mechz_locations.size ] = spots[ i ];
|
zone.mechz_locations[ zone.mechz_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
if(token == "astro_location")
|
else if ( token == "astro_location" )
|
||||||
{
|
{
|
||||||
zone.astro_locations[ zone.astro_locations.size ] = spots[ i ];
|
zone.astro_locations[ zone.astro_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
if(token == "napalm_location")
|
else if ( token == "napalm_location" )
|
||||||
{
|
{
|
||||||
zone.napalm_locations[ zone.napalm_locations.size ] = spots[ i ];
|
zone.napalm_locations[ zone.napalm_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
zone.spawn_locations[ zone.spawn_locations.size ] = spots[ i ];
|
zone.spawn_locations[ zone.spawn_locations.size ] = spots[ i ];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ( isdefined( spots[ i ].script_string ) )
|
if ( isdefined( spots[ i ].script_string ) )
|
||||||
{
|
{
|
||||||
barricade_id = spots[ i ].script_string;
|
barricade_id = spots[ i ].script_string;
|
||||||
@ -294,7 +309,8 @@ zone_init( zone_name ) //checked changed to match cerberus output
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//unused code
|
||||||
|
/*
|
||||||
reinit_zone_spawners() //checked changed to match cerberus output
|
reinit_zone_spawners() //checked changed to match cerberus output
|
||||||
{
|
{
|
||||||
zkeys = getarraykeys( level.zones );
|
zkeys = getarraykeys( level.zones );
|
||||||
@ -332,52 +348,58 @@ reinit_zone_spawners() //checked changed to match cerberus output
|
|||||||
{
|
{
|
||||||
zone.dog_locations[ zone.dog_locations.size ] = spots[ j ];
|
zone.dog_locations[ zone.dog_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
if(token == "screecher_location")
|
else if ( token == "screecher_location" )
|
||||||
{
|
{
|
||||||
zone.screecher_locations[ zone.screecher_locations.size ] = spots[ j ];
|
zone.screecher_locations[ zone.screecher_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
if(token == "avogadro_location")
|
else if ( token == "avogadro_location" )
|
||||||
{
|
{
|
||||||
zone.avogadro_locations[ zone.avogadro_locations.size ] = spots[ j ];
|
zone.avogadro_locations[ zone.avogadro_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
if(token == "quad_location")
|
else if ( token == "quad_location" )
|
||||||
{
|
{
|
||||||
zone.quad_locations[ zone.quad_locations.size ] = spots[ j ];
|
zone.quad_locations[ zone.quad_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
if(token == "leaper_location")
|
else if ( token == "leaper_location" )
|
||||||
{
|
{
|
||||||
zone.leaper_locations[ zone.leaper_locations.size ] = spots[ j ];
|
zone.leaper_locations[ zone.leaper_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
if(token == "brutus_location")
|
else if ( token == "brutus_location" )
|
||||||
{
|
{
|
||||||
zone.brutus_locations[ zone.brutus_locations.size ] = spots[ j ];
|
zone.brutus_locations[ zone.brutus_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
if(token == "mechz_location")
|
else if ( token == "mechz_location" )
|
||||||
{
|
{
|
||||||
zone.mechz_locations[ zone.mechz_locations.size ] = spots[ j ];
|
zone.mechz_locations[ zone.mechz_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
if(token == "astro_location")
|
else if ( token == "astro_location" )
|
||||||
{
|
{
|
||||||
zone.astro_locations[ zone.astro_locations.size ] = spots[ j ];
|
zone.astro_locations[ zone.astro_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
if(token == "napalm_location")
|
else if ( token == "napalm_location" )
|
||||||
{
|
{
|
||||||
zone.napalm_locations[ zone.napalm_locations.size ] = spots[ j ];
|
zone.napalm_locations[ zone.napalm_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
zone.spawn_locations[ zone.spawn_locations.size ] = spots[ j ];
|
zone.spawn_locations[ zone.spawn_locations.size ] = spots[ j ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
enable_zone( zone_name ) //checked changed to match cerberus output
|
enable_zone( zone_name ) //checked changed to match cerberus output
|
||||||
{
|
{
|
||||||
|
//enable the zone even if its already enabled to get around the fact that zone_init() has to enable zones
|
||||||
|
/*
|
||||||
if ( level.zones[ zone_name ].is_enabled )
|
if ( level.zones[ zone_name ].is_enabled )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
level.zones[ zone_name ].is_enabled = 1;
|
level.zones[ zone_name ].is_enabled = 1;
|
||||||
level.zones[zone_name].is_spawning_allowed = 1;
|
level.zones[zone_name].is_spawning_allowed = 1;
|
||||||
level notify( zone_name );
|
level notify( zone_name );
|
||||||
@ -528,11 +550,11 @@ zone_flag_wait( flag_name )
|
|||||||
}
|
}
|
||||||
if ( flags_set )
|
if ( flags_set )
|
||||||
{
|
{
|
||||||
enable_zone( zkeys[ z ] );
|
enable_zone( zkeys[ z ] ); //essential priority over manage_zones //was disabled
|
||||||
azone.is_connected = 1;
|
azone.is_connected = 1;
|
||||||
if ( !level.zones[ azkeys[ az ] ].is_enabled )
|
if ( !level.zones[ azkeys[ az ] ].is_enabled )
|
||||||
{
|
{
|
||||||
enable_zone(azkeys[az]);
|
enable_zone( azkeys[ az ] ); //essential priority over manage_zones //was disabled
|
||||||
}
|
}
|
||||||
if ( flag( "door_can_close" ) )
|
if ( flag( "door_can_close" ) )
|
||||||
{
|
{
|
||||||
@ -542,6 +564,7 @@ zone_flag_wait( flag_name )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
keys = getarraykeys(level.zone_flags);
|
keys = getarraykeys(level.zone_flags);
|
||||||
for(i = 0; i < keys.size; i++)
|
for(i = 0; i < keys.size; i++)
|
||||||
{
|
{
|
||||||
@ -575,8 +598,8 @@ connect_zones( zone_name_a, zone_name_b, one_way ) //checked matches cerberus ou
|
|||||||
}
|
}
|
||||||
zone_init( zone_name_a );
|
zone_init( zone_name_a );
|
||||||
zone_init( zone_name_b );
|
zone_init( zone_name_b );
|
||||||
enable_zone( zone_name_a );
|
enable_zone( zone_name_a ); //was disabled
|
||||||
enable_zone( zone_name_b );
|
enable_zone( zone_name_b ); //was disabled
|
||||||
if ( !isDefined( level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ] ) )
|
if ( !isDefined( level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ] ) )
|
||||||
{
|
{
|
||||||
level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ] = spawnstruct();
|
level.zones[ zone_name_a ].adjacent_zones[ zone_name_b ] = spawnstruct();
|
||||||
@ -612,13 +635,13 @@ manage_zones( initial_zone ) //checked changed to match cerberus output
|
|||||||
for ( i = 0; i < initial_zone.size; i++ )
|
for ( i = 0; i < initial_zone.size; i++ )
|
||||||
{
|
{
|
||||||
zone_init( initial_zone[ i ] );
|
zone_init( initial_zone[ i ] );
|
||||||
enable_zone(initial_zone[i]);
|
enable_zone( initial_zone[ i ] ); //was disabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
zone_init( initial_zone );
|
zone_init( initial_zone );
|
||||||
enable_zone(initial_zone);
|
enable_zone( initial_zone ); //was disabled
|
||||||
}
|
}
|
||||||
setup_zone_flag_waits();
|
setup_zone_flag_waits();
|
||||||
zkeys = getarraykeys( level.zones );
|
zkeys = getarraykeys( level.zones );
|
||||||
@ -631,9 +654,13 @@ manage_zones( initial_zone ) //checked changed to match cerberus output
|
|||||||
oldzone = undefined;
|
oldzone = undefined;
|
||||||
flag_set( "zones_initialized" );
|
flag_set( "zones_initialized" );
|
||||||
flag_wait( "begin_spawning" );
|
flag_wait( "begin_spawning" );
|
||||||
|
|
||||||
while ( getDvarInt( "noclip" ) == 0 || getDvarInt( "notarget" ) != 0 )
|
while ( getDvarInt( "noclip" ) == 0 || getDvarInt( "notarget" ) != 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
players = get_players();
|
||||||
|
zone = players[ 0 ] get_current_zone();
|
||||||
|
players[ 0 ] iprintln( zone );
|
||||||
|
|
||||||
for( z = 0; z < zkeys.size; z++ )
|
for( z = 0; z < zkeys.size; z++ )
|
||||||
{
|
{
|
||||||
level.newzones[ zkeys[ z ] ].is_active = 0;
|
level.newzones[ zkeys[ z ] ].is_active = 0;
|
||||||
@ -688,7 +715,7 @@ manage_zones( initial_zone ) //checked changed to match cerberus output
|
|||||||
if ( zone_choke >= 3 )
|
if ( zone_choke >= 3 )
|
||||||
{
|
{
|
||||||
zone_choke = 0;
|
zone_choke = 0;
|
||||||
wait(0.05);
|
wait 0.05;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
level.zone_scanning_active = 0;
|
level.zone_scanning_active = 0;
|
||||||
@ -714,7 +741,7 @@ manage_zones( initial_zone ) //checked changed to match cerberus output
|
|||||||
}
|
}
|
||||||
[[ level.create_spawner_list_func ]]( zkeys );
|
[[ level.create_spawner_list_func ]]( zkeys );
|
||||||
level.active_zone_names = maps/mp/zombies/_zm_zonemgr::get_active_zone_names();
|
level.active_zone_names = maps/mp/zombies/_zm_zonemgr::get_active_zone_names();
|
||||||
wait(1);
|
wait 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -722,6 +749,8 @@ debug_show_spawn_locations() //checked dev call deleted
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//unused code
|
||||||
|
/*
|
||||||
old_manage_zones( initial_zone ) //checked changed to match cerberus output
|
old_manage_zones( initial_zone ) //checked changed to match cerberus output
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -816,10 +845,10 @@ old_manage_zones( initial_zone ) //checked changed to match cerberus output
|
|||||||
}
|
}
|
||||||
[[ level.create_spawner_list_func ]]( zkeys );
|
[[ level.create_spawner_list_func ]]( zkeys );
|
||||||
level.active_zone_names = maps/mp/zombies/_zm_zonemgr::get_active_zone_names();
|
level.active_zone_names = maps/mp/zombies/_zm_zonemgr::get_active_zone_names();
|
||||||
wait(1);
|
wait 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
create_spawner_list( zkeys ) //checked changed to match cerberus output
|
create_spawner_list( zkeys ) //checked changed to match cerberus output
|
||||||
{
|
{
|
||||||
level.zombie_spawn_locations = [];
|
level.zombie_spawn_locations = [];
|
||||||
@ -942,6 +971,8 @@ get_active_zone_names() //checked changed to match cerberus output
|
|||||||
return ret_list;
|
return ret_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//commented out
|
||||||
|
/*
|
||||||
_init_debug_zones() //checked changed to match cerberus output
|
_init_debug_zones() //checked changed to match cerberus output
|
||||||
{
|
{
|
||||||
current_y = 30;
|
current_y = 30;
|
||||||
@ -1061,21 +1092,44 @@ _debug_zones() //checked changed to match cerberus output
|
|||||||
wait(0.1);
|
wait(0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
is_player_in_zone( zone_name ) //checked changed to match cerberus output
|
is_player_in_zone( zone_name ) //checked changed to match cerberus output
|
||||||
{
|
{
|
||||||
zone = level.zones[ zone_name ];
|
zone = level.zones[ zone_name ];
|
||||||
i = 0;
|
i = 0;
|
||||||
while ( i < zone.volumes.size )
|
for(i = 0; i < zone.volumes.size; i++)
|
||||||
{
|
{
|
||||||
if ( self istouching( level.zones[ zone_name ].volumes[ i ] ) && self.sessionstate != "spectator" )
|
if(self istouching(level.zones[zone_name].volumes[i]) && !self.sessionstate == "spectator")
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
is_player_in_zone_zonemgr_usage( zone_name ) //added to fix is_player_in_zone not working for zonemgr purposes
|
||||||
|
{
|
||||||
|
zone = level.zones[ zone_name ];
|
||||||
|
i = 0;
|
||||||
|
players = get_players();
|
||||||
|
for ( i = 0; i < zone.volumes.size; i++ )
|
||||||
|
{
|
||||||
|
for ( k = 0; k < players.size; k++ )
|
||||||
|
{
|
||||||
|
if ( players[ k ] istouching( level.zones[ zone_name ].volumes[ i ] ) && !players[ k ].sessionstate == "spectator" )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
gsc_restart()
|
||||||
|
{
|
||||||
|
level waittill( "end_game" );
|
||||||
|
wait 3;
|
||||||
|
map_restart( false );
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user