mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add exception id to TeamKill
This commit is contained in:
parent
76b519b856
commit
9a0f16b55b
|
@ -442,17 +442,20 @@ void CGameTeams::ChangeTeamState(int Team, int State)
|
|||
m_TeamState[Team] = State;
|
||||
}
|
||||
|
||||
void CGameTeams::KillTeam(int Team, int NewStrongID)
|
||||
void CGameTeams::KillTeam(int Team, int NewStrongID, int ExceptID)
|
||||
{
|
||||
for(int i = 0; i < MAX_CLIENTS; i++)
|
||||
{
|
||||
if(m_Core.Team(i) == Team && GameServer()->m_apPlayers[i])
|
||||
{
|
||||
GameServer()->m_apPlayers[i]->m_VotedForPractice = false;
|
||||
GameServer()->m_apPlayers[i]->KillCharacter(WEAPON_SELF);
|
||||
if(NewStrongID != -1 && i != NewStrongID)
|
||||
if(i != ExceptID)
|
||||
{
|
||||
GameServer()->m_apPlayers[i]->Respawn(true); // spawn the rest of team with weak hook on the killer
|
||||
GameServer()->m_apPlayers[i]->KillCharacter(WEAPON_SELF);
|
||||
if(NewStrongID != -1 && i != NewStrongID)
|
||||
{
|
||||
GameServer()->m_apPlayers[i]->Respawn(true); // spawn the rest of team with weak hook on the killer
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1006,7 +1009,7 @@ void CGameTeams::OnCharacterDeath(int ClientID, int Weapon)
|
|||
|
||||
m_Practice[Team] = false;
|
||||
|
||||
KillTeam(Team, Weapon == WEAPON_SELF ? ClientID : -1);
|
||||
KillTeam(Team, Weapon == WEAPON_SELF ? ClientID : -1, ClientID);
|
||||
if(Count(Team) > 1)
|
||||
{
|
||||
GameServer()->SendChatTeam(Team, aBuf);
|
||||
|
|
|
@ -35,10 +35,13 @@ class CGameTeams
|
|||
|
||||
class CGameContext *m_pGameContext;
|
||||
|
||||
// Kill the whole team, making the player `NewStrongID` have strong
|
||||
// hook on everyone else. `NewStrongID` can be -1 to get the normal
|
||||
// spawning order.
|
||||
void KillTeam(int Team, int NewStrongID);
|
||||
/**
|
||||
* Kill the whole team.
|
||||
* @param Team The team id to kill
|
||||
* @param NewStrongID The player with that id will get strong hook on everyone else, -1 will set the normal spawning order
|
||||
* @param ExceptID The player that should not get killed
|
||||
*/
|
||||
void KillTeam(int Team, int NewStrongID, int ExceptID = -1);
|
||||
bool TeamFinished(int Team);
|
||||
void OnTeamFinish(CPlayer **Players, unsigned int Size, float Time, const char *pTimestamp);
|
||||
void OnFinish(CPlayer *Player, float Time, const char *pTimestamp);
|
||||
|
|
Loading…
Reference in a new issue