Esempio n. 1
0
        protected override void CreateNode()
        {
            if (comm == null)
            {
                comm = new RACommNode(nodeTransform)
                {
                    OnNetworkPreUpdate      = new Action(OnNetworkPreUpdate),
                    isHome                  = true,
                    isControlSource         = true,
                    isControlSourceMultiHop = true
                };
            }
            comm.name        = nodeName;
            comm.displayName = displaynodeName;
            comm.antennaRelay.Update(!isPermanent ? GameVariables.Instance.GetDSNRange(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.TrackingStation)) : antennaPower, GameVariables.Instance.GetDSNRangeCurve(), false);
//            Vector3d pos = (nodeTransform == null) ? transform.position : nodeTransform.position;
//            body.GetLatLonAlt(pos, out lat, out lon, out alt);

            RACommNode t = comm as RACommNode;

            t.ParentBody = body;
            int   maxTL   = HighLogic.CurrentGame.Parameters.CustomParams <RAParameters>().MaxTechLevel;
            float fTSLvl  = ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.TrackingStation);
            int   tsLevel = (HighLogic.CurrentGame.Mode == Game.Modes.CAREER) ? Convert.ToInt32(1 + (fTSLvl * maxTL)) : maxTL;

            // Config node contains a list of antennas to build.
            //Debug.LogFormat("Building all antennas for tech level {0} from {1}", tsLevel, config);
            t.RAAntennaList = new List <RealAntenna> {
            };
            foreach (ConfigNode antNode in config.GetNodes("Antenna"))
            {
                //Debug.LogFormat("Building an antenna for {0}", antNode);
                int targetLevel = Int32.Parse(antNode.GetValue("TechLevel"));
                if (tsLevel >= targetLevel)
                {
                    RealAntenna ant = new RealAntennaDigital(name)
                    {
                        ParentNode = comm
                    };
                    ant.LoadFromConfigNode(antNode);
                    ant.ProcessUpgrades(tsLevel, antNode);
                    ant.TechLevelInfo = TechLevelInfo.GetTechLevel(tsLevel);
                    t.RAAntennaList.Add(ant);
                }
                else
                {
                    //Debug.LogFormat("Skipped because current techLevel {0} is less than required {1}", tsLevel, targetLevel);
                }
            }
        }
Esempio n. 2
0
        protected override void CreateNode()
        {
            if (comm == null)
            {
                comm = new RACommNode(nodeTransform)
                {
                    OnNetworkPreUpdate      = new Action(OnNetworkPreUpdate),
                    isHome                  = true,
                    isControlSource         = true,
                    isControlSourceMultiHop = true
                };
            }
            comm.name        = nodeName;
            comm.displayName = displaynodeName;
            comm.antennaRelay.Update(!isPermanent ? GameVariables.Instance.GetDSNRange(ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.TrackingStation)) : antennaPower, GameVariables.Instance.GetDSNRangeCurve(), false);
//            Vector3d pos = (nodeTransform == null) ? transform.position : nodeTransform.position;
//            body.GetLatLonAlt(pos, out lat, out lon, out alt);

            RACommNode t = comm as RACommNode;

            t.ParentBody = body;
            int tsLevel = RACommNetScenario.GroundStationTechLevel;

            // Config node contains a list of antennas to build.
            t.RAAntennaList = new List <RealAntenna> {
            };
            foreach (ConfigNode antNode in config.GetNodes("Antenna"))
            {
                //Debug.LogFormat("Building an antenna for {0}", antNode);
                int targetLevel = Int32.Parse(antNode.GetValue("TechLevel"));
                if (tsLevel >= targetLevel)
                {
                    RealAntenna ant = new RealAntennaDigital(name)
                    {
                        ParentNode = comm
                    };
                    ant.LoadFromConfigNode(antNode);
                    ant.ProcessUpgrades(tsLevel, antNode);
                    ant.TechLevelInfo = TechLevelInfo.GetTechLevel(tsLevel);
                    t.RAAntennaList.Add(ant);
                }
            }
        }