From aee0f7d5d2faa8bf36f7134054c56a88866ce7f6 Mon Sep 17 00:00:00 2001 From: Nikolay Epifanov Date: Sat, 26 May 2018 14:17:32 +0400 Subject: [PATCH] Fix gas/liquid heaters: set target temp to 1k C, overheat to 1.2k C --- MovableHeatMod.cs | 131 ++++++++++++++++++++++++++++------------------ 1 file changed, 79 insertions(+), 52 deletions(-) diff --git a/MovableHeatMod.cs b/MovableHeatMod.cs index f55678e..97e6289 100644 --- a/MovableHeatMod.cs +++ b/MovableHeatMod.cs @@ -5,82 +5,109 @@ using Harmony; using JetBrains.Annotations; -namespace Patches +using STRINGS; +using TUNING; +using UnityEngine; + + +public static class MovableHeatMod { - public static class MovableHeatMod - { - private static float OVERHEAT_TEMP = 1273.15f; + private static float zeroC = 273.15f; + private static float OVERHEAT_TEMP = 1000 + zeroC; + private static float HEATER_TARGET_TEMP = 1000 + zeroC; + private static float HEATER_OVERHEAT_TEMP = 1200 + zeroC; - [HarmonyPatch(typeof(LiquidPumpConfig), nameof(LiquidPumpConfig.CreateBuildingDef))] - public static class LiquidPumpConfigPatch + [HarmonyPatch(typeof(LiquidPumpConfig), nameof(LiquidPumpConfig.CreateBuildingDef))] + public static class LiquidPumpConfigPatch + { + public static void Postfix([NotNull] ref BuildingDef __result) { - public static void Postfix([NotNull] ref BuildingDef __result) - { - __result.OverheatTemperature = OVERHEAT_TEMP; - } + __result.OverheatTemperature = OVERHEAT_TEMP; } + } - [HarmonyPatch(typeof(LiquidMiniPumpConfig), nameof(LiquidMiniPumpConfig.CreateBuildingDef))] - public static class LiquidMiniPumpConfigPatch + [HarmonyPatch(typeof(LiquidMiniPumpConfig), nameof(LiquidMiniPumpConfig.CreateBuildingDef))] + public static class LiquidMiniPumpConfigPatch + { + public static void Postfix([NotNull] ref BuildingDef __result) { - public static void Postfix([NotNull] ref BuildingDef __result) - { - __result.OverheatTemperature = OVERHEAT_TEMP; - } + __result.OverheatTemperature = OVERHEAT_TEMP; } + } - [HarmonyPatch(typeof(GasPumpConfig), nameof(GasPumpConfig.CreateBuildingDef))] - public static class GasPumpConfigPatch + [HarmonyPatch(typeof(GasPumpConfig), nameof(GasPumpConfig.CreateBuildingDef))] + public static class GasPumpConfigPatch + { + public static void Postfix([NotNull] ref BuildingDef __result) { - public static void Postfix([NotNull] ref BuildingDef __result) - { - __result.OverheatTemperature = OVERHEAT_TEMP; - } + __result.OverheatTemperature = OVERHEAT_TEMP; } + } - [HarmonyPatch(typeof(GasMiniPumpConfig), nameof(GasMiniPumpConfig.CreateBuildingDef))] - public static class GasMiniPumpConfigPatch + [HarmonyPatch(typeof(GasMiniPumpConfig), nameof(GasMiniPumpConfig.CreateBuildingDef))] + public static class GasMiniPumpConfigPatch + { + public static void Postfix([NotNull] ref BuildingDef __result) { - public static void Postfix([NotNull] ref BuildingDef __result) - { - __result.OverheatTemperature = OVERHEAT_TEMP; - } + __result.OverheatTemperature = OVERHEAT_TEMP; } + } - [HarmonyPatch(typeof(SpaceHeaterConfig), nameof(SpaceHeaterConfig.CreateBuildingDef))] - public static class SpaceHeaterConfigPatch + [HarmonyPatch(typeof(SpaceHeaterConfig), nameof(SpaceHeaterConfig.CreateBuildingDef))] + public static class SpaceHeaterConfigDefPatch + { + public static void Postfix([NotNull] ref BuildingDef __result) + { + __result.OverheatTemperature = HEATER_OVERHEAT_TEMP; + } + } + [HarmonyPatch(typeof(SpaceHeaterConfig), nameof(SpaceHeaterConfig.ConfigureBuildingTemplate))] + public static class SpaceHeaterConfigTemplatePatch + { + public static void Postfix(GameObject go) { - public static void Postfix([NotNull] ref BuildingDef __result) - { - __result.OverheatTemperature = OVERHEAT_TEMP; - } + SpaceHeater spaceHeater = go.AddOrGet(); + spaceHeater.targetTemperature = HEATER_TARGET_TEMP; } + } - [HarmonyPatch(typeof(LiquidHeaterConfig), nameof(LiquidHeaterConfig.CreateBuildingDef))] - public static class LiquidHeaterConfigPatch + [HarmonyPatch(typeof(LiquidHeaterConfig), nameof(LiquidHeaterConfig.CreateBuildingDef))] + public static class LiquidHeaterConfigDefPatch + { + public static void Postfix([NotNull] ref BuildingDef __result) + { + __result.OverheatTemperature = HEATER_OVERHEAT_TEMP; + } + } + [HarmonyPatch(typeof(LiquidHeaterConfig), nameof(LiquidHeaterConfig.ConfigureBuildingTemplate))] + public static class LiquidHeaterConfigTemplatePatch + { + public static void Postfix(GameObject go) { - public static void Postfix([NotNull] ref BuildingDef __result) - { - __result.OverheatTemperature = OVERHEAT_TEMP; - } + SpaceHeater spaceHeater = go.AddOrGet(); + spaceHeater.targetTemperature = HEATER_TARGET_TEMP; } + } - [HarmonyPatch(typeof(AirConditionerConfig), nameof(AirConditionerConfig.CreateBuildingDef))] - public static class AirConditionerConfigPatch + + + + + [HarmonyPatch(typeof(AirConditionerConfig), nameof(AirConditionerConfig.CreateBuildingDef))] + public static class AirConditionerConfigPatch + { + public static void Postfix([NotNull] ref BuildingDef __result) { - public static void Postfix([NotNull] ref BuildingDef __result) - { - __result.OverheatTemperature = OVERHEAT_TEMP; - } + __result.OverheatTemperature = OVERHEAT_TEMP; } + } - [HarmonyPatch(typeof(LiquidConditionerConfig), nameof(LiquidConditionerConfig.CreateBuildingDef))] - public static class LiquidConditionerConfigPatch + [HarmonyPatch(typeof(LiquidConditionerConfig), nameof(LiquidConditionerConfig.CreateBuildingDef))] + public static class LiquidConditionerConfigPatch + { + public static void Postfix([NotNull] ref BuildingDef __result) { - public static void Postfix([NotNull] ref BuildingDef __result) - { - __result.OverheatTemperature = OVERHEAT_TEMP; - } + __result.OverheatTemperature = OVERHEAT_TEMP; } } }