]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge remote-tracking branch 'origin/Mario/respawn_delays'
authorSamual Lenks <samual@xonotic.org>
Sun, 24 Nov 2013 04:36:52 +0000 (23:36 -0500)
committerSamual Lenks <samual@xonotic.org>
Sun, 24 Nov 2013 04:36:52 +0000 (23:36 -0500)
# By Mario
# Via Mario
* origin/Mario/respawn_delays:
  Fix some issues brought up in the tracker
  Only use g_respawn_delay_max if it's higher than normal respawn delay
  Add a new option for forced respawn: g_respawn_delay_max. Forces players to spawn after this many seconds or optionally respawn after normal delay

1  2 
defaultXonotic.cfg
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh

diff --combined defaultXonotic.cfg
index 217aab90a0c0603720b7870fb3ce70fb95fa03ad,687f22aba32bee81dfee054b0602bea013983ff5..39b43139339b93a5589fecb6bab5c83a731f56bb
@@@ -400,6 -400,7 +400,6 @@@ pausable 
  set g_spawnshieldtime 1 "number of seconds you are invincible after you spawned, this shield is lost after you fire"
  set g_antilag 2       "AntiLag (0 = no AntiLag, 1 = verified client side hit scan, 2 = server side hit scan in the past, 3 = unverified client side hit scan)"
  set g_antilag_nudge 0 "don't touch"
 -set g_antilag_bullets 1 "Bullets AntiLag (0 = no AntiLag, 1 = server side hit scan in the past) - DO NOT TOUCH (severely changes weapon balance)"
  set g_shootfromclient 2 "let client decide if it has the gun left or right; if set to 2, center handedness is allowed; see also cl_gunalign"
  set g_shootfromeye 0 "shots are fired from your eye/crosshair; visual gun position can still be influenced by cl_gunalign 1 and 2"
  set g_shootfromcenter 0 "weapon gets moved to the center, shots still come from the barrel of your weapon; visual gun position can still be influenced by cl_gunalign 1 and 2"
@@@ -464,6 -465,7 +464,7 @@@ set g_spawn_furthest 1 "this amount of 
  set g_spawn_useallspawns 0 "use all spawns, e.g. also team spawns in non-teamplay, and all spawns, even enemy spawns, in teamplay"
  // respawn delay
  set g_respawn_delay 2 "number of seconds you have to wait before you can respawn again"
+ set g_respawn_delay_max 0 "number of seconds you can wait before you're forced to respawn (only effective with g_forced_respawn 1)"
  set g_respawn_waves 0 "respawn in waves (every n seconds), intended to decrease overwhelming base attacks"
  
  // overtime
@@@ -1413,7 -1415,7 +1414,7 @@@ sv_cullentities_trace 
  r_cullentities_trace 0
  
  // less "lagging" of other players, but also less PL tolerant... let's try this
 -sv_clmovement_inputtimeout 0.07 // more than 2, less than 3 server frames
 +sv_clmovement_inputtimeout 0.066 // slightly less than 2 frames, so only one frame can be compensated
  
  // exact gloss looks better, e.g. on g-23
  r_shadow_glossexact 1
index c60f25152dac2f23bfc4d0a0345c2fdec119ba88,b0be65d46166b7f87257fce3cb054acb24267dd5..19187a39deeab1c16cab1a8b05834d997dcb35d0
@@@ -70,7 -70,14 +70,7 @@@ float autocvar_ekg
  #define autocvar_fraglimit_override cvar("fraglimit_override")
  float autocvar_g_allow_oldnexbeam;
  float autocvar_g_antilag;
 -float autocvar_g_antilag_bullets;
  float autocvar_g_antilag_nudge;
 -float autocvar_g_arena_maxspawned;
 -float autocvar_g_arena_point_leadlimit;
 -float autocvar_g_arena_point_limit;
 -float autocvar_g_arena_roundbased;
 -float autocvar_g_arena_round_timelimit;
 -float autocvar_g_arena_warmup;
  float autocvar_g_balance_armor_blockpercent;
  float autocvar_g_balance_armor_limit;
  float autocvar_g_balance_armor_regen;
@@@ -801,6 -808,7 +801,7 @@@ float autocvar_g_domination_point_leadl
  float autocvar_g_domination_point_rate;
  float autocvar_g_domination_teams_override;
  float autocvar_g_forced_respawn;
