diff --git a/scripts/zm/main/_zm_reimagined.gsc b/scripts/zm/main/_zm_reimagined.gsc index 49b97a51..a1b289d4 100644 --- a/scripts/zm/main/_zm_reimagined.gsc +++ b/scripts/zm/main/_zm_reimagined.gsc @@ -1,15 +1,21 @@ -#include maps/mp/gametypes_zm/_hud_util; -#include maps/mp/zombies/_zm_utility; -#include common_scripts/utility; -#include maps/mp/_utility; +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; +#include maps\mp\gametypes_zm\_hud_util; + +#include scripts/zm/replaced/_zm; +#include scripts/zm/replaced/_zm_playerhealth; +#include scripts/zm/replaced/_zm_utility; +#include scripts/zm/replaced/_zm_powerups; +#include scripts/zm/replaced/_zm_equipment; main() { - replaceFunc(maps/mp/zombies/_zm::check_quickrevive_for_hotjoin, ::check_quickrevive_for_hotjoin); - replaceFunc(maps/mp/zombies/_zm_playerhealth::playerhealthregen, ::playerhealthregen); - replaceFunc(maps/mp/zombies/_zm_utility::track_players_intersection_tracker, ::track_players_intersection_tracker); - replaceFunc(maps/mp/zombies/_zm_powerups::nuke_powerup, ::nuke_powerup); - replaceFunc(maps/mp/zombies/_zm_equipment::placed_equipment_think, ::placed_equipment_think); + replaceFunc(maps/mp/zombies/_zm::check_quickrevive_for_hotjoin, scripts/zm/replaced/_zm::check_quickrevive_for_hotjoin); + replaceFunc(maps/mp/zombies/_zm_playerhealth::playerhealthregen, scripts/zm/replaced/_zm_playerhealth::playerhealthregen); + replaceFunc(maps/mp/zombies/_zm_utility::track_players_intersection_tracker, scripts/zm/replaced/_zm_utility::track_players_intersection_tracker); + replaceFunc(maps/mp/zombies/_zm_powerups::nuke_powerup, scripts/zm/replaced/_zm_powerups::nuke_powerup); + replaceFunc(maps/mp/zombies/_zm_equipment::placed_equipment_think, scripts/zm/replaced/_zm_equipment::placed_equipment_think); } init() @@ -1636,375 +1642,6 @@ last_stand_restore_pistol_ammo() } } -check_quickrevive_for_hotjoin(disconnecting_player) -{ - // always use coop quick revive -} - -playerhealthregen() -{ - self notify( "playerHealthRegen" ); - self endon( "playerHealthRegen" ); - self endon( "death" ); - self endon( "disconnect" ); - - if ( !isDefined( self.flag ) ) - { - self.flag = []; - self.flags_lock = []; - } - - if ( !isDefined( self.flag[ "player_has_red_flashing_overlay" ] ) ) - { - self player_flag_init( "player_has_red_flashing_overlay" ); - self player_flag_init( "player_is_invulnerable" ); - } - - self player_flag_clear( "player_has_red_flashing_overlay" ); - self player_flag_clear( "player_is_invulnerable" ); - self thread maps/mp/zombies/_zm_playerhealth::healthoverlay(); - - level.playerhealth_regularregendelay = 2000; - level.longregentime = 4000; - - oldratio = 1; - veryhurt = 0; - playerjustgotredflashing = 0; - invultime = 0; - hurttime = 0; - newhealth = 0; - lastinvulratio = 1; - healthoverlaycutoff = 0.2; - - self thread maps/mp/zombies/_zm_playerhealth::playerhurtcheck(); - if ( !isDefined( self.veryhurt ) ) - { - self.veryhurt = 0; - } - self.bolthit = 0; - - if ( getDvar( "scr_playerInvulTimeScale" ) == "" ) - { - setdvar( "scr_playerInvulTimeScale", 1 ); - } - playerinvultimescale = getDvarFloat( "scr_playerInvulTimeScale" ); - - for ( ;; ) - { - wait 0.05; - waittillframeend; - - health_ratio = self.health / self.maxhealth; - maxhealthratio = self.maxhealth / 100; - regenrate = 0.05 / maxhealthratio; - regularregendelay = 2000; - longregendelay = 4000; - - has_revive = 0; - if (flag("solo_game")) - { - if (isDefined(self.bought_solo_revive) && self.bought_solo_revive) - { - has_revive = 1; - } - } - else - { - if (self hasPerk("specialty_quickrevive")) - { - has_revive = 1; - } - } - - if (has_revive) - { - regenrate *= 1.25; - regularregendelay *= 0.75; - longregendelay *= 0.75; - } - - if ( health_ratio > healthoverlaycutoff ) - { - if ( self player_flag( "player_has_red_flashing_overlay" ) ) - { - player_flag_clear( "player_has_red_flashing_overlay" ); - } - lastinvulratio = 1; - playerjustgotredflashing = 0; - veryhurt = 0; - - if ( self.health == self.maxhealth ) - { - continue; - } - } - else if ( self.health <= 0 ) - { - return; - } - - wasveryhurt = veryhurt; - - if ( health_ratio <= healthoverlaycutoff ) - { - veryhurt = 1; - if ( !wasveryhurt ) - { - hurttime = getTime(); - self player_flag_set( "player_has_red_flashing_overlay" ); - playerjustgotredflashing = 1; - } - } - - if ( self.hurtagain ) - { - hurttime = getTime(); - self.hurtagain = 0; - } - - if ( health_ratio >= oldratio ) - { - if ( ( getTime() - hurttime ) < regularregendelay ) - { - continue; - } - else - { - self.veryhurt = veryhurt; - newhealth = health_ratio; - if ( veryhurt ) - { - if ( ( getTime() - hurttime ) >= longregendelay ) - { - newhealth += regenrate; - } - } - else - { - newhealth += regenrate; - } - } - - if ( newhealth > 1 ) - { - newhealth = 1; - } - - if ( newhealth <= 0 ) - { - return; - } - - self setnormalhealth( newhealth ); - oldratio = self.health / self.maxhealth; - continue; - } - else - { - invulworthyhealthdrop = ( lastinvulratio - health_ratio ) > level.worthydamageratio; - } - - if ( self.health <= 1 ) - { - self setnormalhealth( 1 / self.maxhealth ); - invulworthyhealthdrop = 1; - } - - oldratio = self.health / self.maxhealth; - self notify( "hit_again" ); - hurttime = getTime(); - - if ( !invulworthyhealthdrop || playerinvultimescale <= 0 ) - { - continue; - } - else - { - if ( self player_flag( "player_is_invulnerable" ) ) - { - continue; - } - else - { - self player_flag_set( "player_is_invulnerable" ); - level notify( "player_becoming_invulnerable" ); - if ( playerjustgotredflashing ) - { - invultime = level.invultime_onshield; - playerjustgotredflashing = 0; - } - else if ( veryhurt ) - { - invultime = level.invultime_postshield; - } - else - { - invultime = level.invultime_preshield; - } - invultime *= playerinvultimescale; - lastinvulratio = self.health / self.maxhealth; - self thread maps/mp/zombies/_zm_playerhealth::playerinvul( invultime ); - } - } - } -} - -track_players_intersection_tracker() -{ - // BO2 has built in push mechanic -} - -nuke_powerup( drop_item, player_team ) -{ - location = drop_item.origin; - playfx( drop_item.fx, location ); - level thread maps/mp/zombies/_zm_powerups::nuke_flash( player_team ); - wait 0.5; - zombies = getaiarray( level.zombie_team ); - zombies = arraysort( zombies, location ); - zombies_nuked = []; - i = 0; - while ( i < zombies.size ) - { - if ( is_true( zombies[ i ].ignore_nuke ) ) - { - i++; - continue; - } - if ( is_true( zombies[ i ].marked_for_death ) ) - { - i++; - continue; - } - if ( isdefined( zombies[ i ].nuke_damage_func ) ) - { - zombies[ i ] thread [[ zombies[ i ].nuke_damage_func ]](); - i++; - continue; - } - if ( is_magic_bullet_shield_enabled( zombies[ i ] ) ) - { - i++; - continue; - } - zombies[ i ].marked_for_death = 1; - //imported from bo3 _zm_powerup_nuke.gsc - if ( !zombies[ i ].nuked && !is_magic_bullet_shield_enabled( zombies[ i ] ) ) - { - zombies[ i ].nuked = 1; - zombies_nuked[ zombies_nuked.size ] = zombies[ i ]; - } - i++; - } - i = 0; - while ( i < zombies_nuked.size ) - { - if ( !isdefined( zombies_nuked[ i ] ) ) - { - i++; - continue; - } - if ( is_magic_bullet_shield_enabled( zombies_nuked[ i ] ) ) - { - i++; - continue; - } - if ( i < 5 && !zombies_nuked[ i ].isdog ) - { - zombies_nuked[ i ] thread maps/mp/animscripts/zm_death::flame_death_fx(); - } - if ( !zombies_nuked[ i ].isdog ) - { - if ( !is_true( zombies_nuked[ i ].no_gib ) ) - { - zombies_nuked[ i ] maps/mp/zombies/_zm_spawner::zombie_head_gib(); - } - zombies_nuked[ i ] playsound("evt_nuked"); - } - zombies_nuked[ i ] dodamage(zombies_nuked[i].health + 666, zombies_nuked[ i ].origin ); - i++; - } - players = get_players( player_team ); - for ( i = 0; i < players.size; i++ ) - { - players[ i ] maps/mp/zombies/_zm_score::player_add_points( "nuke_powerup", 400 ); - } -} - -placed_equipment_think( model, equipname, origin, angles, tradius, toffset ) -{ - pickupmodel = spawn( "script_model", origin ); - if ( isDefined( angles ) ) - { - pickupmodel.angles = angles; - } - pickupmodel setmodel( model ); - if ( isDefined( level.equipment_safe_to_drop ) ) - { - if ( !( self [[ level.equipment_safe_to_drop ]]( pickupmodel ) ) ) - { - maps/mp/zombies/_zm_equipment::equipment_disappear_fx( pickupmodel.origin, undefined, pickupmodel.angles ); - pickupmodel delete(); - self maps/mp/zombies/_zm_equipment::equipment_take( equipname ); - return undefined; - } - } - watchername = getsubstr( equipname, 0, equipname.size - 3 ); - if ( isDefined( level.retrievehints[ watchername ] ) ) - { - hint = level.retrievehints[ watchername ].hint; - } - else - { - hint = &"MP_GENERIC_PICKUP"; - } - icon = maps/mp/zombies/_zm_equipment::get_equipment_icon( equipname ); - if ( !isDefined( tradius ) ) - { - tradius = 32; - } - torigin = origin; - if ( isDefined( toffset ) ) - { - tforward = anglesToForward( angles ); - torigin += toffset * tforward; - } - tup = anglesToUp( angles ); - eq_unitrigger_offset = 12 * tup; - pickupmodel.stub = maps/mp/zombies/_zm_equipment::generate_equipment_unitrigger( "trigger_radius_use", torigin + eq_unitrigger_offset, angles, 0, tradius, 64, hint, equipname, maps/mp/zombies/_zm_equipment::placed_equipment_unitrigger_think, pickupmodel.canmove ); - pickupmodel.stub.model = pickupmodel; - pickupmodel.stub.equipname = equipname; - pickupmodel.equipname = equipname; - //pickupmodel thread maps/mp/zombies/_zm_equipment::item_attract_zombies(); - pickupmodel thread item_watch_damage(); - if ( maps/mp/zombies/_zm_equipment::is_limited_equipment( equipname ) ) - { - if ( !isDefined( level.dropped_equipment ) ) - { - level.dropped_equipment = []; - } - if ( isDefined( level.dropped_equipment[ equipname ] ) && isDefined( level.dropped_equipment[ equipname ].model ) ) - { - level.dropped_equipment[ equipname ].model maps/mp/zombies/_zm_equipment::dropped_equipment_destroy( 1 ); - } - level.dropped_equipment[ equipname ] = pickupmodel.stub; - } - maps/mp/zombies/_zm_equipment::destructible_equipment_list_add( pickupmodel ); - return pickupmodel; -} - -item_watch_damage() -{ - self endon( "death" ); - self setcandamage( 1 ); - while ( 1 ) - { - self.health = 1000000; - self waittill( "damage", amount ); - self maps/mp/zombies/_zm_equipment::item_damage( amount ); - } -} - setscoreboardcolumns_gametype() { if(getDvar("g_gametype") == "zgrief") diff --git a/scripts/zm/main/_zm_reimagined_zgrief.gsc b/scripts/zm/main/_zm_reimagined_zgrief.gsc index fb90ce2d..5382813b 100644 --- a/scripts/zm/main/_zm_reimagined_zgrief.gsc +++ b/scripts/zm/main/_zm_reimagined_zgrief.gsc @@ -4,6 +4,11 @@ #include maps\mp\gametypes_zm\_hud_util; #include maps\mp\gametypes_zm\_hud_message; +#include scripts/zm/replaced/_zm; +#include scripts/zm/replaced/_zm_audio_announcer; +#include scripts/zm/replaced/_zm_game_module; +#include scripts/zm/replaced/_zm_blockers; + main() { if ( getDvar( "g_gametype" ) != "zgrief" ) @@ -11,10 +16,10 @@ main() return; } - replaceFunc(maps/mp/zombies/_zm::onallplayersready, ::onallplayersready); - replaceFunc(maps/mp/zombies/_zm_audio_announcer::playleaderdialogonplayer, ::playleaderdialogonplayer); - replaceFunc(maps/mp/zombies/_zm_game_module::wait_for_team_death_and_round_end, ::wait_for_team_death_and_round_end); - replaceFunc(maps/mp/zombies/_zm_blockers::handle_post_board_repair_rewards, ::handle_post_board_repair_rewards); + replaceFunc(maps/mp/zombies/_zm::onallplayersready, scripts/zm/replaced/_zm::onallplayersready); + replaceFunc(maps/mp/zombies/_zm_audio_announcer::playleaderdialogonplayer, scripts/zm/replaced/_zm_audio_announcer::playleaderdialogonplayer); + replaceFunc(maps/mp/zombies/_zm_game_module::wait_for_team_death_and_round_end, scripts/zm/replaced/_zm_game_module::wait_for_team_death_and_round_end); + replaceFunc(maps/mp/zombies/_zm_blockers::handle_post_board_repair_rewards, scripts/zm/replaced/_zm_blockers::handle_post_board_repair_rewards); } init() @@ -360,111 +365,6 @@ headstomp_watcher() } } -wait_for_team_death_and_round_end() -{ - level endon( "game_module_ended" ); - level endon( "end_game" ); - - checking_for_round_end = 0; - level.isresetting_grief = 0; - while ( 1 ) - { - cdc_total = 0; - cia_total = 0; - cdc_alive = 0; - cia_alive = 0; - players = get_players(); - i = 0; - while ( i < players.size ) - { - if ( !isDefined( players[ i ]._encounters_team ) ) - { - i++; - continue; - } - if ( players[ i ]._encounters_team == "A" ) - { - cia_total++; - if ( is_player_valid( players[ i ] ) ) - { - cia_alive++; - } - i++; - continue; - } - cdc_total++; - if ( is_player_valid( players[ i ] ) ) - { - cdc_alive++; - } - i++; - } - - if ( !checking_for_round_end ) - { - if ( cia_alive == 0 ) - { - level thread round_end( "B", cia_total == 0 ); - checking_for_round_end = 1; - } - else if ( cdc_alive == 0 ) - { - level thread round_end( "A", cdc_total == 0 ); - checking_for_round_end = 1; - } - } - - if ( cia_alive > 0 && cdc_alive > 0 ) - { - level notify( "stop_round_end_check" ); - checking_for_round_end = 0; - } - - wait 0.05; - } -} - -zombie_goto_round(target_round) -{ - level endon( "end_game" ); - - if ( target_round < 1 ) - { - target_round = 1; - } - - level.zombie_total = 0; - zombies = get_round_enemy_array(); - if ( isDefined( zombies ) ) - { - for ( i = 0; i < zombies.size; i++ ) - { - zombies[ i ] dodamage( zombies[ i ].health + 666, zombies[ i ].origin ); - } - } - - maps/mp/zombies/_zm_game_module::respawn_players(); - maps/mp/zombies/_zm::award_grenades_for_survivors(); - players = get_players(); - foreach(player in players) - { - if(player.score < level.player_starting_points) - { - player maps/mp/zombies/_zm_score::add_to_player_score(level.player_starting_points - player.score); - } - - if(isDefined(player get_player_placeable_mine())) - { - player giveweapon(player get_player_placeable_mine()); - player set_player_placeable_mine(player get_player_placeable_mine()); - player setactionslot(4, "weapon", player get_player_placeable_mine()); - player setweaponammoclip(player get_player_placeable_mine(), 2); - } - } - - level thread round_start_wait(5); -} - round_start_wait(time, initial) { if(!isDefined(initial)) @@ -606,106 +506,6 @@ zombie_spawn_wait(time) flag_set("spawn_zombies"); } -round_end(winner, force_win) -{ - if(!isDefined(force_win)) - { - force_win = false; - } - - winner_alive = 0; - team = "axis"; - if(winner == "B") - { - team = "allies"; - } - - if(!force_win) - { - wait 5; - } - - players = get_players(); - foreach(player in players) - { - if(is_player_valid(player) && player.team == team) - { - winner_alive = 1; - break; - } - } - - if(winner_alive) - { - level.grief_score[winner]++; - level.grief_hud.score[team] setValue(level.grief_score[winner]); - setteamscore(team, level.grief_score[winner]); - } - - if(level.grief_score[winner] == level.grief_winning_score || force_win) - { - level.gamemodulewinningteam = winner; - level.zombie_vars[ "spectators_respawn" ] = 0; - players = get_players(); - i = 0; - while ( i < players.size ) - { - players[ i ] freezecontrols( 1 ); - if ( players[ i ]._encounters_team == winner ) - { - players[ i ] thread maps/mp/zombies/_zm_audio_announcer::leaderdialogonplayer( "grief_won" ); - i++; - continue; - } - players[ i ] thread maps/mp/zombies/_zm_audio_announcer::leaderdialogonplayer( "grief_lost" ); - i++; - } - level notify( "game_module_ended", winner ); - level._game_module_game_end_check = undefined; - maps/mp/gametypes_zm/_zm_gametype::track_encounters_win_stats( level.gamemodulewinningteam ); - level notify( "end_game" ); - } - else - { - players = get_players(); - foreach(player in players) - { - // don't give score back from down - player.pers["score"] = player.score; - - if(is_player_valid(player)) - { - // don't give perk - player notify("perk_abort_drinking"); - // save weapons - player [[level._game_module_player_laststand_callback]](); - } - } - - level.isresetting_grief = 1; - level notify( "end_round_think" ); - level.zombie_vars[ "spectators_respawn" ] = 1; - level notify( "keep_griefing" ); - level notify( "restart_round" ); - - level.round_number++; - setroundsplayed(level.round_number); - - level thread maps/mp/zombies/_zm_audio_announcer::leaderdialog( "grief_restarted" ); - if(!winner_alive) - { - foreach(player in players) - { - player thread show_grief_hud_msg( &"ZOMBIE_GRIEF_RESET" ); - } - } - - zombie_goto_round( level.round_number ); - level thread maps/mp/zombies/_zm_game_module::reset_grief(); - level thread maps/mp/zombies/_zm::round_think( 1 ); - } -} - update_players_on_downed(excluded_player) { players_remaining = 0; @@ -1360,124 +1160,6 @@ unlimited_zombies() } } -onallplayersready() -{ - while ( getPlayers().size < getDvarInt( "zombies_minplayers" ) ) - { - wait 0.1; - } - game[ "state" ] = "playing"; - wait_for_all_players_to_connect( level.crash_delay ); - setinitialplayersconnected(); - flag_set( "initial_players_connected" ); - while ( !aretexturesloaded() ) - { - wait 0.05; - } - thread maps/mp/zombies/_zm::start_zombie_logic_in_x_sec( 3 ); - maps/mp/zombies/_zm::fade_out_intro_screen_zm( 5, 1.5, 1 ); -} - -wait_for_all_players_to_connect( max_wait ) -{ - timeout = int( max_wait * 10 ); - cur_time = 0; - player_count_actual = 0; - while ( getnumconnectedplayers() < getnumexpectedplayers() || player_count_actual != getnumexpectedplayers() ) - { - players = getPlayers(); - player_count_actual = 0; - for ( i = 0; i < players.size; i++ ) - { - players[ i ] freezecontrols( 1 ); - if ( players[ i ].sessionstate == "playing" ) - { - player_count_actual++; - } - } - wait 0.1; - cur_time++; - if ( cur_time >= timeout ) - { - return; - } - } -} - -playleaderdialogonplayer( dialog, team, waittime ) -{ - self endon( "disconnect" ); - - if ( level.allowzmbannouncer ) - { - if ( !isDefined( game[ "zmbdialog" ][ dialog ] ) ) - { - return; - } - } - self.zmbdialogactive = 1; - if ( isDefined( self.zmbdialoggroups[ dialog ] ) ) - { - group = dialog; - dialog = self.zmbdialoggroups[ group ]; - self.zmbdialoggroups[ group ] = undefined; - self.zmbdialoggroup = group; - } - if ( level.allowzmbannouncer ) - { - alias = game[ "zmbdialog" ][ "prefix" ] + "_" + game[ "zmbdialog" ][ dialog ]; - variant = self maps/mp/zombies/_zm_audio_announcer::getleaderdialogvariant( alias ); - if ( !isDefined( variant ) ) - { - full_alias = alias + "_" + "0"; - if ( level.script == "zm_prison" ) - { - dialogType = strtok( game[ "zmbdialog" ][ dialog ], "_" ); - switch ( dialogType[ 0 ] ) - { - case "powerup": - full_alias = alias; - break; - case "grief": - full_alias = alias + "_" + "0"; - break; - default: - full_alias = alias; - } - } - } - else - { - full_alias = alias + "_" + variant; - } - self playlocalsound( full_alias ); - } - - /* - if ( isDefined( waittime ) ) - { - wait waittime; - } - else - { - wait 4; - } - */ - - self.zmbdialogactive = 0; - self.zmbdialoggroup = ""; - if ( self.zmbdialogqueue.size > 0 && level.allowzmbannouncer ) - { - nextdialog = self.zmbdialogqueue[0]; - for( i = 1; i < self.zmbdialogqueue.size; i++ ) - { - self.zmbdialogqueue[ i - 1 ] = self.zmbdialogqueue[ i ]; - } - self.zmbdialogqueue[ i - 1 ] = undefined; - self thread playleaderdialogonplayer( nextdialog, team ); - } -} - zombie_damage( mod, hit_location, hit_origin, player, amount, team ) { if ( is_magic_bullet_shield_enabled( self ) ) @@ -1599,26 +1281,6 @@ zombie_damage( mod, hit_location, hit_origin, player, amount, team ) self thread maps/mp/zombies/_zm_powerups::check_for_instakill( player, mod, hit_location ); } -handle_post_board_repair_rewards( cost, zbarrier ) -{ - self maps/mp/zombies/_zm_stats::increment_client_stat( "boards" ); - self maps/mp/zombies/_zm_stats::increment_player_stat( "boards" ); - if ( isDefined( self.pers[ "boards" ] ) && ( self.pers[ "boards" ] % 10 ) == 0 ) - { - self thread do_player_general_vox( "general", "reboard", 90 ); - } - self maps/mp/zombies/_zm_pers_upgrades_functions::pers_boards_updated( zbarrier ); - self.rebuild_barrier_reward += cost; - - self maps/mp/zombies/_zm_score::player_add_points( "rebuild_board", cost ); - self play_sound_on_ent( "purchase" ); - - if ( isDefined( self.board_repair ) ) - { - self.board_repair += 1; - } -} - func_should_drop_meat() { players = get_players(); diff --git a/scripts/zm/replaced/_zm.gsc b/scripts/zm/replaced/_zm.gsc new file mode 100644 index 00000000..77a93024 --- /dev/null +++ b/scripts/zm/replaced/_zm.gsc @@ -0,0 +1,52 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +check_quickrevive_for_hotjoin(disconnecting_player) +{ + // always use coop quick revive +} + +onallplayersready() +{ + while ( getPlayers().size < getDvarInt( "zombies_minplayers" ) ) + { + wait 0.1; + } + game[ "state" ] = "playing"; + wait_for_all_players_to_connect( level.crash_delay ); + setinitialplayersconnected(); + flag_set( "initial_players_connected" ); + while ( !aretexturesloaded() ) + { + wait 0.05; + } + thread maps/mp/zombies/_zm::start_zombie_logic_in_x_sec( 3 ); + maps/mp/zombies/_zm::fade_out_intro_screen_zm( 5, 1.5, 1 ); +} + +wait_for_all_players_to_connect( max_wait ) +{ + timeout = int( max_wait * 10 ); + cur_time = 0; + player_count_actual = 0; + while ( getnumconnectedplayers() < getnumexpectedplayers() || player_count_actual != getnumexpectedplayers() ) + { + players = getPlayers(); + player_count_actual = 0; + for ( i = 0; i < players.size; i++ ) + { + players[ i ] freezecontrols( 1 ); + if ( players[ i ].sessionstate == "playing" ) + { + player_count_actual++; + } + } + wait 0.1; + cur_time++; + if ( cur_time >= timeout ) + { + return; + } + } +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_ai_brutus.gsc b/scripts/zm/replaced/_zm_ai_brutus.gsc new file mode 100644 index 00000000..2ce492b2 --- /dev/null +++ b/scripts/zm/replaced/_zm_ai_brutus.gsc @@ -0,0 +1,33 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +brutus_health_increases() +{ + if(level.scr_zm_ui_gametype == "zgrief") + { + return; + } + + if ( level.round_number > level.brutus_last_spawn_round ) + { + a_players = getplayers(); + n_player_modifier = 1; + if ( a_players.size > 1 ) + { + n_player_modifier = a_players.size * 0.75; + } + level.brutus_round_count++; + level.brutus_health = int( level.brutus_health_increase * n_player_modifier * level.brutus_round_count ); + level.brutus_expl_dmg_req = int( level.brutus_explosive_damage_increase * n_player_modifier * level.brutus_round_count ); + if ( level.brutus_health >= ( 5000 * n_player_modifier ) ) + { + level.brutus_health = int( 5000 * n_player_modifier ); + } + if ( level.brutus_expl_dmg_req >= ( 4500 * n_player_modifier ) ) + { + level.brutus_expl_dmg_req = int( 4500 * n_player_modifier ); + } + level.brutus_last_spawn_round = level.round_number; + } +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_audio_announcer.gsc b/scripts/zm/replaced/_zm_audio_announcer.gsc new file mode 100644 index 00000000..11560bd8 --- /dev/null +++ b/scripts/zm/replaced/_zm_audio_announcer.gsc @@ -0,0 +1,77 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +playleaderdialogonplayer( dialog, team, waittime ) +{ + self endon( "disconnect" ); + + if ( level.allowzmbannouncer ) + { + if ( !isDefined( game[ "zmbdialog" ][ dialog ] ) ) + { + return; + } + } + self.zmbdialogactive = 1; + if ( isDefined( self.zmbdialoggroups[ dialog ] ) ) + { + group = dialog; + dialog = self.zmbdialoggroups[ group ]; + self.zmbdialoggroups[ group ] = undefined; + self.zmbdialoggroup = group; + } + if ( level.allowzmbannouncer ) + { + alias = game[ "zmbdialog" ][ "prefix" ] + "_" + game[ "zmbdialog" ][ dialog ]; + variant = self maps/mp/zombies/_zm_audio_announcer::getleaderdialogvariant( alias ); + if ( !isDefined( variant ) ) + { + full_alias = alias + "_" + "0"; + if ( level.script == "zm_prison" ) + { + dialogType = strtok( game[ "zmbdialog" ][ dialog ], "_" ); + switch ( dialogType[ 0 ] ) + { + case "powerup": + full_alias = alias; + break; + case "grief": + full_alias = alias + "_" + "0"; + break; + default: + full_alias = alias; + } + } + } + else + { + full_alias = alias + "_" + variant; + } + self playlocalsound( full_alias ); + } + + /* + if ( isDefined( waittime ) ) + { + wait waittime; + } + else + { + wait 4; + } + */ + + self.zmbdialogactive = 0; + self.zmbdialoggroup = ""; + if ( self.zmbdialogqueue.size > 0 && level.allowzmbannouncer ) + { + nextdialog = self.zmbdialogqueue[0]; + for( i = 1; i < self.zmbdialogqueue.size; i++ ) + { + self.zmbdialogqueue[ i - 1 ] = self.zmbdialogqueue[ i ]; + } + self.zmbdialogqueue[ i - 1 ] = undefined; + self thread playleaderdialogonplayer( nextdialog, team ); + } +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_blockers.gsc b/scripts/zm/replaced/_zm_blockers.gsc new file mode 100644 index 00000000..dcaf0f0a --- /dev/null +++ b/scripts/zm/replaced/_zm_blockers.gsc @@ -0,0 +1,23 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +handle_post_board_repair_rewards( cost, zbarrier ) +{ + self maps/mp/zombies/_zm_stats::increment_client_stat( "boards" ); + self maps/mp/zombies/_zm_stats::increment_player_stat( "boards" ); + if ( isDefined( self.pers[ "boards" ] ) && ( self.pers[ "boards" ] % 10 ) == 0 ) + { + self thread do_player_general_vox( "general", "reboard", 90 ); + } + self maps/mp/zombies/_zm_pers_upgrades_functions::pers_boards_updated( zbarrier ); + self.rebuild_barrier_reward += cost; + + self maps/mp/zombies/_zm_score::player_add_points( "rebuild_board", cost ); + self play_sound_on_ent( "purchase" ); + + if ( isDefined( self.board_repair ) ) + { + self.board_repair += 1; + } +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_equip_electrictrap.gsc b/scripts/zm/replaced/_zm_equip_electrictrap.gsc new file mode 100644 index 00000000..35e60ec0 --- /dev/null +++ b/scripts/zm/replaced/_zm_equip_electrictrap.gsc @@ -0,0 +1,124 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +startelectrictrapdeploy( weapon ) +{ + self endon( "death" ); + self endon( "disconnect" ); + self endon( "equip_electrictrap_zm_taken" ); + self thread maps/mp/zombies/_zm_equip_electrictrap::watchforcleanup(); + electricradius = 45; + if ( !isDefined( self.electrictrap_health ) ) + { + self.electrictrap_health = 60; + } + if ( isDefined( weapon ) ) + { + weapon trap_power_on(); + if ( !weapon.power_on ) + { + self iprintlnbold( &"ZOMBIE_NEED_LOCAL_POWER" ); + } + self thread maps/mp/zombies/_zm_equip_electrictrap::electrictrapthink( weapon, electricradius ); + self thread maps/mp/zombies/_zm_equip_electrictrap::electrictrapdecay( weapon ); + self thread maps/mp/zombies/_zm_buildables::delete_on_disconnect( weapon ); + weapon waittill( "death" ); + if ( isDefined( level.electrap_sound_ent ) ) + { + level.electrap_sound_ent playsound( "wpn_zmb_electrap_stop" ); + level.electrap_sound_ent delete(); + level.electrap_sound_ent = undefined; + } + self notify( "etrap_cleanup" ); + } +} + +trap_power_on() +{ + self.power_on = 1; + self.power_on_time = getTime() - 2000; // activates the trap right away + self notify( "stop_attracting_zombies" ); + if ( !isDefined( level.electrap_sound_ent ) ) + { + level.electrap_sound_ent = spawn( "script_origin", self.origin ); + } + level.electrap_sound_ent playsound( "wpn_zmb_electrap_start" ); + level.electrap_sound_ent playloopsound( "wpn_zmb_electrap_loop", 2 ); + self thread maps/mp/zombies/_zm_equip_electrictrap::trapfx(); +} + +electrictrapthink( weapon, electricradius ) +{ + weapon endon( "death" ); + radiussquared = electricradius * electricradius; + while ( isDefined( weapon ) ) + { + if ( weapon.power_on ) + { + zombies = getaiarray( level.zombie_team ); + _a354 = zombies; + _k354 = getFirstArrayKey( _a354 ); + while ( isDefined( _k354 ) ) + { + zombie = _a354[ _k354 ]; + if ( isDefined( zombie ) && isalive( zombie ) ) + { + if ( isDefined( zombie.ignore_electric_trap ) && zombie.ignore_electric_trap ) + { + break; + } + else + { + if ( distancesquared( weapon.origin, zombie.origin ) < radiussquared ) + { + weapon maps/mp/zombies/_zm_equip_electrictrap::zap_zombie( zombie ); + wait 0.15; + } + maps/mp/zombies/_zm_equip_electrictrap::etrap_choke(); + } + } + _k354 = getNextArrayKey( _a354, _k354 ); + } + players = get_players(); + _a373 = players; + _k373 = getFirstArrayKey( _a373 ); + while ( isDefined( _k373 ) ) + { + player = _a373[ _k373 ]; + if ( is_player_valid( player ) && distancesquared( weapon.origin, player.origin ) < radiussquared ) + { + player thread maps/mp/zombies/_zm_traps::player_elec_damage(); + maps/mp/zombies/_zm_equip_electrictrap::etrap_choke(); + } + maps/mp/zombies/_zm_equip_electrictrap::etrap_choke(); + _k373 = getNextArrayKey( _a373, _k373 ); + } + } + wait 0.1; + } +} + +electrictrapdecay( weapon ) +{ + self endon( "death" ); + self endon( "disconnect" ); + self endon( "equip_electrictrap_zm_taken" ); + while ( isDefined( weapon ) ) + { + if ( weapon.power_on ) + { + self.electrictrap_health--; + + if ( self.electrictrap_health <= 0 ) + { + maps/mp/zombies/_zm_equipment::equipment_disappear_fx( weapon.origin, undefined, weapon.angles ); + self maps/mp/zombies/_zm_equip_electrictrap::cleanupoldtrap(); + self.electrictrap_health = undefined; + self thread maps/mp/zombies/_zm_equipment::equipment_release( level.electrictrap_name ); + return; + } + } + wait 1; + } +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_equip_subwoofer.gsc b/scripts/zm/replaced/_zm_equip_subwoofer.gsc new file mode 100644 index 00000000..f51babc7 --- /dev/null +++ b/scripts/zm/replaced/_zm_equip_subwoofer.gsc @@ -0,0 +1,265 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +startsubwooferdeploy( weapon, armed ) +{ + self endon( "death" ); + self endon( "disconnect" ); + self endon( "equip_subwoofer_zm_taken" ); + self thread maps/mp/zombies/_zm_equip_subwoofer::watchforcleanup(); + if ( isDefined( self.subwoofer_kills ) ) + { + weapon.subwoofer_kills = self.subwoofer_kills; + self.subwoofer_kills = undefined; + } + if ( !isDefined( weapon.subwoofer_kills ) ) + { + weapon.subwoofer_kills = 0; + } + if ( !isDefined( self.subwoofer_health ) ) + { + self.subwoofer_health = 60; + self.subwoofer_power_level = 4; + } + if ( isDefined( weapon ) ) + { + weapon subwoofer_power_on(); + if ( weapon.power_on ) + { + self thread maps/mp/zombies/_zm_equip_subwoofer::subwooferthink( weapon, armed ); + } + else + { + self iprintlnbold( &"ZOMBIE_NEED_LOCAL_POWER" ); + } + self thread startsubwooferdecay( weapon ); + self thread maps/mp/zombies/_zm_buildables::delete_on_disconnect( weapon ); + weapon waittill( "death" ); + if ( isDefined( level.subwoofer_sound_ent ) ) + { + level.subwoofer_sound_ent playsound( "wpn_zmb_electrap_stop" ); + level.subwoofer_sound_ent delete(); + level.subwoofer_sound_ent = undefined; + } + self notify( "subwoofer_cleanup" ); + } +} + +subwoofer_power_on() +{ + self.power_on = 1; + self.power_on_time = getTime(); + self.owner thread subwooferthink( self ); +} + +subwooferthink( weapon, armed ) +{ + self endon( "death" ); + self endon( "disconnect" ); + self endon( "equip_subwoofer_zm_taken" ); + weapon notify( "subwooferthink" ); + weapon endon( "subwooferthink" ); + weapon endon( "death" ); + direction_forward = anglesToForward( flat_angle( weapon.angles ) + vectorScale( ( 0, 0, 1 ), 30 ) ); + direction_vector = vectorScale( direction_forward, 512 ); + direction_origin = weapon.origin + direction_vector; + original_angles = weapon.angles; + original_origin = weapon.origin; + tag_spin_origin = weapon gettagorigin( "tag_spin" ); + wait 0.05; + while ( 1 ) + { + while ( isDefined( weapon.power_on ) && !weapon.power_on ) + { + wait 1; + } + wait 2; + if ( isDefined( weapon.power_on ) && !weapon.power_on ) + { + continue; + } + if ( !isDefined( level._subwoofer_choke ) ) + { + level thread maps/mp/zombies/_zm_equip_subwoofer::subwoofer_choke(); + } + while ( level._subwoofer_choke ) + { + wait 0.05; + } + level._subwoofer_choke++; + weapon.subwoofer_network_choke_count = 0; + weapon thread maps/mp/zombies/_zm_equipment::signal_equipment_activated( 1 ); + vibrateamplitude = 4; + if ( self.subwoofer_power_level == 3 ) + { + vibrateamplitude = 8; + } + else + { + if ( self.subwoofer_power_level == 2 ) + { + vibrateamplitude = 13; + } + } + if ( self.subwoofer_power_level == 1 ) + { + vibrateamplitude = 17; + } + weapon vibrate( vectorScale( ( 0, 0, 1 ), 100 ), vibrateamplitude, 0.2, 0.3 ); + zombies = get_array_of_closest( weapon.origin, get_round_enemy_array(), undefined, undefined, 1200 ); + players = get_array_of_closest( weapon.origin, get_players(), undefined, undefined, 1200 ); + props = get_array_of_closest( weapon.origin, getentarray( "subwoofer_target", "script_noteworthy" ), undefined, undefined, 1200 ); + entities = arraycombine( zombies, players, 0, 0 ); + entities = arraycombine( entities, props, 0, 0 ); + _a681 = entities; + _k681 = getFirstArrayKey( _a681 ); + while ( isDefined( _k681 ) ) + { + ent = _a681[ _k681 ]; + if ( !isDefined( ent ) || !isplayer( ent ) && isai( ent ) && !isalive( ent ) ) + { + } + else + { + if ( isDefined( ent.ignore_subwoofer ) && ent.ignore_subwoofer ) + { + break; + } + else + { + distanceentityandsubwoofer = distance2dsquared( original_origin, ent.origin ); + onlydamage = 0; + action = undefined; + if ( distanceentityandsubwoofer <= 32400 ) + { + action = "burst"; + } + else if ( distanceentityandsubwoofer <= 230400 ) + { + action = "fling"; + } + else if ( distanceentityandsubwoofer <= 1440000 ) + { + action = "stumble"; + } + else + { + } + if ( !within_fov( original_origin, original_angles, ent.origin, cos( 45 ) ) ) + { + if ( isplayer( ent ) ) + { + ent maps/mp/zombies/_zm_equip_subwoofer::hit_player( action, 0 ); + } + break; + } + else weapon maps/mp/zombies/_zm_equip_subwoofer::subwoofer_network_choke(); + ent_trace_origin = ent.origin; + if ( isai( ent ) || isplayer( ent ) ) + { + ent_trace_origin = ent geteye(); + } + if ( isDefined( ent.script_noteworthy ) && ent.script_noteworthy == "subwoofer_target" ) + { + ent_trace_origin += vectorScale( ( 0, 0, 1 ), 48 ); + } + if ( !sighttracepassed( tag_spin_origin, ent_trace_origin, 1, weapon ) ) + { + break; + } + else if ( isDefined( ent.script_noteworthy ) && ent.script_noteworthy == "subwoofer_target" ) + { + ent notify( "damaged_by_subwoofer" ); + break; + } + else + { + if ( isDefined( ent.in_the_ground ) && !ent.in_the_ground && isDefined( ent.in_the_ceiling ) && !ent.in_the_ceiling && isDefined( ent.ai_state ) || ent.ai_state == "zombie_goto_entrance" && isDefined( ent.completed_emerging_into_playable_area ) && !ent.completed_emerging_into_playable_area ) + { + onlydamage = 1; + } + if ( isplayer( ent ) ) + { + ent notify( "player_" + action ); + ent maps/mp/zombies/_zm_equip_subwoofer::hit_player( action, 1 ); + break; + } + else if ( isDefined( ent ) ) + { + ent notify( "zombie_" + action ); + shouldgib = distanceentityandsubwoofer <= 810000; + if ( action == "fling" ) + { + ent thread maps/mp/zombies/_zm_equip_subwoofer::fling_zombie( weapon, direction_vector / 4, self, onlydamage ); + weapon.subwoofer_kills++; + self thread maps/mp/zombies/_zm_audio::create_and_play_dialog( "kill", "subwoofer" ); + break; + } + else if ( action == "burst" ) + { + ent thread maps/mp/zombies/_zm_equip_subwoofer::burst_zombie( weapon, self ); + weapon.subwoofer_kills++; + self thread maps/mp/zombies/_zm_audio::create_and_play_dialog( "kill", "subwoofer" ); + break; + } + else + { + if ( action == "stumble" ) + { + ent thread maps/mp/zombies/_zm_equip_subwoofer::knockdown_zombie( weapon, shouldgib, onlydamage ); + } + } + } + } + } + } + _k681 = getNextArrayKey( _a681, _k681 ); + } + /* + if ( weapon.subwoofer_kills >= 45 ) + { + self thread subwoofer_expired( weapon ); + } + */ + } +} + +startsubwooferdecay( weapon ) +{ + self endon( "death" ); + self endon( "disconnect" ); + self endon( "equip_subwoofer_zm_taken" ); + while ( isDefined( weapon ) ) + { + if ( weapon.power_on ) + { + self.subwoofer_kills = 0; + self.subwoofer_health--; + + if ( self.subwoofer_health <= 0 ) + { + break; + } + } + wait 1; + } + + self thread maps/mp/zombies/_zm_equip_subwoofer::subwoofer_expired( weapon ); + + /* + if ( isDefined( weapon ) ) + { + self maps/mp/zombies/_zm_equip_subwoofer::destroy_placed_subwoofer(); + maps/mp/zombies/_zm_equip_subwoofer::subwoofer_disappear_fx( weapon ); + } + self thread maps/mp/zombies/_zm_equip_subwoofer::wait_and_take_equipment(); + self.subwoofer_health = undefined; + self.subwoofer_power_level = undefined; + self.subwoofer_round_start = undefined; + self.subwoofer_power_on = undefined; + self.subwoofer_emped = undefined; + self.subwoofer_emp_time = undefined; + self maps/mp/zombies/_zm_equip_subwoofer::cleanupoldsubwoofer(); + */ +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_equip_turret.gsc b/scripts/zm/replaced/_zm_equip_turret.gsc new file mode 100644 index 00000000..7b55e50c --- /dev/null +++ b/scripts/zm/replaced/_zm_equip_turret.gsc @@ -0,0 +1,116 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +startturretdeploy( weapon ) +{ + self endon( "death" ); + self endon( "disconnect" ); + self endon( "equip_turret_zm_taken" ); + self thread maps/mp/zombies/_zm_equip_turret::watchforcleanup(); + if ( !isDefined( self.turret_health ) ) + { + self.turret_health = 60; + } + if ( isDefined( weapon ) ) + { + weapon hide(); + wait 0.1; + if ( isDefined( weapon.power_on ) && weapon.power_on ) + { + weapon.turret notify( "stop_burst_fire_unmanned" ); + } + if ( !isDefined( weapon ) ) + { + return; + } + if ( isDefined( self.turret ) ) + { + self.turret notify( "stop_burst_fire_unmanned" ); + self.turret notify( "turret_deactivated" ); + self.turret delete(); + } + turret = spawnturret( "misc_turret", weapon.origin, "zombie_bullet_crouch_zm" ); + turret.turrettype = "sentry"; + turret setturrettype( turret.turrettype ); + turret setmodel( "p6_anim_zm_buildable_turret" ); + turret.origin = weapon.origin; + turret.angles = weapon.angles; + turret linkto( weapon ); + turret makeunusable(); + turret.owner = self; + turret setowner( turret.owner ); + turret maketurretunusable(); + turret setmode( "auto_nonai" ); + turret setdefaultdroppitch( 45 ); + turret setconvergencetime( 0.3 ); + turret setturretteam( self.team ); + turret.team = self.team; + turret.damage_own_team = 0; + turret.turret_active = 1; + weapon.turret = turret; + self.turret = turret; + weapon turret_power_on(); + if ( weapon.power_on ) + { + turret thread maps/mp/zombies/_zm_mgturret::burst_fire_unmanned(); + } + else + { + self iprintlnbold( &"ZOMBIE_NEED_LOCAL_POWER" ); + } + self thread turretdecay( weapon ); + self thread maps/mp/zombies/_zm_buildables::delete_on_disconnect( weapon ); + weapon waittill("death"); + if ( isDefined( self.buildableturret.sound_ent ) ) + { + self.buildableturret.sound_ent playsound( "wpn_zmb_turret_stop" ); + self.buildableturret.sound_ent delete(); + self.buildableturret.sound_ent = undefined; + } + if ( isDefined( turret ) ) + { + turret notify( "stop_burst_fire_unmanned" ); + turret notify( "turret_deactivated" ); + turret delete(); + } + self.turret = undefined; + self notify( "turret_cleanup" ); + } +} + +turret_power_on() +{ + self.power_on = 1; + self.turret thread maps/mp/zombies/_zm_mgturret::burst_fire_unmanned(); + player = self.turret.owner; + if ( !isDefined( player.buildableturret.sound_ent ) ) + { + player.buildableturret.sound_ent = spawn( "script_origin", self.turret.origin ); + } + player.buildableturret.sound_ent playsound( "wpn_zmb_turret_start" ); + player.buildableturret.sound_ent playloopsound( "wpn_zmb_turret_loop", 2 ); +} + +turretdecay( weapon ) +{ + self endon( "death" ); + self endon( "disconnect" ); + self endon( "equip_turret_zm_taken" ); + while ( isDefined( weapon ) ) + { + if ( weapon.power_on ) + { + self.turret_health--; + + if ( self.turret_health <= 0 ) + { + maps/mp/zombies/_zm_equipment::equipment_disappear_fx( weapon.origin, undefined, weapon.angles ); + self maps/mp/zombies/_zm_equip_turret::cleanupoldturret(); + self thread maps/mp/zombies/_zm_equipment::equipment_release( level.turret_name ); + return; + } + } + wait 1; + } +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_equipment.gsc b/scripts/zm/replaced/_zm_equipment.gsc new file mode 100644 index 00000000..f1ac0039 --- /dev/null +++ b/scripts/zm/replaced/_zm_equipment.gsc @@ -0,0 +1,77 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +placed_equipment_think( model, equipname, origin, angles, tradius, toffset ) +{ + pickupmodel = spawn( "script_model", origin ); + if ( isDefined( angles ) ) + { + pickupmodel.angles = angles; + } + pickupmodel setmodel( model ); + if ( isDefined( level.equipment_safe_to_drop ) ) + { + if ( !( self [[ level.equipment_safe_to_drop ]]( pickupmodel ) ) ) + { + maps/mp/zombies/_zm_equipment::equipment_disappear_fx( pickupmodel.origin, undefined, pickupmodel.angles ); + pickupmodel delete(); + self maps/mp/zombies/_zm_equipment::equipment_take( equipname ); + return undefined; + } + } + watchername = getsubstr( equipname, 0, equipname.size - 3 ); + if ( isDefined( level.retrievehints[ watchername ] ) ) + { + hint = level.retrievehints[ watchername ].hint; + } + else + { + hint = &"MP_GENERIC_PICKUP"; + } + icon = maps/mp/zombies/_zm_equipment::get_equipment_icon( equipname ); + if ( !isDefined( tradius ) ) + { + tradius = 32; + } + torigin = origin; + if ( isDefined( toffset ) ) + { + tforward = anglesToForward( angles ); + torigin += toffset * tforward; + } + tup = anglesToUp( angles ); + eq_unitrigger_offset = 12 * tup; + pickupmodel.stub = maps/mp/zombies/_zm_equipment::generate_equipment_unitrigger( "trigger_radius_use", torigin + eq_unitrigger_offset, angles, 0, tradius, 64, hint, equipname, maps/mp/zombies/_zm_equipment::placed_equipment_unitrigger_think, pickupmodel.canmove ); + pickupmodel.stub.model = pickupmodel; + pickupmodel.stub.equipname = equipname; + pickupmodel.equipname = equipname; + //pickupmodel thread maps/mp/zombies/_zm_equipment::item_attract_zombies(); + pickupmodel thread item_watch_damage(); + if ( maps/mp/zombies/_zm_equipment::is_limited_equipment( equipname ) ) + { + if ( !isDefined( level.dropped_equipment ) ) + { + level.dropped_equipment = []; + } + if ( isDefined( level.dropped_equipment[ equipname ] ) && isDefined( level.dropped_equipment[ equipname ].model ) ) + { + level.dropped_equipment[ equipname ].model maps/mp/zombies/_zm_equipment::dropped_equipment_destroy( 1 ); + } + level.dropped_equipment[ equipname ] = pickupmodel.stub; + } + maps/mp/zombies/_zm_equipment::destructible_equipment_list_add( pickupmodel ); + return pickupmodel; +} + +item_watch_damage() +{ + self endon( "death" ); + self setcandamage( 1 ); + while ( 1 ) + { + self.health = 1000000; + self waittill( "damage", amount ); + self maps/mp/zombies/_zm_equipment::item_damage( amount ); + } +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_game_module.gsc b/scripts/zm/replaced/_zm_game_module.gsc new file mode 100644 index 00000000..4cf45516 --- /dev/null +++ b/scripts/zm/replaced/_zm_game_module.gsc @@ -0,0 +1,208 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +wait_for_team_death_and_round_end() +{ + level endon( "game_module_ended" ); + level endon( "end_game" ); + + checking_for_round_end = 0; + level.isresetting_grief = 0; + while ( 1 ) + { + cdc_total = 0; + cia_total = 0; + cdc_alive = 0; + cia_alive = 0; + players = get_players(); + i = 0; + while ( i < players.size ) + { + if ( !isDefined( players[ i ]._encounters_team ) ) + { + i++; + continue; + } + if ( players[ i ]._encounters_team == "A" ) + { + cia_total++; + if ( is_player_valid( players[ i ] ) ) + { + cia_alive++; + } + i++; + continue; + } + cdc_total++; + if ( is_player_valid( players[ i ] ) ) + { + cdc_alive++; + } + i++; + } + + if ( !checking_for_round_end ) + { + if ( cia_alive == 0 ) + { + level thread round_end( "B", cia_total == 0 ); + checking_for_round_end = 1; + } + else if ( cdc_alive == 0 ) + { + level thread round_end( "A", cdc_total == 0 ); + checking_for_round_end = 1; + } + } + + if ( cia_alive > 0 && cdc_alive > 0 ) + { + level notify( "stop_round_end_check" ); + checking_for_round_end = 0; + } + + wait 0.05; + } +} + +round_end(winner, force_win) +{ + if(!isDefined(force_win)) + { + force_win = false; + } + + winner_alive = 0; + team = "axis"; + if(winner == "B") + { + team = "allies"; + } + + if(!force_win) + { + wait 5; + } + + players = get_players(); + foreach(player in players) + { + if(is_player_valid(player) && player.team == team) + { + winner_alive = 1; + break; + } + } + + if(winner_alive) + { + level.grief_score[winner]++; + level.grief_hud.score[team] setValue(level.grief_score[winner]); + setteamscore(team, level.grief_score[winner]); + } + + if(level.grief_score[winner] == level.grief_winning_score || force_win) + { + level.gamemodulewinningteam = winner; + level.zombie_vars[ "spectators_respawn" ] = 0; + players = get_players(); + i = 0; + while ( i < players.size ) + { + players[ i ] freezecontrols( 1 ); + if ( players[ i ]._encounters_team == winner ) + { + players[ i ] thread maps/mp/zombies/_zm_audio_announcer::leaderdialogonplayer( "grief_won" ); + i++; + continue; + } + players[ i ] thread maps/mp/zombies/_zm_audio_announcer::leaderdialogonplayer( "grief_lost" ); + i++; + } + level notify( "game_module_ended", winner ); + level._game_module_game_end_check = undefined; + maps/mp/gametypes_zm/_zm_gametype::track_encounters_win_stats( level.gamemodulewinningteam ); + level notify( "end_game" ); + } + else + { + players = get_players(); + foreach(player in players) + { + // don't give score back from down + player.pers["score"] = player.score; + + if(is_player_valid(player)) + { + // don't give perk + player notify("perk_abort_drinking"); + // save weapons + player [[level._game_module_player_laststand_callback]](); + } + } + + level.isresetting_grief = 1; + level notify( "end_round_think" ); + level.zombie_vars[ "spectators_respawn" ] = 1; + level notify( "keep_griefing" ); + level notify( "restart_round" ); + + level.round_number++; + setroundsplayed(level.round_number); + + level thread maps/mp/zombies/_zm_audio_announcer::leaderdialog( "grief_restarted" ); + if(!winner_alive) + { + foreach(player in players) + { + player thread scripts/zm/main/_zm_reimagined_zgrief::show_grief_hud_msg( &"ZOMBIE_GRIEF_RESET" ); + } + } + + zombie_goto_round( level.round_number ); + level thread maps/mp/zombies/_zm_game_module::reset_grief(); + level thread maps/mp/zombies/_zm::round_think( 1 ); + } +} + +zombie_goto_round(target_round) +{ + level endon( "end_game" ); + + if ( target_round < 1 ) + { + target_round = 1; + } + + level.zombie_total = 0; + zombies = get_round_enemy_array(); + if ( isDefined( zombies ) ) + { + for ( i = 0; i < zombies.size; i++ ) + { + zombies[ i ] dodamage( zombies[ i ].health + 666, zombies[ i ].origin ); + } + } + + maps/mp/zombies/_zm_game_module::respawn_players(); + maps/mp/zombies/_zm::award_grenades_for_survivors(); + players = get_players(); + foreach(player in players) + { + if(player.score < level.player_starting_points) + { + player maps/mp/zombies/_zm_score::add_to_player_score(level.player_starting_points - player.score); + } + + if(isDefined(player get_player_placeable_mine())) + { + player giveweapon(player get_player_placeable_mine()); + player set_player_placeable_mine(player get_player_placeable_mine()); + player setactionslot(4, "weapon", player get_player_placeable_mine()); + player setweaponammoclip(player get_player_placeable_mine(), 2); + } + } + + level thread scripts/zm/main/_zm_reimagined_zgrief::round_start_wait(5); +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_playerhealth.gsc b/scripts/zm/replaced/_zm_playerhealth.gsc new file mode 100644 index 00000000..6056f570 --- /dev/null +++ b/scripts/zm/replaced/_zm_playerhealth.gsc @@ -0,0 +1,211 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +playerhealthregen() +{ + self notify( "playerHealthRegen" ); + self endon( "playerHealthRegen" ); + self endon( "death" ); + self endon( "disconnect" ); + + if ( !isDefined( self.flag ) ) + { + self.flag = []; + self.flags_lock = []; + } + + if ( !isDefined( self.flag[ "player_has_red_flashing_overlay" ] ) ) + { + self player_flag_init( "player_has_red_flashing_overlay" ); + self player_flag_init( "player_is_invulnerable" ); + } + + self player_flag_clear( "player_has_red_flashing_overlay" ); + self player_flag_clear( "player_is_invulnerable" ); + self thread maps/mp/zombies/_zm_playerhealth::healthoverlay(); + + level.playerhealth_regularregendelay = 2000; + level.longregentime = 4000; + + oldratio = 1; + veryhurt = 0; + playerjustgotredflashing = 0; + invultime = 0; + hurttime = 0; + newhealth = 0; + lastinvulratio = 1; + healthoverlaycutoff = 0.2; + + self thread maps/mp/zombies/_zm_playerhealth::playerhurtcheck(); + if ( !isDefined( self.veryhurt ) ) + { + self.veryhurt = 0; + } + self.bolthit = 0; + + if ( getDvar( "scr_playerInvulTimeScale" ) == "" ) + { + setdvar( "scr_playerInvulTimeScale", 1 ); + } + playerinvultimescale = getDvarFloat( "scr_playerInvulTimeScale" ); + + for ( ;; ) + { + wait 0.05; + waittillframeend; + + health_ratio = self.health / self.maxhealth; + maxhealthratio = self.maxhealth / 100; + regenrate = 0.05 / maxhealthratio; + regularregendelay = 2000; + longregendelay = 4000; + + has_revive = 0; + if (flag("solo_game")) + { + if (isDefined(self.bought_solo_revive) && self.bought_solo_revive) + { + has_revive = 1; + } + } + else + { + if (self hasPerk("specialty_quickrevive")) + { + has_revive = 1; + } + } + + if (has_revive) + { + regenrate *= 1.25; + regularregendelay *= 0.75; + longregendelay *= 0.75; + } + + if ( health_ratio > healthoverlaycutoff ) + { + if ( self player_flag( "player_has_red_flashing_overlay" ) ) + { + player_flag_clear( "player_has_red_flashing_overlay" ); + } + lastinvulratio = 1; + playerjustgotredflashing = 0; + veryhurt = 0; + + if ( self.health == self.maxhealth ) + { + continue; + } + } + else if ( self.health <= 0 ) + { + return; + } + + wasveryhurt = veryhurt; + + if ( health_ratio <= healthoverlaycutoff ) + { + veryhurt = 1; + if ( !wasveryhurt ) + { + hurttime = getTime(); + self player_flag_set( "player_has_red_flashing_overlay" ); + playerjustgotredflashing = 1; + } + } + + if ( self.hurtagain ) + { + hurttime = getTime(); + self.hurtagain = 0; + } + + if ( health_ratio >= oldratio ) + { + if ( ( getTime() - hurttime ) < regularregendelay ) + { + continue; + } + else + { + self.veryhurt = veryhurt; + newhealth = health_ratio; + if ( veryhurt ) + { + if ( ( getTime() - hurttime ) >= longregendelay ) + { + newhealth += regenrate; + } + } + else + { + newhealth += regenrate; + } + } + + if ( newhealth > 1 ) + { + newhealth = 1; + } + + if ( newhealth <= 0 ) + { + return; + } + + self setnormalhealth( newhealth ); + oldratio = self.health / self.maxhealth; + continue; + } + else + { + invulworthyhealthdrop = ( lastinvulratio - health_ratio ) > level.worthydamageratio; + } + + if ( self.health <= 1 ) + { + self setnormalhealth( 1 / self.maxhealth ); + invulworthyhealthdrop = 1; + } + + oldratio = self.health / self.maxhealth; + self notify( "hit_again" ); + hurttime = getTime(); + + if ( !invulworthyhealthdrop || playerinvultimescale <= 0 ) + { + continue; + } + else + { + if ( self player_flag( "player_is_invulnerable" ) ) + { + continue; + } + else + { + self player_flag_set( "player_is_invulnerable" ); + level notify( "player_becoming_invulnerable" ); + if ( playerjustgotredflashing ) + { + invultime = level.invultime_onshield; + playerjustgotredflashing = 0; + } + else if ( veryhurt ) + { + invultime = level.invultime_postshield; + } + else + { + invultime = level.invultime_preshield; + } + invultime *= playerinvultimescale; + lastinvulratio = self.health / self.maxhealth; + self thread maps/mp/zombies/_zm_playerhealth::playerinvul( invultime ); + } + } + } +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_powerups.gsc b/scripts/zm/replaced/_zm_powerups.gsc new file mode 100644 index 00000000..01150864 --- /dev/null +++ b/scripts/zm/replaced/_zm_powerups.gsc @@ -0,0 +1,80 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +nuke_powerup( drop_item, player_team ) +{ + location = drop_item.origin; + playfx( drop_item.fx, location ); + level thread maps/mp/zombies/_zm_powerups::nuke_flash( player_team ); + wait 0.5; + zombies = getaiarray( level.zombie_team ); + zombies = arraysort( zombies, location ); + zombies_nuked = []; + i = 0; + while ( i < zombies.size ) + { + if ( is_true( zombies[ i ].ignore_nuke ) ) + { + i++; + continue; + } + if ( is_true( zombies[ i ].marked_for_death ) ) + { + i++; + continue; + } + if ( isdefined( zombies[ i ].nuke_damage_func ) ) + { + zombies[ i ] thread [[ zombies[ i ].nuke_damage_func ]](); + i++; + continue; + } + if ( is_magic_bullet_shield_enabled( zombies[ i ] ) ) + { + i++; + continue; + } + zombies[ i ].marked_for_death = 1; + //imported from bo3 _zm_powerup_nuke.gsc + if ( !zombies[ i ].nuked && !is_magic_bullet_shield_enabled( zombies[ i ] ) ) + { + zombies[ i ].nuked = 1; + zombies_nuked[ zombies_nuked.size ] = zombies[ i ]; + } + i++; + } + i = 0; + while ( i < zombies_nuked.size ) + { + if ( !isdefined( zombies_nuked[ i ] ) ) + { + i++; + continue; + } + if ( is_magic_bullet_shield_enabled( zombies_nuked[ i ] ) ) + { + i++; + continue; + } + if ( i < 5 && !zombies_nuked[ i ].isdog ) + { + zombies_nuked[ i ] thread maps/mp/animscripts/zm_death::flame_death_fx(); + } + if ( !zombies_nuked[ i ].isdog ) + { + if ( !is_true( zombies_nuked[ i ].no_gib ) ) + { + zombies_nuked[ i ] maps/mp/zombies/_zm_spawner::zombie_head_gib(); + } + zombies_nuked[ i ] playsound("evt_nuked"); + } + zombies_nuked[ i ] dodamage(zombies_nuked[i].health + 666, zombies_nuked[ i ].origin ); + i++; + } + players = get_players( player_team ); + for ( i = 0; i < players.size; i++ ) + { + players[ i ] maps/mp/zombies/_zm_score::player_add_points( "nuke_powerup", 400 ); + } +} \ No newline at end of file diff --git a/scripts/zm/replaced/_zm_utility.gsc b/scripts/zm/replaced/_zm_utility.gsc new file mode 100644 index 00000000..ebf32215 --- /dev/null +++ b/scripts/zm/replaced/_zm_utility.gsc @@ -0,0 +1,8 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +track_players_intersection_tracker() +{ + // BO2 has built in push mechanic +} \ No newline at end of file diff --git a/scripts/zm/replaced/zm_transit.gsc b/scripts/zm/replaced/zm_transit.gsc new file mode 100644 index 00000000..51c265bf --- /dev/null +++ b/scripts/zm/replaced/zm_transit.gsc @@ -0,0 +1,42 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +lava_damage_depot() +{ + trigs = getentarray( "lava_damage", "targetname" ); + volume = getent( "depot_lava_volume", "targetname" ); + exploder( 2 ); + + foreach ( trigger in trigs ) + { + if ( isDefined( trigger.script_string ) && trigger.script_string == "depot_lava" ) + { + trig = trigger; + } + } + + if ( isDefined( trig ) ) + { + trig.script_float = 0.05; + } + + flag_wait( "power_on" ); + + while ( !volume maps/mp/zm_transit::depot_lava_seen() ) + { + wait 0.05; + } + + if ( isDefined( trig ) ) + { + trig.script_float = 0.4; + earthquake( 0.5, 1.5, trig.origin, 1000 ); + level clientnotify( "earth_crack" ); + crust = getent( "depot_black_lava", "targetname" ); + crust delete(); + } + + stop_exploder( 2 ); + exploder( 3 ); +} \ No newline at end of file diff --git a/scripts/zm/zm_buried/zm_buried_reimagined.gsc b/scripts/zm/zm_buried/zm_buried_reimagined.gsc new file mode 100644 index 00000000..23bfbf1d --- /dev/null +++ b/scripts/zm/zm_buried/zm_buried_reimagined.gsc @@ -0,0 +1,10 @@ +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +#include scripts/zm/replaced/_zm_equip_subwoofer; + +main() +{ + //replaceFunc(maps/mp/zombies/_zm_equip_subwoofer::startsubwooferdecay, scripts/zm/replaced/_zm_equip_subwoofer::startsubwooferdecay); +} \ No newline at end of file diff --git a/scripts/zm/zm_prison/zm_prison_reimagined.gsc b/scripts/zm/zm_prison/zm_prison_reimagined.gsc index 6bcb8b86..695c963f 100644 --- a/scripts/zm/zm_prison/zm_prison_reimagined.gsc +++ b/scripts/zm/zm_prison/zm_prison_reimagined.gsc @@ -1,39 +1,10 @@ -#include maps/mp/gametypes_zm/_hud_util; -#include maps/mp/zombies/_zm_utility; -#include common_scripts/utility; -#include maps/mp/_utility; +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +#include scripts/zm/replaced/_zm_ai_brutus; main() { - replaceFunc(maps/mp/zombies/_zm_ai_brutus::brutus_health_increases, ::brutus_health_increases); -} - -brutus_health_increases() -{ - if(level.scr_zm_ui_gametype == "zgrief") - { - return; - } - - if ( level.round_number > level.brutus_last_spawn_round ) - { - a_players = getplayers(); - n_player_modifier = 1; - if ( a_players.size > 1 ) - { - n_player_modifier = a_players.size * 0.75; - } - level.brutus_round_count++; - level.brutus_health = int( level.brutus_health_increase * n_player_modifier * level.brutus_round_count ); - level.brutus_expl_dmg_req = int( level.brutus_explosive_damage_increase * n_player_modifier * level.brutus_round_count ); - if ( level.brutus_health >= ( 5000 * n_player_modifier ) ) - { - level.brutus_health = int( 5000 * n_player_modifier ); - } - if ( level.brutus_expl_dmg_req >= ( 4500 * n_player_modifier ) ) - { - level.brutus_expl_dmg_req = int( 4500 * n_player_modifier ); - } - level.brutus_last_spawn_round = level.round_number; - } + replaceFunc(maps/mp/zombies/_zm_ai_brutus::brutus_health_increases, scripts/zm/replaced/_zm_ai_brutus::brutus_health_increases); } \ No newline at end of file diff --git a/scripts/zm/zm_transit/zm_transit_reimagined.gsc b/scripts/zm/zm_transit/zm_transit_reimagined.gsc index bcde035f..e8fd0fff 100644 --- a/scripts/zm/zm_transit/zm_transit_reimagined.gsc +++ b/scripts/zm/zm_transit/zm_transit_reimagined.gsc @@ -1,284 +1,14 @@ -#include maps/mp/gametypes_zm/_hud_util; -#include maps/mp/zombies/_zm_utility; -#include common_scripts/utility; -#include maps/mp/_utility; +#include maps\mp\_utility; +#include common_scripts\utility; +#include maps\mp\zombies\_zm_utility; + +#include scripts/zm/replaced/zm_transit; +#include scripts/zm/replaced/_zm_equip_electrictrap; +#include scripts/zm/replaced/_zm_equip_turret; main() { - replaceFunc(maps/mp/zm_transit::lava_damage_depot, ::lava_damage_depot); - replaceFunc(maps/mp/zombies/_zm_equip_electrictrap::startelectrictrapdeploy, ::startelectrictrapdeploy); - replaceFunc(maps/mp/zombies/_zm_equip_turret::startturretdeploy, ::startturretdeploy); -} - -lava_damage_depot() -{ - trigs = getentarray( "lava_damage", "targetname" ); - volume = getent( "depot_lava_volume", "targetname" ); - exploder( 2 ); - - foreach ( trigger in trigs ) - { - if ( isDefined( trigger.script_string ) && trigger.script_string == "depot_lava" ) - { - trig = trigger; - } - } - - if ( isDefined( trig ) ) - { - trig.script_float = 0.05; - } - - flag_wait( "power_on" ); - - while ( !volume maps/mp/zm_transit::depot_lava_seen() ) - { - wait 0.05; - } - - if ( isDefined( trig ) ) - { - trig.script_float = 0.4; - earthquake( 0.5, 1.5, trig.origin, 1000 ); - level clientnotify( "earth_crack" ); - crust = getent( "depot_black_lava", "targetname" ); - crust delete(); - } - - stop_exploder( 2 ); - exploder( 3 ); -} - -startelectrictrapdeploy( weapon ) -{ - self endon( "death" ); - self endon( "disconnect" ); - self endon( "equip_electrictrap_zm_taken" ); - self thread maps/mp/zombies/_zm_equip_electrictrap::watchforcleanup(); - electricradius = 45; - if ( !isDefined( self.electrictrap_health ) ) - { - self.electrictrap_health = 60; - } - if ( isDefined( weapon ) ) - { - weapon trap_power_on(); - if ( !weapon.power_on ) - { - self iprintlnbold( &"ZOMBIE_NEED_LOCAL_POWER" ); - } - self thread maps/mp/zombies/_zm_equip_electrictrap::electrictrapthink( weapon, electricradius ); - self thread maps/mp/zombies/_zm_equip_electrictrap::electrictrapdecay( weapon ); - self thread maps/mp/zombies/_zm_buildables::delete_on_disconnect( weapon ); - weapon waittill( "death" ); - if ( isDefined( level.electrap_sound_ent ) ) - { - level.electrap_sound_ent playsound( "wpn_zmb_electrap_stop" ); - level.electrap_sound_ent delete(); - level.electrap_sound_ent = undefined; - } - self notify( "etrap_cleanup" ); - } -} - -trap_power_on() -{ - self.power_on = 1; - self.power_on_time = getTime() - 2000; // activates the trap right away - self notify( "stop_attracting_zombies" ); - if ( !isDefined( level.electrap_sound_ent ) ) - { - level.electrap_sound_ent = spawn( "script_origin", self.origin ); - } - level.electrap_sound_ent playsound( "wpn_zmb_electrap_start" ); - level.electrap_sound_ent playloopsound( "wpn_zmb_electrap_loop", 2 ); - self thread maps/mp/zombies/_zm_equip_electrictrap::trapfx(); -} - -electrictrapthink( weapon, electricradius ) -{ - weapon endon( "death" ); - radiussquared = electricradius * electricradius; - while ( isDefined( weapon ) ) - { - if ( weapon.power_on ) - { - zombies = getaiarray( level.zombie_team ); - _a354 = zombies; - _k354 = getFirstArrayKey( _a354 ); - while ( isDefined( _k354 ) ) - { - zombie = _a354[ _k354 ]; - if ( isDefined( zombie ) && isalive( zombie ) ) - { - if ( isDefined( zombie.ignore_electric_trap ) && zombie.ignore_electric_trap ) - { - break; - } - else - { - if ( distancesquared( weapon.origin, zombie.origin ) < radiussquared ) - { - weapon maps/mp/zombies/_zm_equip_electrictrap::zap_zombie( zombie ); - wait 0.15; - } - maps/mp/zombies/_zm_equip_electrictrap::etrap_choke(); - } - } - _k354 = getNextArrayKey( _a354, _k354 ); - } - players = get_players(); - _a373 = players; - _k373 = getFirstArrayKey( _a373 ); - while ( isDefined( _k373 ) ) - { - player = _a373[ _k373 ]; - if ( is_player_valid( player ) && distancesquared( weapon.origin, player.origin ) < radiussquared ) - { - player thread maps/mp/zombies/_zm_traps::player_elec_damage(); - maps/mp/zombies/_zm_equip_electrictrap::etrap_choke(); - } - maps/mp/zombies/_zm_equip_electrictrap::etrap_choke(); - _k373 = getNextArrayKey( _a373, _k373 ); - } - } - wait 0.1; - } -} - -electrictrapdecay( weapon ) -{ - self endon( "death" ); - self endon( "disconnect" ); - self endon( "equip_electrictrap_zm_taken" ); - while ( isDefined( weapon ) ) - { - if ( weapon.power_on ) - { - self.electrictrap_health--; - - if ( self.electrictrap_health <= 0 ) - { - maps/mp/zombies/_zm_equipment::equipment_disappear_fx( weapon.origin, undefined, weapon.angles ); - self maps/mp/zombies/_zm_equip_electrictrap::cleanupoldtrap(); - self.electrictrap_health = undefined; - self thread maps/mp/zombies/_zm_equipment::equipment_release( level.electrictrap_name ); - return; - } - } - wait 1; - } -} - -startturretdeploy( weapon ) -{ - self endon( "death" ); - self endon( "disconnect" ); - self endon( "equip_turret_zm_taken" ); - self thread maps/mp/zombies/_zm_equip_turret::watchforcleanup(); - if ( !isDefined( self.turret_health ) ) - { - self.turret_health = 60; - } - if ( isDefined( weapon ) ) - { - weapon hide(); - wait 0.1; - if ( isDefined( weapon.power_on ) && weapon.power_on ) - { - weapon.turret notify( "stop_burst_fire_unmanned" ); - } - if ( !isDefined( weapon ) ) - { - return; - } - if ( isDefined( self.turret ) ) - { - self.turret notify( "stop_burst_fire_unmanned" ); - self.turret notify( "turret_deactivated" ); - self.turret delete(); - } - turret = spawnturret( "misc_turret", weapon.origin, "zombie_bullet_crouch_zm" ); - turret.turrettype = "sentry"; - turret setturrettype( turret.turrettype ); - turret setmodel( "p6_anim_zm_buildable_turret" ); - turret.origin = weapon.origin; - turret.angles = weapon.angles; - turret linkto( weapon ); - turret makeunusable(); - turret.owner = self; - turret setowner( turret.owner ); - turret maketurretunusable(); - turret setmode( "auto_nonai" ); - turret setdefaultdroppitch( 45 ); - turret setconvergencetime( 0.3 ); - turret setturretteam( self.team ); - turret.team = self.team; - turret.damage_own_team = 0; - turret.turret_active = 1; - weapon.turret = turret; - self.turret = turret; - weapon turret_power_on(); - if ( weapon.power_on ) - { - turret thread maps/mp/zombies/_zm_mgturret::burst_fire_unmanned(); - } - else - { - self iprintlnbold( &"ZOMBIE_NEED_LOCAL_POWER" ); - } - self thread turretdecay( weapon ); - self thread maps/mp/zombies/_zm_buildables::delete_on_disconnect( weapon ); - weapon waittill("death"); - if ( isDefined( self.buildableturret.sound_ent ) ) - { - self.buildableturret.sound_ent playsound( "wpn_zmb_turret_stop" ); - self.buildableturret.sound_ent delete(); - self.buildableturret.sound_ent = undefined; - } - if ( isDefined( turret ) ) - { - turret notify( "stop_burst_fire_unmanned" ); - turret notify( "turret_deactivated" ); - turret delete(); - } - self.turret = undefined; - self notify( "turret_cleanup" ); - } -} - -turret_power_on() -{ - self.power_on = 1; - self.turret thread maps/mp/zombies/_zm_mgturret::burst_fire_unmanned(); - player = self.turret.owner; - if ( !isDefined( player.buildableturret.sound_ent ) ) - { - player.buildableturret.sound_ent = spawn( "script_origin", self.turret.origin ); - } - player.buildableturret.sound_ent playsound( "wpn_zmb_turret_start" ); - player.buildableturret.sound_ent playloopsound( "wpn_zmb_turret_loop", 2 ); -} - -turretdecay( weapon ) -{ - self endon( "death" ); - self endon( "disconnect" ); - self endon( "equip_turret_zm_taken" ); - while ( isDefined( weapon ) ) - { - if ( weapon.power_on ) - { - self.turret_health--; - - if ( self.turret_health <= 0 ) - { - maps/mp/zombies/_zm_equipment::equipment_disappear_fx( weapon.origin, undefined, weapon.angles ); - self maps/mp/zombies/_zm_equip_turret::cleanupoldturret(); - self thread maps/mp/zombies/_zm_equipment::equipment_release( level.turret_name ); - return; - } - } - wait 1; - } + replaceFunc(maps/mp/zm_transit::lava_damage_depot, scripts/zm/replaced/zm_transit::lava_damage_depot); + replaceFunc(maps/mp/zombies/_zm_equip_electrictrap::startelectrictrapdeploy, scripts/zm/replaced/_zm_equip_electrictrap::startelectrictrapdeploy); + replaceFunc(maps/mp/zombies/_zm_equip_turret::startturretdeploy, scripts/zm/replaced/_zm_equip_turret::startturretdeploy); } \ No newline at end of file