Example #1
0
 public override void Update()
 {
     if (Lib.IsFlight() && Features.Deploy)
     {
         // Check if it is transmitting
         if (!Features.Science && Features.Signal)
         {
             if (antenna != null)
             {
                 isTransmitting = antenna.stream.Transmitting();
             }
         }
         else if (Features.Science)
         {
             // get info from the cache
             Vessel_Info vi = Cache.VesselInfo(vessel);
             // consume ec if data is transmitted or relayed
             if (vi == null)
             {
                 isTransmitting = false;
             }
             else
             {
                 isTransmitting = (vi.transmitting.Length > 0 || vi.relaying.Length > 0);
             }
         }
         base.Update();
         if (isTransmitting && isConsuming && !isAnimation)
         {
             if (Features.Signal)
             {
                 actualECCost = antenna.cost;
             }
             else if (Features.KCommNet)
             {
                 NetworkAdaptor adap = part.FindModuleImplementing <NetworkAdaptor>();
                 if (adap != null)
                 {
                     actualECCost = adap.ecCost;
                 }
                 else
                 {
                     actualECCost = 0;
                 }
             }
             // Kerbalism already has logic to consume EC when it is transmitting
             isConsuming = false;
         }
     }
 }
Example #2
0
 public NetAdaptorDevice(NetworkAdaptor networkAdap)
 {
     this.networkAdap = networkAdap;
 }