+ float autocvar_g_respawn_delay_max;
  string autocvar_g_forced_team_blue;
  string autocvar_g_forced_team_otherwise;
  string autocvar_g_forced_team_pink;
index 65443f4782992f51f3528ebcbbc36300f98f8d47,0c71bcc9e703da9511576b4b213f8eb2dc5c01d6..d803602ad6ccd6c229e5b61ffa20f4dfc976b6ae
@@@ -167,7 -167,7 +167,7 @@@ void PutObserverInServer (void
        MUTATOR_CALLHOOK(MakePlayerObserver);
  
        Portal_ClearAll(self);
 -      
 +
        if(self.alivetime)
        {
                if(!warmup_stage)
        }
  
        if(self.vehicle)
 -              vehicles_exit(VHEF_RELESE);         
 +              vehicles_exit(VHEF_RELESE);
  
        WaypointSprite_PlayerDead();
  
 -      if not(g_ca)  // don't reset teams when moving a ca player to the spectators
 +      if (!g_ca)  // don't reset teams when moving a ca player to the spectators
                self.team = -1;  // move this as it is needed to log the player spectating in eventlog
  
        if(self.killcount != -666)
        accuracy_resend(self);
  
        self.spectatortime = time;
 -      
 +
        self.classname = "observer";
        self.iscreature = FALSE;
        self.teleportable = TELEPORT_SIMPLE;
@@@ -558,7 -558,7 +558,7 @@@ void PutClientInServer (void
  
                //stuffcmd(self, "chase_active 0");
                //stuffcmd(self, "set viewsize $tmpviewsize \n");
 -              
 +
                target_voicescript_clear(self);
  
                // reset fields the weapons may use
@@@ -766,7 -766,7 +766,7 @@@ void ClientKill_Now(
            if(!self.killindicator_teamchange)
            {
              self.vehicle_health = -1;
 -            Damage(self, self, self, 1 , DEATH_KILL, self.origin, '0 0 0');           
 +            Damage(self, self, self, 1 , DEATH_KILL, self.origin, '0 0 0');
            }
        }
  
@@@ -934,7 -934,7 +934,7 @@@ void ClientKill (void
        if(gameover) return;
        if(self.player_blocked) return;
        if(self.freezetag_frozen) return;
 -      
 +
        ClientKill_TeamChange(0);
  }
  
@@@ -984,7 -984,7 +984,7 @@@ float PlayerInIDList(entity p, string i
        string s;
  
        // NOTE: we do NOT check crypto_keyfp here, an unsigned ID is fine too for this
 -      if not(p.crypto_idfp)
 +      if (!p.crypto_idfp)
                return 0;
  
        // this function allows abbreviated player IDs too!
@@@ -1249,7 -1249,7 +1249,7 @@@ void ClientDisconnect (void
        if(self.vehicle)
            vehicles_exit(VHEF_RELESE);
  
 -      if not(IS_CLIENT(self))
 +      if (!IS_CLIENT(self))
        {
                print("Warning: ClientDisconnect without ClientConnect\n");
                return;
  
        if(autocvar_sv_eventlog)
                GameLogEcho(strcat(":part:", ftos(self.playerid)));
 -              
 +
        Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_DISCONNECT, self.netname);
  
        MUTATOR_CALLHOOK(ClientDisconnect);
@@@ -1430,7 -1430,7 +1430,7 @@@ void player_powerups (void
        Fire_ApplyDamage(self);
        Fire_ApplyEffect(self);
  
 -      if not(g_minstagib)
 +      if (!g_minstagib)
        {
                if (self.items & IT_STRENGTH)
                {
                        self.superweapons_finished = 0;
                }
        }
 -      
 +
        if(autocvar_g_nodepthtestplayers)
                self.effects = self.effects | EF_NODEPTHTEST;
  
@@@ -1613,7 -1613,7 +1613,7 @@@ void player_regen (void
                        self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
        }
  
 -      if not(self.items & IT_UNLIMITED_WEAPON_AMMO)
 +      if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
                self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished) * ((self.items & IT_FUEL_REGEN) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, rot_mod * frametime * (time > self.pauserotfuel_finished), limitf);
  }
  
@@@ -1730,7 -1730,7 +1730,7 @@@ void SpectateCopy(entity spectatee) 
        setorigin(self, spectatee.origin);
        setsize(self, spectatee.mins, spectatee.maxs);
        SetZoomState(spectatee.zoomstate);
 -    
 +
      anticheat_spectatecopy(spectatee);
        self.hud = spectatee.hud;
        if(spectatee.vehicle)
          self.vehicle_reload2 = spectatee.vehicle_reload2;
  
          msg_entity = self;
 -        
 +
          WriteByte (MSG_ONE, SVC_SETVIEWANGLES);
              WriteAngle(MSG_ONE,  spectatee.v_angle_x);
              WriteAngle(MSG_ONE,  spectatee.v_angle_y);
              WriteAngle(MSG_ONE,  spectatee.v_angle_z);
  
          //WriteByte (MSG_ONE, SVC_SETVIEW);
 -        //    WriteEntity(MSG_ONE, self);            
 +        //    WriteEntity(MSG_ONE, self);
          //makevectors(spectatee.v_angle);
 -        //setorigin(self, spectatee.origin - v_forward * 400 + v_up * 300);*/    
 +        //setorigin(self, spectatee.origin - v_forward * 400 + v_up * 300);*/
      }
  }
  
  float SpectateUpdate() {
        if(!self.enemy)
 -          return 0;           
 +          return 0;
  
        if (self == self.enemy)
                return 0;
  
 -      if not(IS_PLAYER(self.enemy))
 +      if (!IS_PLAYER(self.enemy))
                return 0;
  
        SpectateCopy(self.enemy);
@@@ -1820,13 -1820,13 +1820,13 @@@ entity CA_SpectateNext(entity start) 
        if (start.team == self.team) {
                return start;
        }
 -      
 +
        other = start;
        // continue from current player
        while(other && other.team != self.team) {
                other = find(other, classname, "player");
        }
 -      
 +
        if (!other) {
                // restart from begining
                other = find(other, classname, "player");
                        other = find(other, classname, "player");
                }
        }
 -      
 +
        return other;
  }
  
