TFCGameRules: populate serverinfo with teams actually detected to be playable on a given map.
This commit is contained in:
parent
83304cc7a5
commit
81e27e8502
|
@ -18,19 +18,17 @@ class TFCGameRules:CGameRules
|
||||||
{
|
{
|
||||||
void(void) TFCGameRules;
|
void(void) TFCGameRules;
|
||||||
|
|
||||||
virtual bool(void) IsTeamplay;
|
virtual bool IsTeamplay(void);
|
||||||
|
|
||||||
virtual void(NSClientPlayer) PlayerConnect;
|
|
||||||
virtual void(NSClientPlayer) PlayerDisconnect;
|
|
||||||
virtual void(NSClientPlayer) PlayerPostFrame;
|
|
||||||
virtual void(NSClientPlayer) PlayerSpawn;
|
|
||||||
virtual void(NSClientPlayer) PlayerKill;
|
|
||||||
virtual void(NSClientPlayer) PlayerRespawn;
|
|
||||||
virtual void(NSClientPlayer) PlayerDeath;
|
|
||||||
|
|
||||||
virtual void(NSClientPlayer) DropGoalItem;
|
|
||||||
|
|
||||||
|
virtual void PlayerConnect(NSClientPlayer);
|
||||||
|
virtual void PlayerDisconnect(NSClientPlayer);
|
||||||
|
virtual void PlayerPostFrame(NSClientPlayer);
|
||||||
|
virtual void PlayerSpawn(NSClientPlayer);
|
||||||
|
virtual void PlayerKill(NSClientPlayer);
|
||||||
|
virtual void PlayerRespawn(NSClientPlayer);
|
||||||
|
virtual void PlayerDeath(NSClientPlayer);
|
||||||
|
virtual void DropGoalItem(NSClientPlayer);
|
||||||
virtual float ImpulseCommand(NSClient, float);
|
virtual float ImpulseCommand(NSClient, float);
|
||||||
|
virtual void LevelNewParms(void);
|
||||||
virtual void(void) LevelNewParms;
|
virtual void InitPostEnts(void);
|
||||||
};
|
};
|
||||||
|
|
|
@ -168,13 +168,57 @@ TFCGameRules::ImpulseCommand(NSClient bp, float num)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFCGameRules::InitPostEnts(void)
|
||||||
|
{
|
||||||
|
int team_count = 0i;
|
||||||
|
entity e = __NULL__;
|
||||||
|
|
||||||
|
super::InitPostEnts();
|
||||||
|
|
||||||
|
/* populate the serverinfo field with the teams we have on the map */
|
||||||
|
e = find(world, ::classname, "info_teamspawn_blue");
|
||||||
|
if (e) {
|
||||||
|
team_count += 1;
|
||||||
|
forceinfokey(world, sprintf("team_%i", team_count), "Blue");
|
||||||
|
forceinfokey(world, sprintf("teamscore_%i", team_count), "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
e = find(world, ::classname, "info_teamspawn_red");
|
||||||
|
if (e) {
|
||||||
|
team_count += 1;
|
||||||
|
forceinfokey(world, sprintf("team_%i", team_count), "Red");
|
||||||
|
forceinfokey(world, sprintf("teamscore_%i", team_count), "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
e = find(world, ::classname, "info_teamspawn_green");
|
||||||
|
if (e) {
|
||||||
|
team_count += 1;
|
||||||
|
forceinfokey(world, sprintf("team_%i", team_count), "Green");
|
||||||
|
forceinfokey(world, sprintf("teamscore_%i", team_count), "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
e = find(world, ::classname, "info_teamspawn_yellow");
|
||||||
|
if (e) {
|
||||||
|
team_count += 1;
|
||||||
|
forceinfokey(world, sprintf("team_%i", team_count), "Yellow");
|
||||||
|
forceinfokey(world, sprintf("teamscore_%i", team_count), "0");
|
||||||
|
}
|
||||||
|
|
||||||
|
forceinfokey(world, "teams", itos(team_count));
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFCGameRules::TFCGameRules(void)
|
TFCGameRules::TFCGameRules(void)
|
||||||
{
|
{
|
||||||
/* TODO: Make this depend on the actual spawn types */
|
/* wipe the serverinfo clean */
|
||||||
forceinfokey(world, "teams", "2");
|
forceinfokey(world, "teams", "0");
|
||||||
forceinfokey(world, "team_1", "Blue");
|
forceinfokey(world, "team_1", "");
|
||||||
forceinfokey(world, "teamscore_1", "0");
|
forceinfokey(world, "team_2", "");
|
||||||
forceinfokey(world, "team_2", "Red");
|
forceinfokey(world, "team_3", "");
|
||||||
forceinfokey(world, "teamscore_2", "0");
|
forceinfokey(world, "team_4", "");
|
||||||
|
forceinfokey(world, "teamscore_1", "");
|
||||||
|
forceinfokey(world, "teamscore_2", "");
|
||||||
|
forceinfokey(world, "teamscore_3", "");
|
||||||
|
forceinfokey(world, "teamscore_4", "");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue