Files
wwdpublic/Content.Shared/_White/Actions/ActionRelaySystem.cs
Spatison 62d4ba308f [Feature] Xenomorphs Part 1 (#716)
* init commit

* xenomorph: part 1

* weed heal

* fix Rsi

* fix Yaml linter

* fix
2025-07-27 18:11:03 +03:00

30 lines
827 B
C#

using Content.Shared._White.Xenomorphs;
using Content.Shared.Actions;
namespace Content.Shared._White.Actions;
public sealed class ActionRelaySystem : EntitySystem
{
[Dependency] private readonly SharedActionsSystem _actions = default!;
public override void Initialize()
{
SubscribeLocalEvent<ActionsComponent, PlasmaAmountChangeEvent>(RelayEvent);
}
public void RelayEvent<T>(EntityUid uid, ActionsComponent component, T args) where T : EntityEventArgs
{
var ev = new ActionRelayedEvent<T>(args);
var actions = _actions.GetActions(uid, component);
foreach (var action in actions)
{
RaiseLocalEvent(action.Id, ev);
}
}
}
public sealed class ActionRelayedEvent<TEvent>(TEvent args) : EntityEventArgs
{
public TEvent Args = args;
}