Skip to content

Commit

Permalink
ChaosMod: Don't account meta effects in running effects count
Browse files Browse the repository at this point in the history
  • Loading branch information
pongo1231 committed Oct 15, 2023
1 parent 9ca97e8 commit 1ffac55
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions ChaosMod/Components/EffectDispatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ void EffectDispatcher::UpdateEffects(int deltaTime)

bool isEffectPaused = EffectThreads::IsThreadPaused(effect.ThreadId);

bool isMeta = false;
// Temporary non-timed effects will have their entries removed already since their OnStop is called immediately
if (g_EnabledEffects.contains(effect.Identifier))
{
const auto &effectData = g_EnabledEffects.at(effect.Identifier);
isMeta = effectData.IsMeta();
}

if (!EffectThreads::DoesThreadExist(effect.ThreadId))
{
if (effect.MaxTime > 0.f
Expand All @@ -467,22 +475,17 @@ void EffectDispatcher::UpdateEffects(int deltaTime)
EffectThreads::RunThread(effect.ThreadId);
OnPostRunEffect.Fire(effect.Identifier);

activeEffects++;
if (!isMeta)
{
activeEffects++;
}
}

if (effect.HideEffectName && EffectThreads::HasThreadOnStartExecuted(effect.ThreadId))
{
effect.HideEffectName = false;
}

bool isMeta = false;
// Temporary non-timed effects will have their entries removed already since their OnStop is called immediately
if (g_EnabledEffects.contains(effect.Identifier))
{
const auto &effectData = g_EnabledEffects.at(effect.Identifier);
isMeta = effectData.IsMeta();
}

if (effect.MaxTime > 0.f)
{
if (isMeta)
Expand All @@ -504,7 +507,7 @@ void EffectDispatcher::UpdateEffects(int deltaTime)
* (1.f + (t / 5 - 1) * std::max(0.f, SharedState.ActiveEffects.size() - n) / (m - n));
}

if ((effect.MaxTime > 0.f && effect.Timer <= 0.f) || activeEffects > maxEffects)
if ((effect.MaxTime > 0.f && effect.Timer <= 0.f) || (!isMeta && activeEffects > maxEffects))
{
if (effect.Timer < -60.f)
{
Expand Down

0 comments on commit 1ffac55

Please sign in to comment.