]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
add a campaign levelwarp command "warp"
authorRudolf Polzer <divVerent@xonotic.org>
Tue, 13 Sep 2011 07:55:41 +0000 (09:55 +0200)
committerRudolf Polzer <divVerent@xonotic.org>
Tue, 13 Sep 2011 07:55:41 +0000 (09:55 +0200)
usage:

warp - skips current level
warp 10 - skips to level 10

The warp'd progress is NOT saved!

defaultXonotic.cfg
qcsrc/server/campaign.qc
qcsrc/server/cheats.qc
qcsrc/server/gamecommand.qc

index 2996d475adac3e1c2e25ad5183ece23ee90c1de4..759a512e7974b87b91ccdc678dcaefbf4f409dd4 100644 (file)
@@ -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"
index 923950b5071cd4084dff6e3b3750f61560822784..34345cdb653efc19f4a890a7c09d35c5a54a27cc 100644 (file)
@@ -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)
index 3270a9077fbcb1c7b640303553026221836ec7f3..0d95c453a1e6685b1d7032dd06dd520670ae628b 100644 (file)
@@ -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);
index 9203eadbf41c6fbbd63a594a01b87fd01eb692c2..a8537a0ae88c93cb92cf845f5463fd389abc0c10 100644 (file)
@@ -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");
 }