this makes the code less confusing
31 files changed:
{
if (e == self)
return FALSE;
{
if (e == self)
return FALSE;
if (e.team != 0)
return FALSE;
}
if (e.team != 0)
return FALSE;
}
if(e.freezetag_frozen)
return FALSE;
if(e.freezetag_frozen)
return FALSE;
{
if(e.team==0)
return FALSE;
{
if(e.team==0)
return FALSE;
local float besttime;
local entity best, head;
local float besttime;
local entity best, head;
{
bot_removefromlargestteam();
return;
{
bot_removefromlargestteam();
return;
// But don't remove bots immediately on level change, as the real players
// usually haven't rejoined yet
bots_would_leave = FALSE;
// But don't remove bots immediately on level change, as the real players
// usually haven't rejoined yet
bots_would_leave = FALSE;
- if (teams_matter && autocvar_bot_vs_human && (c3==-1 && c4==-1))
+ if (teamplay && autocvar_bot_vs_human && (c3==-1 && c4==-1))
bots = min(ceil(fabs(autocvar_bot_vs_human) * activerealplayers), maxclients - realplayers);
else if ((realplayers || autocvar_bot_join_empty || (currentbots > 0 && time < 5)))
{
bots = min(ceil(fabs(autocvar_bot_vs_human) * activerealplayers), maxclients - realplayers);
else if ((realplayers || autocvar_bot_join_empty || (currentbots > 0 && time < 5)))
{
float havocbot_ctf_teamcount(entity bot, vector org, float radius)
{
float havocbot_ctf_teamcount(entity bot, vector org, float radius)
{
{
local entity head;
local float t, noteam, distance;
{
local entity head;
local float t, noteam, distance;
- noteam = ((self.team == 0) || !teams_matter); // fteqcc sucks
+ noteam = ((self.team == 0) || !teamplay); // fteqcc sucks
if (autocvar_bot_nofire)
return;
if (autocvar_bot_nofire)
return;
if(have_team_spawns > 0)
{
self.team = activator.team;
if(have_team_spawns > 0)
{
self.team = activator.team;
if(autocvar_sv_defaultcharacter == 1) {
defaultskin = 0;
if(autocvar_sv_defaultcharacter == 1) {
defaultskin = 0;
{
string s;
s = Team_ColorNameLowerCase(self.team);
{
string s;
s = Team_ColorNameLowerCase(self.team);
if(chmdl || oldskin != self.skinindex)
self.species = player_getspecies(); // model or skin has changed
if(chmdl || oldskin != self.skinindex)
self.species = player_getspecies(); // model or skin has changed
if(strlen(autocvar_sv_defaultplayercolors))
if(self.clientcolors != stof(autocvar_sv_defaultplayercolors))
setcolor(self, stof(autocvar_sv_defaultplayercolors));
if(strlen(autocvar_sv_defaultplayercolors))
if(self.clientcolors != stof(autocvar_sv_defaultplayercolors))
setcolor(self, stof(autocvar_sv_defaultplayercolors));
void DoTeamChange(float destteam)
{
float t, c0;
void DoTeamChange(float destteam)
{
float t, c0;
{
if(destteam >= 0)
SetPlayerColors(self, destteam);
{
if(destteam >= 0)
SetPlayerColors(self, destteam);
else
self.team_forced = 0;
else
self.team_forced = 0;
if(self.team_forced > 0)
self.team_forced = 0;
if(self.team_forced > 0)
self.team_forced = 0;
if((autocvar_sv_spectate == 1 && !g_lms) || autocvar_g_campaign || self.team_forced < 0) {
self.classname = "observer";
} else {
if((autocvar_sv_spectate == 1 && !g_lms) || autocvar_g_campaign || self.team_forced < 0) {
self.classname = "observer";
} else {
{
if(autocvar_g_balance_teams || autocvar_g_balance_teams_force)
{
{
if(autocvar_g_balance_teams || autocvar_g_balance_teams_force)
{
GetCvars(0);
// notify about available teams
GetCvars(0);
// notify about available teams
{
CheckAllowedTeams(self);
t = 0; if(c1 >= 0) t |= 1; if(c2 >= 0) t |= 2; if(c3 >= 0) t |= 4; if(c4 >= 0) t |= 8;
{
CheckAllowedTeams(self);
t = 0; if(c1 >= 0) t |= 1; if(c2 >= 0) t |= 2; if(c3 >= 0) t |= 4; if(c4 >= 0) t |= 8;
local float c;
c = self.clientcolors & 15;
// LordHavoc: only bothering to support white, green, red, yellow, blue
local float c;
c = self.clientcolors & 15;
// LordHavoc: only bothering to support white, green, red, yellow, blue
- if (!teams_matter) self.colormod = '0 0 0';
+ if (!teamplay) self.colormod = '0 0 0';
else if (c == 0) self.colormod = '1.00 1.00 1.00';
else if (c == 3) self.colormod = '0.10 1.73 0.10';
else if (c == 4) self.colormod = '1.73 0.10 0.10';
else if (c == 0) self.colormod = '1.00 1.00 1.00';
else if (c == 3) self.colormod = '0.10 1.73 0.10';
else if (c == 4) self.colormod = '1.73 0.10 0.10';
void LeaveSpectatorMode()
{
if(nJoinAllowed(1)) {
void LeaveSpectatorMode()
{
if(nJoinAllowed(1)) {
- if(!teams_matter || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0) {
+ if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0) {
self.classname = "player";
if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force)
self.classname = "player";
if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force)
- if(self.deadflag == DEAD_NO && teams_matter)
+ if(self.deadflag == DEAD_NO && teamplay)
{
wp = WaypointSprite_Attach("helpme", TRUE);
if(wp)
{
wp = WaypointSprite_Attach("helpme", TRUE);
if(wp)
if(source.classname != "player")
colorstr = "^0"; // black for spectators
if(source.classname != "player")
colorstr = "^0"; // black for spectators
colorstr = Team_ColorCode(source.team);
else
teamsay = FALSE;
colorstr = Team_ColorCode(source.team);
else
teamsay = FALSE;
break;
case VOICETYPE_TEAMRADIO:
FOR_EACH_REALCLIENT(msg_entity)
break;
case VOICETYPE_TEAMRADIO:
FOR_EACH_REALCLIENT(msg_entity)
- if(!teams_matter || msg_entity.team == self.team)
+ if(!teamplay || msg_entity.team == self.team)
{
if(msg_entity.cvar_cl_voice_directional == 1)
soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);
{
if(msg_entity.cvar_cl_voice_directional == 1)
soundto(MSG_ONE, self, chan, sample, VOL_BASEVOICE, ATTN_MIN);
ClientKill_TeamChange(-2); // observe
} else if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force) {
//JoinBestTeam(self, FALSE, TRUE);
ClientKill_TeamChange(-2); // observe
} else if(autocvar_g_campaign || autocvar_g_balance_teams || autocvar_g_balance_teams_force) {
//JoinBestTeam(self, FALSE, TRUE);
- } else if(teams_matter && !autocvar_sv_spectate && !(self.team_forced > 0)) {
+ } else if(teamplay && !autocvar_sv_spectate && !(self.team_forced > 0)) {
self.classname = "observer";
stuffcmd(self,"menu_showteamselect\n");
}
self.classname = "observer";
stuffcmd(self,"menu_showteamselect\n");
}
} else if( cmd == "selectteam" ) {
if not(self.flags & FL_CLIENT)
return;
} else if( cmd == "selectteam" ) {
if not(self.flags & FL_CLIENT)
return;
sprint( self, "selectteam can only be used in teamgames\n");
} else if(autocvar_g_campaign) {
//JoinBestTeam(self, 0);
sprint( self, "selectteam can only be used in teamgames\n");
} else if(autocvar_g_campaign) {
//JoinBestTeam(self, 0);
readycount = 0;
Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client
readycount = 0;
Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client
- if(autocvar_teamplay_lockonrestart && teams_matter) {
+ if(autocvar_teamplay_lockonrestart && teamplay) {
lockteams = 1;
bprint("^1The teams are now locked.\n");
}
lockteams = 1;
bprint("^1The teams are now locked.\n");
}
.entity jumppadsused[NUM_JUMPPADSUSED];
string gamemode_name;
.entity jumppadsused[NUM_JUMPPADSUSED];
string gamemode_name;
if(other == o)
return FALSE;
if(other.classname == "player")
if(other == o)
return FALSE;
if(other.classname == "player")
- if(!teams_matter || o.team != other.team)
+ if(!teamplay || o.team != other.team)
if not (radar_showennemies)
return FALSE;
return TRUE;
if not (radar_showennemies)
return FALSE;
return TRUE;
float IsDifferentTeam(entity a, entity b)
{
float IsDifferentTeam(entity a, entity b)
{
{
if(a.team == b.team)
return 0;
{
if(a.team == b.team)
return 0;
if (targ.killcount > 2)
msg = ftos(targ.killcount);
if (targ.killcount > 2)
msg = ftos(targ.killcount);
- if(teams_matter && deathtype == DEATH_MIRRORDAMAGE)
+ if(teamplay && deathtype == DEATH_MIRRORDAMAGE)
{
if(attacker.team == COLOR_TEAM1)
deathtype = KILL_TEAM_RED;
{
if(attacker.team == COLOR_TEAM1)
deathtype = KILL_TEAM_RED;
}
else if (attacker.classname == "player" || attacker.classname == "gib")
{
}
else if (attacker.classname == "player" || attacker.classname == "gib")
{
- if(teams_matter && attacker.team == targ.team)
+ if(teamplay && attacker.team == targ.team)
{
if(attacker.team == COLOR_TEAM1)
type = KILL_TEAM_RED;
{
if(attacker.team == COLOR_TEAM1)
type = KILL_TEAM_RED;
damage = 0;
force = '0 0 0';
}
damage = 0;
force = '0 0 0';
}
- else if(teams_matter && attacker.team == targ.team)
+ else if(teamplay && attacker.team == targ.team)
{
if(autocvar_teamplay_mode == 1)
damage = 0;
{
if(autocvar_teamplay_mode == 1)
damage = 0;
void g_model_setcolormaptoactivator (void)
{
void g_model_setcolormaptoactivator (void)
{
{
if(activator.team)
self.colormap = (activator.team - 1) * 0x11;
{
if(activator.team)
self.colormap = (activator.team - 1) * 0x11;
{
s = strcat(":labels:teamscores:", GetTeamScoreString(0, 0));
if(to_console)
{
s = strcat(":labels:teamscores:", GetTeamScoreString(0, 0));
if(to_console)
// TODO make everything use THIS winning condition (except LMS)
WinningConditionHelper();
// TODO make everything use THIS winning condition (except LMS)
WinningConditionHelper();
{
team1_score = TeamScore_GetCompareValue(COLOR_TEAM1);
team2_score = TeamScore_GetCompareValue(COLOR_TEAM2);
{
team1_score = TeamScore_GetCompareValue(COLOR_TEAM1);
team2_score = TeamScore_GetCompareValue(COLOR_TEAM2);
if (argv(0) == "lockteams")
{
if (argv(0) == "lockteams")
{
{
lockteams = 1;
bprint("^1The teams are now locked.\n");
{
lockteams = 1;
bprint("^1The teams are now locked.\n");
if (argv(0) == "unlockteams")
{
if (argv(0) == "unlockteams")
{
{
lockteams = 0;
bprint("^1The teams are now unlocked.\n");
{
lockteams = 0;
bprint("^1The teams are now unlocked.\n");
// 2 (10) no centerprint, admin message
// 3 (11) no centerprint, no admin message
// 2 (10) no centerprint, admin message
// 3 (11) no centerprint, no admin message
- if(!teams_matter) { // death match
+ if(!teamplay) { // death match
print("Currently not playing a team game\n");
return;
}
print("Currently not playing a team game\n");
return;
}
string playername(entity p)
{
string t;
string playername(entity p)
{
string t;
- if (teams_matter && !intermission_running && p.classname == "player")
+ if (teamplay && !intermission_running && p.classname == "player")
{
t = Team_ColorCode(p.team);
return strcat(t, strdecolorize(p.netname));
{
t = Team_ColorCode(p.team);
return strcat(t, strdecolorize(p.netname));
nn = db_get(playerstats_db, sprintf("%s:_netname", p));
if(nn != "")
bufstr_set(b, i++, sprintf("n %s", nn));
nn = db_get(playerstats_db, sprintf("%s:_netname", p));
if(nn != "")
bufstr_set(b, i++, sprintf("n %s", nn));
{
tt = db_get(playerstats_db, sprintf("%s:_team", p));
bufstr_set(b, i++, sprintf("t %s", tt));
{
tt = db_get(playerstats_db, sprintf("%s:_team", p));
bufstr_set(b, i++, sprintf("t %s", tt));
if(p.cvar_cl_allow_uid2name == 1 || clienttype(p) == CLIENTTYPE_BOT)
db_put(playerstats_db, sprintf("%s:_netname", p.playerstats_id), p.netname);
if(p.cvar_cl_allow_uid2name == 1 || clienttype(p) == CLIENTTYPE_BOT)
db_put(playerstats_db, sprintf("%s:_netname", p.playerstats_id), p.netname);
db_put(playerstats_db, sprintf("%s:_team", p.playerstats_id), ftos(p.team));
if(p.alivetime > 0)
db_put(playerstats_db, sprintf("%s:_team", p.playerstats_id), ftos(p.team));
if(p.alivetime > 0)
}
void ScoreRules_generic()
{
}
void ScoreRules_generic()
{
{
CheckAllowedTeams(world);
ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE);
{
CheckAllowedTeams(world);
ScoreRules_basics(((c4>=0) ? 4 : (c3>=0) ? 3 : 2), SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, TRUE);
void SV_OnEntityPreSpawnFunction()
{
if(self.gametypefilter != "")
void SV_OnEntityPreSpawnFunction()
{
if(self.gametypefilter != "")
- if not(isGametypeInFilter(game, teams_matter, have_team_spawns, self.gametypefilter))
+ if not(isGametypeInFilter(game, teamplay, have_team_spawns, self.gametypefilter))
void trigger_push_use()
{
void trigger_push_use()
{
self.team = activator.team;
}
self.team = activator.team;
}
// Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
if(self.notq3a)
// Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
if(self.notq3a)
- if(!teams_matter || g_tdm || g_ctf)
+ if(!teamplay || g_tdm || g_ctf)
- if not(!teams_matter || g_tdm || g_ctf)
+ if not(!teamplay || g_tdm || g_ctf)
return 1;
if(self.notsingle)
return 1;
if(self.notsingle)
return 1;
if(self.notteam)
return 1;
if(self.notteam)
return 1;
if(self.notfree)
return 1;
if(self.notfree)
return 1;
if(self.gametype)
return 1;
if(self.gametype)
string gametypename;
// static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"};
gametypename = "ffa";
string gametypename;
// static char *gametypeNames[] = {"ffa", "tournament", "single", "team", "ctf", "oneflag", "obelisk", "harvester", "teamtournament"};
gametypename = "ffa";
gametypename = "team";
if(g_arena)
gametypename = "tournament";
gametypename = "team";
if(g_arena)
gametypename = "tournament";
void trigger_teleport_use()
{
void trigger_teleport_use()
{
self.team = activator.team;
}
self.team = activator.team;
}
- if not(teams_matter && autocvar_g_telefrags_teamplay && head.team == player.team)
+ if not(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team)
if(head.classname == "player")
if(head.health >= 1)
return 1;
if(head.classname == "player")
if(head.health >= 1)
return 1;
{
if (player.classname == "player" && player.health >= 1)
{
{
if (player.classname == "player" && player.health >= 1)
{
- if not(teams_matter && autocvar_g_telefrags_teamplay && head.team == player.team)
+ if not(teamplay && autocvar_g_telefrags_teamplay && head.team == player.team)
{
if(head.classname == "player")
if(head.health >= 1)
{
if(head.classname == "player")
if(head.health >= 1)
{
if(intermission_running)
return 0; // no rebalancing whatsoever please
{
if(intermission_running)
return 0; // no rebalancing whatsoever please
return 0;
if(autocvar_g_campaign)
return 0;
return 0;
if(autocvar_g_campaign)
return 0;
serverflags &~= SERVERFLAG_TEAMPLAY;
}
serverflags &~= SERVERFLAG_TEAMPLAY;
}
void ActivateTeamplay()
{
serverflags |= SERVERFLAG_TEAMPLAY;
void ActivateTeamplay()
{
serverflags |= SERVERFLAG_TEAMPLAY;
}
void InitGameplayMode()
}
void InitGameplayMode()
MUTATOR_ADD(gamemode_keepaway);
}
MUTATOR_ADD(gamemode_keepaway);
}
entcs_init();
// save it (for the next startup)
entcs_init();
// save it (for the next startup)
setcolor(pl, 16*pants + pants);
} else {
setcolor(pl, shirt + pants);
setcolor(pl, 16*pants + pants);
} else {
setcolor(pl, shirt + pants);
float smallest, selectedteam;
// don't join a team if we're not playing a team game
float smallest, selectedteam;
// don't join a team if we're not playing a team game
return 0;
// find out what teams are available
return 0;
// find out what teams are available
float scolor, dcolor, steam, dteam, dbotcount, scount, dcount;
// in normal deathmatch we can just apply the color and we're done
float scolor, dcolor, steam, dteam, dbotcount, scount, dcount;
// in normal deathmatch we can just apply the color and we're done
SetPlayerColors(self, _color);
return;
}
SetPlayerColors(self, _color);
return;
}
if not (self.tur_active)
return;
if not (self.tur_active)
return;
if (self.team == attacker.team)
{
// This does not happen anymore. Re-enable if you fix that.
if (self.team == attacker.team)
{
// This does not happen anymore. Re-enable if you fix that.
self.nextthink = time + self.ticrate;
// ONS uses somewhat backwards linking.
self.nextthink = time + self.ticrate;
// ONS uses somewhat backwards linking.
{
if not (g_onslaught)
if (self.target)
{
if not (g_onslaught)
if (self.target)
if not (self.team)
self.team = 14; // Assume turrets are on the defending side if not explicitly set otehrwize
}
if not (self.team)
self.team = 14; // Assume turrets are on the defending side if not explicitly set otehrwize
}
- else if not (teams_matter)
self.team = MAX_SHOT_DISTANCE; // Group all turrets into the same team, so they dont kill eachother.
else if(g_onslaught && self.targetname)
{
self.team = MAX_SHOT_DISTANCE; // Group all turrets into the same team, so they dont kill eachother.
else if(g_onslaught && self.targetname)
{
if (clienttype(other) != CLIENTTYPE_REAL)
return;
if (clienttype(other) != CLIENTTYPE_REAL)
return;
if(self.team)
if(self.team != other.team)
return;
if(self.team)
if(self.team != other.team)
return;
self.colormod = self.tur_head.colormod = '0 0 0';
self.colormod = self.tur_head.colormod = '0 0 0';
if(self.team)
if(self.team != other.team)
return;
if(self.team)
if(self.team != other.team)
return;
self.colormap = 1024;
self.tur_head.colormap = 1024;
self.colormap = 1024;
self.tur_head.colormap = 1024;
tracebox(self.origin + '0 0 100', spiderbot_MIN, spiderbot_MAX, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
setorigin(self.spiderbot_spawnpnt,trace_endpos);
tracebox(self.origin + '0 0 100', spiderbot_MIN, spiderbot_MAX, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
setorigin(self.spiderbot_spawnpnt,trace_endpos);
- if(self.team && !teams_matter)
+ if(self.team && !teamplay)
self.team = 0;
else
self.spiderbot_spawnpnt.team = self.team;
self.team = 0;
else
self.spiderbot_spawnpnt.team = self.team;
// count potential damage according to type of target
if (targ == self)
selfdamage = selfdamage + d;
// count potential damage according to type of target
if (targ == self)
selfdamage = selfdamage + d;
- else if (targ.team == self.team && teams_matter)
+ else if (targ.team == self.team && teamplay)
teamdamage = teamdamage + d;
else if (bot_shouldattack(targ))
enemydamage = enemydamage + d;
teamdamage = teamdamage + d;
else if (bot_shouldattack(targ))
enemydamage = enemydamage + d;
desirabledamage = enemydamage;
if (time > self.invincible_finished && time > self.spawnshieldtime)
desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
desirabledamage = enemydamage;
if (time > self.invincible_finished && time > self.spawnshieldtime)
desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
- if (teams_matter && self.team)
+ if (teamplay && self.team)
desirabledamage = desirabledamage - teamdamage;
mine = find(world, classname, "mine");
desirabledamage = desirabledamage - teamdamage;
mine = find(world, classname, "mine");
// teamcolor / hit beam effect
vector v;
v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
// teamcolor / hit beam effect
vector v;
v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
// count potential damage according to type of target
if (targ == self)
selfdamage = selfdamage + d;
// count potential damage according to type of target
if (targ == self)
selfdamage = selfdamage + d;
- else if (targ.team == self.team && teams_matter)
+ else if (targ.team == self.team && teamplay)
teamdamage = teamdamage + d;
else if (bot_shouldattack(targ))
enemydamage = enemydamage + d;
teamdamage = teamdamage + d;
else if (bot_shouldattack(targ))
enemydamage = enemydamage + d;
desirabledamage = enemydamage;
if (time > self.invincible_finished && time > self.spawnshieldtime)
desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
desirabledamage = enemydamage;
if (time > self.invincible_finished && time > self.spawnshieldtime)
desirabledamage = desirabledamage - selfdamage * autocvar_g_balance_selfdamagepercent;
- if (teams_matter && self.team)
+ if (teamplay && self.team)
desirabledamage = desirabledamage - teamdamage;
missile = find(world, classname, "rocket");
desirabledamage = desirabledamage - teamdamage;
missile = find(world, classname, "rocket");
// kind of tuba currently is player slot number, or team number if in
// teamplay
// that way, holes in the range of notes are "plugged"
// kind of tuba currently is player slot number, or team number if in
// teamplay
// that way, holes in the range of notes are "plugged"
{
if(pl.team == COLOR_TEAM2 || pl.team == COLOR_TEAM4)
note += 3;
{
if(pl.team == COLOR_TEAM2 || pl.team == COLOR_TEAM4)
note += 3;
)
{
float t, maxdistance;
)
{
float t, maxdistance;
t = self.team;
else
t = 0;
t = self.team;
else
t = 0;
float t, maxdistance;
if(self.waypointsprite_attachedforcarrier)
return world; // can't attach to FC
float t, maxdistance;
if(self.waypointsprite_attachedforcarrier)
return world; // can't attach to FC
t = self.team;
else
t = 0;
t = self.team;
else
t = 0;