ScoreRules_generic();
}
-void ActivateTeamplay()
-{
- serverflags |= SERVERFLAG_TEAMPLAY;
- teamplay = 1;
- cvar_set("teamplay", "2"); // DP needs this for sending proper getstatus replies.
-}
-
void InitGameplayMode()
{
VoteReset();
// find out good world mins/maxs bounds, either the static bounds found by looking for solid, or the mapinfo specified bounds
get_mi_min_max(1);
- world.mins = mi_min;
- world.maxs = mi_max;
+ // assign reflectively to avoid "assignment to world" warning
+ int done = 0; for (int i = 0, n = numentityfields(); i < n; ++i) {
+ string k = entityfieldname(i); vector v = (k == "mins") ? mi_min : (k == "maxs") ? mi_max : '0 0 0';
+ if (v) {
+ putentityfieldstring(i, world, sprintf("%d %d %d", v));
+ if (++done == 2) break;
+ }
+ }
// currently, NetRadiant's limit is 131072 qu for each side
// distance from one corner of a 131072qu cube to the opposite corner is approx. 227023 qu
// set the distance according to map size but don't go over the limit to avoid issues with float precision
max_shot_distance = min(230000, vlen(world.maxs - world.mins));
MapInfo_LoadMapSettings(mapname);
- serverflags &= ~SERVERFLAG_TEAMPLAY;
- teamplay = 0;
- cvar_set("teamplay", "0"); // DP needs this for sending proper getstatus replies.
+ GameRules_teams(false);
if (!cvar_value_issafe(world.fog))
{
- LOG_INFO("The current map contains a potentially harmful fog setting, ignored\n");
+ LOG_INFO("The current map contains a potentially harmful fog setting, ignored");
world.fog = string_null;
}
if(MapInfo_Map_fog != "")
}
}
+void KillPlayerForTeamChange(entity player)
+{
+ if (IS_DEAD(player))
+ {
+ return;
+ }
+ if (MUTATOR_CALLHOOK(Player_ChangeTeamKill, player) == true)
+ {
+ return;
+ }
+ Damage(player, player, player, 100000, DEATH_TEAMCHANGE.m_id, player.origin,
+ '0 0 0');
+}
+
bool SetPlayerTeamSimple(entity player, int team_num)
{
if (player.team == team_num)
// find out what teams are available
CheckAllowedTeams(this);
- int selected_team;
-
// if we don't care what team he ends up on, put him on whatever team he entered as.
// if he's not on a valid team, then let other code put him on the smallest team
if (!force_best_team)
{
+ int selected_team;
if( c1 >= 0 && this.team == NUM_TEAM_1)
selected_team = this.team;
else if(c2 >= 0 && this.team == NUM_TEAM_2)
{
AutoBalanceBots(old_team, Team_TeamToNumber(best_team));
}
- if (!IS_DEAD(this) && (MUTATOR_CALLHOOK(Player_ChangeTeamKill, this) ==
- false))
- {
- Damage(this, this, this, 100000, DEATH_TEAMCHANGE.m_id, this.origin, '0 0 0');
- }
+ KillPlayerForTeamChange(this);
return best_team;
}
{
return;
}
- // kill player when changing teams
- if (IS_DEAD(this) || (MUTATOR_CALLHOOK(Player_ChangeTeamKill, this) == true))
- {
- return;
- }
- Damage(this, this, this, 100000, DEATH_TEAMCHANGE.m_id, this.origin, '0 0 0');
+ KillPlayerForTeamChange(this);
}
void AutoBalanceBots(int source_team, int destination_team)
}
SetPlayerTeamSimple(lowest_bot_destination_team,
Team_NumberToTeam(source_team));
- if (IS_DEAD(lowest_bot_destination_team) || (MUTATOR_CALLHOOK(
- Player_ChangeTeamKill, lowest_bot_destination_team) == true))
- {
- return;
- }
- Damage(lowest_bot_destination_team, lowest_bot_destination_team,
- lowest_bot_destination_team, 100000, DEATH_TEAMCHANGE.m_id,
- lowest_bot_destination_team.origin, '0 0 0');
+ KillPlayerForTeamChange(lowest_bot_destination_team);
}