Add /showall

This commit is contained in:
def 2014-02-02 19:56:10 +01:00
parent 48c292b8bf
commit 823a04333a
7 changed files with 33 additions and 1 deletions

View file

@ -206,6 +206,7 @@ MACRO_CONFIG_INT(ClBackgroundEntitiesSat, cl_background_entities_sat, 0, 0, 255,
MACRO_CONFIG_INT(ClBackgroundEntitiesLht, cl_background_entities_lht, 128, 0, 255, CFGFLAG_CLIENT|CFGFLAG_SAVE, "Background (entities) color lightness")
MACRO_CONFIG_INT(SvShowOthers, sv_show_others, 1, 0, 1, CFGFLAG_SERVER, "Whether players can user 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(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(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(SvPlasmaRange, sv_plasma_range, 700, 1, 99999, CFGFLAG_SERVER, "How far will the plasma gun track tees")

View file

@ -31,7 +31,8 @@ CONSOLE_COMMAND("move", "ii", CFGFLAG_SERVER|CMDFLAG_TEST, ConMove, this, "Moves
CONSOLE_COMMAND("move_raw", "ii", CFGFLAG_SERVER|CMDFLAG_TEST, ConMoveRaw, this, "Moves to the point with x/y-coordinates ii")
CONSOLE_COMMAND("force_pause", "ii", CFGFLAG_SERVER, ConForcePause, this, "Force i to pause for i seconds")
CONSOLE_COMMAND("force_unpause", "i", CFGFLAG_SERVER, ConForcePause, this, "Set force-pause timer of v to 0.")
CONSOLE_COMMAND("showothers", "?i", CFGFLAG_CHAT, ConShowOthers, this, "Whether to showplayers from other teams or not (off by default), optional i = 0 for off else for on")
CONSOLE_COMMAND("showothers", "?i", CFGFLAG_CHAT, ConShowOthers, this, "Whether to show players from other teams or not (off by default), optional i = 0 for off else for on")
CONSOLE_COMMAND("showall", "?i", CFGFLAG_CHAT, ConShowAll, this, "Whether to show players at any distance (off by default), optional i = 0 for off else for on")
CONSOLE_COMMAND("list", "?s", CFGFLAG_CHAT, ConList, this, "List connected players with optional case-insensitive substring matching filter")

View file

@ -918,6 +918,22 @@ void CGameContext::ConShowOthers(IConsole::IResult *pResult, void *pUserData)
"Showing players from other teams is disabled by the server admin");
}
void CGameContext::ConShowAll(IConsole::IResult *pResult, void *pUserData)
{
CGameContext *pSelf = (CGameContext *) pUserData;
if (!CheckClientID(pResult->m_ClientID))
return;
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientID];
if (!pPlayer)
return;
if (pResult->NumArguments())
pPlayer->m_ShowAll = pResult->GetInteger(0);
else
pPlayer->m_ShowAll = !pPlayer->m_ShowAll;
}
bool CheckClientID(int ClientID)
{
dbg_assert(ClientID >= 0 || ClientID < MAX_CLIENTS,

View file

@ -1048,6 +1048,17 @@ int CCharacter::NetworkClipped(int SnappingClient)
int CCharacter::NetworkClipped(int SnappingClient, vec2 CheckPos)
{
if(SnappingClient == -1 || GameServer()->m_apPlayers[SnappingClient]->m_ShowAll)
return 0;
float dx = GameServer()->m_apPlayers[SnappingClient]->m_ViewPos.x-CheckPos.x;
float dy = GameServer()->m_apPlayers[SnappingClient]->m_ViewPos.y-CheckPos.y;
if(absolute(dx) > 1000.0f || absolute(dy) > 800.0f)
return 1;
if(distance(GameServer()->m_apPlayers[SnappingClient]->m_ViewPos, CheckPos) > 4000.0f)
return 1;
return 0;
}

View file

@ -263,6 +263,7 @@ private:
static void ConToggleBroadcast(IConsole::IResult *pResult, void *pUserData);
static void ConEyeEmote(IConsole::IResult *pResult, void *pUserData);
static void ConShowOthers(IConsole::IResult *pResult, void *pUserData);
static void ConShowAll(IConsole::IResult *pResult, void *pUserData);
static void ConNinjaJetpack(IConsole::IResult *pResult, void *pUserData);
static void ConSayTime(IConsole::IResult *pResult, void *pUserData);
static void ConSayTimeAll(IConsole::IResult *pResult, void *pUserData);

View file

@ -75,6 +75,7 @@ CPlayer::CPlayer(CGameContext *pGameServer, int ClientID, int Team)
m_ClientVersion = VERSION_VANILLA;
m_ShowOthers = g_Config.m_SvShowOthersDefault;
m_ShowAll = g_Config.m_SvShowAllDefault;
m_NinjaJetpack = false;
m_Paused = PAUSED_NONE;

View file

@ -139,6 +139,7 @@ public:
int m_Authed;
int m_ClientVersion;
bool m_ShowOthers;
bool m_ShowAll;
bool m_NinjaJetpack;
bool m_Afk;