]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Merge branch 'master' into z411/bai-server
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index cab642e67fd9b0f8e65a3eafedb54800e8cc3927..a7ac519af1628d1daeb60a4cd7e6f299436a9158 100644 (file)
@@ -98,6 +98,16 @@ void send_CSQC_teamnagger() {
        WriteHeader(MSG_BROADCAST, TE_CSQC_TEAMNAGGER);
 }
 
+void send_TeamNames(int channel, entity to) {
+       msg_entity = to;
+       
+       WriteHeader(channel, TE_CSQC_TEAMNAMES);
+       WriteString(channel, autocvar_g_teamnames_red);
+       WriteString(channel, autocvar_g_teamnames_blue);
+       WriteString(channel, autocvar_g_teamnames_yellow);
+       WriteString(channel, autocvar_g_teamnames_pink);
+}
+
 int CountSpectators(entity player, entity to)
 {
        if(!player) { return 0; } // not sure how, but best to be safe
@@ -409,6 +419,10 @@ void PutObserverInServer(entity this, bool is_forced, bool use_spawnpoint)
 
        if (CS(this).just_joined)
                CS(this).just_joined = false;
+       
+       // for RJZ
+       if (autocvar_rjz_count_shards)
+               send_TotalShards(this);
 }
 
 int player_getspecies(entity this)
@@ -533,6 +547,36 @@ void FixPlayermodel(entity player)
                                setcolor(player, stof(autocvar_sv_defaultplayercolors));
 }
 
+void ResetPlayerResources(entity this)
+{
+       if (warmup_stage) {
+               SetResource(this, RES_SHELLS, warmup_start_ammo_shells);
+               SetResource(this, RES_BULLETS, warmup_start_ammo_nails);
+               SetResource(this, RES_ROCKETS, warmup_start_ammo_rockets);
+               SetResource(this, RES_CELLS, warmup_start_ammo_cells);
+               SetResource(this, RES_PLASMA, warmup_start_ammo_plasma);
+               SetResource(this, RES_FUEL, warmup_start_ammo_fuel);
+               SetResource(this, RES_HEALTH, warmup_start_health);
+               SetResource(this, RES_ARMOR, warmup_start_armorvalue);
+               STAT(WEAPONS, this) = WARMUP_START_WEAPONS;
+       } else {
+               SetResource(this, RES_SHELLS, start_ammo_shells);
+               SetResource(this, RES_BULLETS, start_ammo_nails);
+               SetResource(this, RES_ROCKETS, start_ammo_rockets);
+               SetResource(this, RES_CELLS, start_ammo_cells);
+               SetResource(this, RES_PLASMA, start_ammo_plasma);
+               SetResource(this, RES_FUEL, start_ammo_fuel);
+               SetResource(this, RES_HEALTH, start_health);
+               SetResource(this, RES_ARMOR, start_armorvalue);
+               STAT(WEAPONS, this) = start_weapons;
+               if (MUTATOR_CALLHOOK(ForbidRandomStartWeapons, this) == false)
+               {
+                       GiveRandomWeapons(this, random_start_weapons_count,
+                               autocvar_g_random_start_weapons, random_start_ammo);
+               }
+       }
+}
+
 void PutPlayerInServer(entity this)
 {
        if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE);
@@ -572,32 +616,8 @@ void PutPlayerInServer(entity this)
        this.takedamage = DAMAGE_AIM;
        this.effects = EF_TELEPORT_BIT | EF_RESTARTANIM_BIT;
 
