]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into divVerent/forced-teams-by-idfp
authorRudolf Polzer <divVerent@xonotic.org>
Thu, 11 Nov 2010 13:16:59 +0000 (14:16 +0100)
committerRudolf Polzer <divVerent@xonotic.org>
Thu, 11 Nov 2010 13:16:59 +0000 (14:16 +0100)
1  2 
defaultXonotic.cfg
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc
qcsrc/server/teamplay.qc

diff --combined defaultXonotic.cfg
index 12e66aa76452938119b32358c03396147c830cf1,2e26355e7096a7bd332e8a46d9137f350dffade4..3483f45f9465648da586410e0dd63983340e1e6c
@@@ -526,7 -526,6 +526,6 @@@ set g_minstagib_speed_moverate 1.25 "sp
  set g_vampire 0 "set to 1 to enable the vampire mode, where the damage done to your opponent gets added to your own health"
  set g_weaponarena "0" "put in a list of weapons to enable a weapon arena mode, or try \"all\" or \"most\""
  set g_weaponarena_random "0"  "if set to a number, only that weapon count is given on every spawn (randomly)"
- set g_laserguided_missile 0 "if set to 1 the rockets of the rocket launcher can be steered using a laserpointer"
  set g_midair 0 "if set to 1 you can only apply damage to your opponent while he is airborne"
  set g_midair_shieldtime 0.3 "number of seconds you are still invincible since you lost contact to the ground"
  set g_spawnsound 1 "set to 0 if you don't want to hear the spawn sound when a player spawns"
@@@ -2012,14 -2011,6 +2011,14 @@@ mod_q3shader_default_polygonfactor 
  // allow fullbright
  set sv_allow_fullbright 0 "when set, clients may use r_fullbright on this server without getting a night vision effect overlay"
  
 +// auto-teams (team selection by player ID)
 +// any player not listed is forced to spectate
 +set g_forced_team_red "" "list of player IDs for red team"
 +set g_forced_team_blue "" "list of player IDs for blue team"
 +set g_forced_team_yellow "" "list of player IDs for yellow team"
 +set g_forced_team_pink "" "list of player IDs for pink team"
 +set g_forced_team_otherwise "default" "action if a non listed player joins (can be default for default action, spectate for forcing to spectate, or red, blue, yellow, pink)"
 +
  // other config files
  exec balanceXonotic.cfg
  exec ctfscoring-ai.cfg
