Exemplo n.º 1
0
    public override BTResult Process()
    {
        if (MyParty == null)
        {
            return(Exit(BTResult.Fail));
        }

        if (MyParty.IsPlayerParty && !GameManager.Inst.PlayerControl.IsAutopilot)
        {
            Debug.Log("autopilot disabled!");
            return(Exit(BTResult.Fail));
        }



        bool isFollowerDock = false;

        if (Parameters.Count > 0 && Parameters[0] == "LeaderDockedStation")
        {
            isFollowerDock = true;
        }

        if (!isFollowerDock)
        {
            if (MyParty.NextNode == null)
            {
                //Debug.Log("isdocked " + MyAI.IsDocked + " my party null? " + (MyParty == null) + " next node null? " + (MyParty.NextNode == null));
                return(Exit(BTResult.Fail));
            }
        }

        if (isFollowerDock || MyParty.NextNode.NavNodeType == NavNodeType.Station)
        {
            NavNode dockNode;
            if (isFollowerDock)
            {
                //Debug.Log(MyParty.DockedStationID + " I am " + MyAI.MyShip.name);
                dockNode = GameManager.Inst.WorldManager.AllNavNodes[MyParty.DockedStationID];
                if (MyParty.SpawnedShipsLeader.DockedStationID == "")
                {
                    return(Exit(BTResult.Fail));
                }
            }
            else
            {
                dockNode = MyParty.NextNode;
                //if not destination then don't dock, just get close enough and move on to next node in GoTo
                if (MyParty.CurrentTask.TravelDestNodeID != dockNode.ID)
                {
                    return(Exit(BTResult.Fail));
                }
            }



            //GameObject.Find("Sphere").transform.position = (Vector3)MyAI.Whiteboard.Parameters["Destination"];
            //if too far away from station then go to node
            if (Vector3.Distance(MyAI.MyShip.transform.position, dockNode.Location.RealPos) > 40)
            {
                _dockingStage = 0;
                MyAI.Whiteboard.Parameters["Destination"] = dockNode.Location.RealPos;
                //Debug.Log("BTDockAtNextNode: running, going towards station position " + MyParty.NextNode.Location.RealPos);
                return(Running());
            }
            else if (_dockingStage == 0)
            {
                _dockingStage = 1;
            }


            if (MyAI.MyShip.DockedStationID == dockNode.ID)
            {
                MyAI.MyShip.Hide();
                MyParty.DockedStationID = dockNode.ID;

                //Debug.Log("Finished docking, " + MyParty.DockedStationID);

                if (MyAI.MyShip == MyParty.SpawnedShipsLeader)
                {
                    bool allDocked = true;
                    foreach (ShipBase member in MyAI.MyParty.SpawnedShips)
                    {
                        if (member != MyAI.MyShip && member.DockedStationID == "")
                        {
                            allDocked = false;
                        }
                    }
                    if (allDocked)
                    {
                        Debug.LogError("Everyone has docked! " + MyParty.DockedStationID);
                        return(Exit(BTResult.Success));
                    }
                    else
                    {
                        //Debug.Log("Dock at station running");
                        return(Running());
                    }
                }
                else
                {
                    return(Exit(BTResult.Success));
                }
            }

            if (_currentSession == null)
            {
                DockRequestResult result = GameManager.Inst.WorldManager.CurrentSystem.GetStationByID(dockNode.ID).Dock(MyAI.MyShip, out _currentSession);
                if (result == DockRequestResult.Busy)
                {
                    //Debug.Log("Dock at station running");
                    MyAI.Whiteboard.Parameters["Destination"] = Vector3.zero;
                    return(Running());
                }
                else if (result == DockRequestResult.Deny)
                {
                    return(Exit(BTResult.Fail));
                }
                else
                {
                    //Debug.Log("BTDockAtNextNode: running");
                    return(Running());
                }
            }
            else
            {
                //find dock start
                DockingSession session     = (DockingSession)_currentSession;
                Vector3        dockStartV3 = session.GetDockEnterTarget();
                _dockStart = new RelLoc(_origin.position, dockStartV3, _origin);

                if (!MyAI.MyShip.IsInPortal)
                {
                    if (Vector3.Distance(MyAI.MyShip.transform.position, _dockStart.RealPos) >= 3)
                    {
                        //fly towards docking target
                        MyAI.Whiteboard.Parameters["Destination"] = _dockStart.RealPos;
                    }
                    else
                    {
                        MyAI.Whiteboard.Parameters["Destination"] = Vector3.zero;
                    }
                }
                //Debug.Log("BTDockAtNextNode: running");
                return(Running());
            }
        }
        else if (MyParty.NextNode.NavNodeType == NavNodeType.Tradelane)
        {
            if (MyParty.DestNode.ID == MyParty.NextNode.ID && MyParty.CurrentTLSession == null)
            {
                return(Exit(BTResult.Fail));
            }

            if (MyAI.IsDocked)
            {
                return(Exit(BTResult.Fail));
            }

            //Debug.Log("Docking stage " + _dockingStage + " - " + MyAI.name);

            //if already in tradelane then do a midway dock on prevNode tradelane
            if (Vector3.Distance(MyAI.MyShip.transform.position, GameManager.Inst.PlayerControl.PlayerShip.transform.position) > 500 && MyParty.PrevNode != null &&
                MyParty.PrevNode.NavNodeType == NavNodeType.Tradelane && MyParty.NextNode.NavNodeType == NavNodeType.Tradelane && !MyAI.MyShip.IsInPortal && MyParty.CurrentTLSession == null)
            {
                int           direction = 0;
                TradelaneData prevTL    = (TradelaneData)MyParty.PrevNode;
                TradelaneData nextTL    = (TradelaneData)MyParty.NextNode;
                if (prevTL.NeighborAID == nextTL.ID)
                {
                    direction = -1;
                }
                else if (prevTL.NeighborBID == nextTL.ID)
                {
                    direction = 1;
                }

                if (direction != 0)
                {
                    Tradelane       currentLane = GameManager.Inst.WorldManager.CurrentSystem.GetTradelaneByID(prevTL.ID);
                    DockSessionBase s;
                    Debug.LogError("Start midway dock I am " + MyAI.MyShip.name);
                    DockRequestResult result = currentLane.MidwayDock(MyAI.MyShip, out s, direction);

                    if (result == DockRequestResult.Busy)
                    {
                        MyAI.Whiteboard.Parameters["Destination"] = Vector3.zero;
                        //Debug.Log("Dock at station running");
                        return(Running());
                    }
                    else if (result == DockRequestResult.Deny)
                    {
                        return(Exit(BTResult.Fail));
                    }
                    else
                    {
                        //Debug.Log("BTDockAtNextNode: midway dock granted, running");
                        MyParty.CurrentTLSession = (TLTransitSession)s;
                        _dockingStage            = 2;
                        return(Running());
                    }
                }
            }


            if (MyParty.CurrentTLSession == null)
            {
                //if too far away from station then go to
                float distToNextNode = Vector3.Distance(MyAI.MyShip.transform.position, MyParty.NextNode.Location.RealPos);
                if (distToNextNode > 40)
                {
                    //Debug.Log("BTDockAtNextNode: distToNextNode " + distToNextNode);

                    _dockingStage = 0;
                    MyAI.Whiteboard.Parameters["Destination"] = MyParty.NextNode.Location.RealPos;
                    //Debug.Log("BTDockAtNextNode: running next node " + MyParty.NextNode.ID);
                    return(Running());
                }
                else if (_dockingStage == 0)
                {
                    _dockingStage = 1;
                }

                Tradelane currentLane = GameManager.Inst.WorldManager.CurrentSystem.GetTradelaneByID(MyParty.NextNode.ID);

                if (_dockStart == null)
                {
                    //need to decide if we want to dock here. find the next node after the tradelane, if it's
                    //a trade lane and is this tradelane's neighbor then dock. if not, return fail

                    NavNode nextNextNode = MyParty.NextNextNode;
                    Vector3 dockStartV3  = Vector3.zero;

                    if (nextNextNode != null && nextNextNode.NavNodeType == NavNodeType.Tradelane)
                    {
                        if (nextNextNode.ID == currentLane.NeighborAID)
                        {
                            dockStartV3 = currentLane.TriggerA.transform.position - (currentLane.TriggerA.transform.forward
                                                                                     + new Vector3(UnityEngine.Random.Range(-0.3f, 0.3f), UnityEngine.Random.Range(-0.3f, 0.3f), UnityEngine.Random.Range(-0.3f, 0.3f))).normalized * UnityEngine.Random.Range(10f, 30f);
                        }
                        else if (nextNextNode.ID == currentLane.NeighborBID)
                        {
                            dockStartV3 = currentLane.TriggerB.transform.position - (currentLane.TriggerB.transform.forward
                                                                                     + new Vector3(UnityEngine.Random.Range(-0.3f, 0.3f), UnityEngine.Random.Range(-0.3f, 0.3f), UnityEngine.Random.Range(-0.3f, 0.3f))).normalized * UnityEngine.Random.Range(10f, 30f);
                        }
                        else
                        {
                            return(Exit(BTResult.Fail));
                        }
                    }
                    else
                    {
                        return(Exit(BTResult.Fail));
                    }

                    _dockStart = new RelLoc(_origin.position, dockStartV3, _origin);
                }



                //GameObject.Find("Sphere").transform.position = _dockStart.RealPos;

                if (_dockingStage == 1)
                {
                    if (Vector3.Distance(_dockStart.RealPos, MyAI.MyShip.transform.position) > 5)
                    {
                        MyAI.Whiteboard.Parameters["Destination"] = _dockStart.RealPos;
                        //Debug.Log("BTDockAtNextNode: going to dock start " + Vector3.Distance(_dockStart.RealPos, MyAI.MyShip.transform.position));
                        return(Running());
                    }
                    else
                    {
                        MyAI.Whiteboard.Parameters["Destination"] = Vector3.zero;
                        _dockingStage = 2;
                    }
                }
            }

            MyAI.Whiteboard.Parameters["IgnoreAvoidance"] = true;

            if (MyParty.CurrentTLSession != null && MyAI.MyShip.IsInPortal)
            {
                float distToNextNode = Vector3.Distance(MyAI.MyShip.transform.position, MyParty.NextNode.Location.RealPos);
                //Debug.Log(distToNextNode + " next node " + MyParty.NextNode.ID);
                if (distToNextNode < 10)
                {
                    if (MyParty.NextNextNode == null || MyParty.NextNextNode.NavNodeType != NavNodeType.Tradelane)
                    {
                        MyParty.CurrentTLSession.Stage = TLSessionStage.Cancelling;
                        Debug.LogError("BTDockAtNextNode tradelane: cancel sent");
                    }
                    MyParty.PrevNode = MyParty.NextNode;
                    Debug.LogError("BTDockAtNextNode tradelane: Successful " + MyParty.NextNode.ID);
                    return(Exit(BTResult.Success));
                }
                else
                {
                    //Debug.Log("Dock at station running");
                    return(Running());
                }
            }

            if (MyParty.CurrentTLSession == null)
            {
                Tradelane         currentLane = GameManager.Inst.WorldManager.CurrentSystem.GetTradelaneByID(MyParty.NextNode.ID);
                DockSessionBase   s;
                DockRequestResult result = currentLane.Dock(MyAI.MyShip, out s);

                if (result == DockRequestResult.Busy)
                {
                    //Debug.Log("tradelane is busy");
                    MyAI.Whiteboard.Parameters["Destination"] = Vector3.zero;
                    return(Running());
                }
                else if (result == DockRequestResult.Deny)
                {
                    return(Exit(BTResult.Fail));
                }
                else
                {
                    //Debug.Log("BTDockAtNextNode: dock request granted, running");
                    MyParty.CurrentTLSession = (TLTransitSession)s;
                    return(Running());
                }
            }
            else
            {
                if (!MyAI.MyShip.IsInPortal)
                {
                    if (MyAI.MyShip.RB.velocity.magnitude < 0.1f || _dockingStage == 3)
                    {
                        Tradelane currentLane = GameManager.Inst.WorldManager.CurrentSystem.GetTradelaneByID(MyParty.NextNode.ID);
                        if (currentLane.GetTLSessionDockingStage(MyParty.CurrentTLSession) >= 2)
                        {
                            //fly towards docking trigger
                            Vector3 dockingTrigger = MyParty.CurrentTLSession.CurrentTrigger.transform.position;
                            MyAI.Whiteboard.Parameters["Destination"] = dockingTrigger;
                            _dockingStage = 3;
                        }
                    }
                    else if (_dockingStage == 2)
                    {
                        MyAI.Whiteboard.Parameters["Destination"] = Vector3.zero;
                    }
                }
                //Debug.Log("BTDockAtNextNode: running");
                return(Running());
            }
        }
        else if (MyParty.NextNode.NavNodeType == NavNodeType.JumpGate)
        {
            //if destination is in same system then don't dock
            if (MyParty.CurrentTask.TravelDestSystemID == GameManager.Inst.WorldManager.CurrentSystem.ID || MyAI.IsDocked)
            {
                return(Exit(BTResult.Fail));
            }

            //Debug.Log("Trying to dock at jump gate");
            JumpGate jg = (JumpGate)GameManager.Inst.WorldManager.CurrentSystem.GetStationByID(MyParty.NextNode.ID);
            if (_waitDistance == 0)
            {
                _waitDistance = UnityEngine.Random.Range(25f, 40f);
            }

            Vector3 dockStartV3 = jg.DockingTrigger.transform.position + jg.DockingTrigger.transform.up * 20;
            _dockStart = new RelLoc(_origin.position, dockStartV3, _origin);

            //if too far away from station then go to
            if (Vector3.Distance(MyAI.MyShip.transform.position, MyParty.NextNode.Location.RealPos) > _waitDistance)
            {
                MyAI.Whiteboard.Parameters["Destination"] = _dockStart.RealPos;
                //Debug.Log("BTDockAtNextNode: running " + _waitDistance);
                return(Running());
            }

            MyParty.PrevNode = MyParty.NextNode;


            if (!jg.IsGateActive && !jg.IsPortalReady)
            {
                DockSessionBase session;
                jg.Dock(MyAI.MyShip, out session);
            }

            if (jg.IsGateActive && jg.IsPortalReady)
            {
                //first go to docking trigger Y + 10 and then towards docking trigger


                if (_dockingStage <= 0)
                {
                    MyAI.Whiteboard.Parameters["Destination"] = _dockStart.RealPos;
                    if (Vector3.Distance(MyAI.MyShip.transform.position, _dockStart.RealPos) <= 5)
                    {
                        _dockingStage = 1;
                    }
                    //Debug.Log("Going to dockstart");
                }
                else if (_dockingStage == 1)
                {
                    Debug.Log("Tring to stop at dock start " + MyAI.MyShip.RB.velocity.magnitude);
                    if (MyAI.MyShip.RB.velocity.magnitude > 0.1f)
                    {
                        MyAI.Whiteboard.Parameters["Destination"] = Vector3.zero;
                    }
                    else
                    {
                        _dockingStage = 2;
                    }
                }
                else if (_dockingStage >= 2)
                {
                    MyAI.Whiteboard.Parameters["IgnoreAvoidance"] = true;
                    MyAI.Whiteboard.Parameters["Destination"]     = jg.DockingTrigger.transform.position;
                    //Debug.Log("Going to dock trigger");
                }
                //GameObject.Find("Sphere").transform.position = (Vector3)MyAI.Whiteboard.Parameters["Destination"];
                //Debug.Log("BTDockAtNextNode: running");
                return(Running());
            }
            else
            {
                if (Vector3.Distance(MyAI.MyShip.transform.position, _dockStart.RealPos) <= 5)
                {
                    MyAI.Whiteboard.Parameters["Destination"] = Vector3.zero;
                }
                else
                {
                    MyAI.Whiteboard.Parameters["Destination"] = _dockStart.RealPos;
                }
                //Debug.Log("BTDOckAtNextNode: waiting for jumpgate to start");
                return(Running());
            }
        }


        return(Exit(BTResult.Fail));
    }
