From 6b1a14c67319613c154e02439c43988edc3c7efa Mon Sep 17 00:00:00 2001 From: Samual Date: Thu, 12 May 2011 19:55:53 -0400 Subject: [PATCH] client setting to control whether or not they use noclip movement while spectating.. only problem is that putobserverinserver is run BEFORE getcvars can be completed, thus upon first join whatever setting you choose it doesn't matter :( There really is no way to fix this I think as it will always take time to get the cvars.. This is still a lesser evil than ONLY having a server side option, but.. --- defaultXonotic.cfg | 2 ++ qcsrc/server/cl_client.qc | 4 ++-- qcsrc/server/defs.qh | 1 + qcsrc/server/miscfunctions.qc | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 65a6554e0..3e7a16d31 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1680,6 +1680,8 @@ set sv_clones 0 "number of clones a player may make (reset by the \"kill\" comma set cl_handicap 1 "the higher, the more damage you will receive (client setting)" +seta cl_noclipspectating 0 "noclip for spectators so that you can pass through walls and such. (client setting)" + // must be at the bottom of this file: // alias for switching the teamselect menu alias menu_showteamselect "menu_cmd directmenu TeamSelect" diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 8a3aea874..2f6e4858f 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -653,13 +653,13 @@ void PutObserverInServer (void) accuracy_resend(self); self.spectatortime = time; - + self.classname = "observer"; self.iscreature = FALSE; self.health = -666; self.takedamage = DAMAGE_NO; self.solid = SOLID_NOT; - self.movetype = MOVETYPE_FLY; + self.movetype = (self.cvar_cl_noclipspectating ? MOVETYPE_NOCLIP : MOVETYPE_FLY); self.flags = FL_CLIENT | FL_NOTARGET; self.armorvalue = 666; self.effects = 0; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index cf13fee2c..ca530a991 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -311,6 +311,7 @@ float default_weapon_alpha; .float cvar_cl_playerdetailreduction; .float cvar_scr_centertime; .float cvar_cl_shownames; +.float cvar_cl_noclipspectating; .string cvar_g_xonoticversion; .string cvar_cl_weaponpriority; .string cvar_cl_weaponpriorities[10]; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 0c8162b54..d599c259c 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -588,6 +588,7 @@ void GetCvars(float f) GetCvars_handleFloat(s, f, cvar_cl_shownames, "cl_shownames"); GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion"); GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap"); + GetCvars_handleFloat(s, f, cvar_cl_noclipspectating, "cl_noclipspectating"); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriority, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[0], "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete); GetCvars_handleString_Fixup(s, f, cvar_cl_weaponpriorities[1], "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete); -- 2.39.2