Beispiel #1
0
            }                                                 // skip original method

            static void Postfix(StarmapScreen __instance)
            {
                var           ranges        = SolidBoosterStats.Ranges;
                List <string> rangeDivisors = new List <string>();

                foreach (var range in ranges)
                {
                    rangeDivisors.Add(StarmapScreenOverhaul.FormatDistance(range, ""));
                }

                __instance.Get(out BreakdownList rocketDetailsFuel, nameof(rocketDetailsFuel));
                BreakdownList list = rocketDetailsFuel;

                __instance.Get(out CommandModule currentCommandModule, nameof(currentCommandModule));
                RocketStatsOverhaul stats = (RocketStatsOverhaul)currentCommandModule.rocketStats;

                list.SetTitle(StarmapScreenOverhaul.Caption.TotalBoosterThrust);
                list.SetIcon(__instance.rocketDetailsFuelIcon);
                list.gameObject.name = nameof(rocketDetailsFuel);
                list.ClearRows();

                string moduleName   = "";
                int    boosterCount = 0;

                foreach (GameObject gameObject in stats.BuildingNetworkEnumerable())
                {
                    SolidBooster component = gameObject.GetComponent <SolidBooster>();
                    if (component != null)
                    {
                        moduleName = gameObject.gameObject.GetProperName();
                        boosterCount++;
                    }
                }

                float boosterKmRemaining = stats.GetBoosterThrust();

                for (int i = 0; i < boosterCount; ++i)
                {
                    if (boosterKmRemaining <= GetRange(ranges, i))
                    {
                        list.AddRow().ShowData(moduleName, StarmapScreenOverhaul.FormatDistance(boosterKmRemaining, "+", "") + "/" + rangeDivisors[i]);
                        boosterKmRemaining -= boosterKmRemaining;
                    }
                    else
                    {
                        list.AddRow().ShowData(moduleName, StarmapScreenOverhaul.FormatDistance(GetRange(ranges, i), "+", "") + "/" + rangeDivisors[i]);
                        boosterKmRemaining -= GetRange(ranges, i);
                    }
                }

                AddImportant(list, StarmapScreenOverhaul.Caption.TotalBoosterThrust, stats.GetBoosterThrust());
            }
Beispiel #2
0
            }                                                 // skip original method

            static void Postfix(StarmapScreen __instance)
            {
                __instance.Get(out BreakdownList rocketDetailsRange, nameof(rocketDetailsRange));
                BreakdownList list = rocketDetailsRange;

                __instance.Get(out RocketThrustWidget rocketThrustWidget, nameof(rocketThrustWidget));
                __instance.Get(out CommandModule currentCommandModule, nameof(currentCommandModule));
                RocketStatsOverhaul stats = (RocketStatsOverhaul)currentCommandModule.rocketStats;

                list.ClearRows();

                AddImportant(list, StarmapScreenOverhaul.Caption.TotalEngineThrust, stats.GetEngineThrust());
                AddImportantOxidizer(list, StarmapScreenOverhaul.Caption.TotalOxidizerEfficiency, stats.GetAverageOxidizerEfficiency(), stats.GetEfficiencyContribution());
                AddImportant(list, StarmapScreenOverhaul.Caption.TotalBoosterThrust, stats.GetBoosterThrust());
                AddImportant(list, StarmapScreenOverhaul.Caption.TotalPayload, -stats.GetModulePenalty());
                AddImportant(list, StarmapScreenOverhaul.Caption.TotalDistance, stats.GetRocketMaxDistance());
            }
Beispiel #3
0
            }                                                 // skip original method

            static void Postfix(StarmapScreen __instance)
            {
                __instance.Get(out BreakdownList rocketDetailsOxidizer, nameof(rocketDetailsOxidizer));
                BreakdownList list = rocketDetailsOxidizer;

                __instance.Get(out CommandModule currentCommandModule, nameof(currentCommandModule));
                RocketStatsOverhaul stats = (RocketStatsOverhaul)currentCommandModule.rocketStats;

                list.SetTitle(StarmapScreenOverhaul.Caption.TotalPayload);
                list.SetIcon(__instance.rocketDetailsStorageIcon);
                list.gameObject.name = nameof(rocketDetailsOxidizer);
                list.ClearRows();

                // add row for each module
                foreach (GameObject gameObject in stats.BuildingNetworkEnumerable())
                {
                    string penalty = null;
                    if (gameObject.GetComponent <CargoBay>() != null)
                    {
                        penalty = StarmapScreenOverhaul.FormatDistance(-ModulePenalties.CargoPenalty);
                    }
                    else if (gameObject.GetComponent <TouristModule>() != null)
                    {
                        penalty = StarmapScreenOverhaul.FormatDistance(-ModulePenalties.TouristPenalty);
                    }
                    else if (gameObject.GetComponent <ResearchModule>() != null)
                    {
                        penalty = StarmapScreenOverhaul.FormatDistance(-ModulePenalties.ResearchPenalty);
                    }

                    if (penalty != null)                     // was this a module that we are counting?
                    {
                        string moduleName = gameObject.gameObject.GetProperName();
                        list.AddRow().ShowData(moduleName, penalty);
                    }
                }

                AddImportant(list, StarmapScreenOverhaul.Caption.TotalPayload, -stats.GetModulePenalty());
            }
