SSTUTools.SSTUVolumeContainer.OnStart C# (CSharp) Method

OnStart() public method

public OnStart ( StartState state ) : void
state StartState
return void
        public override void OnStart(StartState state)
        {
            base.OnStart(state);
            loadConfigData();//initialize the container instances, including initializing default values if needed
            updateMassAndCost();//update cached part mass and cost values
            updatePersistentData();//update persistent data in case tank was just initialized
            updateFuelSelections();//update the selections for the 'FuelType' UI slider, this adds or removes the 'custom' option as needed
            updatePartStats();//update part stats for crash tolerance and heat, as determined by the container modifiers

            //disable next fuel event button if main container does not have more than one preset type available
            BaseField fuelSelection = Fields[nameof(guiFuelType)];
            fuelSelection.guiActiveEditor = volume > 0 && enableFuelTypeChange && getBaseContainer().fuelPresets.Length > 1;
            fuelSelection.uiControlEditor.onFieldChanged = onFuelTypeUpdated;

            BaseEvent editContainerEvent = Events[nameof(openGUIEvent)];
            editContainerEvent.guiActiveEditor = volume>0 && enableContainerEdit;

            if (!initializedResources && (HighLogic.LoadedSceneIsEditor || HighLogic.LoadedSceneIsFlight))
            {
                initializedResources = true;
                updateTankResources();
                SSTUStockInterop.fireEditorUpdate();//update cost
            }
        }