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=bd6401d172931ea66eb07776258bc26258e8c1ca;hp=ffbecf1b3df6abcb68c558b4e1c9336713225328;hb=139a594d29f65508e5d6001e90d4ee4fad82ca66;hpb=ba7c5c7aa1351282377f6c4afc4653a130409255 diff --git a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc index ffbecf1b3..bd6401d17 100644 --- a/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc +++ b/qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc @@ -36,16 +36,16 @@ void ClearWinners(); int WinningCondition_LMS() { entity first_player = NULL; - int total_players = 0; - FOREACH_CLIENT(IS_PLAYER(it), { - if (!total_players) + int totalplayers = 0; + FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, { + if (!totalplayers) first_player = it; - ++total_players; + ++totalplayers; }); - if (total_players) + if (totalplayers) { - if (total_players > 1) + if (totalplayers > 1) { // two or more active players - continue with the game @@ -129,6 +129,14 @@ MUTATOR_HOOKFUNCTION(lms, reset_map_players) }); } +// FIXME add support for sv_ready_restart_after_countdown +// that is find a way to respawn/reset players IN GAME without setting lives to 0 +MUTATOR_HOOKFUNCTION(lms, ReadLevelCvars) +{ + // incompatible + sv_ready_restart_after_countdown = 0; +} + MUTATOR_HOOKFUNCTION(lms, PutClientInServer) { entity player = M_ARGV(0, entity); @@ -177,19 +185,21 @@ void lms_RemovePlayer(entity player) if (!player_rank) { int pl_cnt = 0; - FOREACH_CLIENT(IS_PLAYER(it), { pl_cnt++; }); - if (player.lms_spectate_warning != 2) + FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, { + pl_cnt++; + }); + if (player.lms_spectate_warning < 2) { if(IS_BOT_CLIENT(player)) bot_clear(player); - player.frags = FRAGS_LMS_LOSER; + player.frags = FRAGS_PLAYER_OUT_OF_GAME; GameRules_scoring_add(player, LMS_RANK, pl_cnt + 1); } else { lms_lowest_lives = 999; FOREACH_CLIENT(true, { - if (it.frags == FRAGS_LMS_LOSER) + if (it.frags == FRAGS_PLAYER_OUT_OF_GAME) { float it_rank = GameRules_scoring_add(it, LMS_RANK, 0); if (it_rank > player_rank && it_rank <= 256) @@ -209,24 +219,27 @@ void lms_RemovePlayer(entity player) GameRules_scoring_add(player, LMS_LIVES, -GameRules_scoring_add(player, LMS_LIVES, 0)); ++quitters; } - player.frags = FRAGS_LMS_LOSER; + player.frags = FRAGS_PLAYER_OUT_OF_GAME; TRANSMUTE(Observer, player); } - if (pl_cnt == 2 && !warmup_stage) // a player is forfeiting leaving only one player - lms_lowest_lives = 0; // end the game now! } - if(CS(player).killcount != FRAGS_SPECTATOR) - if(GameRules_scoring_add(player, LMS_RANK, 0) > 0 && player.lms_spectate_warning != 2) + if (CS(player).killcount != FRAGS_SPECTATOR && player.lms_spectate_warning < 3) + { + if (GameRules_scoring_add(player, LMS_RANK, 0) > 0 && player.lms_spectate_warning < 2) Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_LMS_NOLIVES, player.netname); else Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_LMS_FORFEIT, player.netname); + } } MUTATOR_HOOKFUNCTION(lms, ClientDisconnect) { entity player = M_ARGV(0, entity); + // no further message other than the disconnect message + player.lms_spectate_warning = 3; + lms_RemovePlayer(player); } @@ -252,6 +265,7 @@ MUTATOR_HOOKFUNCTION(lms, ClientConnect) } } +// FIXME LMS doesn't allow clients to spectate due to its particular implementation MUTATOR_HOOKFUNCTION(lms, AutoJoinOnConnection) { if(autocvar_g_campaign) @@ -293,10 +307,12 @@ MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill) if(tl <= 0) { int pl_cnt = 0; - FOREACH_CLIENT(IS_PLAYER(it), { pl_cnt++; }); + FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, { + pl_cnt++; + }); if(IS_BOT_CLIENT(frag_target)) bot_clear(frag_target); - frag_target.frags = FRAGS_LMS_LOSER; + frag_target.frags = FRAGS_PLAYER_OUT_OF_GAME; GameRules_scoring_add(frag_target, LMS_RANK, pl_cnt); } } @@ -397,7 +413,7 @@ MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate) } else { - if(player.frags != FRAGS_SPECTATOR && player.frags != FRAGS_LMS_LOSER) + 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"); @@ -413,9 +429,10 @@ MUTATOR_HOOKFUNCTION(lms, CheckRules_World) return true; } -MUTATOR_HOOKFUNCTION(lms, WantWeapon) +MUTATOR_HOOKFUNCTION(lms, SetWeaponArena) { - M_ARGV(2, bool) = true; // all weapons + if(M_ARGV(0, string) == "0" || M_ARGV(0, string) == "") + M_ARGV(0, string) = autocvar_g_lms_weaponarena; } MUTATOR_HOOKFUNCTION(lms, GetPlayerStatus)