Pow3r: stage 1 (#4208)

Co-authored-by: 20kdc <asdd2808@gmail.com>
This commit is contained in:
Pieter-Jan Briers
2021-07-04 18:11:52 +02:00
committed by GitHub
parent ea60a81fdf
commit 103bc19508
212 changed files with 8584 additions and 4426 deletions

View File

@@ -11,16 +11,51 @@ namespace Content.Server.NodeContainer.EntitySystems
{
base.Initialize();
SubscribeLocalEvent<NodeContainerComponent, ComponentInit>(OnInitEvent);
SubscribeLocalEvent<NodeContainerComponent, ComponentStartup>(OnStartupEvent);
SubscribeLocalEvent<NodeContainerComponent, ComponentShutdown>(OnShutdownEvent);
SubscribeLocalEvent<NodeContainerComponent, AnchorStateChangedEvent>(OnAnchorStateChanged);
SubscribeLocalEvent<NodeContainerComponent, RotateEvent>(OnRotateEvent);
}
private void OnAnchorStateChanged(EntityUid uid, NodeContainerComponent component, AnchorStateChangedEvent args)
private static void OnInitEvent(EntityUid uid, NodeContainerComponent component, ComponentInit args)
{
component.AnchorUpdate();
foreach (var (key, node) in component.Nodes)
{
node.Name = key;
node.Initialize(component.Owner);
}
}
private void OnRotateEvent(EntityUid uid, NodeContainerComponent container, RotateEvent ev)
private static void OnStartupEvent(EntityUid uid, NodeContainerComponent component, ComponentStartup args)
{
foreach (var node in component.Nodes.Values)
{
node.OnContainerStartup();
}
}
private static void OnShutdownEvent(EntityUid uid, NodeContainerComponent component, ComponentShutdown args)
{
foreach (var node in component.Nodes.Values)
{
node.OnContainerShutdown();
}
}
private static void OnAnchorStateChanged(
EntityUid uid,
NodeContainerComponent component,
AnchorStateChangedEvent args)
{
foreach (var node in component.Nodes.Values)
{
node.AnchorUpdate();
node.AnchorStateChanged();
}
}
private static void OnRotateEvent(EntityUid uid, NodeContainerComponent container, RotateEvent ev)
{
if (ev.NewRotation == ev.OldRotation)
{