Esempio n. 1
0
 /// <summary>
 /// Update the value supplied from a generator connected to the powernet
 /// </summary>
 public void UpdateGenerator(PowerGeneratorComponent generator)
 {
     if (GeneratorList.ContainsKey(generator))
     {
         Supply -= GeneratorList[generator];
         GeneratorList[generator] = generator.Supply;
         Supply += generator.Supply;
     }
 }
 /// <summary>
 /// Remove a power supply from a generator connected to the powernet
 /// </summary>
 public void RemoveGenerator(PowerGeneratorComponent generator)
 {
     if (GeneratorList.ContainsKey(generator))
     {
         Supply -= GeneratorList[generator];
         GeneratorList.Remove(generator);
     }
     else
     {
         Logger.WarningS("power", "We tried to remove generator {0} twice from {1}, somehow.", generator.Owner, this);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Remove a power supply from a generator connected to the powernet
 /// </summary>
 public void RemoveGenerator(PowerGeneratorComponent generator)
 {
     if (Generatorlist.ContainsKey(generator))
     {
         Supply -= Generatorlist[generator];
         Generatorlist.Remove(generator);
     }
     else
     {
         var name = generator.Owner.Prototype.Name;
         Logger.Log(String.Format("We tried to remove a device twice from the same power somehow, prototype {1}", name));
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Register a power supply from a generator connected to the powernet
 /// </summary>
 public void AddGenerator(PowerGeneratorComponent generator)
 {
     GeneratorList.Add(generator, generator.Supply);
     Supply += generator.Supply;
 }