]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/mapobjects/target/changelevel.qc
Merge branch 'master' into Lyberta/WaypointIcons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / target / changelevel.qc
index 114fd871818a14e4ea3df07f52584aa88802ec65..876fed7a7306cab48686a8adef6c1e18caf94e0c 100644 (file)
@@ -5,6 +5,9 @@
 
 void target_changelevel_use(entity this, entity actor, entity trigger)
 {
+       if(game_stopped)
+               return;
+
        if(this.spawnflags & CHANGELEVEL_MULTIPLAYER)
        {
                // simply don't react if a non-player triggers it
@@ -25,12 +28,16 @@ void target_changelevel_use(entity this, entity actor, entity trigger)
        }
 
        if(this.gametype != "")
-               MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype));
+               MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype, false));
 
        if (this.chmap == "")
-               localcmd("endmatch\n");
+       {
+               if(IS_REAL_CLIENT(actor) && autocvar_g_campaign) // only count it as a win if the player touched (TODO: bots ending stage/vehicles?)
+                       campaign_forcewin = true; // this counts as beating the map in a campaign stage!
+               NextLevel();
+       }
        else
-               localcmd(strcat("changelevel ", this.chmap, "\n"));
+               changelevel(this.chmap);
 }
 
 /*target_changelevel