[nexuiz-commits] r8322 - in trunk: Docs data/qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Thu Nov 26 08:44:59 EST 2009
Author: fruitiex
Date: 2009-11-26 08:44:58 -0500 (Thu, 26 Nov 2009)
New Revision: 8322
Modified:
trunk/Docs/eventlog.txt
trunk/data/qcsrc/server/cl_client.qc
trunk/data/qcsrc/server/defs.qh
trunk/data/qcsrc/server/teamplay.qc
Log:
add jointypes to eventlogs and disable the teamnagger in ca
Modified: trunk/Docs/eventlog.txt
===================================================================
--- trunk/Docs/eventlog.txt 2009-11-24 07:47:15 UTC (rev 8321)
+++ trunk/Docs/eventlog.txt 2009-11-26 13:44:58 UTC (rev 8322)
@@ -27,7 +27,7 @@
:join:<ID>:<slot>:bot:<nickname>
:name:<ID>:<nickname>
:part:<ID>
- :team:<ID>:<team>
+ :team:<ID>:<team>:<jointype>
:kill:frag:<ID of killer>:<ID of victim>:type=<death type>:items=<itemstring of killer>:victimitems=<itemstring of victim>
:kill:tk:<ID of killer>:<ID of victim>:type=<death type>:items=<itemstring of killer>:victimitems=<itemstring of victim>
:kill:suicide:<ID>:<ID>:type=<death type>:items=<itemstring>
@@ -83,6 +83,12 @@
13 = Yellow Team
10 = Pink Team
+join types:
+ 1 = connect
+ 2 = auto
+ 3 = manual
+ 4 = spectating
+
label flags:
!! = primary sorting key
<!! = primary sorting key, lower is better
Modified: trunk/data/qcsrc/server/cl_client.qc
===================================================================
--- trunk/data/qcsrc/server/cl_client.qc 2009-11-24 07:47:15 UTC (rev 8321)
+++ trunk/data/qcsrc/server/cl_client.qc 2009-11-26 13:44:58 UTC (rev 8322)
@@ -562,22 +562,28 @@
if(self.flagcarried)
DropFlag(self.flagcarried, world, world);
+
if(self.ballcarried)
DropBall(self.ballcarried, self.origin + self.ballcarried.origin, self.velocity);
WaypointSprite_PlayerDead();
- if(self.killcount != -666)
- {
- if(g_lms)
- {
+ if not(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) {
+ if(g_lms) {
if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
bprint ("^4", self.netname, "^4 has no more lives left\n");
else
bprint ("^4", self.netname, "^4 is spectating now\n"); // TODO turn this into a proper forfeit?
- }
- else
+ } else
bprint ("^4", self.netname, "^4 is spectating now\n");
+
+ if(self.just_joined == FALSE) {
+ LogTeamchange(self.playerid, -1, 4);
+ } else
+ self.just_joined = FALSE;
}
PlayerScore_Clear(self); // clear scores when needed
@@ -643,12 +649,6 @@
if(sv_loddistance1)
SetCustomizer(self, Client_customizeentityforclient, Client_uncustomizeentityforclient);
- if(g_ca) {
- // do nothing
- }
- else
- self.team = -1;
-
if(g_arena)
{
if(self.version_mismatch)
@@ -1295,7 +1295,6 @@
//void dom_player_join_team(entity pl);
void ClientConnect (void)
{
- local string s;
float t;
if(self.flags & FL_CLIENT)
@@ -1357,28 +1356,20 @@
}
self.playerid = (playerid_last = playerid_last + 1);
+
if(cvar("sv_eventlog"))
- {
- if(clienttype(self) == CLIENTTYPE_REAL)
- GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", self.netaddress, ":", self.netname));
- else
- GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":bot:", self.netname));
- s = strcat(":team:", ftos(self.playerid), ":");
- s = strcat(s, ftos(self.team));
- GameLogEcho(s);
- }
- self.netname_previous = strzone(self.netname);
+ GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((clienttype(self) == CLIENTTYPE_REAL) ? self.netaddress : "bot"), ":", self.netname));
- //stuffcmd(self, "set tmpviewsize $viewsize \n");
+ LogTeamchange(self.playerid, self.team, 1);
- bprint ("^4",self.netname);
- bprint ("^4 connected");
+ self.just_joined = TRUE; // stop spamming the eventlog with additional lines when the client connects
+ self.netname_previous = strzone(self.netname);
+
+ bprint("^4", self.netname, "^4 connected");
+
if(g_domination || g_ctf)
- {
- bprint(" and joined the ");
- bprint(ColoredTeamName(self.team));
- }
+ bprint(" and joined the ", ColoredTeamName(self.team));
bprint("\n");
@@ -1488,7 +1479,7 @@
speedaward_alltimebest_holder = db_get(ServerProgsDB, strcat(GetMapname(), rr, "speed/netname"));
race_send_speedaward_alltimebest(MSG_ONE);
}
- else if(cvar("sv_teamnagger"))
+ else if(cvar("sv_teamnagger") && !g_ca) // teamnagger is currently bad for ca
send_CSQC_teamnagger();
}
Modified: trunk/data/qcsrc/server/defs.qh
===================================================================
--- trunk/data/qcsrc/server/defs.qh 2009-11-24 07:47:15 UTC (rev 8321)
+++ trunk/data/qcsrc/server/defs.qh 2009-11-26 13:44:58 UTC (rev 8322)
@@ -634,7 +634,7 @@
string deathmessage;
+.float just_joined;
-
.float cvar_cl_accuracy_data_share;
.float cvar_cl_accuracy_data_receive;
\ No newline at end of file
Modified: trunk/data/qcsrc/server/teamplay.qc
===================================================================
--- trunk/data/qcsrc/server/teamplay.qc 2009-11-24 07:47:15 UTC (rev 8321)
+++ trunk/data/qcsrc/server/teamplay.qc 2009-11-26 13:44:58 UTC (rev 8322)
@@ -72,16 +72,15 @@
void nb_init();
void entcs_init();
-void LogTeamchange(entity pl)
+void LogTeamchange(float player_id, float team_number, float type)
{
- string str;
if(!cvar("sv_eventlog"))
return;
- if(pl.playerid < 1)
+
+ if(player_id < 1)
return;
- str = strcat(":team:", ftos(pl.playerid), ":");
- str = strcat(str, ftos(pl.team));
- GameLogEcho(str);
+
+ GameLogEcho(strcat(":team:", ftos(player_id), ":", ftos(team_number), ":", ftos(type)));
}
void WriteGameCvars()
@@ -601,14 +600,13 @@
SetPlayerColors(pl,_color);
- if(!noprint && t != s)
- {
- //bprint(pl.netname, " has changed to ", TeamNoName(t), "\n");
+ if(t != s) {
+ LogTeamchange(pl.playerid, pl.team, 3); // log manual team join
+
+ if(!noprint)
bprint(pl.netname, "^7 has changed from ", TeamNoName(s), " to ", TeamNoName(t), "\n");
}
- if(t != s)
- LogTeamchange(pl);
}
// set c1...c4 to show what teams are allowed
@@ -881,12 +879,16 @@
selectedteam = pl.team;
else
selectedteam = -1;
+
if(selectedteam > 0)
{
if(!only_return_best)
{
SetPlayerColors(pl, selectedteam - 1);
- LogTeamchange(pl);
+
+ // when JoinBestTeam is called by client.qc/ClientKill_Now_TeamChange the players team is -1 and thus skipped
+ // when JoinBestTeam is called by cl_client.qc/ClientConnect the player_id is 0 the log attempt is rejected
+ LogTeamchange(pl.playerid, pl.team, 99);
}
return selectedteam;
}
@@ -895,7 +897,6 @@
smallest = FindSmallestTeam(pl, TRUE);
-
if(!only_return_best)
{
TeamchangeFrags(self);
@@ -919,7 +920,9 @@
{
error("smallest team: invalid team\n");
}
- LogTeamchange(pl);
+
+ LogTeamchange(pl.playerid, pl.team, 2); // log auto join
+
if(pl.deadflag == DEAD_NO)
Damage(pl, pl, pl, 100000, DEATH_TEAMCHANGE, pl.origin, '0 0 0');
}
@@ -973,18 +976,11 @@
return;
}
- if(cvar("g_campaign"))
- {
+ if((cvar("g_campaign")) || (cvar("g_changeteam_banned") && self.wasplayer)) {
sprint(self, "Team changes not allowed\n");
return; // changing teams is not allowed
}
- if(cvar("g_changeteam_banned") && self.wasplayer)
- {
- sprint(self, "Team changes not allowed\n");
- return;
- }
-
if(cvar("g_balance_teams_prevent_imbalance"))
{
// only allow changing to a smaller or equal size team
More information about the nexuiz-commits
mailing list