From bba82712e0d747e7aeb2dfe22f741eec479ab456 Mon Sep 17 00:00:00 2001 From: def Date: Tue, 25 Nov 2014 22:42:05 +0100 Subject: [PATCH] Add sv_solo_server for easier solo servers (also working for tunezones finally) --- src/engine/shared/config_variables.h | 1 + src/game/server/gamecontext.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index e2ec586b2..614eefb38 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -318,6 +318,7 @@ MACRO_CONFIG_INT(SvRankCheats, sv_rank_cheats, 0, 0, 1, CFGFLAG_SERVER, "Enable MACRO_CONFIG_INT(SvSpoofProtection, sv_spoof_protection, 0, 0, 1, CFGFLAG_SERVER, "Enable spoof protection") MACRO_CONFIG_INT(SvShutdownWhenEmpty, sv_shutdown_when_empty, 0, 0, 1, CFGFLAG_SERVER, "Shutdown server as soon as noone is on it anymore") MACRO_CONFIG_INT(SvKillProtection, sv_kill_protection, 20, 0, 9999, CFGFLAG_SERVER, "0 - Disable, 1-9999 minutes") +MACRO_CONFIG_INT(SvSoloServer, sv_solo_server, 0, 0, 1, CFGFLAG_SERVER, "Set server to solo mode (no player interactions, has to be set before loading the map)") MACRO_CONFIG_STR(SvClientSuggestion, sv_client_suggestion, 128, "Get the client from ddnet.tw to use all features on DDNet", CFGFLAG_SERVER, "Broadcast to display to players without DDNet client") //MACRO_CONFIG_STR(SvClientSuggestionOld, sv_client_suggestion_old, 128, "Your client version is old. Update it on ddnet.tw for new features!", CFGFLAG_SERVER, "Broadcast to display to players with an old version of DDNet client") diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 157961497..90eff5c65 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -2288,6 +2288,8 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/) g_Config.m_SvOldTeleportHook = 0; g_Config.m_SvOldTeleportWeapons = 0; g_Config.m_SvTeleportHoldHook = 0; + g_Config.m_SvTeam = 1; + g_Config.m_SvShowOthersDefault = 0; } Console()->ExecuteFile(g_Config.m_SvResetFile); @@ -2309,6 +2311,21 @@ void CGameContext::OnInit(/*class IKernel *pKernel*/) m_pController = new CGameControllerDDRace(this); ((CGameControllerDDRace*)m_pController)->m_Teams.Reset(); + if(g_Config.m_SvSoloServer) + { + g_Config.m_SvTeam = 3; + g_Config.m_SvShowOthersDefault = 1; + + Tuning()->Set("player_collision", 0); + Tuning()->Set("player_hooking", 0); + + for (int i = 0; i < 256; i++) + { + TuningList()[i].Set("player_collision", 0); + TuningList()[i].Set("player_hooking", 0); + } + } + // delete old score object if(m_pScore) delete m_pScore;