Ejemplo n.º 1
0
        public void RegisterProtos(Vessel v)
        {
            Guid key = v.id;

            RTLog.Notify("AntennaManager: RegisterProtos({0}, {1})", v.vesselName, key);

            if (mLoadedAntennaCache.ContainsKey(key))
            {
                return;
            }

            foreach (ProtoPartSnapshot pps in v.protoVessel.protoPartSnapshots)
            {
                foreach (ProtoPartModuleSnapshot ppms in pps.modules.Where(ppms => ppms.IsAntenna()))
                {
                    if (!mProtoAntennaCache.ContainsKey(key))
                    {
                        mProtoAntennaCache[key] = new List <IAntenna>();
                    }
                    ProtoAntenna proto = new ProtoAntenna(v, pps, ppms);
                    mProtoAntennaCache[key].Add(proto);
                    OnRegister(proto);
                }
            }
        }
Ejemplo n.º 2
0
        public void RegisterProtoFor(Vessel vessel)
        {
            RTUtil.Log("AntennaManager: RegisterProto: " + vessel);
            Guid key = vessel.id;

            if (!mProtoAntennaCache.ContainsKey(key))
            {
                mProtoAntennaCache[key] = new List <IAntenna>();
            }

            mProtoAntennaCache[key].Clear();

            foreach (ProtoPartSnapshot pps in vessel.protoVessel.protoPartSnapshots)
            {
                foreach (ProtoPartModuleSnapshot ppms in pps.modules.Where(x => x.IsAntenna()))
                {
                    IAntenna protoAntenna = new ProtoAntenna(vessel, pps, ppms);
                    if (protoAntenna != null)
                    {
                        // Initialisation can fail.
                        mProtoAntennaCache[key].Add(protoAntenna);
                        OnRegister(protoAntenna);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void RegisterProtos(Vessel v)
        {
            Guid key = v.id;

            RTUtil.Log("AntennaManager: RegisterProtos: {0}, {1}", key, v.vesselName);

            // Refuse to load ProtoAntennas if physical ones exist.
            if (mLoadedAntennaCache.ContainsKey(key))
            {
                return;
            }

            // Iterate over all parts and try to register ProtoAntennas for them.
            foreach (ProtoPartSnapshot pps in v.protoVessel.protoPartSnapshots)
            {
                foreach (ProtoPartModuleSnapshot ppms in pps.modules)
                {
                    if (ppms.IsAntenna())
                    {
                        if (!mProtoAntennaCache.ContainsKey(key))
                        {
                            mProtoAntennaCache[key] = new List <IAntenna>();
                        }
                        ProtoAntenna new_pa = new ProtoAntenna(v, pps, ppms);
                        mProtoAntennaCache[key].Add(new_pa);
                        OnRegister(new_pa);
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public void RegisterProtoFor(Vessel vessel)
        {
            RTUtil.Log("AntennaManager: RegisterProto: " + vessel);
            Guid key = vessel.id;

            if (!mProtoAntennaCache.ContainsKey(key)) {
                mProtoAntennaCache[key] = new List<IAntenna>();
            }

            mProtoAntennaCache[key].Clear();

            foreach (ProtoPartSnapshot pps in vessel.protoVessel.protoPartSnapshots) {
                foreach (ProtoPartModuleSnapshot ppms in pps.modules.Where(x => x.IsAntenna())) {
                    IAntenna protoAntenna = new ProtoAntenna(vessel, pps, ppms);
                    if (protoAntenna != null) {
                        // Initialisation can fail.
                        mProtoAntennaCache[key].Add(protoAntenna);
                        OnRegister(protoAntenna);
                    }
                }
            }
        }