Skip to content

Commit

Permalink
ChaosMod: Forcibly stop effect threads 60 seconds after effect stop r…
Browse files Browse the repository at this point in the history
…equest
  • Loading branch information
pongo1231 committed Sep 22, 2023
1 parent 93c711c commit 1954074
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions ChaosMod/Components/EffectDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,12 +470,6 @@ void EffectDispatcher::UpdateEffects(int deltaTime)
activeEffects++;
}

if (effect.IsStopping)
{
it++;
continue;
}

if (effect.HideEffectName && EffectThreads::HasThreadOnStartExecuted(effect.ThreadId))
{
effect.HideEffectName = false;
Expand Down Expand Up @@ -512,8 +506,16 @@ void EffectDispatcher::UpdateEffects(int deltaTime)

if ((effect.MaxTime > 0.f && effect.Timer <= 0.f) || activeEffects > maxEffects)
{
EffectThreads::StopThread(effect.ThreadId);
effect.IsStopping = true;
if (effect.Timer < -60.f)
{
// Effect took over 60 seconds to stop, forcibly stop it in a blocking manner
EffectThreads::StopThreadImmediately(effect.ThreadId);
}
else if (!effect.IsStopping)
{
EffectThreads::StopThread(effect.ThreadId);
effect.IsStopping = true;
}
}

it++;
Expand Down

0 comments on commit 1954074

Please sign in to comment.