mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 06:28:19 +00:00
Merge #2890
2890: Finish /showothers 2 implementation on server r=heinrich5991 a=def- Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
2a3b254b47
|
@ -287,7 +287,7 @@ MACRO_CONFIG_INT(ClRaceSaveGhost, cl_race_save_ghost, 1, 0, 1, CFGFLAG_CLIENT |
|
||||||
MACRO_CONFIG_INT(ClDDRaceScoreBoard, cl_ddrace_scoreboard, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Enable DDRace Scoreboard")
|
MACRO_CONFIG_INT(ClDDRaceScoreBoard, cl_ddrace_scoreboard, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Enable DDRace Scoreboard")
|
||||||
MACRO_CONFIG_INT(ClShowDecisecs, cl_show_decisecs, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Show deciseconds in game time")
|
MACRO_CONFIG_INT(ClShowDecisecs, cl_show_decisecs, 1, 0, 1, CFGFLAG_SAVE | CFGFLAG_CLIENT, "Show deciseconds in game time")
|
||||||
MACRO_CONFIG_INT(SvResetPickups, sv_reset_pickups, 0, 0, 1, CFGFLAG_SERVER | CFGFLAG_GAME, "Whether the weapons are reset on passing the start tile or not")
|
MACRO_CONFIG_INT(SvResetPickups, sv_reset_pickups, 0, 0, 1, CFGFLAG_SERVER | CFGFLAG_GAME, "Whether the weapons are reset on passing the start tile or not")
|
||||||
MACRO_CONFIG_INT(ClShowOthers, cl_show_others, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show players in other teams")
|
MACRO_CONFIG_INT(ClShowOthers, cl_show_others, 0, 0, 2, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show players in other teams (2 to show own team only)")
|
||||||
MACRO_CONFIG_INT(ClShowOthersAlpha, cl_show_others_alpha, 40, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show players in other teams (alpha value, 0 invisible, 100 fully visible)")
|
MACRO_CONFIG_INT(ClShowOthersAlpha, cl_show_others_alpha, 40, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show players in other teams (alpha value, 0 invisible, 100 fully visible)")
|
||||||
MACRO_CONFIG_INT(ClOverlayEntities, cl_overlay_entities, 0, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Overlay game tiles with a percentage of opacity")
|
MACRO_CONFIG_INT(ClOverlayEntities, cl_overlay_entities, 0, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Overlay game tiles with a percentage of opacity")
|
||||||
MACRO_CONFIG_INT(ClShowQuads, cl_show_quads, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show quads")
|
MACRO_CONFIG_INT(ClShowQuads, cl_show_quads, 1, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Show quads")
|
||||||
|
@ -297,7 +297,7 @@ MACRO_CONFIG_COL(ClBackgroundEntitiesColor, cl_background_entities_color, 128, C
|
||||||
MACRO_CONFIG_STR(ClBackgroundEntities, cl_background_entities, 100, "", CFGFLAG_CLIENT | CFGFLAG_SAVE, "Background (entities)")
|
MACRO_CONFIG_STR(ClBackgroundEntities, cl_background_entities, 100, "", CFGFLAG_CLIENT | CFGFLAG_SAVE, "Background (entities)")
|
||||||
MACRO_CONFIG_INT(ClBackgroundShowTilesLayers, cl_background_show_tiles_layers, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Whether draw tiles layers when using custom background (entities)")
|
MACRO_CONFIG_INT(ClBackgroundShowTilesLayers, cl_background_show_tiles_layers, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Whether draw tiles layers when using custom background (entities)")
|
||||||
MACRO_CONFIG_INT(SvShowOthers, sv_show_others, 1, 0, 1, CFGFLAG_SERVER, "Whether players can use the command showothers or not")
|
MACRO_CONFIG_INT(SvShowOthers, sv_show_others, 1, 0, 1, CFGFLAG_SERVER, "Whether players can use the command showothers or not")
|
||||||
MACRO_CONFIG_INT(SvShowOthersDefault, sv_show_others_default, 0, 0, 1, CFGFLAG_SERVER, "Whether players see others by default")
|
MACRO_CONFIG_INT(SvShowOthersDefault, sv_show_others_default, 0, 0, 2, CFGFLAG_SERVER, "Whether players see others by default (2 for own team)")
|
||||||
MACRO_CONFIG_INT(SvShowAllDefault, sv_show_all_default, 0, 0, 1, CFGFLAG_SERVER, "Whether players see all tees by default")
|
MACRO_CONFIG_INT(SvShowAllDefault, sv_show_all_default, 0, 0, 1, CFGFLAG_SERVER, "Whether players see all tees by default")
|
||||||
MACRO_CONFIG_INT(SvMaxAfkTime, sv_max_afk_time, 0, 0, 9999, CFGFLAG_SERVER, "The time in seconds a player is allowed to be afk (0 = disabled)")
|
MACRO_CONFIG_INT(SvMaxAfkTime, sv_max_afk_time, 0, 0, 9999, CFGFLAG_SERVER, "The time in seconds a player is allowed to be afk (0 = disabled)")
|
||||||
MACRO_CONFIG_INT(SvMaxAfkVoteTime, sv_max_afk_vote_time, 300, 0, 9999, CFGFLAG_SERVER, "The time in seconds a player can be afk and his votes still count (0 = disabled)")
|
MACRO_CONFIG_INT(SvMaxAfkVoteTime, sv_max_afk_vote_time, 300, 0, 9999, CFGFLAG_SERVER, "The time in seconds a player can be afk and his votes still count (0 = disabled)")
|
||||||
|
|
|
@ -45,7 +45,7 @@ CHAT_COMMAND("lock", "?i['0'|'1']", CFGFLAG_CHAT|CFGFLAG_SERVER, ConLockTeam, th
|
||||||
CHAT_COMMAND("unlock", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConUnlockTeam, this, "Unlock a team")
|
CHAT_COMMAND("unlock", "", CFGFLAG_CHAT|CFGFLAG_SERVER, ConUnlockTeam, this, "Unlock a team")
|
||||||
CHAT_COMMAND("invite", "r[player name]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConInviteTeam, this, "Invite a person to a locked team")
|
CHAT_COMMAND("invite", "r[player name]", CFGFLAG_CHAT|CFGFLAG_SERVER, ConInviteTeam, this, "Invite a person to a locked team")
|
||||||
|
|
||||||
CHAT_COMMAND("showothers", "?i['0'|'1']", CFGFLAG_CHAT|CFGFLAG_SERVER, ConShowOthers, this, "Whether to show players from other teams or not (off by default), optional i = 0 for off else for on")
|
CHAT_COMMAND("showothers", "?i['0'|'1'|'2']", CFGFLAG_CHAT | CFGFLAG_SERVER, ConShowOthers, this, "Whether to show players from other teams or not (off by default), optional i = 0 for off, i = 1 for on, i = 2 for own team only")
|
||||||
CHAT_COMMAND("showall", "?i['0'|'1']", CFGFLAG_CHAT | CFGFLAG_SERVER, ConShowAll, this, "Whether to show players at any distance (off by default), optional i = 0 for off else for on")
|
CHAT_COMMAND("showall", "?i['0'|'1']", CFGFLAG_CHAT | CFGFLAG_SERVER, ConShowAll, this, "Whether to show players at any distance (off by default), optional i = 0 for off else for on")
|
||||||
CHAT_COMMAND("specteam", "?i['0'|'1']", CFGFLAG_CHAT | CFGFLAG_SERVER, ConSpecTeam, this, "Whether to show players from other teams when spectating (on by default), optional i = 0 for off else for on")
|
CHAT_COMMAND("specteam", "?i['0'|'1']", CFGFLAG_CHAT | CFGFLAG_SERVER, ConSpecTeam, this, "Whether to show players from other teams when spectating (on by default), optional i = 0 for off else for on")
|
||||||
CHAT_COMMAND("ninjajetpack", "?i['0'|'1']", CFGFLAG_CHAT | CFGFLAG_SERVER, ConNinjaJetpack, this, "Whether to use ninja jetpack or not. Makes jetpack look more awesome")
|
CHAT_COMMAND("ninjajetpack", "?i['0'|'1']", CFGFLAG_CHAT | CFGFLAG_SERVER, ConNinjaJetpack, this, "Whether to use ninja jetpack or not. Makes jetpack look more awesome")
|
||||||
|
|
|
@ -1223,12 +1223,12 @@ void CCharacter::Snap(int SnappingClient)
|
||||||
|
|
||||||
if(pSnapPlayer->GetTeam() == TEAM_SPECTATORS || pSnapPlayer->IsPaused())
|
if(pSnapPlayer->GetTeam() == TEAM_SPECTATORS || pSnapPlayer->IsPaused())
|
||||||
{
|
{
|
||||||
if(pSnapPlayer->m_SpectatorID != -1 && !CanCollide(pSnapPlayer->m_SpectatorID) && !pSnapPlayer->m_ShowOthers)
|
if(pSnapPlayer->m_SpectatorID != -1 && !CanCollide(pSnapPlayer->m_SpectatorID) && (pSnapPlayer->m_ShowOthers == 0 || (pSnapPlayer->m_ShowOthers == 2 && !SameTeam(pSnapPlayer->m_SpectatorID))))
|
||||||
return;
|
return;
|
||||||
else if(pSnapPlayer->m_SpectatorID == -1 && !CanCollide(SnappingClient) && pSnapPlayer->m_SpecTeam)
|
else if(pSnapPlayer->m_SpectatorID == -1 && !CanCollide(SnappingClient) && pSnapPlayer->m_SpecTeam)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if(pSnapChar && !pSnapChar->m_Super && !CanCollide(SnappingClient) && !pSnapPlayer->m_ShowOthers)
|
else if(pSnapChar && !pSnapChar->m_Super && !CanCollide(SnappingClient) && (pSnapPlayer->m_ShowOthers == 0 || (pSnapPlayer->m_ShowOthers == 2 && !SameTeam(SnappingClient))))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,8 +225,7 @@ void CDragger::Snap(int SnappingClient)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Char && Char->IsAlive() && Target && Target->IsAlive() && Target->GetPlayer()->GetCID() != Char->GetPlayer()->GetCID() && !Char->GetPlayer()->m_ShowOthers &&
|
if(Char && Char->IsAlive() && Target && Target->IsAlive() && Target->GetPlayer()->GetCID() != Char->GetPlayer()->GetCID() && (Char->GetPlayer()->m_ShowOthers == 0 || (Char->GetPlayer()->m_ShowOthers == 2 && (Char->Teams()->m_Core.GetSolo(SnappingClient) || Char->Teams()->m_Core.GetSolo(Target->GetPlayer()->GetCID())))))
|
||||||
(Char->Teams()->m_Core.GetSolo(SnappingClient) || Char->Teams()->m_Core.GetSolo(Target->GetPlayer()->GetCID())))
|
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,15 +96,10 @@ void CPlasma::Snap(int SnappingClient)
|
||||||
&& (!Tick))
|
&& (!Tick))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(SnapPlayer && (SnapPlayer->GetTeam() == TEAM_SPECTATORS || SnapPlayer->IsPaused()) && SnapPlayer->m_SpectatorID != -1
|
if(SnapPlayer && (SnapPlayer->GetTeam() == TEAM_SPECTATORS || SnapPlayer->IsPaused()) && SnapPlayer->m_SpectatorID != -1 && GameServer()->GetPlayerChar(SnapPlayer->m_SpectatorID) && GameServer()->GetPlayerChar(SnapPlayer->m_SpectatorID)->Team() != m_ResponsibleTeam && SnapPlayer->m_ShowOthers != 1)
|
||||||
&& GameServer()->GetPlayerChar(SnapPlayer->m_SpectatorID)
|
|
||||||
&& GameServer()->GetPlayerChar(SnapPlayer->m_SpectatorID)->Team() != m_ResponsibleTeam
|
|
||||||
&& !SnapPlayer->m_ShowOthers)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(SnapPlayer && SnapPlayer->GetTeam() != TEAM_SPECTATORS && !SnapPlayer->IsPaused() && SnapChar
|
if(SnapPlayer && SnapPlayer->GetTeam() != TEAM_SPECTATORS && !SnapPlayer->IsPaused() && SnapChar && SnapChar && SnapChar->Team() != m_ResponsibleTeam && SnapPlayer->m_ShowOthers != 1)
|
||||||
&& SnapChar && SnapChar->Team() != m_ResponsibleTeam
|
|
||||||
&& !SnapPlayer->m_ShowOthers)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(SnapPlayer && (SnapPlayer->GetTeam() == TEAM_SPECTATORS || SnapPlayer->IsPaused()) && SnapPlayer->m_SpectatorID == -1
|
if(SnapPlayer && (SnapPlayer->GetTeam() == TEAM_SPECTATORS || SnapPlayer->IsPaused()) && SnapPlayer->m_SpectatorID == -1
|
||||||
|
|
|
@ -1212,12 +1212,12 @@ void CGameContext::OnClientEnter(int ClientID)
|
||||||
|
|
||||||
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
|
Console()->Print(IConsole::OUTPUT_LEVEL_DEBUG, "game", aBuf);
|
||||||
|
|
||||||
if (g_Config.m_SvShowOthersDefault)
|
if(g_Config.m_SvShowOthersDefault > 0)
|
||||||
{
|
{
|
||||||
if (g_Config.m_SvShowOthers)
|
if (g_Config.m_SvShowOthers)
|
||||||
SendChatTarget(ClientID, "You can see other players. To disable this use DDNet client and type /showothers .");
|
SendChatTarget(ClientID, "You can see other players. To disable this use DDNet client and type /showothers .");
|
||||||
|
|
||||||
m_apPlayers[ClientID]->m_ShowOthers = true;
|
m_apPlayers[ClientID]->m_ShowOthers = g_Config.m_SvShowOthersDefault;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_VoteUpdate = true;
|
m_VoteUpdate = true;
|
||||||
|
|
|
@ -188,10 +188,8 @@ void CGameWorld::UpdatePlayerMaps()
|
||||||
(!GameServer()->m_apPlayers[i] ||
|
(!GameServer()->m_apPlayers[i] ||
|
||||||
GameServer()->m_apPlayers[i]->GetClientVersion() == VERSION_VANILLA ||
|
GameServer()->m_apPlayers[i]->GetClientVersion() == VERSION_VANILLA ||
|
||||||
(GameServer()->m_apPlayers[i]->GetClientVersion() >= VERSION_DDRACE &&
|
(GameServer()->m_apPlayers[i]->GetClientVersion() >= VERSION_DDRACE &&
|
||||||
!GameServer()->m_apPlayers[i]->m_ShowOthers
|
(GameServer()->m_apPlayers[i]->m_ShowOthers == 0 ||
|
||||||
)
|
(GameServer()->m_apPlayers[i]->m_ShowOthers == 2 && !GameServer()->m_apPlayers[i]->GetCharacter()->SameTeam(j))))))
|
||||||
)
|
|
||||||
)
|
|
||||||
Dist[j].first = 1e8;
|
Dist[j].first = 1e8;
|
||||||
else
|
else
|
||||||
Dist[j].first = 0;
|
Dist[j].first = 0;
|
||||||
|
|
|
@ -412,11 +412,7 @@ void CPlayer::Snap(int SnappingClient)
|
||||||
if(SnappingClient >= 0)
|
if(SnappingClient >= 0)
|
||||||
{
|
{
|
||||||
CPlayer *pSnapPlayer = GameServer()->m_apPlayers[SnappingClient];
|
CPlayer *pSnapPlayer = GameServer()->m_apPlayers[SnappingClient];
|
||||||
ShowSpec = ShowSpec && (
|
ShowSpec = ShowSpec && (GameServer()->GetDDRaceTeam(id) == GameServer()->GetDDRaceTeam(SnappingClient) || pSnapPlayer->m_ShowOthers == 1 || (pSnapPlayer->GetTeam() == TEAM_SPECTATORS || pSnapPlayer->IsPaused()));
|
||||||
GameServer()->GetDDRaceTeam(id) == GameServer()->GetDDRaceTeam(SnappingClient)
|
|
||||||
|| pSnapPlayer->m_ShowOthers
|
|
||||||
|| (pSnapPlayer->GetTeam() == TEAM_SPECTATORS || pSnapPlayer->IsPaused())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ShowSpec)
|
if(ShowSpec)
|
||||||
|
|
|
@ -161,7 +161,7 @@ public:
|
||||||
bool IsPlaying();
|
bool IsPlaying();
|
||||||
int64 m_Last_KickVote;
|
int64 m_Last_KickVote;
|
||||||
int64 m_Last_Team;
|
int64 m_Last_Team;
|
||||||
bool m_ShowOthers;
|
int m_ShowOthers;
|
||||||
bool m_ShowAll;
|
bool m_ShowAll;
|
||||||
vec2 m_ShowDistance;
|
vec2 m_ShowDistance;
|
||||||
bool m_SpecTeam;
|
bool m_SpecTeam;
|
||||||
|
|
|
@ -389,7 +389,12 @@ int64 CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
|
||||||
{ // Actions of other players
|
{ // Actions of other players
|
||||||
if (!Character(i))
|
if (!Character(i))
|
||||||
continue; // Player is currently dead
|
continue; // Player is currently dead
|
||||||
if (!GetPlayer(i)->m_ShowOthers)
|
if(GetPlayer(i)->m_ShowOthers == 2)
|
||||||
|
{
|
||||||
|
if(m_Core.Team(i) != Team && m_Core.Team(i) != TEAM_SUPER)
|
||||||
|
continue; // In different teams
|
||||||
|
}
|
||||||
|
else if(GetPlayer(i)->m_ShowOthers == 0)
|
||||||
{
|
{
|
||||||
if (m_Core.GetSolo(Asker))
|
if (m_Core.GetSolo(Asker))
|
||||||
continue; // When in solo part don't show others
|
continue; // When in solo part don't show others
|
||||||
|
@ -397,7 +402,7 @@ int64 CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
|
||||||
continue; // When in solo part don't show others
|
continue; // When in solo part don't show others
|
||||||
if (m_Core.Team(i) != Team && m_Core.Team(i) != TEAM_SUPER)
|
if (m_Core.Team(i) != Team && m_Core.Team(i) != TEAM_SUPER)
|
||||||
continue; // In different teams
|
continue; // In different teams
|
||||||
} // ShowOthers
|
}
|
||||||
} // See everything of yourself
|
} // See everything of yourself
|
||||||
}
|
}
|
||||||
else if (GetPlayer(i)->m_SpectatorID != SPEC_FREEVIEW)
|
else if (GetPlayer(i)->m_SpectatorID != SPEC_FREEVIEW)
|
||||||
|
@ -406,7 +411,12 @@ int64 CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
|
||||||
{ // Actions of other players
|
{ // Actions of other players
|
||||||
if (!Character(GetPlayer(i)->m_SpectatorID))
|
if (!Character(GetPlayer(i)->m_SpectatorID))
|
||||||
continue; // Player is currently dead
|
continue; // Player is currently dead
|
||||||
if (!GetPlayer(i)->m_ShowOthers)
|
if(GetPlayer(i)->m_ShowOthers == 2)
|
||||||
|
{
|
||||||
|
if(m_Core.Team(GetPlayer(i)->m_SpectatorID) != Team && m_Core.Team(GetPlayer(i)->m_SpectatorID) != TEAM_SUPER)
|
||||||
|
continue; // In different teams
|
||||||
|
}
|
||||||
|
else if(GetPlayer(i)->m_ShowOthers == 0)
|
||||||
{
|
{
|
||||||
if (m_Core.GetSolo(Asker))
|
if (m_Core.GetSolo(Asker))
|
||||||
continue; // When in solo part don't show others
|
continue; // When in solo part don't show others
|
||||||
|
@ -414,7 +424,7 @@ int64 CGameTeams::TeamMask(int Team, int ExceptID, int Asker)
|
||||||
continue; // When in solo part don't show others
|
continue; // When in solo part don't show others
|
||||||
if (m_Core.Team(GetPlayer(i)->m_SpectatorID) != Team && m_Core.Team(GetPlayer(i)->m_SpectatorID) != TEAM_SUPER)
|
if (m_Core.Team(GetPlayer(i)->m_SpectatorID) != Team && m_Core.Team(GetPlayer(i)->m_SpectatorID) != TEAM_SUPER)
|
||||||
continue; // In different teams
|
continue; // In different teams
|
||||||
} // ShowOthers
|
}
|
||||||
} // See everything of player you're spectating
|
} // See everything of player you're spectating
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue