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=c8cc0e6e565751b75aa3919ffeb4b4ddf3095f51;hb=80fbd518b7cbd82c02fee4d7fcf7d43853d6dd97;hpb=d14f3f5afd18ad9cb251e487f1ca7632d84bf48b diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index c8cc0e6e56..9a210262b6 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -7,10 +7,12 @@ #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; bool autocvar_g_lms_regenerate; +bool autocvar_g_lms_rot; // main functions int LMS_NewPlayerLives() @@ -42,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) @@ -54,7 +62,7 @@ int WinningCondition_LMS() { // two or more active players - continue with the game - if (autocvar_g_campaign) + if (autocvar_g_campaign && campaign_bots_may_start) { FOREACH_CLIENT(IS_REAL_CLIENT(it), { float pl_lives = GameRules_scoring_add(it, LMS_LIVES, 0); @@ -69,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; } @@ -81,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; } } @@ -90,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 @@ -358,9 +377,11 @@ MUTATOR_HOOKFUNCTION(lms, PlayerPreThink) MUTATOR_HOOKFUNCTION(lms, PlayerRegen) { - if(autocvar_g_lms_regenerate) - return false; - return true; + if(!autocvar_g_lms_regenerate) + M_ARGV(2, float) = 0; + if(!autocvar_g_lms_rot) + M_ARGV(3, float) = 0; + return (!autocvar_g_lms_regenerate && !autocvar_g_lms_rot); } MUTATOR_HOOKFUNCTION(lms, ForbidThrowCurrentWeapon) @@ -499,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; }