Exemplo n.º 1
0
        private void AppendingCustomInfo(IMyTerminalBlock block, StringBuilder stringBuilder)
        {
            try
            {
                var status = GetSystemStatus();

                stringBuilder.Append(status +
                                     "\n[Construct DPS]: " + Ai.EffectiveDps.ToString("0.0") +
                                     "\n[ShotsPerSec  ]: " + ShotsPerSec.ToString("0.000") +
                                     "\n" +
                                     "\n[RealDps]: " + EffectiveDps.ToString("0.0") +
                                     "\n[PeakDps]: " + PeakDps.ToString("0.0") +
                                     "\n[BaseDps]: " + BaseDps.ToString("0.0") +
                                     "\n[AreaDps]: " + AreaDps.ToString("0.0") +
                                     "\n[Explode]: " + DetDps.ToString("0.0") +
                                     "\n[Current]: " + CurrentDps.ToString("0.0") + " (" + (CurrentDps / PeakDps).ToString("P") + ")");

                if (HeatPerSecond > 0)
                {
                    stringBuilder.Append("\n__________________________________" +
                                         "\n[Heat Generated / s]: " + HeatPerSecond.ToString("0.0") + " W" +
                                         "\n[Heat Dissipated / s]: " + HeatSinkRate.ToString("0.0") + " W" +
                                         "\n[Current Heat]: " + CurrentHeat.ToString("0.0") + " j (" + (CurrentHeat / MaxHeat).ToString("P") + ")");
                }

                if (HeatPerSecond > 0 && HasEnergyWeapon)
                {
                    stringBuilder.Append("\n__________________________________");
                }

                if (HasEnergyWeapon)
                {
                    stringBuilder.Append("\n[Current Draw]: " + SinkPower.ToString("0.00") + " Mw");
                    if (HasChargeWeapon)
                    {
                        stringBuilder.Append("\n[Current Charge]: " + State.Value.CurrentCharge.ToString("0.00") + " Mw");
                    }
                    stringBuilder.Append("\n[Required Power]: " + MaxRequiredPower.ToString("0.00") + " Mw");
                }

                stringBuilder.Append("\n\n** Use Weapon Wheel Menu\n** to control weapons using\n** MMB outside of this terminal");
                if (Debug)
                {
                    foreach (var weapon in Platform.Weapons)
                    {
                        stringBuilder.Append($"\n\nWeapon: {weapon.System.WeaponName} - Enabled: {weapon.Set.Enable && weapon.Comp.State.Value.Online && weapon.Comp.Set.Value.Overrides.Activate}");
                        stringBuilder.Append($"\nTargetState: {weapon.Target.CurrentState} - Manual: {weapon.Comp.UserControlled || weapon.Target.IsFakeTarget}");
                        stringBuilder.Append($"\nEvent: {weapon.LastEvent} - Ammo :{!weapon.OutOfAmmo}");
                        stringBuilder.Append($"\nOverHeat: {weapon.State.Sync.Overheated} - Shooting: {weapon.IsShooting}");
                        stringBuilder.Append($"\nisAligned: {weapon.Target.IsAligned} - Tracking: {weapon.Target.IsTracking}");
                        stringBuilder.Append($"\nCanShoot: {weapon.Timings.ShootDelayTick <= weapon.Comp.Session.Tick} - Charging: {weapon.State.Sync.Charging}");
                        stringBuilder.Append($"\nAiShooting: {weapon.AiShooting} - lastCheck: {weapon.Comp.Session.Tick - weapon.Target.CheckTick}");
                        stringBuilder.Append($"\n{(weapon.ActiveAmmoDef.AmmoDef.Const.EnergyAmmo ? "ChargeSize: " + weapon.ActiveAmmoDef.AmmoDef.Const.ChargSize.ToString() : "MagSize: " +  weapon.ActiveAmmoDef.AmmoDef.Const.MagazineSize.ToString())} - CurrentCharge: {State.Value.CurrentCharge}({weapon.State.Sync.CurrentCharge})");
                        stringBuilder.Append($"\nChargeTime: {weapon.Timings.ChargeUntilTick}({weapon.Comp.Ai.Session.Tick}) - Delay: {weapon.Timings.ChargeDelayTicks}");
                        stringBuilder.Append($"\nCharging: {weapon.State.Sync.Charging}({weapon.ActiveAmmoDef.AmmoDef.Const.MustCharge}) - Delay: {weapon.Timings.ChargeDelayTicks}");
                    }
                }
            }
            catch (Exception ex) { Log.Line($"Exception in Weapon AppendingCustomInfo: {ex}"); }
        }
