File tree Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Expand file tree Collapse file tree 2 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -465,21 +465,38 @@ void MagicService::ApplyQueuedEffects() noexcept
465465
466466void 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 ;
Original file line number Diff line number Diff 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;
You can’t perform that action at this time.
0 commit comments