@@@ -1861,7 -1861,7 +1861,7 @@@ float SpectatePrev(
  {
        // NOTE: chain order is from the highest to the lower entnum (unlike find)
        other = findchain(classname, "player");
 -      if not(other) // no player
 +      if (!other) // no player
                return FALSE;
  
        entity first = other;
                do { other = other.chain; }
                while(other && other.team != self.team);
  
 -              if not(other)
 +              if (!other)
                {
                        other = first;
                        while(other.team != self.team)
@@@ -2135,7 -2135,7 +2135,7 @@@ void SpectatorThink(
  
  void PlayerUseKey()
  {
 -      if not(IS_PLAYER(self))
 +      if (!IS_PLAYER(self))
                return;
  
        if(self.vehicle)
          vehicles_exit(VHEF_NORMAL);
          return;
        }
 -      
 +
        // a use key was pressed; call handlers
        MUTATOR_CALLHOOK(PlayerUseKey);
  }
@@@ -2305,10 -2305,10 +2305,10 @@@ void PlayerPreThink (void
                                if(frametime)
                                        player_anim();
                                button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE);
 -                              
 +
                                if (self.deadflag == DEAD_DYING)
                                {
-                                       if(self.respawn_flags & RESPAWN_FORCE)
+                                       if((self.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max)
                                                self.deadflag = DEAD_RESPAWNING;
                                        else if(!button_pressed)
                                                self.deadflag = DEAD_DEAD;
                                {
                                        if(button_pressed)
                                                self.deadflag = DEAD_RESPAWNABLE;
+                                       else if(time >= self.respawn_time_max && (self.respawn_flags & RESPAWN_FORCE))
+                                               self.deadflag = DEAD_RESPAWNING;
                                }
                                else if (self.deadflag == DEAD_RESPAWNABLE)
                                {
                                        if(time > self.respawn_time)
                                        {
                                                self.respawn_time = time + 1; // only retry once a second
+                                               self.respawn_time_max = self.respawn_time;
                                                respawn();
                                        }
                                }
  
                                if(self.respawn_flags & RESPAWN_SILENT)
                                        self.stat_respawn_time = 0;
+                               else if((self.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
+                                       self.stat_respawn_time = self.respawn_time_max;
                                else
                                        self.stat_respawn_time = self.respawn_time;
                        }
  
                if(frametime)
                        player_anim();
 -              
 +
                // secret status
                secrets_setstatus();
 -              
 +
                self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
  
                //self.angles_y=self.v_angle_y + 90;   // temp
@@@ -2573,7 -2578,7 +2578,7 @@@ void PlayerPostThink (void
                        return;         // intermission or finale
                GetPressedKeys();
        }
 -      
 +
  #ifdef TETRIS
        }
  #endif
  
        if((g_cts || g_race) && self.cvar_cl_allow_uidtracking == 1 && self.cvar_cl_allow_uid2name == 1)
        {
 -              if not(self.stored_netname)
 +              if (!self.stored_netname)
                        self.stored_netname = strzone(uid2name(self.crypto_idfp));
                if(self.stored_netname != self.netname)
                {
index fe147947104a3018256f067bfff28a394171ac48,8818c30eadc57cb31d03d2b479e8f7844771575e..eb3e81fbb280a7d226e65f2554b22df8c5eab99d
@@@ -637,6 -637,10 +637,10 @@@ void PlayerDamage (entity inflictor, en
                        self.respawn_time = ceil((time + sdelay) / waves) * waves;
                else
                        self.respawn_time = time + sdelay;
+               if(autocvar_g_respawn_delay_max > sdelay)
+                       self.respawn_time_max = time + autocvar_g_respawn_delay_max;
+               else
+                       self.respawn_time_max = self.respawn_time;
                if((sdelay + waves >= 5.0) && (self.respawn_time - time > 1.75))
                        self.respawn_countdown = 10; // first number to count down from is 10
                else
@@@ -697,7 -701,7 +701,7 @@@ float Say(entity source, float teamsay
  
        msgin = formatmessage(msgin);
  
 -      if not(IS_PLAYER(source))
 +      if (!IS_PLAYER(source))
                colorstr = "^0"; // black for spectators
        else if(teamplay)
                colorstr = Team_ColorCode(source.team);
        }
  
        if(!privatesay)
 -      if not(IS_PLAYER(source))
 +      if (!IS_PLAYER(source))
        {
 -              if not(intermission_running)
 +              if (!intermission_running)
                        if(teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(warmup_stage || gameover)))
                                teamsay = -1; // spectators
        }
                {
                        sprint(source, sourcemsgstr);
                        sprint(privatesay, msgstr);
 -                      if not(autocvar_g_chat_tellprivacy) { dedicated_print(msgstr); } // send to server console too if "tellprivacy" is disabled
 +                      if (!autocvar_g_chat_tellprivacy) { dedicated_print(msgstr); } // send to server console too if "tellprivacy" is disabled
                        if(cmsgstr != "")
                                centerprint(privatesay, cmsgstr);
                }
                {
                        sprint(source, sourcemsgstr);
                        dedicated_print(msgstr); // send to server console too
 -                      FOR_EACH_REALCLIENT(head) if not(IS_PLAYER(head))
 +                      FOR_EACH_REALCLIENT(head) if (!IS_PLAYER(head))
                                if(head != source)
                                        sprint(head, msgstr);
                }
@@@ -1014,7 -1018,7 +1018,7 @@@ void PrecachePlayerSounds(string f
        }
        fclose(fh);
  
 -      if not(allvoicesamples)
 +      if (!allvoicesamples)
        {
  #define _VOICEMSG(m) allvoicesamples = strcat(allvoicesamples, " ", #m);
                ALLVOICEMSGS
diff --combined qcsrc/server/defs.qh
index cb58250118809bd9771b13c5c193e1314fa48e90,8de9e26af03689f357505e4059cb422228dad61a..72f4457d61d9fe99dff84bc1c2e728b2dcacab62
@@@ -55,7 -55,7 +55,7 @@@ float team1_score, team2_score, team3_s
  float maxclients;
  
  // flag set on worldspawn so that the code knows if it is dedicated or not
 -float server_is_dedicated; 
 +float server_is_dedicated;
  
  // Fields
  
  .float play_time;
  .float respawn_flags;
  .float respawn_time;
+ .float respawn_time_max;
  .float death_time;
  .float fade_time;
  .float fade_rate;
@@@ -475,7 -476,7 +476,7 @@@ void target_voicescript_clear(entity pl
  .float target_random;
  .float trigger_reverse;
  
 -// Nexball 
 +// Nexball
  .entity ballcarried; // Also used for keepaway
  .float metertime;
  float g_nexball_meter_period;
@@@ -516,8 -517,8 +517,8 @@@ string matchid
  
  .float last_pickup;
  
 -.float hit_time; 
 -.float typehit_time; 
 +.float hit_time;
 +.float typehit_time;
  
  .float stat_leadlimit;