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
MapInfo_SwitchGameType(MapInfo_Type_FromString(this.gametype));
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
if(baseskill < 0)
baseskill = 0;
+ campaign_forcewin = false;
+
cvar_set("sv_public", "0");
cvar_set("pausable", "1");
campaign_won = 1;
bprint("Campaign test run, advancing level.\n");
}
+ else if(campaign_forcewin)
+ {
+ campaign_won = 1;
+ bprint("The current level has been WON.\n");
+ }
else if(won == 1 && lost == 0 && checkrules_equality == 0)
{
if(autocvar_timelimit != 0 && autocvar_fraglimit != 0 && time > autocvar_timelimit * 60) // checks if the timelimit has expired.
* in other game modes, this is ignored
*/
bool campaign_bots_may_start;
+
+bool campaign_forcewin;