]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an option to spawn near teammates to allow turning it off client side (requires...
authorMario <zacjardine@y7mail.com>
Sun, 30 Aug 2015 12:48:35 +0000 (22:48 +1000)
committerMario <zacjardine@y7mail.com>
Sun, 30 Aug 2015 12:48:35 +0000 (22:48 +1000)
mutators.cfg
qcsrc/client/main.qc
qcsrc/server/autocvars.qh
qcsrc/server/mutators/mutator_spawn_near_teammate.qc

index 8f908086eb510fbc881657784669bda269baaf64..6a8d5c6141a0e9bf2a1751132263c5a53e7de307 100644 (file)
@@ -110,9 +110,10 @@ set g_rocket_flying 0 "set to 1 to enable rocket flying in all balance configs"
 // =====================
 //  spawn near teammate
 // =====================
+seta cl_spawn_near_teammate 1 "toggle for spawning near teammates (only effective if g_spawn_near_teammate_ignore_spawnpoint is 2)"
 set g_spawn_near_teammate 0 "if set, players prefer spawns near a team mate"
 set g_spawn_near_teammate_distance 640 "max distance to consider a spawn to be near a team mate"
-set g_spawn_near_teammate_ignore_spawnpoint 0 "ignore spawnpoints and spawn right at team mates"
+set g_spawn_near_teammate_ignore_spawnpoint 0 "ignore spawnpoints and spawn right at team mates, if 2, clients can ignore this option"
 set g_spawn_near_teammate_ignore_spawnpoint_delay 2.5 "how long to wait before its OK to spawn at a player after someone just spawned at this player"
 set g_spawn_near_teammate_ignore_spawnpoint_delay_death 0 "how long to wait before its OK to spawn at a player after death"
 set g_spawn_near_teammate_ignore_spawnpoint_check_health 1 "only allow spawn at this player if their health is full"
index 9b0c49a955cdc354f03ad446486b0bd2babfacdc..31e0256d3062d8cdf802b027c46156356c1c6a8d 100644 (file)
@@ -127,6 +127,8 @@ void CSQC_Init(void)
 
        registercvar("cl_multijump", "1");
 
+       registercvar("cl_spawn_near_teammate", "1");
+
        gametype = 0;
 
        // hud_fields uses strunzone on the titles!
index 0ca57bb02cf316ca76a159553487249fe7f9b2c2..a82efb706a46a4081f4e0754d71d4748ffe1a55b 100644 (file)
@@ -797,6 +797,7 @@ bool autocvar_g_overkill_100a_anyway;
 bool autocvar_g_overkill_ammo_charge;
 float autocvar_g_overkill_ammo_charge_notice;
 float autocvar_g_overkill_ammo_charge_limit;
+int autocvar_g_spawn_near_teammate;
 float autocvar_g_spawn_near_teammate_distance;
 bool autocvar_g_spawn_near_teammate_ignore_spawnpoint;
 float autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay;
index c3ab07a72635271dec43b04e0a87e1982361d8a6..1464870916ebaa23b06be4fe3992fb60a9b58ed0 100644 (file)
@@ -7,9 +7,11 @@
 .float msnt_timer;
 .vector msnt_deathloc;
 
+.float cvar_cl_spawn_near_teammate;
+
 MUTATOR_HOOKFUNCTION(msnt_Spawn_Score)
 {
-       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint)
+       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && self.cvar_cl_spawn_near_teammate))
                return 0;
 
        entity p;
@@ -46,7 +48,7 @@ MUTATOR_HOOKFUNCTION(msnt_Spawn_Score)
 MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
 {
        // Note: when entering this, fixangle is already set.
-       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint)
+       if(autocvar_g_spawn_near_teammate_ignore_spawnpoint == 1 || (autocvar_g_spawn_near_teammate_ignore_spawnpoint == 2 && self.cvar_cl_spawn_near_teammate))
        {
                if(autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death)
                        self.msnt_timer = time + autocvar_g_spawn_near_teammate_ignore_spawnpoint_delay_death;
@@ -158,11 +160,18 @@ MUTATOR_HOOKFUNCTION(msnt_PlayerDies)
        return 0;
 }
 
+MUTATOR_HOOKFUNCTION(msnt_GetCvars)
+{
+       GetCvars_handleFloat(get_cvars_s, get_cvars_f, cvar_cl_spawn_near_teammate, "cl_spawn_near_teammate");
+       return false;
+}
+
 MUTATOR_DEFINITION(mutator_spawn_near_teammate)
 {
        MUTATOR_HOOK(Spawn_Score, msnt_Spawn_Score, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerSpawn, msnt_PlayerSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDies, msnt_PlayerDies, CBC_ORDER_ANY);
+       MUTATOR_HOOK(GetCvars, msnt_GetCvars, CBC_ORDER_ANY);
 
        return 0;
 }