X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fgamemodes%2Fgamemode%2Flms%2Fsv_lms.qc;h=9a210262b68e80b8b1c8b323a81739f8f8111f94;hp=ffc7768e24cecbbab341ad9f2cc59d8ed605bb0e;hb=80fbd518b7cbd82c02fee4d7fcf7d43853d6dd97;hpb=812dd3215ba88d7bcd2b38b9c4acd19d84a5152b diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index ffc7768e2..9a210262b 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -7,6 +7,7 @@ #include int autocvar_g_lms_extra_lives; +float autocvar_g_lms_forfeit_min_match_time; bool autocvar_g_lms_join_anytime; int autocvar_g_lms_last_join; bool autocvar_g_lms_items; @@ -43,10 +44,16 @@ int WinningCondition_LMS() entity first_player = NULL; int totalplayers = 0; - FOREACH_CLIENT(IS_PLAYER(it) && it.frags == FRAGS_PLAYER, { - if (!totalplayers) - first_player = it; - ++totalplayers; + int totalplayed = 0; + FOREACH_CLIENT(true, { + if (IS_PLAYER(it) && it.frags == FRAGS_PLAYER) + { + if (!totalplayers) + first_player = it; + ++totalplayers; + } + else if (GameRules_scoring_add(it, LMS_RANK, 0)) + ++totalplayed; }); if (totalplayers) @@ -70,10 +77,15 @@ int WinningCondition_LMS() // exactly one player? ClearWinners(); - SetWinners(winning, 0); // NOTE: exactly one player is still "player", so this works out if (LMS_NewPlayerLives()) { + if (totalplayed && game_starttime > 0 && time > game_starttime + autocvar_g_lms_forfeit_min_match_time) // give players time to join + { + GameRules_scoring_add(first_player, LMS_RANK, 1); + first_player.winning = 1; + return WINNING_YES; + } // game still running (that is, nobody got removed from the game by a frag yet)? then continue return WINNING_NO; } @@ -82,6 +94,7 @@ int WinningCondition_LMS() // a winner! // and assign him his first place GameRules_scoring_add(first_player, LMS_RANK, 1); + first_player.winning = 1; return WINNING_YES; } } @@ -91,6 +104,11 @@ int WinningCondition_LMS() // nobody is playing at all... if (LMS_NewPlayerLives()) { + if (totalplayed && game_starttime > 0 && time > game_starttime + autocvar_g_lms_forfeit_min_match_time) // give players time to join + { + ClearWinners(); + return WINNING_YES; + } // wait for players... } else @@ -502,7 +520,8 @@ MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate) if(player.frags != FRAGS_SPECTATOR && player.frags != FRAGS_PLAYER_OUT_OF_GAME) { player.lms_spectate_warning = 1; - sprint(player, "WARNING: you won't be able to enter the game again after spectating in LMS. Use the same command again to spectate anyway.\n"); + sprint(player, "^1WARNING:^7 you can't rejoin this match after spectating. Use the same command again to spectate anyway.\n"); + Send_Notification(NOTIF_ONE_ONLY, player, MSG_CENTER, CENTER_LMS_SPECWARN); } return MUT_SPECCMD_RETURN; }