mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add sv_rescue_delay and rename sv_allow_rescue to sv_rescue
This commit is contained in:
parent
5409f0baef
commit
ce465b584c
|
@ -1712,10 +1712,10 @@ void CServer::ConTestingCommands(CConsole::IResult *pResult, void *pUser)
|
||||||
((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
|
((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CServer::ConAllowRescue(CConsole::IResult *pResult, void *pUser)
|
void CServer::ConRescue(CConsole::IResult *pResult, void *pUser)
|
||||||
{
|
{
|
||||||
char aBuf[128];
|
char aBuf[128];
|
||||||
str_format(aBuf, sizeof(aBuf), "Value: %d", g_Config.m_SvAllowRescue);
|
str_format(aBuf, sizeof(aBuf), "Value: %d", g_Config.m_SvRescue);
|
||||||
((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
|
((CConsole*)pUser)->Print(CConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2120,7 +2120,7 @@ int main(int argc, const char **argv) // ignore_convention
|
||||||
pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention
|
pConsole->ParseArguments(argc-1, &argv[1]); // ignore_convention
|
||||||
|
|
||||||
pConsole->Register("sv_test_cmds", "", CFGFLAG_SERVER, CServer::ConTestingCommands, pConsole, "Turns testing commands aka cheats on/off");
|
pConsole->Register("sv_test_cmds", "", CFGFLAG_SERVER, CServer::ConTestingCommands, pConsole, "Turns testing commands aka cheats on/off");
|
||||||
pConsole->Register("sv_allow_rescue", "", CFGFLAG_SERVER, CServer::ConAllowRescue, pConsole, "Allow /rescue command so players can teleport themselves out of freeze");
|
pConsole->Register("sv_allow_rescue", "", CFGFLAG_SERVER, CServer::ConRescue, pConsole, "Allow /rescue command so players can teleport themselves out of freeze");
|
||||||
|
|
||||||
// restore empty config strings to their defaults
|
// restore empty config strings to their defaults
|
||||||
pConfig->RestoreStrings();
|
pConfig->RestoreStrings();
|
||||||
|
|
|
@ -250,7 +250,7 @@ public:
|
||||||
int Run();
|
int Run();
|
||||||
|
|
||||||
static void ConTestingCommands(IConsole::IResult *pResult, void *pUser);
|
static void ConTestingCommands(IConsole::IResult *pResult, void *pUser);
|
||||||
static void ConAllowRescue(IConsole::IResult *pResult, void *pUser);
|
static void ConRescue(IConsole::IResult *pResult, void *pUser);
|
||||||
static void ConKick(IConsole::IResult *pResult, void *pUser);
|
static void ConKick(IConsole::IResult *pResult, void *pUser);
|
||||||
static void ConStatus(IConsole::IResult *pResult, void *pUser);
|
static void ConStatus(IConsole::IResult *pResult, void *pUser);
|
||||||
static void ConShutdown(IConsole::IResult *pResult, void *pUser);
|
static void ConShutdown(IConsole::IResult *pResult, void *pUser);
|
||||||
|
|
|
@ -1235,7 +1235,7 @@ void CGameContext::ConRescue(IConsole::IResult *pResult, void *pUserData)
|
||||||
if (!pChr)
|
if (!pChr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!g_Config.m_SvAllowRescue) {
|
if (!g_Config.m_SvRescue) {
|
||||||
pSelf->SendChatTarget(pPlayer->GetCID(), "Rescue is not enabled on this server");
|
pSelf->SendChatTarget(pPlayer->GetCID(), "Rescue is not enabled on this server");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2007,7 +2007,7 @@ void CCharacter::DDRaceTick()
|
||||||
HandleTuneLayer(); // need this before coretick
|
HandleTuneLayer(); // need this before coretick
|
||||||
|
|
||||||
// look for save position for rescue feature
|
// look for save position for rescue feature
|
||||||
if(g_Config.m_SvAllowRescue) {
|
if(g_Config.m_SvRescue) {
|
||||||
int index = GameServer()->Collision()->GetPureMapIndex(m_Pos);
|
int index = GameServer()->Collision()->GetPureMapIndex(m_Pos);
|
||||||
int tile = GameServer()->Collision()->GetTileIndex(index);
|
int tile = GameServer()->Collision()->GetTileIndex(index);
|
||||||
int ftile = GameServer()->Collision()->GetFTileIndex(index);
|
int ftile = GameServer()->Collision()->GetFTileIndex(index);
|
||||||
|
@ -2190,8 +2190,17 @@ void CCharacter::DDRaceInit()
|
||||||
void CCharacter::Rescue()
|
void CCharacter::Rescue()
|
||||||
{
|
{
|
||||||
if (m_SetSavePos && !m_Super && !m_DeepFreeze && IsGrounded() && m_Pos == m_PrevPos) {
|
if (m_SetSavePos && !m_Super && !m_DeepFreeze && IsGrounded() && m_Pos == m_PrevPos) {
|
||||||
|
if (m_LastRescue + g_Config.m_SvRescueDelay * Server()->TickSpeed() > Server()->Tick())
|
||||||
|
{
|
||||||
|
char aBuf[256];
|
||||||
|
str_format(aBuf, sizeof(aBuf), "You have to wait %d seconds until you can rescue yourself", (m_LastRescue + g_Config.m_SvRescueDelay * Server()->TickSpeed() - Server()->Tick()) / Server()->TickSpeed());
|
||||||
|
GameServer()->SendChatTarget(GetPlayer()->GetCID(), aBuf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int index = GameServer()->Collision()->GetPureMapIndex(m_Pos);
|
int index = GameServer()->Collision()->GetPureMapIndex(m_Pos);
|
||||||
if (GameServer()->Collision()->GetTileIndex(index) == TILE_FREEZE || GameServer()->Collision()->GetFTileIndex(index) == TILE_FREEZE) {
|
if (GameServer()->Collision()->GetTileIndex(index) == TILE_FREEZE || GameServer()->Collision()->GetFTileIndex(index) == TILE_FREEZE) {
|
||||||
|
m_LastRescue = Server()->Tick();
|
||||||
m_Core.m_Pos = m_PrevSavePos;
|
m_Core.m_Pos = m_PrevSavePos;
|
||||||
m_Pos = m_PrevSavePos;
|
m_Pos = m_PrevSavePos;
|
||||||
m_PrevPos = m_PrevSavePos;
|
m_PrevPos = m_PrevSavePos;
|
||||||
|
|
|
@ -244,6 +244,7 @@ public:
|
||||||
int m_TileSFlagsB;
|
int m_TileSFlagsB;
|
||||||
vec2 m_Intersection;
|
vec2 m_Intersection;
|
||||||
int64 m_LastStartWarning;
|
int64 m_LastStartWarning;
|
||||||
|
int64 m_LastRescue;
|
||||||
bool m_LastRefillJumps;
|
bool m_LastRefillJumps;
|
||||||
bool m_LastPenalty;
|
bool m_LastPenalty;
|
||||||
bool m_LastBonus;
|
bool m_LastBonus;
|
||||||
|
|
|
@ -156,7 +156,8 @@ MACRO_CONFIG_STR(SvServerType, sv_server_type, 64, "none", CFGFLAG_SERVER, "Type
|
||||||
|
|
||||||
MACRO_CONFIG_INT(SvSendVotesPerTick, sv_send_votes_per_tick, 5, 1, 15, CFGFLAG_SERVER, "Number of vote options being send per tick")
|
MACRO_CONFIG_INT(SvSendVotesPerTick, sv_send_votes_per_tick, 5, 1, 15, CFGFLAG_SERVER, "Number of vote options being send per tick")
|
||||||
|
|
||||||
MACRO_CONFIG_INT(SvAllowRescue, sv_allow_rescue, 0, 0, 1, CFGFLAG_SERVER, "Allow /rescue command so players can teleport themselves out of freeze")
|
MACRO_CONFIG_INT(SvRescue, sv_rescue, 0, 0, 1, CFGFLAG_SERVER, "Allow /rescue command so players can teleport themselves out of freeze")
|
||||||
|
MACRO_CONFIG_INT(SvRescueDelay, sv_rescue_delay, 5, 0, 1000, CFGFLAG_SERVER, "Number of seconds inbetween two rescues")
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
#ifdef CONF_DEBUG // this one can crash the server if not used correctly
|
#ifdef CONF_DEBUG // this one can crash the server if not used correctly
|
||||||
|
|
Loading…
Reference in a new issue