]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc
Transifex autosync
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / gamemodes / gamemode / lms / sv_lms.qc
index 0357069988e54626982e46ab2556bde2e8633be8..348262e76c231cd7d60d1ebe68bc3b8edd8e68ed 100644 (file)
@@ -12,6 +12,26 @@ bool autocvar_g_lms_join_anytime;
 int autocvar_g_lms_last_join;
 bool autocvar_g_lms_items;
 bool autocvar_g_lms_regenerate;
+int autocvar_g_lms_leader_lives_diff = 2;
+float autocvar_g_lms_leader_minpercent = 0.5;
+float autocvar_g_lms_leader_wp_interval = 25;
+float autocvar_g_lms_leader_wp_interval_jitter = 10;
+float autocvar_g_lms_leader_wp_time = 5;
+float autocvar_g_lms_dynamic_respawn_delay = 1;
+float autocvar_g_lms_dynamic_respawn_delay_base = 2;
+float autocvar_g_lms_dynamic_respawn_delay_increase = 3;
+float autocvar_g_lms_dynamic_respawn_delay_max = 20;
+bool autocvar_g_lms_dynamic_vampire = 1;
+float autocvar_g_lms_dynamic_vampire_factor_base = 0.1;
+float autocvar_g_lms_dynamic_vampire_factor_increase = 0.1;
+float autocvar_g_lms_dynamic_vampire_factor_max = 0.5;
+int autocvar_g_lms_dynamic_vampire_min_lives_diff = 2;
+
+.float lms_leader;
+int lms_leaders;
+float lms_visible_leaders_time;
+bool lms_visible_leaders = true; // triggers lms_visible_leaders_time update in the first frame
+bool lms_visible_leaders_prev;
 bool autocvar_g_lms_rot;
 
 // main functions
@@ -77,13 +97,13 @@ 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
@@ -92,8 +112,9 @@ int WinningCondition_LMS()
                        else
                        {
                                // a winner!
-                               // and assign him his first place
+                               // and assign them their first place
                                GameRules_scoring_add(first_player, LMS_RANK, 1);
+                               first_player.winning = 1;
                                return WINNING_YES;
                        }
                }
@@ -133,6 +154,65 @@ int WinningCondition_LMS()
        return WINNING_NO;
 }
 
