]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/cl_client.qc
Merge commit '54e0ccd220df'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / cl_client.qc
index 2f424b8a8f49d81bd3b82f7a53181fe05df15aac..ef83ef63543c7dc1a77c1633be408fb5ba45a0c1 100644 (file)
@@ -13,10 +13,13 @@ void Announce(string snd) {
 }
 
 void AnnounceTo(entity e, string snd) {
-       msg_entity = e;
-       WriteByte(MSG_ONE, SVC_TEMPENTITY);
-       WriteByte(MSG_ONE, TE_CSQC_ANNOUNCE);
-       WriteString(MSG_ONE, snd);
+       if (clienttype(e) == CLIENTTYPE_REAL)
+       {
+               msg_entity = e;
+               WriteByte(MSG_ONE, SVC_TEMPENTITY);
+               WriteByte(MSG_ONE, TE_CSQC_ANNOUNCE);
+               WriteString(MSG_ONE, snd);
+       }
 }
 
 float ClientData_Send(entity to, float sf)
@@ -405,6 +408,7 @@ string CheckPlayerModel(string plyermodel) {
        {
                if(substring(plyermodel,-4,4) != ".zym")
                if(substring(plyermodel,-4,4) != ".dpm")
+               if(substring(plyermodel,-4,4) != ".iqm")
                if(substring(plyermodel,-4,4) != ".md3")
                if(substring(plyermodel,-4,4) != ".psk")
                        return FallbackPlayerModel;
@@ -582,7 +586,6 @@ void PutObserverInServer (void)
        }
 
        DropAllRunes(self);
-       kh_Key_DropAll(self, TRUE);
 
        Portal_ClearAll(self);
 
@@ -697,6 +700,8 @@ void PutObserverInServer (void)
        }
        else
                self.frags = FRAGS_SPECTATOR;
+
+       MUTATOR_CALLHOOK(MakePlayerObserver);
 }
 
 float RestrictSkin(float s)
@@ -898,9 +903,6 @@ void PutClientInServer (void)
                        self.weapons = randombits(self.weapons, g_weaponarena_random, FALSE);
 
                self.items = start_items;
-               self.switchweapon = w_getbestweapon(self);
-               self.cnt = self.switchweapon;
-               self.weapon = 0;
                self.jump_interval = time;
 
                self.spawnshieldtime = time + cvar("g_spawnshieldtime");
@@ -993,7 +995,6 @@ void PutClientInServer (void)
                }
 
                self.cnt = WEP_LASER;
-               self.nixnex_lastchange_id = -1;
 
                CL_SpawnWeaponentity();
                self.alpha = default_player_alpha;
@@ -1028,8 +1029,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 +1038,12 @@ void PutClientInServer (void)
                                SUB_UseTargets();
                        activator = world;
                self = oldself;
+
+               MUTATOR_CALLHOOK(PlayerSpawn);
+
+               self.switchweapon = w_getbestweapon(self);
+               self.cnt = self.switchweapon;
+               self.weapon = 0;
        } else if(self.classname == "observer" || (g_ca && !allowed_to_spawn)) {
                PutObserverInServer ();
        }
@@ -1578,7 +1585,7 @@ void ClientDisconnect (void)
        SoundEntity_Detach(self);
 
        DropAllRunes(self);
-       kh_Key_DropAll(self, TRUE);
+       MUTATOR_CALLHOOK(ClientDisconnect);
 
        Portal_ClearAll(self);
 
@@ -2046,6 +2053,7 @@ void SetZoomState(float z)
 }
 
 void GetPressedKeys(void) {
+       MUTATOR_CALLHOOK(GetPressedKeys);
        if (self.movement_x > 0) // get if movement keys are pressed
        {       // forward key pressed
                self.pressedkeys |= KEY_FORWARD;
@@ -2115,7 +2123,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;
@@ -2487,6 +2496,8 @@ void PlayerPreThink (void)
                return;
 #endif
 
+       MUTATOR_CALLHOOK(PlayerPreThink);
+
        if(self.classname == "player") {
 //             if(self.netname == "Wazat")
 //                     bprint(self.classname, "\n");
@@ -2508,8 +2519,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();
 
@@ -2522,8 +2531,7 @@ void PlayerPreThink (void)
 
                if(frametime)
                {
-                       if(cvar("gameversion") >= 20600) // only do this for 2.6 and above FIXME remove this check when making 2.6
-                               self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2;
+                       self.glowmod = colormapPaletteColor(self.clientcolors & 0x0F, TRUE) * 2;
                        player_powerups();
                }
 
@@ -2843,7 +2851,6 @@ void PlayerPostThink (void)
                        ImpulseCommands();
                if (intermission_running)
                        return;         // intermission or finale
-
                GetPressedKeys();
        } else if (self.classname == "observer") {
                //do nothing