Skip to content

Commit 0e26641

Browse files
committed
Make the 'Reveal Players' effect ephemeral
Duration is set to 6 seconds
1 parent 4103310 commit 0e26641

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

Code/client/Services/Generic/MagicService.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -465,21 +465,38 @@ void MagicService::ApplyQueuedEffects() noexcept
465465

466466
void MagicService::UpdateRevealOtherPlayersEffect() noexcept
467467
{
468-
if (GetAsyncKeyState(VK_F4) & 0x01)
469-
m_revealOtherPlayers = !m_revealOtherPlayers;
468+
constexpr auto cRevealDuration = 6s;
469+
constexpr auto cDelayBetweenUpdates = 2s;
470470

471-
if (!m_revealOtherPlayers)
472-
return;
471+
// Effect's activation and lifecycle
473472

473+
static std::chrono::steady_clock::time_point revealStartTimePoint;
474474
static std::chrono::steady_clock::time_point lastSendTimePoint;
475-
constexpr auto cDelayBetweenUpdates = 2s;
475+
476+
if (GetAsyncKeyState(VK_F4) & 0x01 && !m_revealingOtherPlayers)
477+
{
478+
m_revealingOtherPlayers = true;
479+
revealStartTimePoint = std::chrono::steady_clock::now();
480+
}
481+
482+
if (!m_revealingOtherPlayers)
483+
return;
476484

477485
const auto now = std::chrono::steady_clock::now();
486+
487+
if (now - revealStartTimePoint > cRevealDuration)
488+
{
489+
m_revealingOtherPlayers = false;
490+
return;
491+
}
492+
478493
if (now - lastSendTimePoint < cDelayBetweenUpdates)
479494
return;
480495

481496
lastSendTimePoint = now;
482497

498+
// When active
499+
483500
Mod* pSkyrimTogether = ModManager::Get()->GetByName("SkyrimTogether.esp");
484501
if (!pSkyrimTogether)
485502
return;

Code/client/Services/MagicService.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct MagicService
8888
Map<uint32_t, AddTargetRequest> m_queuedEffects;
8989
Map<uint32_t, NotifyAddTarget> m_queuedRemoteEffects;
9090

91-
bool m_revealOtherPlayers = false;
91+
bool m_revealingOtherPlayers = false;
9292

9393
entt::scoped_connection m_updateConnection;
9494
entt::scoped_connection m_spellCastEventConnection;

0 commit comments

Comments
 (0)