private void UpdateDisplay() { DetailedInfo.Clear(); DetailedInfo.AppendStringBuilder(MyTexts.Get(MyCommonTexts.BlockPropertiesText_Type)); DetailedInfo.Append(BlockDefinition.DisplayNameText); DetailedInfo.Append("\n"); DetailedInfo.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertiesText_MaxRequiredInput)); MyValueFormatter.AppendWorkInBestUnit(ResourceSink.MaxRequiredInput, DetailedInfo); DetailedInfo.Append("\n"); DetailedInfo.AppendStringBuilder(MyTexts.Get(MySpaceTexts.BlockPropertiesText_OxygenOutput)); DetailedInfo.Append((SourceComp.MaxOutputByType(BlockDefinition.ProducedGas) * 60).ToString("F")); DetailedInfo.Append(" L/min"); RaisePropertiesChanged(); UpdateEmissivity(); }
void GetPowerOutput() { currentPower = 0; maxPower = 0; percentPower = 0; GridTerminalSystem.GetBlocksOfType <IMyBatteryBlock>(null, b => { if (!b.IsCharging) { currentPower += b.CurrentOutput; source = b.Components.Get <MyResourceSourceComponent>(); if (source != null) { maxPower += source.MaxOutputByType(new MyDefinitionId(typeof(MyObjectBuilder_GasProperties), "Electricity")); } } return(false); }); GridTerminalSystem.GetBlocksOfType <IMyReactor>(null, b => { if (b.Enabled) { currentPower += b.CurrentOutput; maxPower += b.MaxOutput; } return(false); }); GridTerminalSystem.GetBlocksOfType <IMySolarPanel>(null, b => { currentPower += b.CurrentOutput; maxPower += b.MaxOutput; return(false); }); //all in MW,m need to change to watts maxPower *= 1000000; currentPower *= 1000000; if (maxPower > 0) { percentPower = (currentPower / maxPower) * 100; } else { percentPower = 100; } }