]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
q3compat: downgrade multiple worldspawn error to a warning bones_was_here/q3compat_worldspawn 1481/head
authorbones_was_here <bones_was_here@xonotic.au>
Mon, 24 Feb 2025 20:09:41 +0000 (06:09 +1000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 2 May 2025 09:24:54 +0000 (19:24 +1000)
qcsrc/server/world.qc

index 5e4bc9c69aa3657e077e0429ade5025514b6354e..a7326fca0c9aebf9eea5c8fc7ff54643449fbafd 100644 (file)
@@ -757,6 +757,21 @@ void InitGameplayMode()
 bool world_already_spawned;
 spawnfunc(worldspawn)
 {
+       // Must be checked first because we don't always error() and don't want to print this twice.
+       if (world_already_spawned)
+       {
+               string msg = "world already spawned - you may have EXACTLY ONE worldspawn!";
+               if (q3compat) // must be set during (first) worldspawn
+               {
+                       // Q3 allows >1 worldspawn entity, test map: q3dmz_carnage
+                       LOG_WARN(msg);
+                       return;
+               }
+               else
+                       error(msg);
+       }
+       world_already_spawned = true;
+
 #ifdef WATERMARK
        string watermark_start = cvar_string("sv_watermark_start");
        if (watermark_start == "") // always true on Xonotic (re)start
@@ -844,10 +859,6 @@ spawnfunc(worldspawn)
                }
        }
 
-       if(world_already_spawned)
-               error("world already spawned - you may have EXACTLY ONE worldspawn!");
-       world_already_spawned = true;
-
        delete_fn = remove_safely; // during spawning, watch what you remove!
 
        cvar_changes_init(); // do this very early now so it REALLY matches the server config