}
}
+MUTATOR_HOOKFUNCTION(dom_GetTeamCount)
+{
+ ret_float = domination_teams;
+ return 0;
+}
+
MUTATOR_HOOKFUNCTION(dom_ResetMap)
{
+ total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
FOR_EACH_PLAYER(self)
{
PutClientInServer();
self.player_blocked = 1;
+ if(IS_REAL_CLIENT(self))
+ set_dom_state(self);
}
return 1;
}
}
// scoreboard setup
-void ScoreRules_dom()
+void ScoreRules_dom(float teams)
{
if(domination_roundbased)
{
- ScoreRules_basics(domination_teams, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
+ ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, TRUE);
ScoreInfo_SetLabel_TeamScore (ST_DOM_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES, "takes", 0);
ScoreRules_basics_end();
sp_domticks = SFL_SORT_PRIO_PRIMARY;
else
sp_score = SFL_SORT_PRIO_PRIMARY;
- CheckAllowedTeams(world);
- ScoreRules_basics(domination_teams, sp_score, sp_score, TRUE);
+ ScoreRules_basics(teams, sp_score, sp_score, TRUE);
ScoreInfo_SetLabel_TeamScore (ST_DOM_TICKS, "ticks", sp_domticks);
ScoreInfo_SetLabel_PlayerScore(SP_DOM_TICKS, "ticks", sp_domticks);
ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES, "takes", 0);
}
// spawn some default teams if the map is not set up for domination
-void dom_spawnteams()
+void dom_spawnteams(float teams)
{
dom_spawnteam("Red", NUM_TEAM_1-1, "models/domination/dom_red.md3", 0, "domination/claim.wav", "", "Red team has captured a control point");
dom_spawnteam("Blue", NUM_TEAM_2-1, "models/domination/dom_blue.md3", 0, "domination/claim.wav", "", "Blue team has captured a control point");
- if(domination_teams >= 3)
+ if(teams >= 3)
dom_spawnteam("Yellow", NUM_TEAM_3-1, "models/domination/dom_yellow.md3", 0, "domination/claim.wav", "", "Yellow team has captured a control point");
- if(domination_teams >= 4)
+ if(teams >= 4)
dom_spawnteam("Pink", NUM_TEAM_4-1, "models/domination/dom_pink.md3", 0, "domination/claim.wav", "", "Pink team has captured a control point");
dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, "", "", "");
}
if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
{
print("No ""dom_team"" entities found on this map, creating them anyway.\n");
- dom_spawnteams();
+ domination_teams = bound(2, ((autocvar_g_domination_teams_override < 2) ? autocvar_g_domination_default_teams : autocvar_g_domination_teams_override), 4);
+ dom_spawnteams(domination_teams);
}
+
+ CheckAllowedTeams(world);
+ domination_teams = ((c4>=0) ? 4 : (c3>=0) ? 3 : 2);
+
+ addstat(STAT_DOM_TOTAL_PPS, AS_FLOAT, dom_total_pps);
+ addstat(STAT_DOM_PPS_RED, AS_FLOAT, dom_pps_red);
+ addstat(STAT_DOM_PPS_BLUE, AS_FLOAT, dom_pps_blue);
+ if(domination_teams >= 3) addstat(STAT_DOM_PPS_YELLOW, AS_FLOAT, dom_pps_yellow);
+ if(domination_teams >= 4) addstat(STAT_DOM_PPS_PINK, AS_FLOAT, dom_pps_pink);
domination_roundbased = autocvar_g_domination_roundbased;
- ScoreRules_dom();
+ ScoreRules_dom(domination_teams);
if(domination_roundbased)
{
precache_model("models/domination/dom_unclaimed.md3");
precache_sound("domination/claim.wav");
- domination_teams = ((autocvar_g_domination_teams_override < 2) ? autocvar_g_domination_default_teams : autocvar_g_domination_teams_override);
- domination_teams = ((c4>=0) ? 4 : (c3>=0) ? 3 : 2);
-
- addstat(STAT_DOM_TOTAL_PPS, AS_FLOAT, dom_total_pps);
- addstat(STAT_DOM_PPS_RED, AS_FLOAT, dom_pps_red);
- addstat(STAT_DOM_PPS_BLUE, AS_FLOAT, dom_pps_blue);
- if(domination_teams >= 3) addstat(STAT_DOM_PPS_YELLOW, AS_FLOAT, dom_pps_yellow);
- if(domination_teams >= 4) addstat(STAT_DOM_PPS_PINK, AS_FLOAT, dom_pps_pink);
-
InitializeEntity(world, dom_DelayedInit, INITPRIO_GAMETYPE);
}
MUTATOR_DEFINITION(gamemode_domination)
{
+ MUTATOR_HOOK(GetTeamCount, dom_GetTeamCount, CBC_ORDER_ANY);
MUTATOR_HOOK(reset_map_players, dom_ResetMap, CBC_ORDER_ANY);
MUTATOR_HOOK(PlayerSpawn, dom_PlayerSpawn, CBC_ORDER_ANY);
MUTATOR_HOOK(ClientConnect, dom_ClientConnect, CBC_ORDER_ANY);
- MUTATOR_HOOK(HavocBot_ChooseRule, dom_BotRoles, CBC_ORDER_ANY);
+ MUTATOR_HOOK(HavocBot_ChooseRole, dom_BotRoles, CBC_ORDER_ANY);
MUTATOR_ONADD
{
MUTATOR_ONREMOVE
{
- error("This is a game type and it cannot be removed at runtime.");
+ print("This is a game type and it cannot be removed at runtime.");
+ return -1;
}
return 0;