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

This commit is contained in:
Perry Fraser
2025-07-12 12:49:58 -04:00
committed by GitHub
parent ad34d88a49
commit dbfe05d5cc
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);
}