protected virtual void RemoveExtraModifiers(long dt) { if (Entity == null || !Entity.InScene) { return; } using (Lock.AcquireExclusiveUsing()) { using (PoolManager.Get(out List <TRtKey> toRemove)) { foreach (var id in Modifiers.Keys) { if (!KeyExists(in id)) { toRemove.Add(id); } } foreach (var rem in toRemove) { if (DebugFlags.Trace(typeof(EquiModifierStorageComponent <,>))) { this.GetLogger().Info($"Removing {rem} since context creation failed"); } Modifiers.Remove(rem); } } using (PoolManager.Get(out List <ModifierDataKey> toRemove)) { foreach (var id in ModifierData.Keys) { if (!KeyExists(in id.Host)) { toRemove.Add(id); } } foreach (var rem in toRemove) { if (DebugFlags.Trace(typeof(EquiModifierStorageComponent <,>))) { this.GetLogger().Info($"Removing {rem} since context creation failed"); } ModifierData.Remove(rem); } } } }
protected void RemoveExtraModifiers() { using (Lock.AcquireExclusiveUsing()) { using (PoolManager.Get(out List <TRtKey> toRemove)) { foreach (var id in Modifiers.Keys) { if (!TryCreateContext(in id, InterningBag <EquiModifierBaseDefinition> .Empty, out _)) { toRemove.Add(id); } } foreach (var rem in toRemove) { if (DebugFlags.Trace(typeof(EquiModifierStorageComponent <,>))) { this.GetLogger().Info($"Removing {rem} since context creation failed"); } Modifiers.Remove(rem); } } using (PoolManager.Get(out List <ModifierDataKey> toRemove)) { foreach (var id in ModifierData.Keys) { if (!TryCreateContext(in id.Host, InterningBag <EquiModifierBaseDefinition> .Empty, out _)) { toRemove.Add(id); } } foreach (var rem in toRemove) { if (DebugFlags.Trace(typeof(EquiModifierStorageComponent <,>))) { this.GetLogger().Info($"Removing {rem} since context creation failed"); } ModifierData.Remove(rem); } } } }