Ejemplo n.º 1
0
 private void OnStartupEvent(EntityUid uid, NodeContainerComponent component, ComponentStartup args)
 {
     foreach (var node in component.Nodes.Values)
     {
         _nodeGroupSystem.QueueReflood(node);
     }
 }
Ejemplo n.º 2
0
        private void OnRotateEvent(EntityUid uid, NodeContainerComponent container, ref RotateEvent ev)
        {
            if (ev.NewRotation == ev.OldRotation)
            {
                return;
            }

            var xform = Transform(uid);

            foreach (var node in container.Nodes.Values)
            {
                if (node is not IRotatableNode rotatableNode)
                {
                    continue;
                }

                // Don't bother updating nodes that can't even be connected to anything atm.
                if (!node.Connectable(EntityManager, xform))
                {
                    continue;
                }

                if (rotatableNode.RotateEvent(ref ev))
                {
                    _nodeGroupSystem.QueueReflood(node);
                }
            }
        }
Ejemplo n.º 3
0
 private static void OnShutdownEvent(EntityUid uid, NodeContainerComponent component, ComponentShutdown args)
 {
     foreach (var node in component.Nodes.Values)
     {
         node.OnContainerShutdown();
     }
 }
Ejemplo n.º 4
0
 private static void OnStartupEvent(EntityUid uid, NodeContainerComponent component, ComponentStartup args)
 {
     foreach (var node in component.Nodes.Values)
     {
         node.OnContainerStartup();
     }
 }
        private void OnExamine(EntityUid uid, NodeContainerComponent component, ExaminedEvent args)
        {
            if (!component.Examinable || !args.IsInDetailsRange)
            {
                return;
            }

            foreach (var node in component.Nodes.Values)
            {
                if (node == null)
                {
                    continue;
                }
                switch (node.NodeGroupID)
                {
                case NodeGroupID.HVPower:
                    args.PushMarkup(
                        Loc.GetString("node-container-component-on-examine-details-hvpower"));
                    break;

                case NodeGroupID.MVPower:
                    args.PushMarkup(
                        Loc.GetString("node-container-component-on-examine-details-mvpower"));
                    break;

                case NodeGroupID.Apc:
                    args.PushMarkup(
                        Loc.GetString("node-container-component-on-examine-details-apc"));
                    break;
                }
            }
        }
Ejemplo n.º 6
0
 private void OnShutdownEvent(EntityUid uid, NodeContainerComponent component, ComponentShutdown args)
 {
     foreach (var node in component.Nodes.Values)
     {
         _nodeGroupSystem.QueueNodeRemove(node);
         node.Deleting = true;
     }
 }
Ejemplo n.º 7
0
 private void OnInitEvent(EntityUid uid, NodeContainerComponent component, ComponentInit args)
 {
     foreach (var(key, node) in component.Nodes)
     {
         node.Name = key;
         node.Initialize(component.Owner, EntityManager);
     }
 }
 private void OnReAnchor(EntityUid uid, NodeContainerComponent component, ref ReAnchorEvent args)
 {
     foreach (var node in component.Nodes.Values)
     {
         _nodeGroupSystem.QueueNodeRemove(node);
         _nodeGroupSystem.QueueReflood(node);
     }
 }
Ejemplo n.º 9
0
 private static void OnAnchorStateChanged(
     EntityUid uid,
     NodeContainerComponent component,
     ref AnchorStateChangedEvent args)
 {
     foreach (var node in component.Nodes.Values)
     {
         node.AnchorUpdate();
         node.AnchorStateChanged();
     }
 }
Ejemplo n.º 10
0
        private void OnRotateEvent(EntityUid uid, NodeContainerComponent container, RotateEvent ev)
        {
            if (ev.NewRotation == ev.OldRotation)
            {
                return;
            }

            foreach (var node in container.Nodes.Values)
            {
                if (node is not IRotatableNode rotatableNode)
                {
                    continue;
                }
                rotatableNode.RotateEvent(ev);
            }
        }
Ejemplo n.º 11
0
        private void PaintNodes(NodeContainerComponent nodeContainerComponent, NodeGroupID nodeGroupId, Color color)
        {
            var group = nodeContainerComponent.Nodes[nodeGroupId.ToString().ToLower()].NodeGroup;

            if (group == null)
            {
                return;
            }

            foreach (var x in group.Nodes)
            {
                if (!IoCManager.Resolve <IEntityManager>().TryGetComponent <AtmosPipeColorComponent?>(x.Owner, out var atmosPipeColorComponent))
                {
                    continue;
                }

                EntitySystem.Get <AtmosPipeColorSystem>().SetColor(x.Owner, atmosPipeColorComponent, color);
            }
        }
Ejemplo n.º 12
0
        private void OnAnchorStateChanged(
            EntityUid uid,
            NodeContainerComponent component,
            ref AnchorStateChangedEvent args)
        {
            foreach (var node in component.Nodes.Values)
            {
                if (!node.NeedAnchored)
                {
                    continue;
                }

                node.OnAnchorStateChanged(EntityManager, args.Anchored);

                if (args.Anchored)
                {
                    _nodeGroupSystem.QueueReflood(node);
                }
                else
                {
                    _nodeGroupSystem.QueueNodeRemove(node);
                }
            }
        }
Ejemplo n.º 13
0
 private void OnAnchorStateChanged(EntityUid uid, NodeContainerComponent component, AnchorStateChangedEvent args)
 {
     component.AnchorUpdate();
 }
Ejemplo n.º 14
0
 private void OnBodyTypeChanged(EntityUid uid, NodeContainerComponent component, PhysicsBodyTypeChangedEvent args)
 {
     component.AnchorUpdate();
 }