+// runs on waypoints which are attached to leaders, updates once per frame
+bool lms_waypointsprite_visible_for_player(entity this, entity player, entity view)
+{
+       if(view.lms_leader)
+               if(IS_SPEC(player))
+                       return false; // we don't want spectators of leaders to see the attached waypoint on the top of their screen
+
+       if (!lms_visible_leaders)
+               return false;
+
+       return true;
+}
+
+int lms_leaders_lives_diff;
+void lms_UpdateLeaders()
+{
+       int max_lives = 0;
+       int pl_cnt = 0;
+       FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+               int lives = GameRules_scoring_add(it, LMS_LIVES, 0);
+               if (lives > max_lives)
+                       max_lives = lives;
+               pl_cnt++;
+       });
+
+       int second_max_lives = 0;
+       int pl_cnt_with_max_lives = 0;
+       FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+               int lives = GameRules_scoring_add(it, LMS_LIVES, 0);
+               if (lives == max_lives)
+                       pl_cnt_with_max_lives++;
+               else if (lives > second_max_lives)
+                       second_max_lives = lives;
+       });
+
+       lms_leaders_lives_diff = max_lives - second_max_lives;
+
+       int lives_diff = autocvar_g_lms_leader_lives_diff;
+       if (lms_leaders_lives_diff >= lives_diff && pl_cnt_with_max_lives <= pl_cnt * autocvar_g_lms_leader_minpercent)
+               FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+                       int lives = GameRules_scoring_add(it, LMS_LIVES, 0);
+                       if (lives == max_lives)
+                       {
+                               if (!it.lms_leader)
+                                       it.lms_leader = true;
+                       }
+                       else
+                       {
+                               it.lms_leader = false;
+                       }
+               });
+       else
+               FOREACH_CLIENT(IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+                       if (it.waypointsprite_attachedforcarrier)
+                               WaypointSprite_Kill(it.waypointsprite_attachedforcarrier);
+                       it.lms_leader = false;
+               });
+}
+
 // mutator hooks
 MUTATOR_HOOKFUNCTION(lms, reset_map_global)
 {
@@ -143,17 +223,11 @@ MUTATOR_HOOKFUNCTION(lms, reset_map_players)
 {
        FOREACH_CLIENT(true, {
                if (it.frags == FRAGS_PLAYER_OUT_OF_GAME)
-               {
-                       // players who forfeited (rank >= 256) become spectators
-                       if (it.lms_spectate_warning == 2)
-                               it.frags = FRAGS_SPECTATOR;
-                       else
-                               it.frags = FRAGS_PLAYER;
-               }
+                       it.frags = FRAGS_PLAYER;
 
                CS(it).killcount = 0;
                INGAME_STATUS_CLEAR(it);
-               it.lms_spectate_warning = 0;
+               it.lms_spectate = false;
                GameRules_scoring_add(it, LMS_RANK, -GameRules_scoring_add(it, LMS_RANK, 0));
                GameRules_scoring_add(it, LMS_LIVES, -GameRules_scoring_add(it, LMS_LIVES, 0));
 
@@ -162,6 +236,9 @@ MUTATOR_HOOKFUNCTION(lms, reset_map_players)
 
                TRANSMUTE(Player, it);
                PutClientInServer(it);
+               it.lms_leader = false;
+               if (it.waypointsprite_attachedforcarrier)
+                       WaypointSprite_Kill(it.waypointsprite_attachedforcarrier);
        });
 }
 
@@ -188,14 +265,11 @@ bool lms_AddPlayer(entity player)
        }
        if (warmup_stage || time <= game_starttime)
        {
-               if(player.lms_spectate_warning)
-               {
-                       player.lms_spectate_warning = 0;
-                       GameRules_scoring_add(player, LMS_RANK, -GameRules_scoring_add(player, LMS_RANK, 0));
-                       int lives = GameRules_scoring_add(player, LMS_LIVES, 0);
-                       if(lives <= 0)
-                               GameRules_scoring_add(player, LMS_LIVES, LMS_NewPlayerLives());
-               }
+               player.lms_spectate = false;
+               GameRules_scoring_add(player, LMS_RANK, -GameRules_scoring_add(player, LMS_RANK, 0));
+               int lives = GameRules_scoring_add(player, LMS_LIVES, 0);
+               if(lives <= 0)
+                       GameRules_scoring_add(player, LMS_LIVES, LMS_NewPlayerLives());
        }
        else
        {
@@ -218,6 +292,9 @@ MUTATOR_HOOKFUNCTION(lms, PutClientInServer)
        }
 }
 
