diff --git a/scripts/zm/locs/zm_buried_loc_maze.gsc b/scripts/zm/locs/zm_buried_loc_maze.gsc index 6b2bcc56..131da0bf 100644 --- a/scripts/zm/locs/zm_buried_loc_maze.gsc +++ b/scripts/zm/locs/zm_buried_loc_maze.gsc @@ -94,7 +94,7 @@ struct_init() { if(isDefined(point.script_string) && isSubStr(point.script_string, "zgrief_maze")) { - scripts\zm\replaced\utility::register_map_initial_spawnpoint( point.origin, point.angles, point.script_int ); + scripts\zm\replaced\utility::register_map_spawn( point.origin, point.angles, "zone_maze", point.script_int ); } } diff --git a/scripts/zm/locs/zm_prison_loc_docks.gsc b/scripts/zm/locs/zm_prison_loc_docks.gsc index 200162ca..506bafa2 100644 --- a/scripts/zm/locs/zm_prison_loc_docks.gsc +++ b/scripts/zm/locs/zm_prison_loc_docks.gsc @@ -39,12 +39,12 @@ struct_init() origin = respawn.origin + (anglesToRight(respawn.angles) * 32); angles = respawn.angles; - scripts\zm\replaced\utility::register_map_initial_spawnpoint( origin, angles, script_int ); + scripts\zm\replaced\utility::register_map_spawn( origin, angles, respawnpoints[ind].script_noteworthy, script_int ); origin = respawn.origin + (anglesToRight(respawn.angles) * -32); angles = respawn.angles; - scripts\zm\replaced\utility::register_map_initial_spawnpoint( origin, angles, script_int ); + scripts\zm\replaced\utility::register_map_spawn( origin, angles, respawnpoints[ind].script_noteworthy, script_int ); i++; } diff --git a/scripts/zm/locs/zm_transit_loc_cornfield.gsc b/scripts/zm/locs/zm_transit_loc_cornfield.gsc index 6e142a4e..3eba3901 100644 --- a/scripts/zm/locs/zm_transit_loc_cornfield.gsc +++ b/scripts/zm/locs/zm_transit_loc_cornfield.gsc @@ -34,13 +34,13 @@ struct_init() angles = respawn.angles; script_int = 1; - scripts\zm\replaced\utility::register_map_initial_spawnpoint( origin, angles, script_int ); + scripts\zm\replaced\utility::register_map_spawn( origin, angles, respawnpoints[ind].script_noteworthy, script_int ); origin = respawn.origin + (anglesToRight(respawn.angles) * -32); angles = respawn.angles; script_int = 2; - scripts\zm\replaced\utility::register_map_initial_spawnpoint( origin, angles, script_int ); + scripts\zm\replaced\utility::register_map_spawn( origin, angles, respawnpoints[ind].script_noteworthy, script_int ); } structs = getstructarray( "game_mode_object", "targetname" ); diff --git a/scripts/zm/locs/zm_transit_loc_diner.gsc b/scripts/zm/locs/zm_transit_loc_diner.gsc index 33a7675c..f1d54037 100644 --- a/scripts/zm/locs/zm_transit_loc_diner.gsc +++ b/scripts/zm/locs/zm_transit_loc_diner.gsc @@ -33,7 +33,7 @@ struct_init() respawn.angles += (0, 180, 0); } - scripts\zm\replaced\utility::register_map_initial_spawnpoint( respawn.origin, respawn.angles, respawn.script_int ); + scripts\zm\replaced\utility::register_map_spawn( respawn.origin, respawn.angles, respawnpoints[ind].script_noteworthy, respawn.script_int ); } gameObjects = getEntArray( "script_model", "classname" ); diff --git a/scripts/zm/locs/zm_transit_loc_power.gsc b/scripts/zm/locs/zm_transit_loc_power.gsc index b10dab92..e87fe1da 100644 --- a/scripts/zm/locs/zm_transit_loc_power.gsc +++ b/scripts/zm/locs/zm_transit_loc_power.gsc @@ -17,14 +17,15 @@ struct_init() scripts\zm\replaced\utility::register_perk_struct( "specialty_scavenger", "zombie_vending_tombstone", ( 10946, 8308.77, -408 ), ( 0, 270, 0 ) ); scripts\zm\replaced\utility::register_perk_struct( "specialty_weapupgrade", "p6_anim_zm_buildable_pap_on", ( 12333, 8158, -752 ), ( 0, 180, 0 ) ); - scripts\zm\replaced\utility::register_map_initial_spawnpoint( (10160, 8060, -554), (0, 0, 0), 1 ); - scripts\zm\replaced\utility::register_map_initial_spawnpoint( (10160, 7996, -554), (0, 0, 0), 1 ); - scripts\zm\replaced\utility::register_map_initial_spawnpoint( (10160, 7932, -554), (0, 0, 0), 1 ); - scripts\zm\replaced\utility::register_map_initial_spawnpoint( (10160, 7868, -554), (0, 0, 0), 1 ); - scripts\zm\replaced\utility::register_map_initial_spawnpoint( (10160, 7772, -554), (0, 0, 0), 2 ); - scripts\zm\replaced\utility::register_map_initial_spawnpoint( (10160, 7708, -554), (0, 0, 0), 2 ); - scripts\zm\replaced\utility::register_map_initial_spawnpoint( (10160, 7644, -554), (0, 0, 0), 2 ); - scripts\zm\replaced\utility::register_map_initial_spawnpoint( (10160, 7580, -554), (0, 0, 0), 2 ); + zone = "zone_pow"; + scripts\zm\replaced\utility::register_map_spawn( (10160, 8060, -554), (0, 0, 0), zone, 1 ); + scripts\zm\replaced\utility::register_map_spawn( (10160, 7996, -554), (0, 0, 0), zone, 1 ); + scripts\zm\replaced\utility::register_map_spawn( (10160, 7932, -554), (0, 0, 0), zone, 1 ); + scripts\zm\replaced\utility::register_map_spawn( (10160, 7868, -554), (0, 0, 0), zone, 1 ); + scripts\zm\replaced\utility::register_map_spawn( (10160, 7772, -554), (0, 0, 0), zone, 2 ); + scripts\zm\replaced\utility::register_map_spawn( (10160, 7708, -554), (0, 0, 0), zone, 2 ); + scripts\zm\replaced\utility::register_map_spawn( (10160, 7644, -554), (0, 0, 0), zone, 2 ); + scripts\zm\replaced\utility::register_map_spawn( (10160, 7580, -554), (0, 0, 0), zone, 2 ); } precache() diff --git a/scripts/zm/locs/zm_transit_loc_tunnel.gsc b/scripts/zm/locs/zm_transit_loc_tunnel.gsc index 444f3cf5..ea8a298d 100644 --- a/scripts/zm/locs/zm_transit_loc_tunnel.gsc +++ b/scripts/zm/locs/zm_transit_loc_tunnel.gsc @@ -31,7 +31,7 @@ struct_init() respawn_array = getstructarray(respawnpoints[ind].target, "targetname"); foreach(respawn in respawn_array) { - scripts\zm\replaced\utility::register_map_initial_spawnpoint( respawn.origin, respawn.angles, respawn.script_int ); + scripts\zm\replaced\utility::register_map_spawn( respawn.origin, respawn.angles, respawnpoints[ind].script_noteworthy, respawn.script_int ); } } diff --git a/scripts/zm/replaced/utility.gsc b/scripts/zm/replaced/utility.gsc index 1b7d27fa..3e26e037 100644 --- a/scripts/zm/replaced/utility.gsc +++ b/scripts/zm/replaced/utility.gsc @@ -126,47 +126,56 @@ add_struct( s_struct ) register_perk_struct( name, model, origin, angles ) { perk_struct = spawnStruct(); + perk_struct.targetname = "zm_perk_machine"; + perk_struct.origin = origin; + perk_struct.angles = angles; perk_struct.script_noteworthy = name; perk_struct.model = model; - perk_struct.angles = angles; - perk_struct.origin = origin; - perk_struct.targetname = "zm_perk_machine"; if ( name == "specialty_weapupgrade" ) { flag_struct = spawnStruct(); flag_struct.targetname = "weapupgrade_flag_targ"; - flag_struct.model = "zombie_sign_please_wait"; - flag_struct.angles = angles + ( 0, 180, 180 ); flag_struct.origin = origin + ( anglesToForward( angles ) * 29 ) + ( anglesToRight( angles ) * -13.5 ) + ( anglesToUp( angles ) * 49.5 ); + flag_struct.angles = angles + ( 0, 180, 180 ); + flag_struct.model = "zombie_sign_please_wait"; perk_struct.target = flag_struct.targetname; + add_struct( flag_struct ); } add_struct( perk_struct ); } -register_map_initial_spawnpoint( origin, angles, team_num ) +register_map_spawn_point( origin, zone, dist ) { - spawnpoint_struct = spawnStruct(); - spawnpoint_struct.origin = origin; - if ( isDefined( angles ) ) + spawn_point_struct = spawnStruct(); + spawn_point_struct.targetname = "player_respawn_point"; + spawn_point_struct.origin = origin; + spawn_point_struct.locked = !zone_is_enabled( zone ); + spawn_point_struct.script_int = dist; + spawn_point_struct.script_noteworthy = zone; + spawn_point_struct.script_string = getDvar( "g_gametype" ) + "_" + getDvar( "ui_zm_mapstartlocation" ); + spawn_point_struct.target = zone + "_player_spawns"; + + add_struct( spawn_point_struct ); +} + +register_map_spawn( origin, angles, zone, team_num ) +{ + spawn_struct = spawnStruct(); + spawn_struct.targetname = zone + "_player_spawns"; + spawn_struct.origin = origin; + spawn_struct.angles = angles; + spawn_struct.script_string = getDvar( "g_gametype" ) + "_" + getDvar( "ui_zm_mapstartlocation" ); + + if ( isDefined( team_num ) ) { - spawnpoint_struct.angles = angles; + spawn_struct.script_noteworthy = "initial_spawn"; + spawn_struct.script_int = team_num; } - else - { - spawnpoint_struct.angles = ( 0, 0, 0 ); - } - spawnpoint_struct.radius = 32; - spawnpoint_struct.script_noteworthy = "initial_spawn"; - spawnpoint_struct.script_int = team_num; - spawnpoint_struct.script_string = getDvar( "g_gametype" ) + "_" + getDvar( "ui_zm_mapstartlocation" ); - spawnpoint_struct.locked = 0; - player_respawn_point_size = level.struct_class_names[ "targetname" ][ "player_respawn_point" ].size; - player_initial_spawnpoint_size = level.struct_class_names[ "script_noteworthy" ][ "initial_spawn" ].size; - level.struct_class_names[ "targetname" ][ "player_respawn_point" ][ player_respawn_point_size ] = spawnpoint_struct; - level.struct_class_names[ "script_noteworthy" ][ "initial_spawn" ][ player_initial_spawnpoint_size ] = spawnpoint_struct; + + add_struct( spawn_struct ); } wallbuy( weapon_name, target, targetname, origin, angles, play_chalk_fx = 1 ) diff --git a/scripts/zm/zm_transit/zm_transit_reimagined.gsc b/scripts/zm/zm_transit/zm_transit_reimagined.gsc index 8beb5de7..429d0bf5 100644 --- a/scripts/zm/zm_transit/zm_transit_reimagined.gsc +++ b/scripts/zm/zm_transit/zm_transit_reimagined.gsc @@ -344,19 +344,16 @@ player_respawn_override() else if (level.scr_zm_map_start_location == "town") { // North Town respawns - struct = spawnStruct(); - struct.targetname = "player_respawn_point"; - struct.origin = (1468.5, 703.5, -39.5); - struct.locked = 0; - struct.script_int = 5000; - struct.script_noteworthy = "zone_town_north"; - struct.target = struct.script_noteworthy + "_player_spawns"; + origin = (1468.5, 703.5, -39.5); + zone = "zone_town_north"; + dist = 5000; + + scripts\zm\replaced\utility::register_map_spawn_point(origin, zone, dist); respawn_array = []; for (i = 0; i < 8; i++) { respawn_array[i] = spawnStruct(); - respawn_array[i].targetname = struct.target; } respawn_array[0].origin = (1581, 666, -39.5); @@ -383,27 +380,22 @@ player_respawn_override() respawn_array[7].origin = (1356, 741, -39.5); respawn_array[7].angles = (0, 270, 0); - scripts\zm\replaced\utility::add_struct(struct); - foreach (respawn_struct in respawn_array) { - scripts\zm\replaced\utility::add_struct(respawn_struct); + scripts\zm\replaced\utility::register_map_spawn(respawn_struct.origin, respawn_struct.angles, zone); } // South Town respawns - struct = spawnStruct(); - struct.targetname = "player_respawn_point"; - struct.origin = (1424.5, -1426.5, -39.5); - struct.locked = 0; - struct.script_int = 5000; - struct.script_noteworthy = "zone_town_south"; - struct.target = struct.script_noteworthy + "_player_spawns"; + origin = (1424.5, -1426.5, -39.5); + zone = "zone_town_south"; + dist = 5000; + + scripts\zm\replaced\utility::register_map_spawn_point(origin, zone, dist); respawn_array = []; for (i = 0; i < 8; i++) { respawn_array[i] = spawnStruct(); - respawn_array[i].targetname = struct.target; } respawn_array[0].origin = (1312, -1389, -39.5); @@ -430,27 +422,22 @@ player_respawn_override() respawn_array[7].origin = (1537, -1464, -39.5); respawn_array[7].angles = (0, 90, 0); - scripts\zm\replaced\utility::add_struct(struct); - foreach (respawn_struct in respawn_array) { - scripts\zm\replaced\utility::add_struct(respawn_struct); + scripts\zm\replaced\utility::register_map_spawn(respawn_struct.origin, respawn_struct.angles, zone); } // East Town respawns - struct = spawnStruct(); - struct.targetname = "player_respawn_point"; - struct.origin = (2308.5, -461.5, -34); - struct.locked = 0; - struct.script_int = 5000; - struct.script_noteworthy = "zone_town_east"; - struct.target = struct.script_noteworthy + "_player_spawns"; + origin = (2308.5, -461.5, -34); + zone = "zone_town_east"; + dist = 5000; + + scripts\zm\replaced\utility::register_map_spawn_point(origin, zone, dist); respawn_array = []; for (i = 0; i < 8; i++) { respawn_array[i] = spawnStruct(); - respawn_array[i].targetname = struct.target; } respawn_array[0].origin = (2276, -559, -34); @@ -477,27 +464,22 @@ player_respawn_override() respawn_array[7].origin = (2341, -364, -34); respawn_array[7].angles = (0, 180, 0); - scripts\zm\replaced\utility::add_struct(struct); - foreach (respawn_struct in respawn_array) { - scripts\zm\replaced\utility::add_struct(respawn_struct); + scripts\zm\replaced\utility::register_map_spawn(respawn_struct.origin, respawn_struct.angles, zone); } // West Town respawns - struct = spawnStruct(); - struct.targetname = "player_respawn_point"; - struct.origin = (568.5, -446.5, -34); - struct.locked = 0; - struct.script_int = 5000; - struct.script_noteworthy = "zone_town_west"; - struct.target = struct.script_noteworthy + "_player_spawns"; + origin = (568.5, -446.5, -34); + zone = "zone_town_west"; + dist = 5000; + + scripts\zm\replaced\utility::register_map_spawn_point(origin, zone, dist); respawn_array = []; for (i = 0; i < 8; i++) { respawn_array[i] = spawnStruct(); - respawn_array[i].targetname = struct.target; } respawn_array[0].origin = (601, -349, -34); @@ -524,11 +506,9 @@ player_respawn_override() respawn_array[7].origin = (536, -544, -34); respawn_array[7].angles = (0, 0, 0); - scripts\zm\replaced\utility::add_struct(struct); - foreach (respawn_struct in respawn_array) { - scripts\zm\replaced\utility::add_struct(respawn_struct); + scripts\zm\replaced\utility::register_map_spawn(respawn_struct.origin, respawn_struct.angles, zone); } } }