Exemplo n.º 2
0
        private void AppendingCustomInfo(IMyTerminalBlock block, StringBuilder stringBuilder)
        {
            try
            {
                var status = GetSystemStatus();

                stringBuilder.Append(status +
                                     "\nConstruct DPS: " + Ai.EffectiveDps.ToString("0.0") +
                                     "\nShotsPerSec: " + ShotsPerSec.ToString("0.000") +
                                     "\n" +
                                     "\nRealDps: " + EffectiveDps.ToString("0.0") +
                                     "\nPeakDps: " + PeakDps.ToString("0.0") +
                                     "\nBaseDps: " + BaseDps.ToString("0.0") +
                                     "\nAreaDps: " + AreaDps.ToString("0.0") +
                                     "\nExplode: " + DetDps.ToString("0.0") +
                                     "\nCurrent: " + CurrentDps.ToString("0.0") + " (" + (CurrentDps / PeakDps).ToString("P") + ")");

                if (HeatPerSecond > 0)
                {
                    stringBuilder.Append("\n__________________________________" +
                                         "\nHeat Generated / s: " + HeatPerSecond.ToString("0.0") + " W" +
                                         "\nHeat Dissipated / s: " + HeatSinkRate.ToString("0.0") + " W" +
                                         "\nCurrent Heat: " + CurrentHeat.ToString("0.0") + " j (" + (CurrentHeat / MaxHeat).ToString("P") + ")");
                }

                if (HeatPerSecond > 0 && HasEnergyWeapon)
                {
                    stringBuilder.Append("\n__________________________________");
                }

                if (HasEnergyWeapon)
                {
                    stringBuilder.Append("\nCurrent Draw: " + SinkPower.ToString("0.00") + " MWs");
                    if (HasChargeWeapon)
                    {
                        stringBuilder.Append("\nCurrent Charge: " + CurrentCharge.ToString("0.00") + " MWs");
                    }
                    stringBuilder.Append("\nRequired Power: " + MaxRequiredPower.ToString("0.00") + " MWs");
                }

                stringBuilder.Append("\n\n==== Weapons ====");

                var weaponCnt = Platform.Weapons.Length;
                for (int i = 0; i < weaponCnt; i++)
                {
                    var    w = Platform.Weapons[i];
                    string shots;
                    if (w.ActiveAmmoDef.ConsumableDef.Const.EnergyAmmo)
                    {
                        shots = "\nCharging:" + w.Charging;
                    }
                    else
                    {
                        shots = "\n" + w.ActiveAmmoDef.ConsumableDef.AmmoMagazine + ": " + w.Ammo.CurrentAmmo;
                    }

                    var burst = w.ActiveAmmoDef.ConsumableDef.Const.BurstMode ? "\nBurst: " + w.ShotsFired + "(" + w.System.ShotsPerBurst + ") - Delay: " + w.System.Values.HardPoint.Loading.DelayAfterBurst : string.Empty;

                    var endReturn = i + 1 != weaponCnt ? "\n" : string.Empty;

                    stringBuilder.Append("\nName: " + w.System.WeaponName + shots + burst + "\nReloading: " + w.Reloading + endReturn);

                    string otherAmmo = null;
                    for (int j = 0; j < w.System.AmmoTypes.Length; j++)
                    {
                        var ammo = w.System.AmmoTypes[j];
                        if (ammo == w.ActiveAmmoDef || !ammo.ConsumableDef.Const.IsTurretSelectable || string.IsNullOrEmpty(ammo.ConsumableDef.AmmoMagazine) || ammo.AmmoName == "Blank" || ammo.AmmoName == "Energy")
                        {
                            continue;
                        }

                        if (otherAmmo == null)
                        {
                            otherAmmo = "\n\nAlternate Magazines:";
                        }

                        otherAmmo += $"\n{ammo.ConsumableDef.AmmoMagazine}";
                    }

                    if (otherAmmo != null)
                    {
                        stringBuilder.Append(otherAmmo);
                    }
                }

                if (Debug)
                {
                    foreach (var weapon in Platform.Weapons)
                    {
                        stringBuilder.Append($"\n\nWeapon: {weapon.System.WeaponName} - Enabled: {IsWorking}");
                        stringBuilder.Append($"\nTargetState: {weapon.Target.CurrentState} - Manual: {weapon.Comp.UserControlled || weapon.Target.IsFakeTarget}");
                        stringBuilder.Append($"\nEvent: {weapon.LastEvent} - Ammo :{!weapon.NoMagsToLoad}");
                        stringBuilder.Append($"\nOverHeat: {weapon.State.Overheated} - Shooting: {weapon.IsShooting}");
                        stringBuilder.Append($"\nisAligned: {weapon.Target.IsAligned}");
                        stringBuilder.Append($"\nCanShoot: {weapon.ShotReady} - Charging: {weapon.Charging}");
                        stringBuilder.Append($"\nAiShooting: {weapon.AiShooting}");
                        stringBuilder.Append($"\n{(weapon.ActiveAmmoDef.ConsumableDef.Const.EnergyAmmo ? "ChargeSize: " + weapon.ActiveAmmoDef.ConsumableDef.Const.ChargSize.ToString() : "MagSize: " +  weapon.ActiveAmmoDef.ConsumableDef.Const.MagazineSize.ToString())} - CurrentCharge: {CurrentCharge}({weapon.Ammo.CurrentCharge})");
                        stringBuilder.Append($"\nChargeTime: {weapon.ChargeUntilTick}({weapon.Comp.Ai.Session.Tick}) - Delay: {weapon.ChargeDelayTicks}");
                        stringBuilder.Append($"\nCharging: {weapon.Charging}({weapon.ActiveAmmoDef.ConsumableDef.Const.MustCharge}) - Delay: {weapon.ChargeDelayTicks}");
                    }
                }
            }
            catch (Exception ex) { Log.Line($"Exception in Weapon AppendingCustomInfo: {ex}"); }
        }