-       if (warmup_stage) {
-               SetResource(this, RES_SHELLS, warmup_start_ammo_shells);
-               SetResource(this, RES_BULLETS, warmup_start_ammo_nails);
-               SetResource(this, RES_ROCKETS, warmup_start_ammo_rockets);
-               SetResource(this, RES_CELLS, warmup_start_ammo_cells);
-               SetResource(this, RES_PLASMA, warmup_start_ammo_plasma);
-               SetResource(this, RES_FUEL, warmup_start_ammo_fuel);
-               SetResource(this, RES_HEALTH, warmup_start_health);
-               SetResource(this, RES_ARMOR, warmup_start_armorvalue);
-               STAT(WEAPONS, this) = WARMUP_START_WEAPONS;
-       } else {
-               SetResource(this, RES_SHELLS, start_ammo_shells);
-               SetResource(this, RES_BULLETS, start_ammo_nails);
-               SetResource(this, RES_ROCKETS, start_ammo_rockets);
-               SetResource(this, RES_CELLS, start_ammo_cells);
-               SetResource(this, RES_PLASMA, start_ammo_plasma);
-               SetResource(this, RES_FUEL, start_ammo_fuel);
-               SetResource(this, RES_HEALTH, start_health);
-               SetResource(this, RES_ARMOR, start_armorvalue);
-               STAT(WEAPONS, this) = start_weapons;
-               if (MUTATOR_CALLHOOK(ForbidRandomStartWeapons, this) == false)
-               {
-                       GiveRandomWeapons(this, random_start_weapons_count,
-                               autocvar_g_random_start_weapons, random_start_ammo);
-               }
-       }
+       ResetPlayerResources(this);
+       
        SetSpectatee_status(this, 0);
 
        PS(this).dual_weapons = '0 0 0';
@@ -834,7 +854,9 @@ void PutClientInServer(entity this)
        } else if (IS_PLAYER(this)) {
                PutPlayerInServer(this);
        }
-
+       // send team names
+       if(teamplay && IS_REAL_CLIENT(this))
+               send_TeamNames(MSG_ONE, this);
        bot_relinkplayerlist();
 }
 
@@ -874,6 +896,13 @@ void ClientInit_misc(entity this)
        WriteByte(channel, this.cnt * 255.0); // g_balance_damagepush_speedfactor
        WriteByte(channel, serverflags);
        WriteCoord(channel, autocvar_g_trueaim_minrange);
+       
+       // z411 send full hostname
+       WriteString(channel, (autocvar_hostname_full != "" ? autocvar_hostname_full : autocvar_hostname));
+       WriteString(channel, autocvar_sv_motd_permanent);
+       
+       // z411 send client countdown type
+       WriteByte(channel, autocvar_sv_timer_countdown);
 }
 
 void ClientInit_CheckUpdate(entity this)
@@ -1105,8 +1134,12 @@ void ClientConnect(entity this)
        else
                CS(this).allowed_timeouts = autocvar_sv_timeout_number;
 
-       if (autocvar_sv_eventlog)
+       if (autocvar_sv_eventlog) {
                GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? GameLog_ProcessIP(this.netaddress) : "bot"), ":", playername(this.netname, this.team, false)));
+               
+               /* z411 for RJZ */
+               if(autocvar_rjz_ranks) GameLogEcho(strcat(":idfp:", ftos(etof(this)), ":", this.crypto_idfp));
+       }
 
        CS(this).just_joined = true;  // stop spamming the eventlog with additional lines when the client connects
 
@@ -1976,6 +2009,11 @@ void Join(entity this)
        else
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_JOIN_PLAY, this.netname);
        this.team_selected = false;
+       
+       // z411
+       // send constant ready notification
+       if(warmup_stage)
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MISSING_READY);
 }
 
 int GetPlayerLimit()
@@ -2115,12 +2153,13 @@ bool PlayerThink(entity this)
                return false;
        }
 
-       if (timeout_status == TIMEOUT_ACTIVE) {
-               // don't allow the player to turn around while game is paused
+       if (game_timeout) {
+        // don't allow the player to turn around while game is paused
                // FIXME turn this into CSQC stuff
                this.v_angle = this.lastV_angle;
                this.angles = this.lastV_angle;
                this.fixangle = true;
+               return false;
        }
 
        if (frametime) player_powerups(this);