public void RandomizeSymmetry()
        {
            Group group = room.groups.general.childGroups.Values.ElementAt(0);
            Color color = Utils.randomColor();
            Vector2 center = parent.body.pos;
            float dist = (float)Utils.random.NextDouble() * 100f + 20f;
            float angle = (float)Utils.random.NextDouble() * GMath.TwoPI;
            float speed = (float)Utils.random.NextDouble() * 5f + 1f;
            int numberOfNodes = Utils.random.Next(10) + 2;

            float angleIncrement = GMath.TwoPI / numberOfNodes;

            Node centerNode = room.defaultNode.CreateClone(room);
            centerNode.body.color = color;
            centerNode.collision.active = false;
            centerNode.body.pos = center;
            room.spawnNode(centerNode, lifetime: -1, g: group);
            HashSet<Node> outerNodes = new HashSet<Node>();
            for(int i = 0; i < numberOfNodes; i++)
            {
                Node n = centerNode.CreateClone(room);
                float angleFromCenter = angleIncrement * i;
                Vector2 spawnPosition = (VMath.AngleToVector(angleFromCenter) * dist) + center;
                Vector2 spawnVelocity = VMath.AngleToVector(angleFromCenter + angle) * speed;
                room.spawnNode(n, lifetime: -1, g: group);
                n.body.pos = spawnPosition;
                n.body.velocity = spawnVelocity;
                n.body.radius = 5f;
                n.body.mass = 10f;
                n.body.color = color * 0.5f;
                n.movement.mode = movemode.free;
                outerNodes.Add(n);

                //n.addComponent<PhaseOrb>(true);
                //n.Comp<PhaseOrb>().phaserLength = 200;

                //n.addComponent<Laser>(true);
                //n.Comp<Laser>().laserLength = 200;

                n.addComponent<Waver>(true);
                n.Comp<Waver>().Length = 200;
                n.Comp<Waver>().reflective = true;

                n.addComponent<ColorChanger>(true);
            }
            centerNode.movement.active = false;
            centerNode.basicdraw.active = false;

            Gravity grav = new Gravity();
            grav.multiplier = 20f;
            grav.radius = float.MaxValue;

            Spring spring = new Spring();
            spring.restdist = 100;
            spring.radius = float.MaxValue;

            Follow follow = new Follow();

            RelativeMotion rel = new RelativeMotion();

            Link link = new Link(parent, outerNodes, grav);
            //Link link = new Link(outerNodes, parent, follow);
            //link.AddLinkComponent(rel, true);
            //link.AddLinkComponent(follow, true);
            link.active = true;
            link.DrawLinkLines = false;
            links.Enqueue(link);
        }
        public override void OnSpawn()
        {
            shootNode.dataStore["linknodeparent"] = parent;
            shootNode.body.pos = parent.body.pos;
            shootNode.addComponent<ColorChanger>(true);
            shootNode.AffectExclusionCheck += (node) => node == parent;
            room.groups.items.IncludeEntity(shootNode);
            shootNode.OnSpawn();
            shootNode.body.AddExclusionCheck(parent.body);
            shootNode.active = false;
            shootNode.movement.maxVelocity.value = 50f;

            spring = new Spring();
            spring.restdist = 0;
            spring.springMode = Spring.mode.PushOnly;
            spring.multiplier = 400;

            //Tether tether = new Tether();
            //tether.mindist = 0;
            //tether.maxdist = 20;
            //tether.active = true;

            //shootNodeLink = new Link(parent, shootNode, spring);
            //shootNodeLink.IsEntangled = true;
            ////shovelLink.components.Add(tether);

            grav = new Gravity();
            grav.mode = Gravity.Mode.ConstantForce;
            //grav.Repulsive = true;
            grav.multiplier = 100;

            shootLink = new Link(parent, shootNode, grav);
            shootLink.AddLinkComponent(spring, true);

            //
            Gravity attachGrav = new Gravity();
            attachGrav.multiplier = 100;
            attachGrav.mode = Gravity.Mode.ConstantForce;

            Tether aTether = new Tether();
            aTether.maxdist = 100;
            aTether.mindist = 0;
            aTether.activated = true;

            Spring aSpring = new Spring();
            aSpring.springMode = Spring.mode.PushAndPull;
            aSpring.multiplier = 100;
            aSpring.restdist = 0;

            attachedNodesQueue = new Queue<Node>();
            //attachLink = new Link(parent, new HashSet<Node>(), attachGrav); //targetsToSelf

            attachLink = new Link(new HashSet<Node>(), new HashSet<Node>(), aTether); //targetsChained
            attachLink.FormationType = formationtype.Chain;
            //attachLink.AddLinkComponent(aTether, true);
            //attachLink.AddLinkComponent(attachGrav, true);

            shootNode.body.OnCollisionEnter += (n, other) =>
                {
                    if (other == parent) return;
                    if (linkMode == LinkMode.TargetsToSelf)
                    {
                        if (!attachLink.targets.Contains(other))
                        {
                            attachLink.targets.Add(other);
                            attachedNodesQueue.Enqueue(other);
                            attachLink.active = true;
                        }
                    }
                    else if (linkMode == LinkMode.TargetsToTargets)
                    {
                        if (!attachLink.sources.Contains(other))
                        {
                            attachLink.sources.Add(other);
                            attachLink.targets.Add(other);
                            attachedNodesQueue.Enqueue(other);
                            attachLink.active = true;
                        }
                    }
                    else if (linkMode == LinkMode.TargetsChained)
                    {
                        if (!attachLink.sources.Contains(other))
                        {
                            attachedNodesQueue.Enqueue(other);
                            attachLink.formation.AddChainNode(other);
                            attachLink.active = true;
                        }
                    }
                };

            parent.body.ExclusionCheck += (c1, c2) =>
                attachLink.targets.Contains(c2.parent);
        }