]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator/gamemode_lms.qc
Merge branch 'master' into terencehill/hud_fixes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_lms.qc
index 9c9e191d2065d59423dd4edadb6a10d1d266417a..4f84c5abbcb6c71994884d3a68e13f2ef703c5c8 100644 (file)
@@ -1,3 +1,4 @@
+#include "gamemode_lms.qh"
 #ifndef GAMEMODE_LMS_H
 #define GAMEMODE_LMS_H
 
@@ -44,6 +45,7 @@ float LMS_NewPlayerLives();
 
 #ifdef IMPLEMENTATION
 
+#include <common/mutators/mutator/instagib/items.qc>
 #include <server/campaign.qh>
 #include <server/command/cmd.qh>
 
@@ -71,6 +73,8 @@ float LMS_NewPlayerLives()
        return bound(1, lms_lowest_lives, fl);
 }
 
+void ClearWinners();
+
 // LMS winning condition: game terminates if and only if there's at most one
 // one player who's living lives. Top two scores being equal cancels the time
 // limit.
@@ -157,10 +161,9 @@ MUTATOR_HOOKFUNCTION(lms, reset_map_global)
 }
 
 MUTATOR_HOOKFUNCTION(lms, reset_map_players)
-{SELFPARAM();
+{
        if(restart_mapalreadyrestarted || (time < game_starttime))
-       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(WITH(entity, self, it, PlayerScore_Add(it, SP_LMS_LIVES, LMS_NewPlayerLives()))));
-
+       FOREACH_CLIENT(IS_PLAYER(it), LAMBDA(PlayerScore_Add(it, SP_LMS_LIVES, LMS_NewPlayerLives())));
        return false;
 }
 
@@ -170,17 +173,14 @@ MUTATOR_HOOKFUNCTION(lms, PutClientInServer)
        // FIXME fix LMS scoring for new system
        if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
        {
-               self.classname = STR_OBSERVER;
+               TRANSMUTE(Observer, self);
                Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_LMS_NOLIVES);
        }
-
-       return false;
 }
 
 MUTATOR_HOOKFUNCTION(lms, PlayerDies)
-{SELFPARAM();
-       self.respawn_flags |= RESPAWN_FORCE;
-
+{
+       frag_target.respawn_flags |= RESPAWN_FORCE;
        return false;
 }
 
@@ -206,15 +206,16 @@ MUTATOR_HOOKFUNCTION(lms, ClientDisconnect)
 }
 
 MUTATOR_HOOKFUNCTION(lms, MakePlayerObserver)
-{SELFPARAM();
-       lms_RemovePlayer(self);
-       return false;
+{
+    SELFPARAM();
+       lms_RemovePlayer(this);
+       return true;  // prevent team reset
 }
 
 MUTATOR_HOOKFUNCTION(lms, ClientConnect)
 {SELFPARAM();
-       self.classname = STR_PLAYER;
-       campaign_bots_may_start = 1;
+       TRANSMUTE(Player, self);
+       campaign_bots_may_start = true;
 
        if(PlayerScore_Add(self, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
        {
@@ -345,6 +346,7 @@ MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
 
 MUTATOR_HOOKFUNCTION(lms, ClientCommand_Spectate)
 {
+    SELFPARAM();
        if(self.lms_spectate_warning)
        {
                // for the forfeit message...