From: terencehill Date: Thu, 12 May 2022 14:01:13 +0000 (+0200) Subject: Add ReadyRestart support to Assault in campaign mode since it's a requirement now... X-Git-Tag: xonotic-v0.8.5~38 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f79d3329e933bd6d5539d2065467772d85c36079;p=xonotic%2Fxonotic-data.pk3dir.git Add ReadyRestart support to Assault in campaign mode since it's a requirement now. It fixes broken Assault campaign level. --- diff --git a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc index 5edfd5ff1..e9fb0a48d 100644 --- a/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc +++ b/qcsrc/common/gamemodes/gamemode/assault/sv_assault.qc @@ -255,7 +255,7 @@ int WinningCondition_Assault() TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 666 - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 0)); - if(ent.cnt == 1 || autocvar_g_campaign) // this was the second round + if(ent.cnt == 1 || autocvar_g_campaign) // this was the second round or the only round in campaign { status = WINNING_YES; } @@ -630,5 +630,8 @@ MUTATOR_HOOKFUNCTION(as, OnEntityPreSpawn) MUTATOR_HOOKFUNCTION(as, ReadyRestart_Deny) { // readyrestart not supported (yet) + // it's supported only in campaign mode (single round mode), since campaign requires it + if (autocvar_g_campaign) + return false; return true; } diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 01758efe5..12e130c9e 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -486,7 +486,13 @@ void ReadyRestart_force(bool is_fake_round_start) void ReadyRestart(bool forceWarmupEnd) { - if (MUTATOR_CALLHOOK(ReadyRestart_Deny) || intermission_running || race_completing) localcmd("restart\n"); + if (MUTATOR_CALLHOOK(ReadyRestart_Deny) || intermission_running || race_completing) + { + // NOTE: ReadyRestart support is mandatory in campaign + if (autocvar_g_campaign) + error("ReadyRestart must be supported in campaign mode!"); + localcmd("restart\n"); // if ReadyRestart is denied, restart the server + } else localcmd("\nsv_hook_readyrestart\n"); if(forceWarmupEnd || autocvar_g_campaign) diff --git a/qcsrc/server/mutators/events.qh b/qcsrc/server/mutators/events.qh index 6feb81132..9c5c86993 100644 --- a/qcsrc/server/mutators/events.qh +++ b/qcsrc/server/mutators/events.qh @@ -1153,7 +1153,10 @@ MUTATOR_HOOKABLE(ChatMessage, EV_ChatMessage); /**/ MUTATOR_HOOKABLE(ChatMessageTo, EV_ChatMessageTo); -/** return true to just restart the match, for modes that don't support readyrestart */ +/** + * return true to restart the match instead of restarting the server, for modes that don't support readyrestart. + * NOTE: ReadyRestart support is mandatory in campaign + */ MUTATOR_HOOKABLE(ReadyRestart_Deny, EV_NO_ARGS); /** called when a fusion reactor is validating its target */