mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge #4611
4611: Default players to being afk on new map r=heinrich5991 a=def- As reported by MitakoKotomi in https://forum.ddnet.tw/viewtopic.php?f=118&p=70154 <!-- What is the motivation for the changes of this pull request --> ## Checklist - [x] Tested the change ingame - [ ] Provided screenshots if it is a visual change - [ ] Tested in combination with possibly related configuration options - [ ] Written a unit test if it works standalone, system.c especially - [ ] Considered possible null pointers and out of bounds array indexing - [ ] Changed no physics that affect existing maps - [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional) Co-authored-by: Dennis Felsing <dennis@felsin9.de>
This commit is contained in:
commit
cfe5032217
|
@ -1773,8 +1773,6 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
|
|||
if(Length == 0 || (pMsg->m_pMessage[0] != '/' && (g_Config.m_SvSpamprotection && pPlayer->m_LastChat && pPlayer->m_LastChat + Server()->TickSpeed() * ((31 + Length) / 32) > Server()->Tick())))
|
||||
return;
|
||||
|
||||
pPlayer->UpdatePlaytime();
|
||||
|
||||
int GameTeam = ((CGameControllerDDRace *)m_pController)->m_Teams.m_Core.Team(pPlayer->GetCID());
|
||||
if(Team)
|
||||
Team = ((pPlayer->GetTeam() == -1) ? CHAT_SPEC : GameTeam);
|
||||
|
@ -1842,6 +1840,7 @@ void CGameContext::OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID)
|
|||
}
|
||||
else
|
||||
{
|
||||
pPlayer->UpdatePlaytime();
|
||||
char aCensoredMessage[256];
|
||||
CensorMessage(aCensoredMessage, pMsg->m_pMessage, sizeof(aCensoredMessage));
|
||||
SendChat(ClientID, Team, aCensoredMessage, ClientID);
|
||||
|
|
|
@ -71,6 +71,7 @@ void CPlayer::Reset()
|
|||
m_aTimeoutCode[0] = '\0';
|
||||
delete m_pLastTarget;
|
||||
m_pLastTarget = new CNetObj_PlayerInput({0});
|
||||
m_LastTargetInit = false;
|
||||
m_TuneZone = 0;
|
||||
m_TuneZoneOld = m_TuneZone;
|
||||
m_Halloween = false;
|
||||
|
@ -555,8 +556,11 @@ void CPlayer::OnDirectInput(CNetObj_PlayerInput *NewInput)
|
|||
if(mem_comp(NewInput, m_pLastTarget, sizeof(CNetObj_PlayerInput)))
|
||||
{
|
||||
mem_copy(m_pLastTarget, NewInput, sizeof(CNetObj_PlayerInput));
|
||||
UpdatePlaytime();
|
||||
// Ignore the first direct input and keep the player afk as it is sent automatically
|
||||
if(m_LastTargetInit)
|
||||
UpdatePlaytime();
|
||||
m_LastActionTick = Server()->Tick();
|
||||
m_LastTargetInit = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -186,6 +186,7 @@ public:
|
|||
bool m_LastBroadcastImportance;
|
||||
|
||||
CNetObj_PlayerInput *m_pLastTarget;
|
||||
bool m_LastTargetInit;
|
||||
/*
|
||||
afk timer's 1st warning after 50% of sv_max_afk_time
|
||||
2nd warning after 90%
|
||||
|
|
Loading…
Reference in a new issue