]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Prepare LMS code for an cleaner merge (no actual change)
authorterencehill <piuntn@gmail.com>
Mon, 13 Sep 2021 21:43:41 +0000 (23:43 +0200)
committerterencehill <piuntn@gmail.com>
Mon, 13 Sep 2021 21:43:41 +0000 (23:43 +0200)
qcsrc/common/gamemodes/gamemode/lms/sv_lms.qc

index 9185525e72b213e1101a2d4b17af601f510876cb..41673a7d77135ae5f2c0ae84923a22a49c812370 100644 (file)
@@ -172,39 +172,8 @@ MUTATOR_HOOKFUNCTION(lms, PutClientInServer)
        }
 }
 
-MUTATOR_HOOKFUNCTION(lms, CalculateRespawnTime)
+MUTATOR_HOOKFUNCTION(lms, PlayerSpawn)
 {
-       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;
-
-       player.respawn_time = time + autocvar_g_lms_dynamic_respawn_delay_base +
-               autocvar_g_lms_dynamic_respawn_delay_increase * max(0, max_lives - pl_lives);
-       return true;
 }
 
 MUTATOR_HOOKFUNCTION(lms, ForbidSpawn)
@@ -221,6 +190,10 @@ MUTATOR_HOOKFUNCTION(lms, ForbidSpawn)
        return false;
 }
 
+MUTATOR_HOOKFUNCTION(lms, PlayerDies)
+{
+}
+
 void lms_RemovePlayer(entity player)
 {
        static int quitters = 0;
@@ -437,6 +410,41 @@ MUTATOR_HOOKFUNCTION(lms, PlayerDied)
                lms_UpdateWaypoints();
 }
 
+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;
+
+       player.respawn_time = time + autocvar_g_lms_dynamic_respawn_delay_base +
+               autocvar_g_lms_dynamic_respawn_delay_increase * max(0, max_lives - pl_lives);
+       return true;
+}
+
 MUTATOR_HOOKFUNCTION(lms, GiveFragsForKill)
 {
        entity frag_target = M_ARGV(1, entity);