Compare commits

...

5 commits

Author SHA1 Message Date
KebsCS 056ebaff4f
Merge 34871095dc into 0369946156 2024-09-14 19:37:07 +02:00
Robert Müller 0369946156
Merge pull request #8946 from MilkeeyCat/pr_fix_callvote_map_change
Don't add `/` if the directory is empty
2024-09-14 17:11:22 +00:00
MilkeeyCat 232018de23 Don't add / if the directory is empty 2024-09-14 19:49:01 +03:00
Dennis Felsing 868c513c0c Version 18.5.1 2024-09-14 15:55:22 +02:00
KebsCS 34871095dc
Add /unspec command 2024-09-10 00:16:55 +02:00
6 changed files with 43 additions and 3 deletions

View file

@ -376,6 +376,37 @@ void CGameContext::ConToggleSpec(IConsole::IResult *pResult, void *pUserData)
ToggleSpecPause(pResult, pUserData, g_Config.m_SvPauseable ? CPlayer::PAUSE_SPEC : CPlayer::PAUSE_PAUSED);
}
void CGameContext::ConUnspec(IConsole::IResult *pResult, void *pUserData)
{
if(!CheckClientId(pResult->m_ClientId))
return;
CGameContext *pSelf = (CGameContext *)pUserData;
CPlayer *pPlayer = pSelf->m_apPlayers[pResult->m_ClientId];
if(!pPlayer)
return;
int PauseState = pPlayer->IsPaused();
int PauseType = g_Config.m_SvPauseable ? CPlayer::PAUSE_SPEC : CPlayer::PAUSE_PAUSED;
if(PauseState > 0)
{
IServer *pServ = pSelf->Server();
char aBuf[128];
str_format(aBuf, sizeof(aBuf), "You are force-paused for %d seconds.", (PauseState - pServ->Tick()) / pServ->TickSpeed());
pSelf->Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "chatresp", aBuf);
}
else
{
if(-PauseState != CPlayer::PAUSE_NONE && PauseType != CPlayer::PAUSE_NONE)
{
pPlayer->Pause(CPlayer::PAUSE_NONE, false);
if(pPlayer->m_SpectatorId != pResult->m_ClientId)
pPlayer->SpectateFreeView();
}
}
}
void CGameContext::ConToggleSpecVoted(IConsole::IResult *pResult, void *pUserData)
{
ToggleSpecPauseVoted(pResult, pUserData, g_Config.m_SvPauseable ? CPlayer::PAUSE_SPEC : CPlayer::PAUSE_PAUSED);

View file

@ -3526,7 +3526,7 @@ void CGameContext::ConAddMapVotes(IConsole::IResult *pResult, void *pUserData)
str_format(aCommand, sizeof(aCommand), "clear_votes; add_map_votes \"%s\"", aDirectory);
}
else
str_format(aCommand, sizeof(aCommand), "change_map \"%s/%s\"", pDirectory, aOptionEscaped);
str_format(aCommand, sizeof(aCommand), "change_map \"%s%s%s\"", pDirectory, pDirectory[0] == '\0' ? "" : "/", aOptionEscaped);
pSelf->AddVote(aDescription, aCommand);
}
@ -3747,6 +3747,7 @@ void CGameContext::RegisterChatCommands()
Console()->Register("converse", "r[message]", CFGFLAG_CHAT | CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, ConConverse, this, "Converse with the last person you whispered to (private message)");
Console()->Register("pause", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTogglePause, this, "Toggles pause");
Console()->Register("spec", "?r[player name]", CFGFLAG_CHAT | CFGFLAG_SERVER, ConToggleSpec, this, "Toggles spec (if not available behaves as /pause)");
Console()->Register("unspec", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConUnspec, this, "Stops spectating the current player and returns to free view mode");
Console()->Register("pausevoted", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConTogglePauseVoted, this, "Toggles pause on the currently voted player");
Console()->Register("specvoted", "", CFGFLAG_CHAT | CFGFLAG_SERVER, ConToggleSpecVoted, this, "Toggles spec on the currently voted player");
Console()->Register("dnd", "?i['0'|'1']", CFGFLAG_CHAT | CFGFLAG_SERVER | CFGFLAG_NONTEEHISTORIC, ConDND, this, "Toggle Do Not Disturb (no chat and server messages)");

View file

@ -426,6 +426,7 @@ private:
static void ConTogglePause(IConsole::IResult *pResult, void *pUserData);
static void ConTogglePauseVoted(IConsole::IResult *pResult, void *pUserData);
static void ConToggleSpec(IConsole::IResult *pResult, void *pUserData);
static void ConUnspec(IConsole::IResult *pResult, void *pUserData);
static void ConToggleSpecVoted(IConsole::IResult *pResult, void *pUserData);
static void ConForcePause(IConsole::IResult *pResult, void *pUserData);
static void ConTeamTop5(IConsole::IResult *pResult, void *pUserData);

View file

@ -867,6 +867,12 @@ void CPlayer::SpectatePlayerName(const char *pName)
}
}
void CPlayer::SpectateFreeView()
{
if(m_SpectatorId >= 0)
m_SpectatorId = SPEC_FREEVIEW;
}
void CPlayer::ProcessScoreResult(CScorePlayerResult &Result)
{
if(Result.m_Success) // SQL request was successful

View file

@ -67,6 +67,7 @@ public:
const CCharacter *GetCharacter() const;
void SpectatePlayerName(const char *pName);
void SpectateFreeView();
//---------------------------------------------------------
// this is used for snapping so we know how we can clip the view for the player

View file

@ -3,7 +3,7 @@
#ifndef GAME_VERSION_H
#define GAME_VERSION_H
#ifndef GAME_RELEASE_VERSION
#define GAME_RELEASE_VERSION "18.5"
#define GAME_RELEASE_VERSION "18.5.1"
#endif
// teeworlds
@ -13,7 +13,7 @@
#define GAME_NETVERSION7 "0.7 802f1be60a05665f"
// ddnet
#define DDNET_VERSION_NUMBER 18050
#define DDNET_VERSION_NUMBER 18051
extern const char *GIT_SHORTREV_HASH;
#define GAME_NAME "DDNet"
#endif