Exemple #1
0
 void init_tank_manager()
 {
     if(tank_manager != null) return;
     tank_manager = new SwitchableTankManager(this);
     tank_manager.EnablePartControls = !HighLogic.LoadedSceneIsEditor;
     tank_manager.Load(ModuleSave);
     var used_volume = tank_manager.TotalVolume;
     if(used_volume > Volume)
     {
         this.Log("WARNING: Volume limit is less than the total volume " +
             "of preconfigured tanks: {0} < {1}", Volume, used_volume);
         Volume = used_volume;
     }
 }
 protected override void early_setup(StartState state)
 {
     base.early_setup(state);
     Fields["hangar_v"].guiActive = true;
     Fields["hangar_d"].guiActive = true;
     max_side = Mathf.Pow(TotalVolume, 1f/3);
     //init tank manager
     if(HasTankManager)
     {
         tank_manager = new SwitchableTankManager(this);
         if(ModuleSave.HasNode(SwitchableTankManager.NODE_NAME))
             tank_manager.Load(ModuleSave.GetNode(SwitchableTankManager.NODE_NAME));
         Events["EditTanks"].active = true;
         if(BuildTanksFrom != string.Empty)
         {
             metal_pump = new ResourcePump(part, BuildTanksFrom);
             if(!metal_pump.Valid) metal_pump = null;
             else if(TanksMass <= 0)
                 TanksMass = tank_manager.TanksVolumes
                     .Aggregate(0f, (m, v) => m+metal_for_tank(v)*metal_pump.Resource.density);
         }
     }
 }