return false;
}
+MUTATOR_HOOKFUNCTION(nb, GetTeamCount)
+{
+ ret_string = "nexball_team";
+ return true;
+}
+
REGISTER_MUTATOR(nb, g_nexball)
{
ActivateTeamplay();
#define EV_GetTeamCount(i, o) \
/**/ i(float, ret_float) \
/**/ o(float, ret_float) \
+ /**/ i(string, ret_string) \
+ /**/ o(string, ret_string) \
/**/
float ret_float;
MUTATOR_HOOKABLE(GetTeamCount, EV_GetTeamCount);
}
// mutator hooks
-MUTATOR_HOOKFUNCTION(assault, PlayerSpawn)
+MUTATOR_HOOKFUNCTION(as, PlayerSpawn)
{SELFPARAM();
if(self.team == assault_attacker_team)
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING);
return false;
}
-MUTATOR_HOOKFUNCTION(assault, TurretSpawn)
+MUTATOR_HOOKFUNCTION(as, TurretSpawn)
{SELFPARAM();
if(!self.team || self.team == MAX_SHOT_DISTANCE)
self.team = 5; // this gets reversed when match starts?
return false;
}
-MUTATOR_HOOKFUNCTION(assault, VehicleSpawn)
+MUTATOR_HOOKFUNCTION(as, VehicleSpawn)
{SELFPARAM();
self.nextthink = time + 0.5;
return false;
}
-MUTATOR_HOOKFUNCTION(assault, HavocBot_ChooseRole)
+MUTATOR_HOOKFUNCTION(as, HavocBot_ChooseRole)
{SELFPARAM();
havocbot_ast_reset_role(self);
return true;
}
-MUTATOR_HOOKFUNCTION(assault, PlayHitsound)
+MUTATOR_HOOKFUNCTION(as, PlayHitsound)
{
return (frag_victim.classname == "func_assault_destructible");
}
+MUTATOR_HOOKFUNCTION(as, GetTeamCount)
+{
+ // assault always has 2 teams
+ c1 = c2 = 0;
+ return true;
+}
+
// scoreboard setup
void assault_ScoreRules()
{
ScoreRules_basics_end();
}
-REGISTER_MUTATOR(assault, g_assault)
+REGISTER_MUTATOR(as, g_assault)
{
ActivateTeamplay();
have_team_spawns = -1; // request team spawns
MUTATOR_HOOKFUNCTION(ca, GetTeamCount, CBC_ORDER_EXCLUSIVE)
{
ret_float = ca_teams;
- return 0;
+ return false;
}
entity ca_LastPlayerForTeam()
MUTATOR_HOOKFUNCTION(dom, GetTeamCount)
{
+ // fallback?
ret_float = domination_teams;
- return 0;
+ ret_string = "dom_team";
+
+ entity head = find(world, classname, ret_string);
+ while(head)
+ {
+ if(head.netname != "")
+ {
+ switch(head.team)
+ {
+ case NUM_TEAM_1: c1 = 0; break;
+ case NUM_TEAM_2: c2 = 0; break;
+ case NUM_TEAM_3: c3 = 0; break;
+ case NUM_TEAM_4: c4 = 0; break;
+ }
+ }
+
+ head = find(head, classname, ret_string);
+ }
+
+ ret_string = string_null;
+
+ return true;
}
MUTATOR_HOOKFUNCTION(dom, reset_map_players)
MUTATOR_HOOKFUNCTION(kh, GetTeamCount, CBC_ORDER_EXCLUSIVE)
{
ret_float = kh_teams;
- return 0;
+ return false;
}
MUTATOR_HOOKFUNCTION(kh, SpectateCopy)
MUTATOR_HOOKFUNCTION(ons, GetTeamCount)
{
// onslaught is special
- entity tmp_entity;
- for(tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
+ for(entity tmp_entity = ons_worldgeneratorlist; tmp_entity; tmp_entity = tmp_entity.ons_worldgeneratornext)
{
switch(tmp_entity.team)
{
// set c1...c4 to show what teams are allowed
void CheckAllowedTeams (entity for_whom)
{SELFPARAM();
- float dm;
- entity head;
- string teament_name;
+ int dm = 0;
c1 = c2 = c3 = c4 = -1;
cb1 = cb2 = cb3 = cb4 = 0;
- teament_name = string_null;
- if(g_onslaught)
- {
- // onslaught is special
- head = findchain(classname, "onslaught_generator");
- while (head)
- {
- if (head.team == NUM_TEAM_1) c1 = 0;
- if (head.team == NUM_TEAM_2) c2 = 0;
- if (head.team == NUM_TEAM_3) c3 = 0;
- if (head.team == NUM_TEAM_4) c4 = 0;
- head = head.chain;
- }
- }
- else if(g_domination)
- teament_name = "dom_team";
- else if(g_ctf)
- teament_name = "ctf_team";
- else if(g_tdm)
- teament_name = "tdm_team";
- else if(g_nexball)
- teament_name = "nexball_team";
- else if(g_assault)
- c1 = c2 = 0; // Assault always has 2 teams
- else
- {
- // cover anything else by treating it like tdm with no teams spawned
- dm = 2;
+ string teament_name = string_null;
- MUTATOR_CALLHOOK(GetTeamCount, dm);
- dm = ret_float;
+ bool mutator_returnvalue = MUTATOR_CALLHOOK(GetTeamCount, dm, teament_name);
+ teament_name = ret_string;
+ dm = ret_float;
+ if(!mutator_returnvalue)
+ {
if(dm >= 4)
c1 = c2 = c3 = c4 = 0;
else if(dm >= 3)
// find out what teams are allowed if necessary
if(teament_name)
{
- head = find(world, classname, teament_name);
+ entity head = find(world, classname, teament_name);
while(head)
{
- if(!(g_domination && head.netname == ""))
+ switch(head.team)
{
- if(head.team == NUM_TEAM_1)
- c1 = 0;
- else if(head.team == NUM_TEAM_2)
- c2 = 0;
- else if(head.team == NUM_TEAM_3)
- c3 = 0;
- else if(head.team == NUM_TEAM_4)
- c4 = 0;
+ case NUM_TEAM_1: c1 = 0; break;
+ case NUM_TEAM_2: c2 = 0; break;
+ case NUM_TEAM_3: c3 = 0; break;
+ case NUM_TEAM_4: c4 = 0; break;
}
+
head = find(head, classname, teament_name);
}
}