public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                // Laser range
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_LaserRange), nameFormat);
                builder.Add(": ", nameFormat);

                var buf = block.textBuffer;

                buf.Clear();

                if (Range < 1E8)
                {
                    TerminalUtilities.GetDistanceDisplay(Range, buf);
                }
                else
                {
                    buf.Append(MyTexts.GetString(MySpaceTexts.ScreenTerminal_Infinite));
                }

                buf.Append('\n');
                builder.Add(buf, valueFormat);

                // Antenna status
                builder.Add(MyTexts.GetString(MySpaceTexts.TerminalStatus), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(GetLocalizedAntennaStatus(), valueFormat);
                builder.Add("\n", valueFormat);
            }
Example #2
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                // Broadcast name
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertiesTitle_HudText), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(HudText, valueFormat);
                builder.Add("\n", valueFormat);

                // Broadcast Radius
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_BroadcastRadius), nameFormat);
                builder.Add(": ", nameFormat);

                block.textBuffer.Clear();
                TerminalUtilities.GetDistanceDisplay(Range, block.textBuffer);
                block.textBuffer.Append('\n');
                builder.Add(block.textBuffer, valueFormat);

                // Broadcasting enabled/disabled
                builder.Add(MyTexts.GetString(MySpaceTexts.HudInfoBroadcasting), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(IsBroadcasting ? MyTexts.GetString(MySpaceTexts.HudInfoOn) : MyTexts.GetString(MySpaceTexts.HudInfoOff), valueFormat);
                builder.Add("\n", valueFormat);
            }
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                var buf = block.textBuffer;

                // Current charge
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertiesText_StoredPower), nameFormat);

                buf.Clear();
                TerminalUtilities.GetPowerDisplay(Charge, buf);
                buf.Append('h');
                builder.Add(buf, valueFormat);

                // pct
                buf.Clear();
                buf.Append(" (");
                buf.AppendFormat("{0:F1}", (Charge / Capacity) * 100f);
                buf.Append("%)\n");
                builder.Add(buf, nameFormat);

                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertiesText_MaxStoredPower), nameFormat);

                buf.Clear();
                TerminalUtilities.GetPowerDisplay(Capacity, buf);
                buf.Append("h\n");
                builder.Add(buf, valueFormat);

                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_ChargeMode), nameFormat);
                builder.Add(": ", nameFormat);

                buf.Clear();
                buf.Append(GetLocalizedChargeMode());
                buf.Append('\n');
                builder.Add(buf, valueFormat);
            }
Example #4
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                var buf = block.textBuffer;

                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertiesText_Effectiveness), nameFormat);
                builder.Add(" ", nameFormat);

                buf.Clear();
                buf.Append(Math.Round(ThrustEffectiveness * 100f, 2));
                buf.Append("%\n");
                builder.Add(buf, valueFormat);

                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_ThrustOverride), nameFormat);
                builder.Add(": ", nameFormat);

                if (Override > 0f)
                {
                    buf.Clear();
                    TerminalUtilities.GetForceDisplay(Override * ThrustEffectiveness, buf);
                    buf.Append('\n');

                    builder.Add(buf, valueFormat);
                }
                else
                {
                    builder.Add(MyTexts.TrySubstitute("Disabled"), valueFormat);
                }
            }
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                var buf = block.textBuffer;

                // Jump status
                builder.Add(MyTexts.GetString(MySpaceTexts.TerminalStatus), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(GetLocalizedDriveStatus(), valueFormat);
                builder.Add("\n", valueFormat);

                // Stored power
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertiesText_StoredPower), nameFormat);

                buf.Clear();
                TerminalUtilities.GetPowerDisplay(Charge, buf);
                buf.Append('h');
                builder.Add(buf, valueFormat);

                // pct
                buf.Clear();
                buf.Append(" (");
                buf.Append(Math.Round(Charge / Capacity * 100f, 1));
                buf.Append("%)\n");
                builder.Add(buf, nameFormat);

                // Power capacity
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertiesText_MaxStoredPower), nameFormat);

                buf.Clear();
                TerminalUtilities.GetPowerDisplay(Capacity, buf);
                buf.Append("h\n");
                builder.Add(buf, valueFormat);
            }
