Fix Whoopie Cushions from lagging the game. (#39194)

This commit is contained in:
Princess Cheeseballs
2025-08-08 15:11:13 -07:00
committed by GitHub
parent 2b8145ce87
commit ce7b7c1adf
5 changed files with 72 additions and 12 deletions

View File

@@ -22,6 +22,13 @@ public sealed partial class StatusEffectsSystem
TimeSpan duration
)
{
if (duration == TimeSpan.Zero)
{
statusEffect = null;
return false;
}
// We check to make sure time is greater than zero here because sometimes you want to use TryAddStatusEffect to remove duration instead...
if (!TryGetStatusEffect(target, effectProto, out statusEffect))
return TryAddStatusEffect(target, effectProto, out statusEffect, duration);
@@ -53,6 +60,12 @@ public sealed partial class StatusEffectsSystem
TimeSpan? duration = null
)
{
if (duration <= TimeSpan.Zero)
{
statusEffect = null;
return false;
}
if (!TryGetStatusEffect(target, effectProto, out statusEffect))
return TryAddStatusEffect(target, effectProto, out statusEffect, duration);
@@ -83,6 +96,12 @@ public sealed partial class StatusEffectsSystem
TimeSpan? duration = null
)
{
if (duration <= TimeSpan.Zero)
{
statusEffect = null;
return false;
}
if (!TryGetStatusEffect(target, effectProto, out statusEffect))
return TryAddStatusEffect(target, effectProto, out statusEffect, duration);