+int last_forfeiter_lives;
+float last_forfeiter_health;
+float last_forfeiter_armorvalue;
 MUTATOR_HOOKFUNCTION(lms, PlayerSpawn)
 {
        entity player = M_ARGV(0, entity);
@@ -232,6 +309,11 @@ MUTATOR_HOOKFUNCTION(lms, PlayerSpawn)
                int pl_lives = GameRules_scoring_add(player, LMS_LIVES, 0);
                float min_health = start_health;
                float min_armorvalue = start_armorvalue;
+               if (last_forfeiter_lives == pl_lives)
+               {
+                       min_health = last_forfeiter_health;
+                       min_armorvalue = last_forfeiter_armorvalue;
+               }
                FOREACH_CLIENT(it != player && IS_PLAYER(it) && !IS_DEAD(it) && GameRules_scoring_add(it, LMS_LIVES, 0) == pl_lives, {
                        if (GetResource(it, RES_HEALTH) < min_health)
                                min_health = GetResource(it, RES_HEALTH);
@@ -256,20 +338,6 @@ MUTATOR_HOOKFUNCTION(lms, ForbidSpawn)
        return true;
 }
 
-MUTATOR_HOOKFUNCTION(lms, PlayerDies)
-{
-       entity frag_target = M_ARGV(2, entity);
-
-       float tl = GameRules_scoring_add(frag_target, LMS_LIVES, 0);
-       if (tl <= 0)
-       {
-               frag_target.respawn_flags = RESPAWN_SILENT;
-               // prevent unwanted sudden rejoin as spectator and movement of spectator camera
-               frag_target.respawn_time = time + 2;
-       }
-       frag_target.respawn_flags |= RESPAWN_FORCE;
-}
-
 void lms_RemovePlayer(entity player)
 {
        if (warmup_stage || time < game_starttime)
@@ -278,7 +346,7 @@ void lms_RemovePlayer(entity player)
        float player_rank = GameRules_scoring_add(player, LMS_RANK, 0);
        if (!player_rank)
        {
-               if (player.lms_spectate_warning < 2)
+               if (!player.lms_spectate)
                {
                        player.frags = FRAGS_PLAYER_OUT_OF_GAME;
                        int pl_cnt = 0;
@@ -289,38 +357,46 @@ void lms_RemovePlayer(entity player)
                }
                else if (INGAME(player))
                {
-                       int min_forfeiter_rank = 665; // different from 666
                        FOREACH_CLIENT(it != player, {
-                               // update rank of other players that were eliminated
+                               // update rank of other players
                                if (it.frags == FRAGS_PLAYER_OUT_OF_GAME)
+                                       GameRules_scoring_add(it, LMS_RANK, -1);
+                       });
+                       int rank = GameRules_scoring_add(player, LMS_RANK, 0);
+                       GameRules_scoring_add(player, LMS_RANK, -rank);
+                       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)
                                {
-                                       float it_rank = GameRules_scoring_add(it, LMS_RANK, 0);
-                                       if (it_rank > player_rank && it_rank <= 256)
-                                               GameRules_scoring_add(it, LMS_RANK, -1);
-                                       if (it_rank > 256 && it_rank <= min_forfeiter_rank)
-                                               min_forfeiter_rank = it_rank - 1;
+                                       last_forfeiter_lives = pl_lives;
+                                       last_forfeiter_health = pl_health;
+                                       last_forfeiter_armorvalue = pl_armor;
                                }
-                               else if (it.frags != FRAGS_SPECTATOR)
+                               else if (pl_lives == last_forfeiter_lives)
                                {
-                                       float tl = GameRules_scoring_add(it, LMS_LIVES, 0);
-                                       if(tl < lms_lowest_lives)
-                                               lms_lowest_lives = tl;
+                                       // these values actually can belong to a different forfeiter
+                                       last_forfeiter_health = min(last_forfeiter_health, pl_health);
+                                       last_forfeiter_armorvalue = min(last_forfeiter_armorvalue, pl_armor);
                                }
-                       });
-                       GameRules_scoring_add(player, LMS_RANK, min_forfeiter_rank);
-                       if(!warmup_stage)
-                               GameRules_scoring_add(player, LMS_LIVES, -GameRules_scoring_add(player, LMS_LIVES, 0));
-                       player.frags = FRAGS_PLAYER_OUT_OF_GAME;
+                               GameRules_scoring_add(player, LMS_LIVES, -pl_lives);
+                       }
+                       player.frags = FRAGS_SPECTATOR;
                        TRANSMUTE(Observer, player);
+                       INGAME_STATUS_CLEAR(player);
+                       player.lms_spectate = false;
+                       CS(player).killcount = FRAGS_SPECTATOR;
                }
+               if (autocvar_g_lms_leader_lives_diff > 0)
+                       lms_UpdateLeaders();
        }
 
-       if (CS(player).killcount != FRAGS_SPECTATOR && player.lms_spectate_warning < 3)
+       if (CS(player).killcount != FRAGS_SPECTATOR)
        {
-               if (GameRules_scoring_add(player, LMS_RANK, 0) > 0 && player.lms_spectate_warning < 2)
+               if (GameRules_scoring_add(player, LMS_RANK, 0) > 0)
                        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);
        }
 }
 
