From: terencehill Date: Wed, 19 Feb 2014 17:30:53 +0000 (+0100) Subject: Merge branch 'master' into terencehill/ca_fixes X-Git-Tag: xonotic-v0.8.0~126^2~16 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=3b0e076988a8daae0310a764049fe06c1a4666ca;hp=cff9142d7732b7722fc7878fa6a98a4548823e43 Merge branch 'master' into terencehill/ca_fixes Conflicts: qcsrc/server/cl_player.qc --- diff --git a/gamemodes.cfg b/gamemodes.cfg index bf6ba106d3..08b988273e 100644 --- a/gamemodes.cfg +++ b/gamemodes.cfg @@ -203,10 +203,10 @@ set g_assault 0 "Assault: attack the enemy base as fast as you can, then defend // ============ // clan arena // ============ -set g_ca 0 "Clan Arena: Played in rounds, once you're dead you're out! The team with survivors wins the round." -set g_ca_point_limit 10 "point limit 10 is standard for clan arena" -set g_ca_point_leadlimit 0 -set g_ca_spectate_enemies 0 "Allow spectating enemy player by dead player during clan arena games." +set g_ca 0 "Clan Arena: Played in rounds, once you're dead you're out! The team with survivors wins the round" +seta g_ca_point_limit -1 "Clan Arena point limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)" +seta g_ca_point_leadlimit -1 "Clan Arena point lead limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)" +set g_ca_spectate_enemies 0 "Allow spectating enemy player by dead player during clan arena games" set g_ca_warmup 10 "how long the players will have time to run around the map before the round starts" set g_ca_damage2score_multiplier 0.01 set g_ca_round_timelimit 180 "round time limit in seconds" diff --git a/qcsrc/common/mapinfo.qh b/qcsrc/common/mapinfo.qh index 7746dfe3eb..d7d72bd7b6 100644 --- a/qcsrc/common/mapinfo.qh +++ b/qcsrc/common/mapinfo.qh @@ -51,7 +51,7 @@ REGISTER_GAMETYPE(_("Team Deathmatch"),tdm,g_tdm,TEAM_DEATHMATCH,"timelimit=20 p REGISTER_GAMETYPE(_("Capture the Flag"),ctf,g_ctf,CTF,"timelimit=20 caplimit=10 leadlimit=0"); #define g_ctf IS_GAMETYPE(CTF) -REGISTER_GAMETYPE(_("Clan Arena"),ca,g_ca,CA,"timelimit=20 pointlimit=10 leadlimit=0"); +REGISTER_GAMETYPE(_("Clan Arena"),ca,g_ca,CA,"timelimit=20 pointlimit=10 teams=2 leadlimit=0"); #define g_ca IS_GAMETYPE(CA) REGISTER_GAMETYPE(_("Domination"),dom,g_domination,DOMINATION,"timelimit=20 pointlimit=200 teams=2 leadlimit=0"); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 691c4930e9..ddc293e016 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -265,6 +265,7 @@ void PutObserverInServer (void) self.punchvector = '0 0 0'; self.oldvelocity = self.velocity; self.fire_endtime = -1; + self.event_damage = func_null; } .float model_randomizer; @@ -786,8 +787,8 @@ void ClientKill_Now() if(self.killindicator_teamchange) ClientKill_Now_TeamChange(); - // in any case: - Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0'); + if(IS_PLAYER(self)) + Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0'); // now I am sure the player IS dead } @@ -1991,7 +1992,7 @@ float nJoinAllowed(entity ignore) { float currentlyPlaying = 0; FOR_EACH_REALCLIENT(e) - if(IS_PLAYER(e) || e.caplayer == 1) + if(IS_PLAYER(e) || e.caplayer) currentlyPlaying += 1; if(currentlyPlaying < autocvar_g_maxplayers) @@ -2005,7 +2006,10 @@ float nJoinAllowed(entity ignore) { * g_maxplayers_spectator_blocktime seconds */ void checkSpectatorBlock() { - if(IS_SPEC(self) || IS_OBSERVER(self)) { + if(IS_SPEC(self) || IS_OBSERVER(self)) + if(!self.caplayer) + if(IS_REAL_CLIENT(self)) + { if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) { Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING); dropclient(self); diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 67738c4c6c..5f2289c18d 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -716,6 +716,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht self.flags &= ~FL_ONGROUND; // dying animation self.deadflag = DEAD_DYING; + // when to allow respawn calculate_player_respawn_time(); diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index c8c87e0968..40f7ed406c 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -152,6 +152,8 @@ void ClientCommand_join(float request) { if(!IS_PLAYER(self) && !lockteams) { + if(self.caplayer) + return; if(nJoinAllowed(self)) { if(autocvar_g_campaign) { campaign_bots_may_start = 1; } @@ -573,15 +575,11 @@ void ClientCommand_spectate(float request) } } - if(IS_PLAYER(self) && autocvar_sv_spectate == 1) - ClientKill_TeamChange(-2); // observe - - // in CA, allow a dead player to move to spectators (without that, caplayer!=0 will be moved back to the player list) - // note: if arena game mode is ever done properly, this needs to be removed. - if(self.caplayer && (IS_SPEC(self) || IS_OBSERVER(self))) + if((IS_PLAYER(self) || self.caplayer) && autocvar_sv_spectate == 1) { - sprint(self, "WARNING: you will spectate in the next round.\n"); - self.caplayer = 0; + if(self.caplayer && (IS_SPEC(self) || IS_OBSERVER(self))) + sprint(self, "WARNING: you will spectate in the next round.\n"); + ClientKill_TeamChange(-2); // observe } } return; // never fall through to usage diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 2e002eb1c5..4816711d96 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -216,6 +216,8 @@ void GameCommand_allspec(float request, float argc) FOR_EACH_REALPLAYER(client) { self = client; + if(self.caplayer) + self.caplayer = 0; PutObserverInServer(); ++i; } @@ -1048,6 +1050,8 @@ void GameCommand_moveplayer(float request, float argc) if(!IS_SPEC(client) && !IS_OBSERVER(client)) { self = client; + if(self.caplayer) + self.caplayer = 0; PutObserverInServer(); successful = strcat(successful, (successful ? ", " : ""), client.netname); @@ -1152,9 +1156,10 @@ void GameCommand_nospectators(float request) { blockSpectators = 1; entity plr; - FOR_EACH_CLIENT(plr) //give every spectator seconds time to become a player + FOR_EACH_REALCLIENT(plr) //give every spectator seconds time to become a player { if(IS_SPEC(plr) || IS_OBSERVER(plr)) + if(!plr.caplayer) { plr.spectatortime = time; Send_Notification(NOTIF_ONE_ONLY, plr, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime); diff --git a/qcsrc/server/mutators/gamemode_ca.qc b/qcsrc/server/mutators/gamemode_ca.qc index 8a6315c423..ca60c26095 100644 --- a/qcsrc/server/mutators/gamemode_ca.qc +++ b/qcsrc/server/mutators/gamemode_ca.qc @@ -142,6 +142,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerSpawn) MUTATOR_HOOKFUNCTION(ca_PutClientInServer) { if(!allowed_to_spawn) + if(IS_PLAYER(self)) // this is true even when player is trying to join { self.classname = "observer"; if(self.jointime != time) //not when connecting @@ -160,6 +161,11 @@ MUTATOR_HOOKFUNCTION(ca_reset_map_players) FOR_EACH_CLIENT(self) { self.killcount = 0; + if(!self.caplayer && IS_BOT_CLIENT(self)) + { + self.team = -1; + self.caplayer = 1; + } if(self.caplayer) { self.classname = "player";