]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator/gamemode_lms.qc
Round down the midway score between the 2 flags if either has a score
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_lms.qc
index 348930bf54554cab10d3d12ef023cef56e053c30..c3c24559e34bc76e112a3c001383df57f7e54407 100644 (file)
@@ -168,6 +168,7 @@ MUTATOR_HOOKFUNCTION(lms, PlayerDies)
 
 void lms_RemovePlayer(entity player)
 {
+       static int quitters = 0;
        float player_rank = PlayerScore_Add(player, SP_LMS_RANK, 0);
        if (!player_rank)
        {
@@ -175,6 +176,8 @@ void lms_RemovePlayer(entity player)
                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);
                }
@@ -185,7 +188,7 @@ void lms_RemovePlayer(entity player)
                                if (it.frags == FRAGS_LMS_LOSER)
                                {
                                        float it_rank = PlayerScore_Add(it, SP_LMS_RANK, 0);
-                                       if (it_rank > player_rank && it_rank < 665)
+                                       if (it_rank > player_rank && it_rank <= 256)
                                                PlayerScore_Add(it, SP_LMS_RANK, -1);
                                        lms_lowest_lives = 0;
                                }
@@ -196,9 +199,12 @@ void lms_RemovePlayer(entity player)
                                                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));
-                       PlayerScore_Add(player, SP_LMS_RANK, 665); // different from 666
+                               ++quitters;
+                       }
                        player.frags = FRAGS_LMS_LOSER;
                        TRANSMUTE(Observer, player);
                }
@@ -277,6 +283,8 @@ MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill)
                {
                        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);
                }
@@ -406,7 +414,7 @@ MUTATOR_HOOKFUNCTION(lms, GetPlayerStatus)
 
 MUTATOR_HOOKFUNCTION(lms, AddPlayerScore)
 {
-       if(gameover)
+       if(game_stopped)
        if(M_ARGV(0, entity) == SP_LMS_RANK) // score field
                return true; // allow writing to this field in intermission as it is needed for newly joining players
 }