From: terencehill Date: Tue, 29 Nov 2016 18:22:07 +0000 (+0100) Subject: Merge branch 'master' into terencehill/ca_bots_fix X-Git-Tag: xonotic-v0.8.2~388^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f8d1d29d782183456e036ff96a2f55080d980247;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into terencehill/ca_bots_fix Conflicts: qcsrc/server/mutators/mutator/gamemode_lms.qc --- f8d1d29d782183456e036ff96a2f55080d980247 diff --cc qcsrc/server/mutators/mutator/gamemode_lms.qc index 793cbf6b7,c325a3595..25f6d3e0a --- a/qcsrc/server/mutators/mutator/gamemode_lms.qc +++ b/qcsrc/server/mutators/mutator/gamemode_lms.qc @@@ -141,14 -168,46 +168,48 @@@ MUTATOR_HOOKFUNCTION(lms, PlayerDies void lms_RemovePlayer(entity player) { - // Only if the player cannot play at all - if(PlayerScore_Add(player, SP_LMS_RANK, 0) == 666) - player.frags = FRAGS_SPECTATOR; - else + static int quitters = 0; + float player_rank = PlayerScore_Add(player, SP_LMS_RANK, 0); + if (!player_rank) { - if(IS_BOT_CLIENT(player)) - bot_clear(player); - player.frags = FRAGS_LMS_LOSER; + int pl_cnt = 0; + FOREACH_CLIENT(IS_PLAYER(it), { pl_cnt++; }); + if (player.lms_spectate_warning != 2) + { ++ if(IS_BOT_CLIENT(player)) ++ bot_clear(player); + player.frags = FRAGS_LMS_LOSER; + PlayerScore_Add(player, SP_LMS_RANK, pl_cnt + 1); + } + else + { + lms_lowest_lives = 999; + FOREACH_CLIENT(true, { + if (it.frags == FRAGS_LMS_LOSER) + { + float it_rank = PlayerScore_Add(it, SP_LMS_RANK, 0); + if (it_rank > player_rank && it_rank <= 256) + PlayerScore_Add(it, SP_LMS_RANK, -1); + lms_lowest_lives = 0; + } + else if (it.frags != FRAGS_SPECTATOR) + { + float tl = PlayerScore_Add(it, SP_LMS_LIVES, 0); + if(tl < lms_lowest_lives) + lms_lowest_lives = tl; + } + }); + PlayerScore_Add(player, SP_LMS_RANK, 665 - quitters); // different from 666 + if(!warmup_stage) + { + PlayerScore_Add(player, SP_LMS_LIVES, -PlayerScore_Add(player, SP_LMS_LIVES, 0)); + ++quitters; + } + player.frags = FRAGS_LMS_LOSER; + 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(player.killcount != FRAGS_SPECTATOR) @@@ -212,21 -271,21 +273,23 @@@ MUTATOR_HOOKFUNCTION(lms, GiveFragsForK { entity frag_target = M_ARGV(1, entity); - // remove a life - float tl; - tl = PlayerScore_Add(frag_target, SP_LMS_LIVES, -1); - if(tl < lms_lowest_lives) - lms_lowest_lives = tl; - if(tl <= 0) + if (!warmup_stage) { - if(!lms_next_place) - lms_next_place = player_count; - else - lms_next_place = min(lms_next_place, player_count); - PlayerScore_Add(frag_target, SP_LMS_RANK, lms_next_place); // won't ever spawn again - --lms_next_place; + // remove a life + int tl = PlayerScore_Add(frag_target, SP_LMS_LIVES, -1); + if(tl < lms_lowest_lives) + lms_lowest_lives = tl; + if(tl <= 0) + { + int pl_cnt = 0; + FOREACH_CLIENT(IS_PLAYER(it), { pl_cnt++; }); ++ if(IS_BOT_CLIENT(frag_target)) ++ bot_clear(frag_target); + frag_target.frags = FRAGS_LMS_LOSER; + PlayerScore_Add(frag_target, SP_LMS_RANK, pl_cnt); + } } - M_ARGV(2, float) = 0; + M_ARGV(2, float) = 0; // frag score return true; }