]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Allow forcing the player to a given team in campaign mode. Useful for story based...
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 15 Sep 2010 13:19:13 +0000 (16:19 +0300)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Wed, 15 Sep 2010 13:19:13 +0000 (16:19 +0300)
No, bot_vs_human can't replace this iirc. For one thing, bot_vs_human is useless if you have more than 2 teams. Also, bot_vs_human can only force the player in team X while forcing bots in the other team (so you can't put the player to the team you want without braking bot balance).

defaultXonotic.cfg
qcsrc/server/teamplay.qc

index 8e29eb492dc5c084425a503bc70a7d322dec56fa..acc84b0130392c30fcc4aea255b2d5cbd176c410 100644 (file)
@@ -1118,6 +1118,7 @@ set quit_and_redirect ""  "set to an IP to redirect all players at the end of the
 
 // singleplayer campaign
 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 "xonotic25"
 set g_campaign_skill 0
 set g_campaignxonotic20_index 0
index 0798b29b29b2769194190d7200d39ce3a6bd32ff..a37acb8af26351c118fc9bb4d52b3bdb100afa71 100644 (file)
@@ -879,6 +879,29 @@ float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
        // find out what teams are available
        CheckAllowedTeams(pl);
 
+       // if we want the player in a certain team for campaign, force him there
+       if(cvar("g_campaign"))
+       if(clienttype(pl) == CLIENTTYPE_REAL) // only players, not bots
+       {
+               switch(cvar("g_campaign_forceteam"))
+               {
+                       case 1:
+                               SetPlayerColors(pl, COLOR_TEAM1 - 1);
+                               return COLOR_TEAM1;
+                       case 2:
+                               SetPlayerColors(pl, COLOR_TEAM2 - 1);
+                               return COLOR_TEAM2;
+                       case 3:
+                               SetPlayerColors(pl, COLOR_TEAM3 - 1);
+                               return COLOR_TEAM3;
+                       case 4:
+                               SetPlayerColors(pl, COLOR_TEAM4 - 1);
+                               return COLOR_TEAM4;
+                       default:
+                               break;
+               }
+       }
+
        // if we don't care what team he ends up on, put him on whatever team he entered as.
        // if he's not on a valid team, then let other code put him on the smallest team
        if(!forcebestteam)