r6053 - in trunk: data data/maps data/maps/_init data/qcsrc/server server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Fri Mar 6 04:40:44 EST 2009


Author: div0
Date: 2009-03-06 04:40:41 -0500 (Fri, 06 Mar 2009)
New Revision: 6053

Added:
   trunk/data/maps/_init/
   trunk/data/maps/_init/_init.bsp
   trunk/data/maps/_init/_init.map
   trunk/data/server.cfg
Modified:
   trunk/data/defaultNexuiz.cfg
   trunk/data/qcsrc/server/g_world.qc
   trunk/server/server_havoc_linux.sh
   trunk/server/server_havoc_mac.sh
   trunk/server/server_havoc_windows.bat
   trunk/server/server_linux.sh
   trunk/server/server_mac.sh
   trunk/server/server_windows.bat
Log:
Radical change (please test): allow sv_cmd commands in server.cfg; automatically execute server.cfg on dedicated servers

This is done by making a tiny bsp file _init/_init.bsp that causes server initialization to take place.

Result: aggressor is no longer forcefully loaded as first map, so servers should start up a little faster now.


Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg	2009-03-05 14:02:02 UTC (rev 6052)
+++ trunk/data/defaultNexuiz.cfg	2009-03-06 09:40:41 UTC (rev 6053)
@@ -736,7 +736,7 @@
 seta cl_hitsound 1
 
 // startmap_dm is used when running with the -listen or -dedicated commandline options
-alias startmap_dm "set _sv_init 1; map aggressor"
+alias startmap_dm "set _sv_init 0; map _init/_init; exec server.cfg; set _sv_init 1"
 
 // aliases:
 alias +attack2 +button3

Added: trunk/data/maps/_init/_init.bsp
===================================================================
(Binary files differ)


Property changes on: trunk/data/maps/_init/_init.bsp
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/data/maps/_init/_init.map
===================================================================
--- trunk/data/maps/_init/_init.map	                        (rev 0)
+++ trunk/data/maps/_init/_init.map	2009-03-06 09:40:41 UTC (rev 6053)
@@ -0,0 +1,12 @@
+{
+"classname" "__init_dedicated_server"
+// brush 0
+{
+( 0 0 0 ) ( 0 1 0 ) ( 0 0 1 ) common/caulk 0 0 0 0.5 0.5 0 0 0
+( 0 0 0 ) ( 1 0 0 ) ( 0 1 0 ) common/caulk 0 0 0 0.5 0.5 0 0 0
+( 0 0 0 ) ( 0 0 1 ) ( 1 0 0 ) common/caulk 0 0 0 0.5 0.5 0 0 0
+( 1 1 1 ) ( 1 1 0 ) ( 1 0 1 ) common/caulk 0 0 0 0.5 0.5 0 0 0
+( 1 1 1 ) ( 1 0 1 ) ( 0 1 1 ) common/caulk 0 0 0 0.5 0.5 0 0 0
+( 1 1 1 ) ( 0 1 1 ) ( 1 1 0 ) common/caulk 0 0 0 0.5 0.5 0 0 0
+}
+}

Modified: trunk/data/qcsrc/server/g_world.qc
===================================================================
--- trunk/data/qcsrc/server/g_world.qc	2009-03-05 14:02:02 UTC (rev 6052)
+++ trunk/data/qcsrc/server/g_world.qc	2009-03-06 09:40:41 UTC (rev 6053)
@@ -131,27 +131,38 @@
 	}
 }
 
-float GotoFirstMap()
+void GotoFirstMap()
 {
 	if(cvar("_sv_init"))
 	{
-		cvar_set("_sv_init", "0");
+		// cvar_set("_sv_init", "0");
+		// we do NOT set this to 0 any more, so someone "accidentally" changing
+		// to this "init" map on a dedicated server will cause no permanent
+		// harm
 		if(cvar("g_maplist_shuffle"))
 			ShuffleMaplist();
 		tokenizebyseparator(cvar_string("g_maplist"), " ");
-		{
-			cvar_set("nextmap", argv(0));
 
-			MapInfo_Enumerate();
-			MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0), 0);
+		cvar_set("nextmap", argv(0));
 
-			if(!DoNextMapOverride())
-				GotoNextMap();
+		MapInfo_Enumerate();
+		MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0, (g_maplist_allow_hidden ? MAPINFO_FLAG_HIDDEN : 0), 0);
 
-			return 1;
-		}
+		if(!DoNextMapOverride())
+			GotoNextMap();
+
+		return;
 	}
-	return 0;
+
+	if(time < 5)
+	{
+		self.nextthink = time;
+	}
+	else
+	{
+		self.nextthink = time + 1;
+		print("Waiting for _sv_init being set to 1 by initialization scripts...\n");
+	}
 }
 
 void cvar_changes_init()
