committed by
GitHub
parent
ea60a81fdf
commit
103bc19508
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user