mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Added /ShowOthers
This commit is contained in:
parent
82eac5cf3b
commit
babe838cab
|
@ -57,6 +57,7 @@ CONSOLE_COMMAND("rank", "?r", CFGFLAG_SERVER, ConRank, this, "Shows the rank of
|
|||
CONSOLE_COMMAND("rules", "", CFGFLAG_SERVER, ConRules, this, "Shows the server rules", -1)
|
||||
CONSOLE_COMMAND("team", "?i", CFGFLAG_SERVER, ConJoinTeam, this, "Lets you join team i (shows your team if left blank)", -1)
|
||||
CONSOLE_COMMAND("top5", "?i", CFGFLAG_SERVER, ConTop5, this, "Shows five ranks of the ladder beginning with rank i (1 by default)", -1)
|
||||
CONSOLE_COMMAND("showothers", "", CFGFLAG_SERVER, ConShowOthers, this, "Whether to showplayers from other teams or not (off by default)", -1)
|
||||
|
||||
#undef CONSOLE_COMMAND
|
||||
|
||||
|
|
|
@ -916,3 +916,14 @@ void CGameContext::ConEyeEmote(IConsole::IResult *pResult, void *pUserData, int
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CGameContext::ConShowOthers(IConsole::IResult *pResult, void *pUserData, int ClientId)
|
||||
{
|
||||
CGameContext *pSelf = (CGameContext *)pUserData;
|
||||
|
||||
if(pSelf->m_apPlayers[ClientId]->m_IsUsingDDRaceClient)
|
||||
pSelf->m_apPlayers[ClientId]->m_ShowOthers = !pSelf->m_apPlayers[ClientId]->m_ShowOthers;
|
||||
else
|
||||
pSelf->SendChatTarget(ClientId, "Showing players from other teams is only available with DDRace Client, http://DDRace.info");
|
||||
}
|
||||
|
||||
|
|
|
@ -1521,7 +1521,7 @@ void CCharacter::Snap(int SnappingClient)
|
|||
CCharacter* SnapChar = GameServer()->GetPlayerChar(SnappingClient);
|
||||
if(SnapChar && !SnapChar->m_Super &&
|
||||
GameServer()->m_apPlayers[SnappingClient]->GetTeam() != -1 &&
|
||||
!CanCollide(SnappingClient) && !GameServer()->m_apPlayers[SnappingClient]->m_IsUsingDDRaceClient) return;
|
||||
!CanCollide(SnappingClient) && (!GameServer()->m_apPlayers[SnappingClient]->m_IsUsingDDRaceClient || (GameServer()->m_apPlayers[SnappingClient]->m_IsUsingDDRaceClient && !GameServer()->m_apPlayers[SnappingClient]->m_ShowOthers))) return;
|
||||
if(GetPlayer()->m_Invisible &&
|
||||
GetPlayer()->GetCID() != SnappingClient &&
|
||||
GameServer()->m_apPlayers[SnappingClient]->m_Authed < GetPlayer()->m_Authed
|
||||
|
|
|
@ -82,7 +82,7 @@ void CPlasma::Snap(int SnappingClient)
|
|||
int Tick = (Server()->Tick()%Server()->TickSpeed())%11;
|
||||
if(!SnapChar) return;
|
||||
if (SnapChar->m_Alive && (m_Layer == LAYER_SWITCH && !GameServer()->Collision()->m_pSwitchers[m_Number].m_Status[SnapChar->Team()]) && (!Tick)) return;
|
||||
if((SnapChar->Team() != m_ResponsibleTeam) && !SnapChar->GetPlayer()->m_IsUsingDDRaceClient) return;
|
||||
if((SnapChar->Team() != m_ResponsibleTeam) && (!SnapChar->GetPlayer()->m_IsUsingDDRaceClient || (GameServer()->m_apPlayers[SnappingClient]->m_IsUsingDDRaceClient && !GameServer()->m_apPlayers[SnappingClient]->m_ShowOthers))) return;
|
||||
CNetObj_Laser *pObj = static_cast<CNetObj_Laser *>(Server()->SnapNewItem(NETOBJTYPE_LASER, m_Id, sizeof(CNetObj_Laser)));
|
||||
pObj->m_X = (int)m_Pos.x;
|
||||
pObj->m_Y = (int)m_Pos.y;
|
||||
|
|
|
@ -126,6 +126,7 @@ class CGameContext : public IGameServer
|
|||
static void ConToggleEyeEmote(IConsole::IResult *pResult, void *pUserData, int ClientId);
|
||||
static void ConToggleBroadcast(IConsole::IResult *pResult, void *pUserData, int ClientId);
|
||||
static void ConEyeEmote(IConsole::IResult *pResult, void *pUserData, int ClientId);
|
||||
static void ConShowOthers(IConsole::IResult *pResult, void *pUserData, int ClientId);
|
||||
|
||||
CGameContext(int Resetting);
|
||||
void Construct(int Resetting);
|
||||
|
|
|
@ -33,6 +33,7 @@ CPlayer::CPlayer(CGameContext *pGameServer, int CID, int Team)
|
|||
|
||||
m_Invisible = false;
|
||||
m_IsUsingDDRaceClient = false;
|
||||
m_ShowOthers = false;
|
||||
|
||||
// Variable initialized:
|
||||
m_Last_Pause = 0;
|
||||
|
|
|
@ -90,8 +90,9 @@ public:
|
|||
|
||||
// TODO: clean this up
|
||||
int m_Authed;
|
||||
|
||||
|
||||
bool m_IsUsingDDRaceClient;
|
||||
bool m_ShowOthers;
|
||||
|
||||
int m_Starttime;
|
||||
int m_Refreshtime;
|
||||
|
|
Loading…
Reference in a new issue