]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
LMS: correctly update last forfeiter's health and armor if they forfeited when dead
authorterencehill <piuntn@gmail.com>
Wed, 2 Nov 2022 23:15:14 +0000 (00:15 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 7 Mar 2023 15:35:05 +0000 (16:35 +0100)
Also remove a TODO comment I resolved in the previous commit

qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
qcsrc/common/notifications/all.inc

index b2ab903cbd0b6b6170d67974101c2c2af026bb82..013de60d664cc02022e3d9f2bb395a9c2f6d9ed0 100644 (file)
@@ -367,17 +367,19 @@ void lms_RemovePlayer(entity player)
                        if(!warmup_stage)
                        {
                                int pl_lives = GameRules_scoring_add(player, LMS_LIVES, 0);
+                               float pl_health = IS_DEAD(player) ? start_health : GetResource(player, RES_HEALTH);
+                               float pl_armor = IS_DEAD(player) ? start_armorvalue : GetResource(player, RES_ARMOR);
                                if (!last_forfeiter_lives || pl_lives < last_forfeiter_lives)
                                {
                                        last_forfeiter_lives = pl_lives;
-                                       last_forfeiter_health = GetResource(player, RES_HEALTH);
-                                       last_forfeiter_armorvalue = GetResource(player, RES_ARMOR);
+                                       last_forfeiter_health = pl_health;
+                                       last_forfeiter_armorvalue = pl_armor;
                                }
                                else if (pl_lives == last_forfeiter_lives)
                                {
                                        // these values actually can belong to a different forfeiter
-                                       last_forfeiter_health = min(last_forfeiter_health, GetResource(player, RES_HEALTH));
-                                       last_forfeiter_armorvalue = min(last_forfeiter_armorvalue, GetResource(player, RES_ARMOR));
+                                       last_forfeiter_health = min(last_forfeiter_health, pl_health);
+                                       last_forfeiter_armorvalue = min(last_forfeiter_armorvalue, pl_armor);
                                }
                                GameRules_scoring_add(player, LMS_LIVES, -pl_lives);
                        }
index 671a324673278bc5c9256b6246903517105b013d..ec5616f9795380b21a1c1b9f0cf46c686757dc2c 100644 (file)
@@ -707,7 +707,6 @@ string multiteam_info_sprintf(string input, string teamname) { return ((input !=
     MULTITEAM_CENTER(KEYHUNT_START,                     N_ENABLE,    0, 0, "",               CPID_KEYHUNT,           "0 0",  _("^BGYou are starting with the ^TC^TT Key"), "", KEY)
 
     MSG_CENTER_NOTIF(LMS_NOLIVES,                       N_ENABLE,    0, 0, "",               CPID_LMS,               "0 0",  _("^BGYou have no lives left, you must wait until the next match"), "")
-    // TODO update notifications.cfg
     MSG_CENTER_NOTIF(LMS_VISIBLE_LEADER,                N_ENABLE,    0, 0, "",               CPID_LMS,               "0 0",  _("^BGEnemies can now see you on radar!"), "")
     MSG_CENTER_NOTIF(LMS_VISIBLE_OTHER,                 N_ENABLE,    0, 0, "",               CPID_LMS,               "0 0",  _("^BGLeaders can now be seen by enemies on radar!"), "")