Beispiel #4
0
            }                                                 // skip original method

            static void Postfix(StarmapScreen __instance)
            {
                __instance.Get(out BreakdownList rocketDetailsStorage, nameof(rocketDetailsStorage));
                BreakdownList list = rocketDetailsStorage;

                __instance.Get(out CommandModule currentCommandModule, nameof(currentCommandModule));
                RocketStatsOverhaul stats = (RocketStatsOverhaul)currentCommandModule.rocketStats;

                list.SetTitle(StarmapScreenOverhaul.Caption.TotalOxidizerEfficiency);
                list.SetIcon(__instance.rocketDetailsOxidizerIcon);
                list.gameObject.name = nameof(rocketDetailsStorage);
                list.ClearRows();

                stats.GetOxidizerAmounts(out float oxyrockAmount, out float loxAmount, out float mixedAmount);
                float totalEfficiency = stats.GetAverageOxidizerEfficiency();

                list.AddRow().ShowData(StarmapScreenOverhaul.Caption.OxyRock, StarmapScreenOverhaul.FormatDistance(oxyrockAmount, "", "kg"));
                list.AddRow().ShowData(StarmapScreenOverhaul.Caption.LiquidOxygen, StarmapScreenOverhaul.FormatDistance(loxAmount, "", "kg"));
                list.AddRow().ShowData(StarmapScreenOverhaul.Caption.Mixed, StarmapScreenOverhaul.FormatDistance(mixedAmount, "", "kg"));

                AddImportantOxidizer(list, StarmapScreenOverhaul.Caption.TotalOxidizerEfficiency, totalEfficiency, stats.GetEfficiencyContribution());
            }
Beispiel #5
0
        public static void AddImportant(BreakdownList list, string caption, float value)
        {
            Color color;

            if (value > 0)
            {
                color = Color.green;
            }
            else if (value == 0)
            {
                color = Color.yellow;
            }
            else
            {
                color = Color.red;
            }

            BreakdownListRow row;

            row = list.AddRow();
            row.ShowStatusData(caption, StarmapScreenOverhaul.FormatDistance(value), color);
            row.SetImportant(true);
        }
Beispiel #6
0
            }                                                 // skip original method

            static void Postfix(StarmapScreen __instance)
            {
                __instance.Get(out BreakdownList rocketDetailsMass, nameof(rocketDetailsMass));
                BreakdownList list = rocketDetailsMass;

                __instance.Get(out RocketThrustWidget rocketThrustWidget, nameof(rocketThrustWidget));
                __instance.Get(out CommandModule currentCommandModule, nameof(currentCommandModule));
                RocketStatsPatches.TryLog("before cast");
                RocketStatsOverhaul stats = (RocketStatsOverhaul)currentCommandModule.rocketStats;

                RocketStatsPatches.TryLog("after1 cast");
                RocketEngineImproved engine = (RocketEngineImproved)stats.GetMainEngine();

                RocketStatsPatches.TryLog("after2 cast");
                list.SetTitle(StarmapScreenOverhaul.Caption.TotalEngineThrust);
                list.ClearRows();

                string fuelRange = StarmapScreenOverhaul.FormatDistance(engine.MinFuel, "", "kg") + " to " + StarmapScreenOverhaul.FormatDistance(engine.MaxFuel, "", "kg");

                list.AddRow().ShowData(StarmapScreenOverhaul.Caption.EngineExhaustVelocity, StarmapScreenOverhaul.FormatDistance(engine.ExhaustVelocity, "", "m/s"));
                list.AddRow().ShowData(StarmapScreenOverhaul.Caption.RecommendedOxidizableFuel, fuelRange);
                list.AddRow().ShowData(StarmapScreenOverhaul.Caption.TotalOxidizableFuel, StarmapScreenOverhaul.FormatDistance(stats.GetTotalOxidizableFuel(), "", "kg"));
                AddImportant(list, StarmapScreenOverhaul.Caption.TotalEngineThrust, stats.GetEngineThrust());
            }
Beispiel #7
0
 public static void AddImportantOxidizer(BreakdownList list, string caption, float percent, float value)
 {
     AddImportant(list, caption + ": " + (int)percent + "%", value);
 }