turn NIX into a mutator; fix keyhunt
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index 9575965c148a208753e7638b4cccf2b62e2155b8..f7be50277e62b0301c1f1fec5c93891537bcf25a 100644 (file)
@@ -453,8 +453,8 @@ float Client_customizeentityforclient()
        modelsource = self;
 
 #ifdef ALLOW_FORCEMODELS
-       if(other.cvar_cl_forceplayermodelsfromnexuiz)
-               if not(self.modelindex_lod0_from_nexuiz)
+       if(other.cvar_cl_forceplayermodelsfromxonotic)
+               if not(self.modelindex_lod0_from_xonotic)
                        modelsource = other;
        if(other.cvar_cl_forceplayermodels && sv_clforceplayermodels)
                modelsource = other;
@@ -549,7 +549,7 @@ void setmodel_lod(entity e, string modelname)
        }
 
        s = whichpack(self.model);
-       self.modelindex_lod0_from_nexuiz = ((s == "") || (substring(s, 0, 4) == "data"));
+       self.modelindex_lod0_from_xonotic = ((s == "") || (substring(s, 0, 4) == "data"));
 
        player_setupanimsformodel();
        UpdatePlayerSounds();
@@ -582,7 +582,6 @@ void PutObserverInServer (void)
        }
 
        DropAllRunes(self);
-       kh_Key_DropAll(self, TRUE);
 
        Portal_ClearAll(self);
 
@@ -697,6 +696,8 @@ void PutObserverInServer (void)
        }
        else
                self.frags = FRAGS_SPECTATOR;
+
+       MUTATOR_CALLHOOK(MakePlayerObserver);
 }
 
 float RestrictSkin(float s)
@@ -993,7 +994,6 @@ void PutClientInServer (void)
                }
 
                self.cnt = WEP_LASER;
-               self.nixnex_lastchange_id = -1;
 
                CL_SpawnWeaponentity();
                self.alpha = default_player_alpha;
@@ -1028,8 +1028,8 @@ void PutClientInServer (void)
                target_voicescript_clear(self);
 
                // reset fields the weapons may use
-        for (j = WEP_FIRST; j <= WEP_LAST; ++j)
-            weapon_action(j, WR_RESETPLAYER);
+               for (j = WEP_FIRST; j <= WEP_LAST; ++j)
+                       weapon_action(j, WR_RESETPLAYER);
 
                oldself = self;
                self = spot;
@@ -1037,6 +1037,8 @@ void PutClientInServer (void)
                                SUB_UseTargets();
                        activator = world;
                self = oldself;
+
+               MUTATOR_CALLHOOK(PlayerSpawn);
        } else if(self.classname == "observer" || (g_ca && !allowed_to_spawn)) {
                PutObserverInServer ();
        }
@@ -1578,7 +1580,7 @@ void ClientDisconnect (void)
        SoundEntity_Detach(self);
 
        DropAllRunes(self);
-       kh_Key_DropAll(self, TRUE);
+       MUTATOR_CALLHOOK(ClientDisconnect);
 
        Portal_ClearAll(self);
 
@@ -2115,7 +2117,8 @@ void SpectateCopy(entity spectatee) {
        } else
                update_stats (0, spectatee.cvar_cl_accuracy_data_share * spectatee.stat_hit, spectatee.cvar_cl_accuracy_data_share * spectatee.stat_fired);
 
-       self.kh_state = spectatee.kh_state;
+       other = spectatee;
+       MUTATOR_CALLHOOK(SpectateCopy);
        self.armortype = spectatee.armortype;
        self.armorvalue = spectatee.armorvalue;
        self.ammo_cells = spectatee.ammo_cells;
@@ -2446,29 +2449,29 @@ void PlayerPreThink (void)
 
        // version nagging
        if(self.version_nagtime)
-               if(self.cvar_g_nexuizversion)
+               if(self.cvar_g_xonoticversion)
                        if(time > self.version_nagtime)
                        {
-                               if(strstr(self.cvar_g_nexuizversion, "svn", 0) < 0)
+                               if(strstr(self.cvar_g_xonoticversion, "svn", 0) < 0)
                                {
-                                       if(strstr(cvar_string("g_nexuizversion"), "svn", 0) >= 0)
+                                       if(strstr(cvar_string("g_xonoticversion"), "svn", 0) >= 0)
                                        {
-                                               dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Nexuiz ", cvar_string("g_nexuizversion"), " (beta)^7, you have ^3Nexuiz ", self.cvar_g_nexuizversion, "^1\n");
-                                               sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Nexuiz ", cvar_string("g_nexuizversion"), " (beta)^7, you have ^3Nexuiz ", self.cvar_g_nexuizversion, "^1\n"));
+                                               dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
+                                               sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n"));
                                        }
                                        else
                                        {
                                                float r;
-                                               r = vercmp(self.cvar_g_nexuizversion, cvar_string("g_nexuizversion"));
+                                               r = vercmp(self.cvar_g_xonoticversion, cvar_string("g_xonoticversion"));
                                                if(r < 0)
                                                {
-                                                       dprint("^1NOTE^7 to ", self.netname, "^7 - ^3Nexuiz ", cvar_string("g_nexuizversion"), "^7 is out, and you still have ^3Nexuiz ", self.cvar_g_nexuizversion, "^1 - get the update from ^4http://www.nexuiz.com/^1!\n");
-                                                       sprint(self, strcat("\{1}^1NOTE: ^3Nexuiz ", cvar_string("g_nexuizversion"), "^7 is out, and you still have ^3Nexuiz ", self.cvar_g_nexuizversion, "^1 - get the update from ^4http://www.nexuiz.com/^1!\n"));
+                                                       dprint("^1NOTE^7 to ", self.netname, "^7 - ^3Xonotic ", cvar_string("g_xonoticversion"), "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.com/^1!\n");
+                                                       sprint(self, strcat("\{1}^1NOTE: ^3Xonotic ", cvar_string("g_xonoticversion"), "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.com/^1!\n"));
                                                }
                                                else if(r > 0)
                                                {
-                                                       dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Nexuiz ", cvar_string("g_nexuizversion"), "^7, you have ^3Nexuiz ", self.cvar_g_nexuizversion, "^1\n");
-                                                       sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Nexuiz ", cvar_string("g_nexuizversion"), "^7, you have ^3Nexuiz ", self.cvar_g_nexuizversion, "^1\n"));
+                                                       dprint("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
+                                                       sprint(self, strcat("\{1}^1NOTE: ^7the server is running ^3Xonotic ", cvar_string("g_xonoticversion"), "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n"));
                                                }
                                        }
                                }
@@ -2508,8 +2511,6 @@ void PlayerPreThink (void)
                        self.effects = self.effects - (self.effects & EF_NODRAW);
                }
 
-               Nixnex_GiveCurrentWeapon();
-
                if(frametime > 0) // don't do this in cl_movement frames, just in server ticks
                        UpdateSelectedPlayer();