Example #6
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                var buf = block.textBuffer;

                // Acceleration due to gravity
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_GravityAcceleration), nameFormat);
                builder.Add(": ", nameFormat);

                buf.Clear();
                buf.AppendFormat("{0:G4}", Acceleration);
                buf.Append(" m/s²\n");
                builder.Add(buf, valueFormat);

                if (IsSpherical)
                {
                    // Field radius
                    builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_GravityFieldRadius), nameFormat);
                    builder.Add(": ", nameFormat);

                    buf.Clear();
                    TerminalUtilities.GetDistanceDisplay(Radius, buf);
                    buf.Append('\n');
                    builder.Add(buf, valueFormat);
                }
                else
                {
                    // Field width
                    builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_GravityFieldWidth), nameFormat);
                    builder.Add(": ", nameFormat);

                    buf.Clear();
                    TerminalUtilities.GetDistanceDisplay(FieldSize.X, buf);
                    buf.Append('\n');
                    builder.Add(buf, valueFormat);

                    // Field height
                    builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_GravityFieldHeight), nameFormat);
                    builder.Add(": ", nameFormat);

                    buf.Clear();
                    TerminalUtilities.GetDistanceDisplay(FieldSize.Y, buf);
                    buf.Append('\n');
                    builder.Add(buf, valueFormat);

                    // Field depth
                    builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_GravityFieldDepth), nameFormat);
                    builder.Add(": ", nameFormat);

                    buf.Clear();
                    TerminalUtilities.GetDistanceDisplay(FieldSize.Z, buf);
                    buf.Append('\n');
                    builder.Add(buf, valueFormat);
                }
            }
Example #7
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                // Targeting radius
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_LargeTurretRadius), nameFormat);
                builder.Add(": ", nameFormat);

                block.textBuffer.Clear();
                TerminalUtilities.GetDistanceDisplay(Range, block.textBuffer);
                block.textBuffer.Append('\n');

                builder.Add(block.textBuffer, valueFormat);
            }
Example #8
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                // Detector range
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_OreDetectorRange), nameFormat);
                builder.Add(": ", nameFormat);

                block.textBuffer.Clear();
                TerminalUtilities.GetDistanceDisplay(Range, block.textBuffer);
                block.textBuffer.Append('\n');

                builder.Add(block.textBuffer, valueFormat);
            }
            public override void SetBlock(SuperBlock block)
            {
                base.SetBlock(block, TBlockSubtypes.GunBase);

                if (subtype != null)
                {
                    ammoTypes.Clear();
                    (subtype.AmmoInventory as IMyInventory).GetAcceptedItems(ammoTypes);

                    AmmoName.Clear();
                    TerminalUtilities.GetBeautifiedTypeID(AmmoTypes[0].SubtypeId, AmmoName);
                }
            }
Example #10
0
        public override void BeforeClose()
        {
            if (ExceptionHandler.IsClient)
            {
                BvConfig.Save();
                QuickActionHudSpace.Close();
                BvConfig.OnConfigLoad -= UpdateBindPageVisibility;
            }

            if (ExceptionHandler.Unloading)
            {
                TerminalUtilities.Close();
                Instance = null;
            }
        }
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                if (subtype.IsAttached)
                {
                    // Piston extension dist
                    builder.Add(MyTexts.GetString(MySpaceTexts.TerminalDistance), nameFormat);
                    builder.Add(": ", nameFormat);

                    block.textBuffer.Clear();
                    TerminalUtilities.GetDistanceDisplay(ExtensionDist, block.textBuffer);
                    block.textBuffer.Append('\n');

                    builder.Add(block.textBuffer, valueFormat);
                }
            }
