diff --git a/sources/BaseAPI/API/SideEffects/SideEffectAPI.uc b/sources/BaseAPI/API/SideEffects/SideEffectAPI.uc index 7e58b91..3317c59 100644 --- a/sources/BaseAPI/API/SideEffects/SideEffectAPI.uc +++ b/sources/BaseAPI/API/SideEffects/SideEffectAPI.uc @@ -120,6 +120,24 @@ public function SideEffect Add_S( return newSideEffect; } +/// Checks whether specified [`SideEffect`] is currently active. +/// +/// Check is done via contents and not instance equality. +/// Returns `true` if specified [`SideEffect`] is currently active and `false` otherwise. +public function bool IsRegistered(SideEffect sideEffectToCheck) { + local int i; + + if (sideEffectToCheck == none) return false; + if (!sideEffectToCheck.IsInitialized()) return false; + + for (i = 0; i < activeSideEffects.length; i += 1) { + if (activeSideEffects[i].IsEqual(sideEffectToCheck)) { + return true; + } + } + return false; +} + /// Adds a new side effect to the list of active side effects. /// /// This method will fail if its argument is `none`, non-initialized or a side effect with that