@@ -326,6 +337,25 @@
 	self = oldself;
 }
 
+void spawnfunc___init_dedicated_server(void)
+{
+	// handler for _init/_init map (only for dedicated server initialization)
+
+	dprint_load(); // load dprint status from cvar
+	world_initialized = -1; // don't complain
+	remove = remove_unsafely;
+
+	entity e;
+	e = spawn();
+	e.think = GotoFirstMap;
+	e.nextthink = time; // this is usually 1 at this point
+
+	e = spawn();
+	e.classname = "info_player_deathmatch"; // safeguard against player joining
+
+	self.classname = "worldspawn"; // safeguard against various stuff ;)
+}
+
 void Map_MarkAsRecent(string m);
 float world_already_spawned;
 void RegisterWeapons();
@@ -367,12 +397,6 @@
 	// needs to be done so early as they would still spawn
 	RegisterWeapons();
 
-	if(GotoFirstMap())
-	{
-		world_initialized = -1; // don't complain
-		return;
-	}
-
 	if(sv_cheats)
 		ServerProgsDB = db_create();
 	else

Added: trunk/data/server.cfg
===================================================================
--- trunk/data/server.cfg	                        (rev 0)
+++ trunk/data/server.cfg	2009-03-06 09:40:41 UTC (rev 6053)
@@ -0,0 +1,8 @@
+echo
+echo You have not written any server.cfg file yet.
+echo The server will therefore run at default settings.
+echo
+echo For information on how to set up a dedicated server,
+echo look at the files in the server/ subdirectory of your
+echo Nexuiz install.
+echo

Modified: trunk/server/server_havoc_linux.sh
===================================================================
--- trunk/server/server_havoc_linux.sh	2009-03-05 14:02:02 UTC (rev 6052)
+++ trunk/server/server_havoc_linux.sh	2009-03-06 09:40:41 UTC (rev 6053)
@@ -6,4 +6,4 @@
 esac
 
 cd "`dirname "${0}"`"
-exec ./${executable} -game havoc +exec server.cfg "${@}"
+exec ./${executable} -game havoc "${@}"

Modified: trunk/server/server_havoc_mac.sh
===================================================================
--- trunk/server/server_havoc_mac.sh	2009-03-05 14:02:02 UTC (rev 6052)
+++ trunk/server/server_havoc_mac.sh	2009-03-06 09:40:41 UTC (rev 6053)
@@ -3,4 +3,4 @@
 executable="nexuiz-osx-dedicated"
 
 cd "`dirname "${0}"`"
-exec ./${executable} -game havoc +exec server.cfg "${@}"
+exec ./${executable} -game havoc "${@}"

Modified: trunk/server/server_havoc_windows.bat
===================================================================
--- trunk/server/server_havoc_windows.bat	2009-03-05 14:02:02 UTC (rev 6052)
+++ trunk/server/server_havoc_windows.bat	2009-03-06 09:40:41 UTC (rev 6053)
@@ -5,4 +5,4 @@
 
 %~d0
 cd "%~p0"
-.\%executable% -game havoc +exec server.cfg %*
+.\%executable% -game havoc %*

Modified: trunk/server/server_linux.sh
===================================================================
--- trunk/server/server_linux.sh	2009-03-05 14:02:02 UTC (rev 6052)
+++ trunk/server/server_linux.sh	2009-03-06 09:40:41 UTC (rev 6053)
@@ -6,4 +6,4 @@
 esac
 
 cd "`dirname "${0}"`"
-exec ./${executable} +exec server.cfg "${@}"
+exec ./${executable} "${@}"

Modified: trunk/server/server_mac.sh
===================================================================
--- trunk/server/server_mac.sh	2009-03-05 14:02:02 UTC (rev 6052)
+++ trunk/server/server_mac.sh	2009-03-06 09:40:41 UTC (rev 6053)
@@ -3,4 +3,4 @@
 executable="nexuiz-osx-dedicated"
 
 cd "`dirname "${0}"`"
-exec ./${executable} +exec server.cfg "${@}"
+exec ./${executable} "${@}"

Modified: trunk/server/server_windows.bat
===================================================================
--- trunk/server/server_windows.bat	2009-03-05 14:02:02 UTC (rev 6052)
+++ trunk/server/server_windows.bat	2009-03-06 09:40:41 UTC (rev 6053)
@@ -5,4 +5,4 @@
 
 %~d0
 cd "%~p0"
-.\%executable% +exec server.cfg %*
+.\%executable% %*




More information about the nexuiz-commits mailing list