1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-10 15:17:57 -05:00

Grief: round restart optimizations

This commit is contained in:
Jbleezy
2021-12-18 02:55:27 -08:00
parent 3f813b7c35
commit e6d13e64b8
2 changed files with 118 additions and 81 deletions

View File

@ -377,6 +377,8 @@ headstomp_watcher()
round_start_wait(time, initial)
{
level endon("end_game");
if(!isDefined(initial))
{
initial = false;
@ -509,6 +511,9 @@ countdown_pulse( hud_elem, duration )
zombie_spawn_wait(time)
{
level endon("end_game");
level endon( "restart_round" );
flag_clear("spawn_zombies");
wait time;

View File

@ -8,6 +8,7 @@ wait_for_team_death_and_round_end()
level endon( "end_game" );
checking_for_round_end = 0;
checking_for_round_tie = 0;
level.isresetting_grief = 0;
while ( 1 )
{
@ -42,16 +43,40 @@ wait_for_team_death_and_round_end()
i++;
}
if ( cia_total == 0 )
{
level notify( "stop_round_end_check" );
level thread round_end( "B", true );
checking_for_round_end = 1;
}
else if ( cdc_total == 0 )
{
level notify( "stop_round_end_check" );
level thread round_end( "A", true );
checking_for_round_end = 1;
}
if ( !checking_for_round_tie )
{
if(cia_alive == 0 && cdc_alive == 0)
{
level notify( "stop_round_end_check" );
level thread check_for_round_end();
checking_for_round_tie = 1;
checking_for_round_end = 1;
}
}
if ( !checking_for_round_end )
{
if ( cia_alive == 0 )
{
level thread round_end( "B", cia_total == 0 );
level thread check_for_round_end( "B" );
checking_for_round_end = 1;
}
else if ( cdc_alive == 0 )
{
level thread round_end( "A", cdc_total == 0 );
level thread check_for_round_end( "A" );
checking_for_round_end = 1;
}
}
@ -60,12 +85,29 @@ wait_for_team_death_and_round_end()
{
level notify( "stop_round_end_check" );
checking_for_round_end = 0;
checking_for_round_tie = 0;
}
wait 0.05;
}
}
check_for_round_end(winner)
{
level endon( "stop_round_end_check" );
if(isDefined(winner))
{
wait 5;
}
else
{
wait 0.5;
}
level thread round_end(winner);
}
round_end(winner, force_win)
{
if(!isDefined(force_win))
@ -73,111 +115,101 @@ round_end(winner, force_win)
force_win = false;
}
winner_alive = 0;
team = "axis";
if(winner == "B")
team = undefined;
if(isDefined(winner))
{
team = "allies";
if(winner == "A")
{
team = "axis";
}
else
{
team = "allies";
}
}
if(!force_win)
if(isDefined(winner))
{
wait 5;
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" );
return;
}
}
players = get_players();
foreach(player in players)
{
if(is_player_valid(player) && player.team == team)
// don't give score back from down
player.pers["score"] = player.score;
if(is_player_valid(player))
{
winner_alive = 1;
break;
// don't give perk
player notify("perk_abort_drinking");
// save weapons
player [[level._game_module_player_laststand_callback]]();
}
}
if(winner_alive)
{
level.grief_score[winner]++;
level.grief_hud.score[team] setValue(level.grief_score[winner]);
setteamscore(team, level.grief_score[winner]);
}
level.isresetting_grief = 1;
level notify( "end_round_think" );
level.zombie_vars[ "spectators_respawn" ] = 1;
level notify( "keep_griefing" );
level notify( "restart_round" );
if(level.grief_score[winner] == level.grief_winning_score || force_win)
level.round_number++;
setroundsplayed(level.round_number);
level thread maps/mp/zombies/_zm_audio_announcer::leaderdialog( "grief_restarted" );
if(isDefined(winner))
{
level.gamemodulewinningteam = winner;
level.zombie_vars[ "spectators_respawn" ] = 0;
players = get_players();
i = 0;
while ( i < players.size )
foreach(player in players)
{
players[ i ] freezecontrols( 1 );
if ( players[ i ]._encounters_team == winner )
if(player.team == team)
{
players[ i ] thread maps/mp/zombies/_zm_audio_announcer::leaderdialogonplayer( "grief_won" );
i++;
continue;
player thread scripts/zm/main/_zm_reimagined_zgrief::show_grief_hud_msg( "You won the round" );
}
else
{
player thread scripts/zm/main/_zm_reimagined_zgrief::show_grief_hud_msg( "You lost the round" );
}
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]]();
}
player thread scripts/zm/main/_zm_reimagined_zgrief::show_grief_hud_msg( &"ZOMBIE_GRIEF_RESET" );
}
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)
{
if(player.team == team)
{
player thread scripts/zm/main/_zm_reimagined_zgrief::show_grief_hud_msg( "You won the round" );
}
else
{
player thread scripts/zm/main/_zm_reimagined_zgrief::show_grief_hud_msg( "You lost the round" );
}
}
}
else
{
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( 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)