@@ -328,8 +404,7 @@ MUTATOR_HOOKFUNCTION(lms, ClientDisconnect)
 {
        entity player = M_ARGV(0, entity);
 
-       // no further message other than the disconnect message
-       player.lms_spectate_warning = 3;
+       player.lms_spectate = true;
 
        lms_RemovePlayer(player);
        INGAME_STATUS_CLEAR(player);
@@ -352,8 +427,8 @@ MUTATOR_HOOKFUNCTION(lms, MakePlayerObserver)
        }
        else
        {
-               if (is_forced)
-                       player.lms_spectate_warning = 2;
+               if (is_forced || player.killindicator_teamchange == -2) // player is forced or wants to spectate
+                       player.lms_spectate = true;
                if (!GameRules_scoring_add(player, LMS_RANK, 0))
                        lms_RemovePlayer(player);
        }
@@ -370,10 +445,64 @@ MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
 {
        entity player = M_ARGV(0, entity);
 
+       // recycled REDALIVE and BLUEALIVE to avoid adding a dedicated stat
+       STAT(REDALIVE, player) = lms_leaders;
+       STAT(BLUEALIVE, player) = lms_leaders_lives_diff;
+
        if(player.deadflag == DEAD_DYING)
                player.deadflag = DEAD_RESPAWNING;
 }
 
+MUTATOR_HOOKFUNCTION(lms, SV_StartFrame)
+{
+       if (intermission_running)
+               return;
+
+       lms_leaders = 0;
+       FOREACH_CLIENT(true, {
+               if (IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME && it.lms_leader)
+                       lms_leaders++;
+       });
+
+       float leader_time = autocvar_g_lms_leader_wp_time;
+       float leader_interval = leader_time + autocvar_g_lms_leader_wp_interval;
+       lms_visible_leaders_prev = lms_visible_leaders;
+       lms_visible_leaders = (lms_leaders && time > lms_visible_leaders_time && time < lms_visible_leaders_time + leader_time);
+       if (!lms_leaders || (lms_visible_leaders_prev && !lms_visible_leaders))
+               lms_visible_leaders_time = time + leader_interval + random() * autocvar_g_lms_leader_wp_interval_jitter;
+
+       FOREACH_CLIENT(true, {
+               STAT(OBJECTIVE_STATUS, it) = lms_visible_leaders;
+               if (IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME)
+               {
+                       if (it.lms_leader)
+                       {
+                               if (!it.waypointsprite_attachedforcarrier)
+                               {
+                                       WaypointSprite_AttachCarrier(WP_LmsLeader, it, RADARICON_FLAGCARRIER);
+                                       it.waypointsprite_attachedforcarrier.waypointsprite_visible_for_player = lms_waypointsprite_visible_for_player;
+                                       WaypointSprite_UpdateRule(it.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
+                                       vector pl_color = colormapPaletteColor(it.clientcolors & 0x0F, false);
+                                       WaypointSprite_UpdateTeamRadar(it.waypointsprite_attachedforcarrier, RADARICON_FLAGCARRIER, pl_color);
+                                       WaypointSprite_Ping(it.waypointsprite_attachedforcarrier);
+                               }
+                               if (!lms_visible_leaders_prev && lms_visible_leaders && IS_REAL_CLIENT(it))
+                                       Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_LMS_VISIBLE_LEADER);
+                       }
+                       else // if (!it.lms_leader)
+                       {
+                               if (IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME)
+                               {
+                                       if (!lms_visible_leaders_prev && lms_visible_leaders && IS_REAL_CLIENT(it))
+                                               Send_Notification(NOTIF_ONE, it, MSG_CENTER, CENTER_LMS_VISIBLE_OTHER);
+                               }
+                               if (it.waypointsprite_attachedforcarrier)
+                                       WaypointSprite_Kill(it.waypointsprite_attachedforcarrier);
+                       }
+               }
+       });
+}
+
 MUTATOR_HOOKFUNCTION(lms, PlayerRegen)
 {
        if(!autocvar_g_lms_regenerate)
@@ -383,12 +512,92 @@ MUTATOR_HOOKFUNCTION(lms, PlayerRegen)
        return (!autocvar_g_lms_regenerate && !autocvar_g_lms_rot);
 }
 
