diff --git a/1.3/Assemblies/VanillaPowerExpanded.dll b/1.3/Assemblies/VanillaPowerExpanded.dll index c18c6a1..bd4cef1 100644 Binary files a/1.3/Assemblies/VanillaPowerExpanded.dll and b/1.3/Assemblies/VanillaPowerExpanded.dll differ diff --git a/1.3/Source/VanillaPowerExpanded/.vs/VanillaPowerExpanded/v16/.suo b/1.3/Source/VanillaPowerExpanded/.vs/VanillaPowerExpanded/v16/.suo index 9b0ca31..4804118 100644 Binary files a/1.3/Source/VanillaPowerExpanded/.vs/VanillaPowerExpanded/v16/.suo and b/1.3/Source/VanillaPowerExpanded/.vs/VanillaPowerExpanded/v16/.suo differ diff --git a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/GasNet/Patches/PathGrid.cs b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/GasNet/Patches/PathGrid.cs index 8aa6dd8..2b981a5 100644 --- a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/GasNet/Patches/PathGrid.cs +++ b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/GasNet/Patches/PathGrid.cs @@ -16,52 +16,60 @@ public static void Postfix(IntVec3 c, bool perceivedStatic, ref int __result, Ma { // add extra pathing cost for tiles on or close to toxic or flammable gas. // this is analogous to the vanilla code for fire. - if (perceivedStatic && Gas_Spreading.AnyGases) - { - //var before = __result; - // - var comp = MapComponent_GasDanger.GetCachedComp(___map); - var gases = comp.GasesAt(c); - foreach (var gas in gases) + if (VanillaPowerExpanded.VanillaPowerExpanded_Mod.settings.disableGasPathCalculations) + { + if (perceivedStatic && Gas_Spreading.AnyGases) { - if (gas.Flammable) - { - __result += (int)Mathf.Clamp01(gas.Density) * (gas.Position == c ? 1000 : 150); - } + //var before = __result; + // + var comp = MapComponent_GasDanger.GetCachedComp(___map); + var gases = comp.GasesAt(c); - if (gas.Toxic) + foreach (var gas in gases) { - __result += (int)Mathf.Clamp01(gas.Density) * (gas.Position == c ? 500 : 75); + if (gas.Flammable) + { + __result += (int)Mathf.Clamp01(gas.Density) * (gas.Position == c ? 1000 : 150); + } + + if (gas.Toxic) + { + __result += (int)Mathf.Clamp01(gas.Density) * (gas.Position == c ? 500 : 75); + } } + + // + //foreach (var offset in GenAdj.AdjacentCellsAndInside) + //{ + // var cell = c + offset; + // var center = cell.Equals(c); + // if (!cell.InBounds(___map)) + // { + // continue; + // } + // + // var gases = comp.GasesAt(c + offset); + // // var gases = ___map.thingGrid.ThingsListAtFast(c + offset).OfType(); + // foreach (var gas in gases) + // { + // if (gas.Flammable) + // { + // __result += Mathf.CeilToInt(Mathf.Clamp01(gas.Density) * (center ? 1000 : 150)); + // } + // + // if (gas.Toxic) + // { + // __result += Mathf.CeilToInt(Mathf.Clamp01(gas.Density) * (center ? 500 : 75)); + // } + // } + //} } - // - //foreach (var offset in GenAdj.AdjacentCellsAndInside) - //{ - // var cell = c + offset; - // var center = cell.Equals(c); - // if (!cell.InBounds(___map)) - // { - // continue; - // } - // - // var gases = comp.GasesAt(c + offset); - // // var gases = ___map.thingGrid.ThingsListAtFast(c + offset).OfType(); - // foreach (var gas in gases) - // { - // if (gas.Flammable) - // { - // __result += Mathf.CeilToInt(Mathf.Clamp01(gas.Density) * (center ? 1000 : 150)); - // } - // - // if (gas.Toxic) - // { - // __result += Mathf.CeilToInt(Mathf.Clamp01(gas.Density) * (center ? 500 : 75)); - // } - // } - //} + } + + } } } \ No newline at end of file diff --git a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/GasNet/Patches/Region.cs b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/GasNet/Patches/Region.cs index d330a1a..82d4526 100644 --- a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/GasNet/Patches/Region.cs +++ b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/GasNet/Patches/Region.cs @@ -22,12 +22,16 @@ public static class Region { public static void Postfix(ref Danger __result, Verse.Region __instance) { - if (Gas_Spreading.AnyGases) - { - var danger = MapComponent_GasDanger.GetCachedComp(__instance.Map)?.DangerIn(__instance) ?? Danger.None; - // result is highest level of danger. - __result = danger > __result ? danger : __result; + if (VanillaPowerExpanded.VanillaPowerExpanded_Mod.settings.disableGasPathCalculations) { + if (Gas_Spreading.AnyGases) + { + var danger = MapComponent_GasDanger.GetCachedComp(__instance.Map)?.DangerIn(__instance) ?? Danger.None; + // result is highest level of danger. + __result = danger > __result ? danger : __result; + } + } + } } } \ No newline at end of file diff --git a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/Options/VanillaPowerExpanded_Settings.cs b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/Options/VanillaPowerExpanded_Settings.cs new file mode 100644 index 0000000..a9e66d1 --- /dev/null +++ b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/Options/VanillaPowerExpanded_Settings.cs @@ -0,0 +1,61 @@ +using RimWorld; +using UnityEngine; +using Verse; +using System.Collections.Generic; +using System.Linq; +using System; + + +namespace VanillaPowerExpanded +{ + + + public class VanillaPowerExpanded_Settings : ModSettings + + { + + + public bool disableGasPathCalculations = false; + + + + + public override void ExposeData() + { + base.ExposeData(); + + Scribe_Values.Look(ref disableGasPathCalculations, "disableGasPathCalculations", false, true); + + + } + + public void DoWindowContents(Rect inRect) + { + Listing_Standard ls = new Listing_Standard(); + + + ls.Begin(inRect); + ls.Gap(10f); + + + ls.CheckboxLabeled("VPE_DisableGasPathCalculations".Translate(), ref disableGasPathCalculations, null); + + + + ls.End(); + } + + + + } + + + + + + + + + + +} diff --git a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/Options/VanillaPowerExpanded_SettingsController.cs b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/Options/VanillaPowerExpanded_SettingsController.cs new file mode 100644 index 0000000..338ac58 --- /dev/null +++ b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/Options/VanillaPowerExpanded_SettingsController.cs @@ -0,0 +1,29 @@ +using RimWorld; +using UnityEngine; +using Verse; +using System.Collections.Generic; +using System.Linq; + +namespace VanillaPowerExpanded +{ + + + + public class VanillaPowerExpanded_Mod : Mod + { + public static VanillaPowerExpanded_Settings settings; + + public VanillaPowerExpanded_Mod(ModContentPack content) : base(content) + { + settings = GetSettings(); + } + public override string SettingsCategory() => "Vanilla Furniture Expanded - Power"; + + public override void DoSettingsWindowContents(Rect inRect) + { + settings.DoWindowContents(inRect); + } + } + + +} diff --git a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/VanillaPowerExpanded.csproj b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/VanillaPowerExpanded.csproj index 4d78f79..809644a 100644 --- a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/VanillaPowerExpanded.csproj +++ b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/VanillaPowerExpanded.csproj @@ -337,6 +337,8 @@ + + diff --git a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache index e083cb6..bf9b460 100644 Binary files a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache and b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.csproj.CoreCompileInputs.cache b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.csproj.CoreCompileInputs.cache index 0f06172..7cd3f15 100644 --- a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.csproj.CoreCompileInputs.cache +++ b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -2a5c4ad19f68fd7598a6ff5444d201a9d2957603 +5c8f6730d80a1ff3ea5a2b715c461efadc47cf4b diff --git a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.csprojAssemblyReference.cache b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.csprojAssemblyReference.cache index 2354b2a..400d45e 100644 Binary files a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.csprojAssemblyReference.cache and b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.csprojAssemblyReference.cache differ diff --git a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.dll b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.dll index db5e407..bd4cef1 100644 Binary files a/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.dll and b/1.3/Source/VanillaPowerExpanded/VanillaPowerExpanded/obj/Release/VanillaPowerExpanded.dll differ diff --git a/Languages/English/Keyed/Misc_Gameplay.xml b/Languages/English/Keyed/Misc_Gameplay.xml index 64712f9..04f934e 100644 --- a/Languages/English/Keyed/Misc_Gameplay.xml +++ b/Languages/English/Keyed/Misc_Gameplay.xml @@ -18,6 +18,7 @@ Gas powered buildings must be placed adjacent to gas pipes, not on top Deconstruct Gas Network Deconstruct only gas pipes and subterranean gas pipes + Disable Helixien gas path calculations (use to reduce lag) Gas excess (stored) in network: {0} ({1}) @@ -58,7 +59,7 @@ Lightning energy stored for: - Producing {0} W of electricity + Lightning electricity depleted. Looks like you'll have to wait for the next thunderstorm.