From: Rudolf Polzer Date: Tue, 13 Sep 2011 07:55:41 +0000 (+0200) Subject: add a campaign levelwarp command "warp" X-Git-Tag: xonotic-v0.6.0~40^2~141^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=fd34c19b67ed8a12051ace4ce73d8d8077e03dbb;p=xonotic%2Fxonotic-data.pk3dir.git add a campaign levelwarp command "warp" usage: warp - skips current level warp 10 - skips to level 10 The warp'd progress is NOT saved! --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 2996d475a..759a512e7 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -1186,6 +1186,7 @@ set g_campaign 0 set g_campaign_forceteam 0 "Forces the player to a given team in campaign mode, 1 = red, 2 = blue, 3 = yellow, 4 = pink" seta g_campaign_name "xonoticbeta" set g_campaign_skill 0 +alias warp "sv_cmd warp $*" alias singleplayer_start "g_campaign_index 0; set scmenu_campaign_goto 0" alias singleplayer_continue "set scmenu_campaign_goto -1" diff --git a/qcsrc/server/campaign.qc b/qcsrc/server/campaign.qc index 923950b50..34345cdb6 100644 --- a/qcsrc/server/campaign.qc +++ b/qcsrc/server/campaign.qc @@ -256,6 +256,8 @@ void CampaignPostIntermission() void CampaignLevelWarp(float n) { + if(n < 0) + n = campaign_level + 1; CampaignFile_Unload(); CampaignFile_Load(n, 1); if(campaign_entries) diff --git a/qcsrc/server/cheats.qc b/qcsrc/server/cheats.qc index 3270a9077..0d95c453a 100644 --- a/qcsrc/server/cheats.qc +++ b/qcsrc/server/cheats.qc @@ -604,14 +604,6 @@ float CheatCommand(float argc) remove(e); DID_CHEAT(); break; - case "warp": - IS_CHEAT(0, argc, 0); - if(argc == 2) if(autocvar_g_campaign) - { - CampaignLevelWarp(stof(argv(1))); - DID_CHEAT(); - } - break; case "god": IS_CHEAT(0, argc, 0); BITXOR_ASSIGN(self.flags, FL_GODMODE); diff --git a/qcsrc/server/gamecommand.qc b/qcsrc/server/gamecommand.qc index 9203eadbf..a8537a0ae 100644 --- a/qcsrc/server/gamecommand.qc +++ b/qcsrc/server/gamecommand.qc @@ -725,6 +725,7 @@ void GameCommand(string command) print(" find classname\n"); print(" extendmatchtime\n"); print(" reducematchtime\n"); + print(" warp [level]\n"); GameCommand_Vote("help", world); GameCommand_Ban("help"); GameCommand_Generic("help"); @@ -1485,6 +1486,19 @@ void GameCommand(string command) return; } + if(argv(0) == "warp") + { + if(autocvar_g_campaign) + { + if(argc >= 2) + CampaignLevelWarp(stof(argv(1))); + else + CampaignLevelWarp(-1); + } + else + print("Not in campaign, can't level warp\n"); + } + print("Invalid command. For a list of supported commands, try sv_cmd help.\n"); }