Example #12
0
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                // Color packed into one line
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_LightColor), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add("R: ", nameFormat);

                block.textBuffer.Clear();
                block.textBuffer.Append(Color.R);
                block.textBuffer.Append(" ");
                builder.Add(block.textBuffer, valueFormat);

                builder.Add("G: ", nameFormat);

                block.textBuffer.Clear();
                block.textBuffer.Append(Color.G);
                block.textBuffer.Append(" ");
                builder.Add(block.textBuffer, valueFormat);

                builder.Add("B: ", nameFormat);

                block.textBuffer.Clear();
                block.textBuffer.Append(Color.B);
                block.textBuffer.Append("\n");
                builder.Add(block.textBuffer, valueFormat);

                // Light radius
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_LightRadius), nameFormat);
                builder.Add(": ", nameFormat);

                block.textBuffer.Clear();
                TerminalUtilities.GetDistanceDisplay(Radius, block.textBuffer);
                block.textBuffer.Append('\n');

                builder.Add(block.textBuffer, valueFormat);

                // Light intensity
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_LightIntensity), nameFormat);
                builder.Add(": ", nameFormat);

                block.textBuffer.Clear();
                block.textBuffer.Append(Math.Round(Intensity, 2));
                block.textBuffer.Append('\n');

                builder.Add(block.textBuffer, valueFormat);
            }
Example #13
0
        /// <summary>
        /// Retrieves a Block Property's Terminal Name.
        /// </summary>
        private static void GetTooltipName(ITerminalProperty prop, StringBuilder dst)
        {
            var tooltip = prop as IMyTerminalControlTitleTooltip;

            if (tooltip != null)
            {
                StringBuilder name = MyTexts.Get(tooltip.Title);

                // Exclude leading spaces
                int start = 0;

                for (int i = 0; i < name.Length; i++)
                {
                    if (name[i] > ' ')
                    {
                        break;
                    }

                    start++;
                }

                dst.EnsureCapacity(name.Length - start);

                for (int n = start; n < name.Length; n++)
                {
                    char ch     = name[n],
                         nextCh = name[Math.Min(n + 1, name.Length - 1)];

                    if (
                        // Exclude special chars and most punctuation
                        (ch == ' ' || ch >= 'A' || (ch >= '0' && ch <= '9'))
                        // Exclude repeating and trailing spaces
                        && !(nextCh == ' ' && ch == ' '))
                    {
                        dst.Append(ch);
                    }
                }
            }
            else
            {
                TerminalUtilities.GetBeautifiedTypeID(prop.Id, dst);
            }
        }
            public override void GetSummary(RichText builder, GlyphFormat nameFormat, GlyphFormat valueFormat)
            {
                var buf = block.textBuffer;

                // Broadcast text
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertiesTitle_HudText), nameFormat);
                builder.Add(": ", nameFormat);

                builder.Add(HudText, valueFormat);
                builder.Add('\n', valueFormat);

                // Broadcast radius
                builder.Add(MyTexts.GetString(MySpaceTexts.BlockPropertyTitle_BroadcastRadius), nameFormat);
                builder.Add(": ", nameFormat);

                buf.Clear();
                TerminalUtilities.GetDistanceDisplay(Radius, buf);
                buf.Append('\n');
                builder.Add(buf, valueFormat);
            }
Example #15
0
        private void HudInit()
        {
            if (ExceptionHandler.IsClient)
            {
                CanUpdate = true;

                BvBinds.Init();
                BvConfig.Load();
                AddChatCommands();
                InitSettingsMenu();
                TerminalUtilities.Init();
                QuickActionHudSpace.Init();

                if (BvConfig.WasConfigOld)
                {
                    RichHudTerminal.OpenToPage(helpMain);
                }

                BvConfig.OnConfigLoad += UpdateBindPageVisibility;
                UpdateBindPageVisibility();
            }
        }
Example #16
0
            /// <summary>
            /// Returns a one-line summary of the power input/output in the format -Input/+Output
            /// </summary>
            public static void GetPowerDisplay(float?input, float?output, StringBuilder dst)
            {
                float scale, total = 0f;

                if (input != null)
                {
                    total += input.Value;
                }

                if (output != null)
                {
                    total += output.Value;
                }

                string suffix;

                TerminalUtilities.GetPowerScale(total / 10f, out scale, out suffix);

                if (input != null)
                {
                    dst.Append("-");
                    dst.AppendFormat("{0:G4}", (input * scale).Value);
                }
                if (output != null)
                {
                    if (input != null)
                    {
                        dst.Append(" / ");
                    }

                    dst.Append("+");
                    dst.AppendFormat("{0:G4}", (output * scale).Value);
                }

                dst.Append(' ');
                dst.Append(suffix);
            }