From: Rudolf Polzer Date: Sun, 19 Feb 2012 16:22:58 +0000 (+0100) Subject: mark Sandbox as mod for the server browser X-Git-Tag: xonotic-v0.6.0~66^2~7 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fd0f4bf0dd4c85aced89a6cd0a2fa9023699bce2;p=xonotic%2Fxonotic-data.pk3dir.git mark Sandbox as mod for the server browser --- diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index acf820803..bd49365a6 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -909,13 +909,8 @@ void spawnfunc_worldspawn (void) PlayerStats_Init(); + // MOD AUTHORS: change this, and possibly remove a few of the blocks below to ignore certain changes modname = "Xonotic"; - // weird mutators that deserve to count as mod - if(autocvar_g_minstagib) - modname = "MinstaGib"; - // weird game types that deserve to count as mod - if(g_cts) - modname = "CTS"; // physics/balance/config changes that count as mod if(cvar_string("g_mod_physics") != cvar_defstring("g_mod_physics")) modname = cvar_string("g_mod_physics"); @@ -923,8 +918,19 @@ void spawnfunc_worldspawn (void) modname = cvar_string("g_mod_balance"); if(cvar_string("g_mod_config") != cvar_defstring("g_mod_config")) modname = cvar_string("g_mod_config"); + // weird mutators that deserve to count as mod + if(autocvar_g_minstagib) + modname = "MinstaGib"; + // extra mutators that deserve to count as mod + MUTATOR_CALLHOOK(SetModname); + // weird game types that deserve to count as mod + if(g_cts) + modname = "CTS"; + // save it for later modname = strzone(modname); + WinningConditionHelper(); // set worldstatus + world_initialized = 1; } diff --git a/qcsrc/server/mutators/base.qh b/qcsrc/server/mutators/base.qh index ecec3c87c..137eebadb 100644 --- a/qcsrc/server/mutators/base.qh +++ b/qcsrc/server/mutators/base.qh @@ -201,3 +201,7 @@ MUTATOR_HOOKABLE(Spawn_Score); MUTATOR_HOOKABLE(SV_StartFrame); // runs globally each server frame + +MUTATOR_HOOKABLE(SetModname); + // OUT + string modname; // name of the mutator/mod if it warrants showing as such in the server browser diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index e7f51aa88..31a1a4e85 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -794,10 +794,17 @@ MUTATOR_HOOKFUNCTION(sandbox_StartFrame) return TRUE; } +MUTATOR_HOOKFUNCTION(sandbox_SetModname) +{ + modname = "Sandbox"; + return TRUE; +} + MUTATOR_DEFINITION(sandbox) { MUTATOR_HOOK(SV_ParseClientCommand, sandbox_PlayerCommand, CBC_ORDER_ANY); MUTATOR_HOOK(SV_StartFrame, sandbox_StartFrame, CBC_ORDER_ANY); + MUTATOR_HOOK(SetModname, sandbox_SetModname, CBC_ORDER_ANY); MUTATOR_ONADD {