Exemplo n.º 2
0
    public StarSystemData LoadStarSystemData(string path, bool isScene)
    {
        //

        XmlDocument doc = new XmlDocument();

        string file = File.ReadAllText(path);

        try
        {
            doc.LoadXml(file);
        }
        catch (XmlException)
        {
            return(null);
        }

        XmlNode systemNode = doc.GetElementsByTagName("system")[0];
        XmlAttributeCollection systemAttrs = systemNode.Attributes;
        string    systemID   = systemAttrs["id"].Value.ToString();
        string    systemName = systemAttrs["displayname"].Value.ToString();
        Transform origin     = null;

        if (isScene)
        {
            origin = GameObject.Find("Origin").transform;
        }

        StarSystemData systemData = new StarSystemData(systemID, systemName);

        systemData.SystemID = systemID;

        XmlNodeList systemContent = systemNode.ChildNodes;

        foreach (XmlNode node in systemContent)
        {
            if (node.Name == "systemlocation")
            {
                Vector3 location = location = DBManager.ParseXmlVector3(node.FirstChild);

                systemData.Location = new RelLoc(Vector3.zero, location, null);
            }

            if (node.Name == "ambience")
            {
                XmlNodeList content = node.ChildNodes;
                foreach (XmlNode subnode in content)
                {
                    if (subnode.Name == "skybox")
                    {
                        string skyboxName = node.InnerText;
                        systemData.SkyboxName = skyboxName;
                    }

                    if (subnode.Name == "ambientcolor")
                    {
                        XmlNode colorNode = subnode.FirstChild;
                        systemData.AmbientColor = DBManager.ParseXmlColorNode(colorNode);
                    }
                }
            }

            if (node.Name == "origin")
            {
                Vector3 originLoc = DBManager.ParseXmlVector3(node.FirstChild);
                systemData.OriginPosition = originLoc;
                if (isScene)
                {
                    origin.position = originLoc;
                }
            }

            if (node.Name == "sun")
            {
                string  sunID     = "";
                string  name      = "";
                float   intensity = 0;
                Vector3 scale     = Vector3.zero;
                Vector3 location  = Vector3.zero;
                Color   color     = Color.black;

                SunData sunData = new SunData();

                XmlNodeList content = node.ChildNodes;
                foreach (XmlNode subnode in content)
                {
                    if (subnode.Name == "id")
                    {
                        sunID = subnode.InnerText;
                    }
                    if (subnode.Name == "displayname")
                    {
                        name = subnode.InnerText;
                    }
                    if (subnode.Name == "location")
                    {
                        location = systemData.OriginPosition + DBManager.ParseXmlVector3(subnode.FirstChild);
                    }
                    if (subnode.Name == "scale")
                    {
                        scale = DBManager.ParseXmlVector3(subnode.FirstChild);
                    }
                    if (subnode.Name == "sunlight")
                    {
                        XmlAttributeCollection sunlightAttr = subnode.Attributes;
                        intensity = Convert.ToSingle(sunlightAttr["intensity"].Value);
                        XmlNode colorNode = subnode.FirstChild;
                        color = DBManager.ParseXmlColorNode(colorNode);
                    }
                }

                sunData.ID          = sunID;
                sunData.DisplayName = name;
                sunData.Location    = new RelLoc(systemData.OriginPosition, location, origin);
                sunData.Scale       = scale;
                sunData.Color       = color;
                sunData.Intensity   = intensity;
                systemData.Suns.Add(sunData);
            }
            if (node.Name == "planet")
            {
                string  planetID = "";
                string  name     = "";
                Vector3 scale    = Vector3.zero;
                Vector3 location = Vector3.zero;

                PlanetData planetData = new PlanetData();

                XmlNodeList content = node.ChildNodes;
                foreach (XmlNode subnode in content)
                {
                    if (subnode.Name == "id")
                    {
                        planetID = subnode.InnerText;
                    }
                    if (subnode.Name == "displayname")
                    {
                        name = subnode.InnerText;
                    }
                    if (subnode.Name == "location")
                    {
                        location = systemData.OriginPosition + DBManager.ParseXmlVector3(subnode.FirstChild);
                    }
                    if (subnode.Name == "scale")
                    {
                        scale = DBManager.ParseXmlVector3(subnode.FirstChild);
                    }
                }

                planetData.ID            = planetID;
                planetData.DisplayName   = name;
                planetData.Location      = new RelLoc(systemData.OriginPosition, location, origin);
                planetData.OriginalScale = scale;
                systemData.Planets.Add(planetData);
            }
            if (node.Name == "station")
            {
                string        stationID        = "";
                string        name             = "";
                string        stationType      = "";
                Vector3       location         = Vector3.zero;
                Vector3       eulerAngles      = Vector3.zero;
                XmlNodeList   content          = node.ChildNodes;
                string        targetSystem     = "";
                string        exitGateID       = "";
                List <string> neighborIDs      = new List <string>();
                Vector3       spawnDisposition = Vector3.zero;

                foreach (XmlNode subnode in content)
                {
                    if (subnode.Name == "id")
                    {
                        stationID = subnode.InnerText;
                    }
                    if (subnode.Name == "displayname")
                    {
                        name = subnode.InnerText;
                    }
                    if (subnode.Name == "stationtype")
                    {
                        stationType = subnode.InnerText;
                    }
                    if (subnode.Name == "location")
                    {
                        location = systemData.OriginPosition + DBManager.ParseXmlVector3(subnode.FirstChild);
                    }
                    if (subnode.Name == "eulerangles")
                    {
                        eulerAngles = DBManager.ParseXmlVector3(subnode.FirstChild);
                    }
                    if (subnode.Name == "targetsystem")
                    {
                        targetSystem = subnode.InnerText;
                    }
                    if (subnode.Name == "exitgateid")
                    {
                        exitGateID = subnode.InnerText;
                    }
                    if (subnode.Name == "navneighbor")
                    {
                        neighborIDs.Add(subnode.InnerText);
                    }
                    if (subnode.Name == "spawndisposition")
                    {
                        spawnDisposition = DBManager.ParseXmlVector3(subnode.FirstChild);
                    }
                }

                if (stationType == "JumpGate")
                {
                    JumpGateData jumpGateData = new JumpGateData();
                    jumpGateData.ID               = stationID;
                    jumpGateData.DisplayName      = name;
                    jumpGateData.TargetSystem     = targetSystem;
                    jumpGateData.ExitGateID       = exitGateID;
                    jumpGateData.Location         = new RelLoc(systemData.OriginPosition, location, origin);
                    jumpGateData.EulerAngles      = eulerAngles;
                    jumpGateData.NeighborIDs      = neighborIDs;
                    jumpGateData.NavNodeType      = NavNodeType.JumpGate;
                    jumpGateData.SystemID         = systemID;
                    jumpGateData.SpawnDisposition = spawnDisposition;
                    systemData.JumpGates.Add(jumpGateData);
                    systemData.ChildNodes.Add(jumpGateData);
                    systemData.NeighborIDs.Add(targetSystem);
                }
                else if (stationType == "Station")
                {
                    StationData stationData = new StationData();
                    stationData.DisplayName = name;
                    stationData.ID          = stationID;
                    stationData.Location    = new RelLoc(systemData.OriginPosition, location, origin);
                    stationData.EulerAngles = eulerAngles;
                    stationData.NeighborIDs = neighborIDs;
                    stationData.NavNodeType = NavNodeType.Station;
                    stationData.SystemID    = systemID;
                    systemData.Stations.Add(stationData);
                    systemData.ChildNodes.Add(stationData);
                }
            }
            if (node.Name == "tradelane")
            {
                string        stationID   = "";
                string        displayName = "";
                Vector3       location    = Vector3.zero;
                Vector3       eulerAngles = Vector3.zero;
                XmlNodeList   content     = node.ChildNodes;
                string        terminal    = "";
                string        neighborA   = "";
                string        neighborB   = "";
                List <string> neighborIDs = new List <string>();
                foreach (XmlNode subnode in content)
                {
                    if (subnode.Name == "id")
                    {
                        stationID = subnode.InnerText;
                    }
                    if (subnode.Name == "displayname")
                    {
                        displayName = subnode.InnerText;
                    }
                    if (subnode.Name == "location")
                    {
                        location = systemData.OriginPosition + DBManager.ParseXmlVector3(subnode.FirstChild);
                    }
                    if (subnode.Name == "eulerangles")
                    {
                        eulerAngles = DBManager.ParseXmlVector3(subnode.FirstChild);
                    }
                    if (subnode.Name == "terminal")
                    {
                        terminal = subnode.InnerText;
                    }
                    if (subnode.Name == "neighbor_a")
                    {
                        neighborA = subnode.InnerText;
                        if (neighborA != "NULL")
                        {
                            neighborIDs.Add(neighborA);
                        }
                    }
                    if (subnode.Name == "neighbor_b")
                    {
                        neighborB = subnode.InnerText;
                        if (neighborB != "NULL")
                        {
                            neighborIDs.Add(neighborB);
                        }
                    }
                    if (subnode.Name == "navneighbor")
                    {
                        neighborIDs.Add(subnode.InnerText);
                    }
                }

                TradelaneData tradelaneData = new TradelaneData();
                tradelaneData.ID             = stationID;
                tradelaneData.DisplayName    = displayName;
                tradelaneData.IsTerminalAorB = Convert.ToInt32(terminal);
                tradelaneData.NeighborAID    = neighborA;
                tradelaneData.NeighborBID    = neighborB;
                tradelaneData.Location       = new RelLoc(systemData.OriginPosition, location, origin);
                tradelaneData.EulerAngles    = eulerAngles;
                tradelaneData.NeighborIDs    = neighborIDs;
                tradelaneData.NavNodeType    = NavNodeType.Tradelane;
                tradelaneData.SystemID       = systemID;
                systemData.Tradelanes.Add(tradelaneData);
                systemData.ChildNodes.Add(tradelaneData);
            }
        }



        return(systemData);
    }