]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Merge branch 'master' into pending-release
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index eb2ba1dcf7234831965879998894cedc3b0d13d6..5b7509e484d5fecec7e6f49a852de6ea218e39e9 100644 (file)
@@ -138,6 +138,8 @@ bool ClientData_Send(entity this, entity to, int sf)
        if (CS(e).race_completed)       sf |= BIT(0); // forced scoreboard
        if (CS(to).spectatee_status)    sf |= BIT(1); // spectator ent number follows
        if (CS(e).zoomstate)            sf |= BIT(2); // zoomed
+       if (observe_blocked_if_eliminated && INGAME(to))
+                                       sf |= BIT(3); // observing blocked
        if (autocvar_sv_showspectators == 1 || (autocvar_sv_showspectators && IS_SPEC(to)))
                                        sf |= BIT(4); // show spectators
 
@@ -534,6 +536,19 @@ void FixPlayermodel(entity player)
                                setcolor(player, stof(autocvar_sv_defaultplayercolors));
 }
 
+void GiveWarmupResources(entity this)
+{
+       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;
+}
+
 void PutPlayerInServer(entity this)
 {
        if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE);
@@ -576,17 +591,10 @@ 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 {
+       if (warmup_stage)
+               GiveWarmupResources(this);
+       else
+       {
                SetResource(this, RES_SHELLS, start_ammo_shells);
                SetResource(this, RES_BULLETS, start_ammo_nails);
                SetResource(this, RES_ROCKETS, start_ammo_rockets);
@@ -810,7 +818,7 @@ void PutPlayerInServer(entity this)
 
        antilag_clear(this, CS(this));
 
-       if (warmup_stage == -1)
+       if (warmup_stage < 0 || warmup_stage > 1)
                ReadyCount();
 }
 
@@ -1040,7 +1048,7 @@ void SendWelcomeMessage(entity this, int msg_type)
        WriteString(msg_type, autocvar_g_xonoticversion);
        WriteByte(msg_type, CS(this).version_mismatch);
        WriteByte(msg_type, (CS(this).version < autocvar_gameversion));
-       WriteByte(msg_type, map_minplayers);
+       WriteByte(msg_type, autocvar_g_warmup > 1 ? autocvar_g_warmup : map_minplayers);
        WriteByte(msg_type, GetPlayerLimit());
 
        MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
@@ -1166,7 +1174,7 @@ void ClientConnect(entity this)
        if (IS_REAL_CLIENT(this))
                sv_notice_join(this);
 
-       this.move_qcphysics = autocvar_sv_qcphysics;
+       this.move_qcphysics = true;
 
        // update physics stats (players can spawn before physics runs)
        Physics_UpdateStats(this);
@@ -2253,10 +2261,12 @@ void ObserverOrSpectatorThink(entity this)
                                }
                                CS(this).impulse = 0;
                        } else if(PHYS_INPUT_BUTTON_ATCK2(this)) {
-                               this.would_spectate = false;
-                               this.flags &= ~FL_JUMPRELEASED;
-                               TRANSMUTE(Observer, this);
-                               PutClientInServer(this);
+                               if(!observe_blocked_if_eliminated || !INGAME(this)) {
+                                       this.would_spectate = false;
+                                       this.flags &= ~FL_JUMPRELEASED;
+                                       TRANSMUTE(Observer, this);
+                                       PutClientInServer(this);
+                               }
                        } else if(!SpectateUpdate(this) && !SpectateNext(this)) {
                                PutObserverInServer(this, false, true);
                                this.would_spectate = true;