+MUTATOR_HOOKFUNCTION(lms, PlayerPowerups)
+{
+       entity player = M_ARGV(0, entity);
+       if (player.waypointsprite_attachedforcarrier)
+               player.effects |= (EF_ADDITIVE | EF_FULLBRIGHT);
+       else
+               player.effects &= ~(EF_ADDITIVE | EF_FULLBRIGHT);
+}
+
 MUTATOR_HOOKFUNCTION(lms, ForbidThrowCurrentWeapon)
 {
        // forbode!
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(lms, Damage_Calculate)
+{
+       if (!autocvar_g_lms_dynamic_vampire)
+               return;
+
+       entity frag_attacker = M_ARGV(1, entity);
+       entity frag_target = M_ARGV(2, entity);
+       float frag_damage = M_ARGV(4, float);
+
+       if (IS_PLAYER(frag_attacker) && !IS_DEAD(frag_attacker)
+               && IS_PLAYER(frag_target) && !IS_DEAD(frag_target) && frag_attacker != frag_target)
+       {
+               float vampire_factor = 0;
+
+               int frag_attacker_lives = GameRules_scoring_add(frag_attacker, LMS_LIVES, 0);
+               int frag_target_lives = GameRules_scoring_add(frag_target, LMS_LIVES, 0);
+               int diff = frag_target_lives - frag_attacker_lives - autocvar_g_lms_dynamic_vampire_min_lives_diff;
+
+               if (diff >= 0)
+                       vampire_factor = autocvar_g_lms_dynamic_vampire_factor_base + diff * autocvar_g_lms_dynamic_vampire_factor_increase;
+               if (vampire_factor > 0)
+               {
+                       vampire_factor = min(vampire_factor, autocvar_g_lms_dynamic_vampire_factor_max);
+                       SetResourceExplicit(frag_attacker, RES_HEALTH,
+                               min(GetResource(frag_attacker, RES_HEALTH) + frag_damage * vampire_factor, start_health));
+               }
+       }
+}
+
+MUTATOR_HOOKFUNCTION(lms, PlayerDied)
+{
+       if (!warmup_stage && autocvar_g_lms_leader_lives_diff > 0)
+               lms_UpdateLeaders();
+}
+
+MUTATOR_HOOKFUNCTION(lms, CalculateRespawnTime)
+{
+       entity player = M_ARGV(0, entity);
+       player.respawn_flags |= RESPAWN_FORCE;
+
+       int pl_lives = GameRules_scoring_add(player, LMS_LIVES, 0);
+       if (pl_lives <= 0)
+       {
+               player.respawn_flags = RESPAWN_SILENT;
+               // prevent unwanted sudden rejoin as spectator and movement of spectator camera
+               player.respawn_time = time + 2;
+               return true;
+       }
+
+       if (autocvar_g_lms_dynamic_respawn_delay <= 0)
+               return false;
+
+       int max_lives = 0;
+       int pl_cnt = 0;
+       FOREACH_CLIENT(it != player && IS_PLAYER(it) && it.frags != FRAGS_PLAYER_OUT_OF_GAME, {
+               int lives = GameRules_scoring_add(it, LMS_LIVES, 0);
+               if (lives > max_lives)
+                       max_lives = lives;
+               pl_cnt++;
+       });
+
+       // min delay with only 2 players
+       if (pl_cnt == 1) // player wasn't counted
+               max_lives = 0;
+
+       float dlay = autocvar_g_lms_dynamic_respawn_delay_base +
+               autocvar_g_lms_dynamic_respawn_delay_increase * max(0, max_lives - pl_lives);
+       player.respawn_time = time + min(autocvar_g_lms_dynamic_respawn_delay_max, dlay);
+       return true;
+}
+
 MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill)
 {
        entity frag_target = M_ARGV(1, entity);
@@ -438,43 +647,36 @@ MUTATOR_HOOKFUNCTION(lms, ForbidPlayerScore_Clear)
 
 MUTATOR_HOOKFUNCTION(lms, FilterItemDefinition)
 {
-       if (autocvar_g_lms_items)
+       if (autocvar_g_lms_items || autocvar_g_pickup_items > 0)
                return false;
 
-       entity definition = M_ARGV(0, entity);
-
-       if (autocvar_g_lms_extra_lives && definition == ITEM_ExtraLife)
-       {
+       entity def = M_ARGV(0, entity);
+       if (autocvar_g_powerups && autocvar_g_lms_extra_lives && (def == ITEM_ExtraLife || def == ITEM_HealthMega))
                return false;
-       }
-       return (autocvar_g_pickup_items <= 0); // only allow items if explicitly enabled
-}
 
-void lms_extralife(entity this)
-{
-       StartItem(this, ITEM_ExtraLife);
+       return true;
 }
 
-MUTATOR_HOOKFUNCTION(lms, OnEntityPreSpawn)
+void lms_replace_with_extralife(entity this)
 {
-       if (MUTATOR_RETURNVALUE) return false;
-       if (!autocvar_g_powerups) return false;
-       if (!autocvar_g_lms_extra_lives) return false;
-
-       entity ent = M_ARGV(0, entity);
+       entity e = new(item_extralife);
+       Item_CopyFields(this, e);
 
-       // Can't use .itemdef here
-       if (ent.classname != "item_health_mega") return false;
-
-       entity e = spawn();
-       setthink(e, lms_extralife);
+       StartItem(e, ITEM_ExtraLife);
+}
 
-       e.nextthink = time + 0.1;
-       e.spawnflags = ent.spawnflags;
-       e.noalign = ent.noalign;
-       setorigin(e, ent.origin);
+MUTATOR_HOOKFUNCTION(lms, FilterItem)
+{
+       entity item = M_ARGV(0, entity);
+       entity def = item.itemdef;
+       if(def == ITEM_HealthMega && !(autocvar_g_lms_items || autocvar_g_pickup_items > 0))
+       {
+               if(autocvar_g_powerups && autocvar_g_lms_extra_lives)
+                       lms_replace_with_extralife(item);
+               return true;
+       }
 
-       return true;
+       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms, ItemTouch)
@@ -488,6 +690,7 @@ MUTATOR_HOOKFUNCTION(lms, ItemTouch)
        {
                Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES, autocvar_g_lms_extra_lives);
                GameRules_scoring_add(toucher, LMS_LIVES, autocvar_g_lms_extra_lives);
+               Inventory_pickupitem(item.itemdef, toucher);
                return MUT_ITEMTOUCH_PICKUP;
        }
 
