]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Merge branch 'master' into Mario/cts_respawn_clear
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index 3ecac48855e7b0c8a274809c79298758b981dc35..aad1629fcb2af38b9d9b71b7ebd4ba2ffc2679df 100644 (file)
@@ -354,6 +354,15 @@ void PutObserverInServer(entity this)
        this.oldvelocity = this.velocity;
        this.fire_endtime = -1;
        this.event_damage = func_null;
+
+       for(int slot = 0; slot < MAX_AXH; ++slot)
+       {
+               entity axh = this.(AuxiliaryXhair[slot]);
+               this.(AuxiliaryXhair[slot]) = NULL;
+
+               if(axh.owner == this && axh != NULL && !wasfreed(axh))
+                       delete(axh);
+       }
 }
 
 int player_getspecies(entity this)
@@ -374,11 +383,12 @@ void FixPlayermodel(entity player)
        {
                if(teamplay)
                {
-                       string s = Static_Team_ColorName_Lower(player.team);
-                       if (s != "neutral")
+                       switch(player.team)
                        {
-                               defaultmodel = cvar_string(strcat("sv_defaultplayermodel_", s));
-                               defaultskin = cvar(strcat("sv_defaultplayerskin_", s));
+                               case NUM_TEAM_1: defaultmodel = autocvar_sv_defaultplayermodel_red; defaultskin = autocvar_sv_defaultplayerskin_red; break;
+                               case NUM_TEAM_2: defaultmodel = autocvar_sv_defaultplayermodel_blue; defaultskin = autocvar_sv_defaultplayerskin_blue; break;
+                               case NUM_TEAM_3: defaultmodel = autocvar_sv_defaultplayermodel_yellow; defaultskin = autocvar_sv_defaultplayerskin_yellow; break;
+                               case NUM_TEAM_4: defaultmodel = autocvar_sv_defaultplayermodel_pink; defaultskin = autocvar_sv_defaultplayerskin_pink; break;
                        }
                }
 
@@ -409,9 +419,13 @@ void FixPlayermodel(entity player)
        {
                if(teamplay)
                {
-                       string s = Static_Team_ColorName_Lower(player.team);
-                       if (s != "neutral")
-                               defaultskin = cvar(strcat("sv_defaultplayerskin_", s));
+                       switch(player.team)
+                       {
+                               case NUM_TEAM_1: defaultskin = autocvar_sv_defaultplayerskin_red; break;
+                               case NUM_TEAM_2: defaultskin = autocvar_sv_defaultplayerskin_blue; break;
+                               case NUM_TEAM_3: defaultskin = autocvar_sv_defaultplayerskin_yellow; break;
+                               case NUM_TEAM_4: defaultskin = autocvar_sv_defaultplayerskin_pink; break;
+                       }
                }
 
                if(!defaultskin)
@@ -642,6 +656,7 @@ void PutClientInServer(entity this)
                        IL_PUSH(g_bot_targets, this);
                this.bot_attack = true;
                this.monster_attack = true;
+               navigation_dynamicgoal_init(this, false);
 
                PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_JUMP(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
 
@@ -699,7 +714,7 @@ void PutClientInServer(entity this)
                for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
                        .entity weaponentity = weaponentities[slot];
-                       if(slot == 0)
+                       if(slot == 0 || autocvar_g_weaponswitch_debug == 1)
                                this.(weaponentity).m_switchweapon = w_getbestweapon(this, weaponentity);
                        else
                                this.(weaponentity).m_switchweapon = WEP_Null;
@@ -892,7 +907,7 @@ void KillIndicator_Think(entity this)
                ClientKill_Now(this.owner);
                return;
        }
-    else if(g_cts && this.health == 1) // health == 1 means that it's silent
+    else if(this.health == 1) // health == 1 means that it's silent
     {
         this.nextthink = time + 1;
         this.cnt -= 1;
@@ -922,11 +937,9 @@ void ClientKill_TeamChange (entity this, float targetteam) // 0 = don't change,
 
        killtime = autocvar_g_balance_kill_delay;
 
-       if(g_race_qualifying || g_cts)
-               killtime = 0;
-
     if(MUTATOR_CALLHOOK(ClientKill, this, killtime))
        return;
+    killtime = M_ARGV(1, float);
 
        this.killindicator_teamchange = targetteam;
 
@@ -1205,7 +1218,7 @@ void ClientConnect(entity this)
                stuffcmd(this, strcat("\nfog ", world.fog, "\nr_fog_exp2 0\nr_drawfog 1\n"));
 
        if (autocvar_sv_teamnagger && !(autocvar_bot_vs_human && AvailableTeams() == 2))
-               if (!g_ca && !g_cts && !g_race) // teamnagger is currently bad for ca, race & cts
+               if(!MUTATOR_CALLHOOK(HideTeamNagger, this))
                        send_CSQC_teamnagger();
 
        CSQCMODEL_AUTOINIT(this);
@@ -1216,6 +1229,8 @@ void ClientConnect(entity this)
                sv_notice_join(this);
 
        // update physics stats (players can spawn before physics runs)
+       STAT(MOVEVARS_HIGHSPEED, this) = autocvar_g_movement_highspeed;
+       MUTATOR_CALLHOOK(PlayerPhysics_UpdateStats, this); // do it BEFORE the function so we can modify highspeed!
        Physics_UpdateStats(this, PHYS_HIGHSPEED(this));
 
        IL_EACH(g_initforplayer, it.init_for_player, {
@@ -1705,6 +1720,11 @@ void SpectateCopy(entity this, entity spectatee)
                this.(weaponentity) = spectatee.(weaponentity);
        }
 
+       for(int slot = 0; slot < MAX_AXH; ++slot)
+       {
+               this.(AuxiliaryXhair[slot]) = spectatee.(AuxiliaryXhair[slot]);
+       }
+
     anticheat_spectatecopy(this, spectatee);
        this.hud = spectatee.hud;
        if(spectatee.vehicle)
@@ -2334,6 +2354,7 @@ void PlayerPreThink (entity this)
                CheckRules_Player(this);
 
                if (game_stopped || intermission_running) {
+                       this.modelflags &= ~MF_ROCKET;
                        if(intermission_running)
                                IntermissionThink(this);
                        return;
@@ -2358,6 +2379,13 @@ void PlayerPreThink (entity this)
                                }
                        } else {
                                if (frametime) player_anim(this);
+
+                               if (this.respawn_flags & RESPAWN_DENY)
+                               {
+                                       STAT(RESPAWN_TIME, this) = 0;
+                                       return;
+                               }
+
                                bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
 
                                switch(this.deadflag)