Exemple #1
0
            }                                                 // skip original method

            static void Postfix(GameObject go)
            {
                RocketEngineImproved rocketEngine = go.AddOrGet <RocketEngineImproved>();

                rocketEngine.ExhaustVelocity = PetroleumEngineStats.ExhaustVelocity;
                rocketEngine.RangePenalty    = PetroleumEngineStats.RangePenalty;
                rocketEngine.MinFuel         = PetroleumEngineStats.MinFuel;
                rocketEngine.MaxFuel         = PetroleumEngineStats.MaxFuel;

                rocketEngine.fuelTag             = ElementLoader.FindElementByHash(SimHashes.Petroleum).tag;
                rocketEngine.explosionEffectHash = SpawnFXHashes.MeteorImpactDust;
                EntityTemplates.ExtendBuildingToRocketModule(go);
                go.AddOrGet <RocketModule>().SetBGKAnim(Assets.GetAnim("rocket_petroleum_engine_bg_kanim"));
            }
Exemple #2
0
        public override void DoPostConfigureComplete(GameObject go)
        {
            RocketEngineImproved engine = go.AddOrGet <RocketEngineImproved>();

            engine.ExhaustVelocity = MethaneEngineStats.ExhaustVelocity;
            engine.RangePenalty    = MethaneEngineStats.RangePenalty;
            engine.MinFuel         = MethaneEngineStats.MinFuel;
            engine.MaxFuel         = MethaneEngineStats.MaxFuel;

            engine.fuelTag             = ElementLoader.FindElementByHash(MethaneEngineStats.FuelType).tag;
            engine.explosionEffectHash = SpawnFXHashes.MeteorImpactDust;
            engine.exhaustElement      = SimHashes.Steam;
            engine.exhaustTemperature  = 2000f;
            EntityTemplates.ExtendBuildingToRocketModule(go);
            go.AddOrGet <RocketModule>().SetBGKAnim(Assets.GetAnim("rocket_hydrogen_engine_bg_kanim"));
        }
Exemple #3
0
            }                                                 // skip original method

            static void Postfix(GameObject go)
            {
                TryDebug.Log(nameof(DoPostConfigureComplete), " called");
                RocketEngineImproved rocketEngine = go.AddOrGet <RocketEngineImproved>();

                rocketEngine.ExhaustVelocity = HydrogenEngineStats.ExhaustVelocity;
                rocketEngine.RangePenalty    = HydrogenEngineStats.RangePenalty;
                rocketEngine.MinFuel         = HydrogenEngineStats.MinFuel;
                rocketEngine.MaxFuel         = HydrogenEngineStats.MaxFuel;

                rocketEngine.fuelTag             = ElementLoader.FindElementByHash(SimHashes.LiquidHydrogen).tag;
                rocketEngine.explosionEffectHash = SpawnFXHashes.MeteorImpactDust;
                rocketEngine.exhaustElement      = SimHashes.Steam;
                rocketEngine.exhaustTemperature  = 2000f;
                EntityTemplates.ExtendBuildingToRocketModule(go);
                go.AddOrGet <RocketModule>().SetBGKAnim(Assets.GetAnim("rocket_hydrogen_engine_bg_kanim"));
            }
Exemple #4
0
        public new RocketEngineImproved GetMainEngine()
        {
            RocketEngineImproved rocketEngine = null;

            foreach (GameObject gameObject in BuildingNetworkEnumerable())
            {
                rocketEngine = gameObject.GetComponent <RocketEngineImproved>();
                if (rocketEngine != null)
                {
                    if (rocketEngine.mainEngine)
                    {
                        break;
                    }
                }
            }
            return(rocketEngine);
        }
Exemple #5
0
            }                                                 // skip original method

            static void Postfix(GameObject go)
            {
                RocketEngineImproved rocketEngine = go.AddOrGet <RocketEngineImproved>();

                rocketEngine.ExhaustVelocity = SteamEngineStats.ExhaustVelocity;
                rocketEngine.RangePenalty    = SteamEngineStats.RangePenalty;
                rocketEngine.MinFuel         = SteamEngineStats.MinFuel;
                rocketEngine.MaxFuel         = SteamEngineStats.MaxFuel;
                rocketEngine.OnlyFuel        = true;

                rocketEngine.fuelTag             = ElementLoader.FindElementByHash(SimHashes.Steam).tag;
                rocketEngine.explosionEffectHash = SpawnFXHashes.MeteorImpactDust;
                rocketEngine.requireOxidizer     = false;
                rocketEngine.exhaustElement      = SimHashes.Steam;
                rocketEngine.exhaustTemperature  = ElementLoader.FindElementByHash(SimHashes.Steam).lowTemp + 50f;
                FuelTank fuelTank = go.AddOrGet <FuelTank>();

                fuelTank.capacityKg = SteamEngineStats.MaxStorage;
                fuelTank.FuelType   = ElementLoader.FindElementByHash(SimHashes.Steam).tag;

                var list = new List <Storage.StoredItemModifier>();

                list.Add(Storage.StoredItemModifier.Hide);
                list.Add(Storage.StoredItemModifier.Seal);
                list.Add(Storage.StoredItemModifier.Insulate);
                fuelTank.SetDefaultStoredItemModifiers(list);

                ConduitConsumer conduitConsumer = go.AddOrGet <ConduitConsumer>();

                conduitConsumer.conduitType          = ConduitType.Gas;
                conduitConsumer.consumptionRate      = 10f;
                conduitConsumer.capacityTag          = fuelTank.FuelType;
                conduitConsumer.capacityKG           = SteamEngineStats.MaxStorage;
                conduitConsumer.forceAlwaysSatisfied = true;
                conduitConsumer.wrongElementResult   = ConduitConsumer.WrongElementResult.Dump;
                go.AddOrGet <RocketModule>().SetBGKAnim(Assets.GetAnim("rocket_steam_engine_bg_kanim"));
                EntityTemplates.ExtendBuildingToRocketModule(go);
            }
Exemple #6
0
        public float GetEngineContribution(float fuel)
        {
            RocketEngineImproved engine = GetMainEngine() as RocketEngineImproved;

            if (engine == null)
            {
                Debug.Log($"A rocket engine does not implement the {nameof(RocketEngineImproved)}.");
                return(0);
            }
            if (engine.OnlyFuel)
            {
                fuel = GetTotalFuel(false);
            }

            fuel /= DistanceEquationScalars.FuelPerXTick;
            float exponentPenalty = -GetFuelPenalty(fuel);
            float linearBenefit   = fuel * engine.ExhaustVelocity * DistanceEquationScalars.Exhaust;

            float thrust    = exponentPenalty + linearBenefit;
            float max_range = DistanceEquationScalars.Range * thrust - engine.RangePenalty;

            return(max_range);
        }
Exemple #7
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());
            }