index 750590a84210a76597f1a42f5b5308b87fcc8eeb,abdd41ebe93649243ea01781dd48505d16b1099f..72f37a078436339fc418ca9a3f18edc97b16b8d2
@@@ -1408,27 -1408,6 +1408,27 @@@ void FixClientCvars(entity e
         */
  }
  
 +float PlayerInIDList(entity p, string idlist)
 +{
 +      float n, i;
 +      string s;
 +
 +      // NOTE: we do NOT check crypto_keyfp here, an unsigned ID is fine too for this
 +      if not(p.crypto_idfp)
 +              return 0;
 +
 +      // this function allows abbreviated player IDs too!
 +      n = tokenize_console(idlist);
 +      for(i = 0; i < n; ++i)
 +      {
 +              s = argv(i);
 +              if(s == substring(p.crypto_idfp, 0, strlen(s)))
 +                      return 1;
 +      }
 +
 +      return 0;
 +}
 +
  /*
  =============
  ClientConnect
@@@ -1484,37 -1463,9 +1484,37 @@@ void ClientConnect (void
        //if(g_domination)
        //      dom_player_join_team(self);
  
 +      // identify the right forced team
 +      if(PlayerInIDList(self, cvar_string("g_forced_team_red")))
 +              self.team_forced = COLOR_TEAM1;
 +      else if(PlayerInIDList(self, cvar_string("g_forced_team_blue")))
 +              self.team_forced = COLOR_TEAM2;
 +      else if(PlayerInIDList(self, cvar_string("g_forced_team_yellow")))
 +              self.team_forced = COLOR_TEAM3;
 +      else if(PlayerInIDList(self, cvar_string("g_forced_team_pink")))
 +              self.team_forced = COLOR_TEAM4;
 +      else if(cvar_string("g_forced_team_otherwise") == "red")
 +              self.team_forced = COLOR_TEAM1;
 +      else if(cvar_string("g_forced_team_otherwise") == "blue")
 +              self.team_forced = COLOR_TEAM2;
 +      else if(cvar_string("g_forced_team_otherwise") == "yellow")
 +              self.team_forced = COLOR_TEAM3;
 +      else if(cvar_string("g_forced_team_otherwise") == "pink")
 +              self.team_forced = COLOR_TEAM4;
 +      else if(cvar_string("g_forced_team_otherwise") == "spectate")
 +              self.team_forced = -1;
 +      else if(cvar_string("g_forced_team_otherwise") == "spectator")
 +              self.team_forced = -1;
 +      else
 +              self.team_forced = 0;
 +
 +      if(!teams_matter)
 +              if(self.team_forced > 0)
 +                      self.team_forced = 0;
 +
        JoinBestTeam(self, FALSE, FALSE); // if the team number is valid, keep it
  
 -      if((cvar("sv_spectate") == 1 && !g_lms) || cvar("g_campaign")) {
 +      if((cvar("sv_spectate") == 1 && !g_lms) || cvar("g_campaign") || self.team_forced < 0) {
                self.classname = "observer";
        } else {
                if(teams_matter)
@@@ -1744,11 -1695,6 +1744,6 @@@ void ClientDisconnect (void
  
        bot_relinkplayerlist();
  
-       // remove laserdot
-       if(self.weaponentity)
-               if(self.weaponentity.lasertarget)
-                       remove(self.weaponentity.lasertarget);
        if(g_arena)
        {
                Spawnqueue_Unmark(self);
@@@ -2428,9 -2374,6 +2423,9 @@@ void LeaveSpectatorMode(
   * @return bool TRUE if the player is allowed to join, false otherwise
   */
  float isJoinAllowed() {
 +      if(self.team_forced < 0)
 +              return FALSE; // forced spectators can never join
 +
        if (!cvar("g_maxplayers"))
                return TRUE;
  
diff --combined qcsrc/server/defs.qh
index 4e5a6bfced33d959f054d8ef724c853c7379f8d5,95fce0ade3b7a284ad646a88e56001f55ab4a6b4..1d3c5a6321fecde83d0fb30da4cb8ed7c5442276
@@@ -18,7 -18,7 +18,7 @@@ float require_spawnfunc_prefix; // if t
  float ctf_score_value(string parameter);
  
  float g_dm, g_domination, g_ctf, g_tdm, g_keyhunt, g_onslaught, g_assault, g_arena, g_ca, g_lms, g_runematch, g_race, g_nexball, g_cts;
- float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_laserguided_missile, g_midair, g_minstagib, g_pinata, g_norecoil, g_vampire, g_minstagib_invis_alpha, g_bloodloss;
+ float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_midair, g_minstagib, g_pinata, g_norecoil, g_minstagib_invis_alpha, g_bloodloss;
  float g_warmup_limit;
  float g_warmup_allguns;
  float g_warmup_allow_timeout;
@@@ -243,10 -243,6 +243,6 @@@ float alreadychangedlevel
  .float welcomemessage_time;
  .float version;
  
- // Laser target for laser-guided weapons
- .entity lasertarget;
- .float laser_on;
  // minstagib vars
  .float jump_interval;    // laser refire
  
@@@ -662,5 -658,3 +658,5 @@@ string deathmessage
  float allowed_to_spawn; // boolean variable used by the clan arena code to determine if a player can spawn (after the round has ended)
  
  float serverflags;
 +
 +.float team_forced; // can be a team number to force a team, or 0 for default action, or -1 for forced spectator
diff --combined qcsrc/server/g_world.qc
index 9e911be07d038ccc0786957458379c5a5bfe9f3d,688b5e416f881b55b7507d7d62a892bd1adda9a7..4b4b8ed2853240e870ca811fd82a78f5c4fd27f8
@@@ -301,12 -301,6 +301,12 @@@ void cvar_changes_init(
                BADCVAR("developer");
                BADPREFIX("developer_");
  
 +              // these can contain player IDs, so better hide
 +              BADCVAR("g_forced_team_red");
 +              BADCVAR("g_forced_team_blue");
 +              BADCVAR("g_forced_team_yellow");
 +              BADCVAR("g_forced_team_pink");
 +
                // mapinfo
                BADCVAR("timelimit");
                BADCVAR("fraglimit");
                BADCVAR("sv_vote_master_password");
                BADCVAR("sv_vote_simple_majority_factor");
                BADCVAR("timelimit_override");
 +
 +              if(cvar("g_minstagib"))
 +              {
 +                      BADCVAR("g_grappling_hook");
 +                      BADCVAR("g_jetpack");
 +              }
  #undef BADPREFIX
  #undef BADCVAR
  
@@@ -705,24 -693,34 +705,34 @@@ void spawnfunc_worldspawn (void
                MUTATOR_CALLHOOK(BuildMutatorsString);
                s = ret_string;
  
+               // simple, probably not good in the mutator system
                if(cvar("g_grappling_hook"))
                        s = strcat(s, ":grappling_hook");
+               // initialiation stuff, not good in the mutator system
                if(!cvar("g_use_ammunition"))
                        s = strcat(s, ":no_use_ammunition");
+               // initialiation stuff, not good in the mutator system
                if(!cvar("g_pickup_items"))
                        s = strcat(s, ":no_pickup_items");
+               // initialiation stuff, not good in the mutator system
                if(cvar_string("g_weaponarena") != "0")
                        s = strcat(s, ":", cvar_string("g_weaponarena"), " arena");
-               if(cvar("g_vampire"))
-                       s = strcat(s, ":vampire");
-               if(cvar("g_laserguided_missile"))
-                       s = strcat(s, ":laserguided_missile");
+               // TODO to mutator system
                if(cvar("g_norecoil"))
                        s = strcat(s, ":norecoil");
+               // TODO to mutator system
                if(cvar("g_midair"))
                        s = strcat(s, ":midair");
+               // TODO to mutator system
                if(cvar("g_minstagib"))
                        s = strcat(s, ":minstagib");
                GameLogEcho(s);
                GameLogEcho(":gameinfo:end");
        }
diff --combined qcsrc/server/teamplay.qc
index d9d71bc0985c38c4cd42624d83cd6552387cea22,13680e68a8a2719c32ad396fbdef8ef692899e68..d784c72d8fa64d0d7f4a234f5a370f5cb98cd1db
@@@ -512,12 -512,8 +512,8 @@@ void PrintWelcomeMessage(entity pl
                modifications = strcat(modifications, ", Cloaked");
        if(g_grappling_hook)
                modifications = strcat(modifications, ", Hook");
-       if(g_laserguided_missile)
-               modifications = strcat(modifications, ", LG missiles");
        if(g_midair)
                modifications = strcat(modifications, ", Midair");
-       if(g_vampire)
-               modifications = strcat(modifications, ", Vampire");
        if(g_pinata)
                modifications = strcat(modifications, ", Pinata");
        if(g_weapon_stay)
@@@ -711,16 -707,6 +707,16 @@@ void CheckAllowedTeams (entity for_whom
                                c1 = -1;
                }
        }
 +
 +      // if player has a forced team, ONLY allow that one
 +      if(self.team_forced == COLOR_TEAM1 && c1 >= 0)
 +              c2 = c3 = c4 = -1;
 +      else if(self.team_forced == COLOR_TEAM2 && c2 >= 0)
 +              c1 = c3 = c4 = -1;
 +      else if(self.team_forced == COLOR_TEAM3 && c3 >= 0)
 +              c1 = c2 = c4 = -1;
 +      else if(self.team_forced == COLOR_TEAM4 && c4 >= 0)
 +              c1 = c2 = c3 = -1;
  }
  
  float PlayerValue(entity p)