fixed /emote reset

This commit is contained in:
fisted 2011-01-07 23:26:28 +01:00
parent 395c87a7ad
commit 2a4bb8e631
3 changed files with 20 additions and 8 deletions

View file

@ -892,17 +892,17 @@ void CGameContext::ConEyeEmote(IConsole::IResult *pResult, void *pUserData, int
if (pChr)
{
if (!str_comp(pResult->GetString(0), "angry"))
pChr->m_EmoteType = EMOTE_ANGRY;
pChr->m_DefEmote = EMOTE_ANGRY;
else if (!str_comp(pResult->GetString(0), "blink"))
pChr->m_EmoteType = EMOTE_BLINK;
pChr->m_DefEmote = EMOTE_BLINK;
else if (!str_comp(pResult->GetString(0), "close"))
pChr->m_EmoteType = EMOTE_BLINK;
pChr->m_DefEmote = EMOTE_BLINK;
else if (!str_comp(pResult->GetString(0), "happy"))
pChr->m_EmoteType = EMOTE_HAPPY;
pChr->m_DefEmote = EMOTE_HAPPY;
else if (!str_comp(pResult->GetString(0), "pain"))
pChr->m_EmoteType = EMOTE_PAIN;
pChr->m_DefEmote = EMOTE_PAIN;
else if (!str_comp(pResult->GetString(0), "surprise"))
pChr->m_EmoteType = EMOTE_SURPRISE;
pChr->m_DefEmote = EMOTE_SURPRISE;
else
{
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Unkown emote... Say /emote");
@ -912,7 +912,7 @@ void CGameContext::ConEyeEmote(IConsole::IResult *pResult, void *pUserData, int
if (pResult->NumArguments() > 1)
Duration = pResult->GetInteger(1);
pChr->m_EmoteStop = pSelf->Server()->Tick() + Duration * pSelf->Server()->TickSpeed();
pChr->m_DefEmoteReset = pSelf->Server()->Tick() + Duration * pSelf->Server()->TickSpeed();
}
}
}

View file

@ -99,6 +99,8 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos)
Controller->m_Teams.SendTeamsState(GetPlayer()->GetCID());
}
m_DefEmote = EMOTE_NORMAL;
m_DefEmoteReset = -1;
return true;
}
@ -766,6 +768,13 @@ void CCharacter::Tick()
m_Core.Tick(true);
m_Core.m_Id = GetPlayer()->GetCID();
if (m_DefEmoteReset >= 0 && m_DefEmoteReset <= Server()->Tick())
{
m_DefEmoteReset = -1;
m_EmoteType = m_DefEmote = EMOTE_NORMAL;
m_EmoteStop = -1;
}
m_DoSplash = false;
if (g_Config.m_SvEndlessDrag)
m_Core.m_HookTick = 0;
@ -1552,7 +1561,7 @@ void CCharacter::Snap(int SnappingClient)
// set emote
if (m_EmoteStop < Server()->Tick())
{
m_EmoteType = EMOTE_NORMAL;
m_EmoteType = m_DefEmote;
m_EmoteStop = -1;
}

View file

@ -145,6 +145,9 @@ public:
int m_EmoteType;
int m_EmoteStop;
int m_DefEmote; //used to override the default emote through /emote
int m_DefEmoteReset; //tick when it gets reset
// last tick that the player took any action ie some input
int m_LastAction;