refactor: rework the new status effect system to use containers (#38915) (#38943)

Co-authored-by: Perry Fraser <perryprog@users.noreply.github.com>
This commit is contained in:
Fildrance
2025-07-12 20:53:08 +03:00
committed by GitHub
parent 2181585030
commit f4d223b2e1
18 changed files with 244 additions and 214 deletions

View File

@@ -3,20 +3,20 @@ using Robust.Shared.Player;
namespace Content.Shared.StatusEffectNew;
public abstract partial class SharedStatusEffectsSystem
public sealed partial class StatusEffectsSystem
{
protected void InitializeRelay()
private void InitializeRelay()
{
SubscribeLocalEvent<StatusEffectContainerComponent, LocalPlayerAttachedEvent>(RelayStatusEffectEvent);
SubscribeLocalEvent<StatusEffectContainerComponent, LocalPlayerDetachedEvent>(RelayStatusEffectEvent);
}
protected void RefRelayStatusEffectEvent<T>(EntityUid uid, StatusEffectContainerComponent component, ref T args) where T : struct
private void RefRelayStatusEffectEvent<T>(EntityUid uid, StatusEffectContainerComponent component, ref T args) where T : struct
{
RelayEvent((uid, component), ref args);
}
protected void RelayStatusEffectEvent<T>(EntityUid uid, StatusEffectContainerComponent component, T args) where T : class
private void RelayStatusEffectEvent<T>(EntityUid uid, StatusEffectContainerComponent component, T args) where T : class
{
RelayEvent((uid, component), args);
}
@@ -25,7 +25,7 @@ public abstract partial class SharedStatusEffectsSystem
{
// this copies the by-ref event if it is a struct
var ev = new StatusEffectRelayedEvent<T>(args);
foreach (var activeEffect in statusEffect.Comp.ActiveStatusEffects)
foreach (var activeEffect in statusEffect.Comp.ActiveStatusEffects?.ContainedEntities ?? [])
{
RaiseLocalEvent(activeEffect, ref ev);
}
@@ -37,7 +37,7 @@ public abstract partial class SharedStatusEffectsSystem
{
// this copies the by-ref event if it is a struct
var ev = new StatusEffectRelayedEvent<T>(args);
foreach (var activeEffect in statusEffect.Comp.ActiveStatusEffects)
foreach (var activeEffect in statusEffect.Comp.ActiveStatusEffects?.ContainedEntities ?? [])
{
RaiseLocalEvent(activeEffect, ref ev);
}