]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Improve end of warmup countdown abort (when player count drops too low)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index 6d8ef921b1f4b9bc0679cb97feb3ed7aafe7c0d1..5b7509e484d5fecec7e6f49a852de6ea218e39e9 100644 (file)
@@ -536,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);
@@ -578,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);