From: Mario Date: Sun, 30 Aug 2015 12:48:35 +0000 (+1000) Subject: Add an option to spawn near teammates to allow turning it off client side (requires... X-Git-Tag: xonotic-v0.8.2~1952 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=3d589ea3ec4baaa64fab90fa169430b79d05bbe1;p=xonotic%2Fxonotic-data.pk3dir.git Add an option to spawn near teammates to allow turning it off client side (requires server to allow this) --- diff --git a/mutators.cfg b/mutators.cfg index 8f908086e..6a8d5c614 100644 --- a/mutators.cfg +++ b/mutators.cfg @@ -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" diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 9b0c49a95..31e0256d3 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -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! diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 0ca57bb02..a82efb706 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; diff --git a/qcsrc/server/mutators/mutator_spawn_near_teammate.qc b/qcsrc/server/mutators/mutator_spawn_near_teammate.qc index c3ab07a72..146487091 100644 --- a/qcsrc/server/mutators/mutator_spawn_near_teammate.qc +++ b/qcsrc/server/mutators/mutator_spawn_near_teammate.qc @@ -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; }