@@ -497,7 +700,7 @@ MUTATOR_HOOKFUNCTION(lms, ItemTouch)
 MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
 {
        FOREACH_CLIENT(IS_REAL_CLIENT(it), {
-               if (INGAME(it) && it.lms_spectate_warning < 2)
+               if (INGAME(it))
                        ++M_ARGV(0, int); // activerealplayers
                ++M_ARGV(1, int); // realplayers
        });
@@ -508,23 +711,10 @@ MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
 MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate)
 {
        entity player = M_ARGV(0, entity);
-
-       if(warmup_stage || time < game_starttime || player.lms_spectate_warning)
-       {
-               // for the forfeit message...
-               player.lms_spectate_warning = 2;
-       }
-       else
-       {
-               if(player.frags != FRAGS_SPECTATOR && player.frags != FRAGS_PLAYER_OUT_OF_GAME)
-               {
-                       player.lms_spectate_warning = 1;
-                       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;
-       }
-       return MUT_SPECCMD_CONTINUE;
+       if(player.frags != FRAGS_SPECTATOR && player.frags != FRAGS_PLAYER_OUT_OF_GAME)
+               return MUT_SPECCMD_CONTINUE;
+       // ranked players (out of game) can no longer become real spectators
+       return MUT_SPECCMD_RETURN;
 }
 
 MUTATOR_HOOKFUNCTION(lms, CheckRules_World)