refactor: rework the new status effect system to use containers (#38915)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user