refactor: phase 5 transpiler docs, mod-compat helpers, and build quality gates

This commit is contained in:
2026-06-23 23:03:13 +08:00
parent cca8b8594d
commit c2016909ff
43 changed files with 2327 additions and 135 deletions
+28
View File
@@ -0,0 +1,28 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = crlf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{cs,vb}]
# Suggestion-only so existing code does not break the build
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
dotnet_style_readonly_field = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
+30
View File
@@ -0,0 +1,30 @@
name: Build
on:
push:
branches: [main, master, refactor/*]
pull_request:
branches: [main, master]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore
run: dotnet restore DSP_Mods.sln
- name: Build Release
run: dotnet build DSP_Mods.sln -c Release --no-restore
- name: Package main mods
run: |
dotnet build UXAssist/UXAssist.csproj -t:ZipMod -c Release --no-restore
dotnet build CheatEnabler/CheatEnabler.csproj -t:ZipMod -c Release --no-restore
dotnet build UniverseGenTweaks/UniverseGenTweaks.csproj -t:ZipMod -c Release --no-restore
+3 -1
View File
@@ -145,5 +145,7 @@ The sync is implemented as an inline PowerShell `Exec` step inside the `ZipMod`
- **Preloader pattern:** `DustbinPreloader` and `LabOptPreloader` use Mono.Cecil to inject new fields into game assemblies at BepInEx preload time, enabling their corresponding main mods to read/write those fields via normal C# without reflection. - **Preloader pattern:** `DustbinPreloader` and `LabOptPreloader` use Mono.Cecil to inject new fields into game assemblies at BepInEx preload time, enabling their corresponding main mods to read/write those fields via normal C# without reflection.
- **Internationalization:** `UXAssist/Common/I18N.cs` provides bilingual (EN + ZH) string lookup used across UXAssist and CheatEnabler. Localization keys are declared as `public const string` in per-project registration classes (`UXAssist/Common/I18NKeys.cs`, `CheatEnabler/Localization.cs`, `UniverseGenTweaks/Localization.cs`) and registered through a single `Register()` call from each mod's `Awake()`. Do not pass Chinese string literals to `.Translate()` at call sites. - **Internationalization:** `UXAssist/Common/I18N.cs` provides bilingual (EN + ZH) string lookup used across UXAssist and CheatEnabler. Localization keys are declared as `public const string` in per-project registration classes (`UXAssist/Common/I18NKeys.cs`, `CheatEnabler/Localization.cs`, `UniverseGenTweaks/Localization.cs`) and registered through a single `Register()` call from each mod's `Awake()`. Do not pass Chinese string literals to `.Translate()` at call sites.
- **Centralized game constants:** Hard-coded item IDs, tech IDs, logistics capacities, and Dyson sphere geometry defaults live in `UXAssist/Common/GameConstants` (`ItemIds`, `TechIds`, `LogisticsConstants`, `DysonSphereConstants`). Prefer these constants over inline literals in UXAssist patches. - **Centralized game constants:** Hard-coded item IDs, tech IDs, logistics capacities, and Dyson sphere geometry defaults live in `UXAssist/Common/GameConstants` (`ItemIds`, `TechIds`, `LogisticsConstants`, `DysonSphereConstants`). Prefer these constants over inline literals in UXAssist patches.
- **Transpiler patches:** Performance-critical mods (LabOpt, MechaDronesTweaks) use `[HarmonyTranspiler]` to rewrite IL instructions directly for maximum efficiency. - **Transpiler patches:** Performance-critical mods (LabOpt, MechaDronesTweaks) use `[HarmonyTranspiler]` to rewrite IL instructions directly for maximum efficiency. All transpilers in UXAssist, CheatEnabler, and UniverseGenTweaks carry a standard header comment (`// Harmony transpiler:`, `// Target:`, `// Fallback:`) documenting the target method and fallback behavior. `UXAssist.Common.Patching.TranspilerGuard` provides a reusable `CodeMatcher.Finish` helper that returns original instructions when a matcher becomes invalid.
- **Mod-compatibility reflection:** Use `UXAssist.Common.ModCompat.ModCompatHelper` for BepInEx plugin detection, external mod type/method/field resolution, and property-setter lookup. Use `UXAssist.Common.Utils.DysonSphereReflection` for the DSPOptimizations-compatible `DysonSphereLayer` private fields (`totalNodeSP`, `totalFrameSP`, `totalCP`) instead of resolving them locally in each consumer.
- **Build quality gates:** Root `.editorconfig` defines suggestion-only C# style conventions. `Directory.Build.props` enables `TreatWarningsAsErrors` with `NoWarn>0618` for the expected obsolete-API usage, so any new warning fails the build. `.github/workflows/build.yml` runs a Release build and packages the three main mods on every push/PR.
- **Save persistence:** Mods that need to persist data use the `IModCanSave` interface from DSPModSave. - **Save persistence:** Mods that need to persist data use the `IModCanSave` interface from DSPModSave.
@@ -4,6 +4,7 @@ using UnityEngine;
using UXAssist.Common; using UXAssist.Common;
using UXAssist.Common.GameConstants; using UXAssist.Common.GameConstants;
using UXAssist.Common.ModFeatures; using UXAssist.Common.ModFeatures;
using UXAssist.Common.Utils;
using CheatEnabler; using CheatEnabler;
namespace CheatEnabler.Functions.DysonSphere; namespace CheatEnabler.Functions.DysonSphere;
@@ -19,8 +20,6 @@ public static class FrameRemovalFunctions
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThisWillRemoveAllFramesOn0AreYouSure.Translate(), star.displayName), Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () => UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThisWillRemoveAllFramesOn0AreYouSure.Translate(), star.displayName), Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
{ {
var totalFrameSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
foreach (var dysonSphereLayer in dysonSphere.layersIdBased) foreach (var dysonSphereLayer in dysonSphere.layersIdBased)
{ {
if (dysonSphereLayer == null) continue; if (dysonSphereLayer == null) continue;
@@ -49,7 +48,7 @@ public static class FrameRemovalFunctions
dysonSphereLayer.frameCursor = 1; dysonSphereLayer.frameCursor = 1;
dysonSphereLayer.frameRecycleCursor = 0; dysonSphereLayer.frameRecycleCursor = 0;
dysonSphereLayer.SetFrameCapacity(DysonSphereConstants.DefaultLayerPoolCapacity); dysonSphereLayer.SetFrameCapacity(DysonSphereConstants.DefaultLayerPoolCapacity);
totalFrameSpInfo?.SetValue(dysonSphereLayer, 0); DysonSphereReflection.SetTotalFrameSP(dysonSphereLayer, 0);
} }
dysonSphere.CheckAutoNodes(); dysonSphere.CheckAutoNodes();
dysonSphere.PickAutoNode(); dysonSphere.PickAutoNode();
@@ -4,6 +4,7 @@ using HarmonyLib;
using UnityEngine; using UnityEngine;
using UXAssist.Common; using UXAssist.Common;
using UXAssist.Common.ModFeatures; using UXAssist.Common.ModFeatures;
using UXAssist.Common.Utils;
using CheatEnabler; using CheatEnabler;
namespace CheatEnabler.Functions.DysonSphere; namespace CheatEnabler.Functions.DysonSphere;
@@ -19,10 +20,6 @@ public static class ShellCompletionFunctions
UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThisWillCompleteAllDysonSphereShellsOn0InstantlyAreYouSure.Translate(), star.displayName), Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () => UIMessageBox.Show(Localization.CheatEnabler.Translate(), string.Format(Localization.ThisWillCompleteAllDysonSphereShellsOn0InstantlyAreYouSure.Translate(), star.displayName), Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
{ {
var totalNodeSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalNodeSP");
var totalFrameSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
var totalCpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalCP");
var rocketCount = 0L; var rocketCount = 0L;
var solarSailCount = 0L; var solarSailCount = 0L;
foreach (var dysonSphereLayer in dysonSphere.layersIdBased) foreach (var dysonSphereLayer in dysonSphere.layersIdBased)
@@ -75,16 +72,16 @@ public static class ShellCompletionFunctions
shell.nodecps[nodeIndex] = cpMax; shell.nodecps[nodeIndex] = cpMax;
shell.nodecps[shell.nodecps.Length - 1] += diff; shell.nodecps[shell.nodecps.Length - 1] += diff;
solarSailCount += diff; solarSailCount += diff;
if (totalCpInfo != null) if (DysonSphereReflection.HasTotalCP)
{ {
shell.SetMaterialDynamicVars(); shell.SetMaterialDynamicVars();
} }
} }
} }
totalNodeSpInfo?.SetValue(dysonSphereLayer, totalNodeSp); DysonSphereReflection.SetTotalNodeSP(dysonSphereLayer, totalNodeSp);
totalFrameSpInfo?.SetValue(dysonSphereLayer, totalFrameSp); DysonSphereReflection.SetTotalFrameSP(dysonSphereLayer, totalFrameSp);
totalCpInfo?.SetValue(dysonSphereLayer, totalCp); DysonSphereReflection.SetTotalCP(dysonSphereLayer, totalCp);
} }
dysonSphere.CheckAutoNodes(); dysonSphere.CheckAutoNodes();
+9 -1
View File
@@ -34,6 +34,9 @@ public static class CombatPatch
private class MechaInvincible : PatchImpl<MechaInvincible> private class MechaInvincible : PatchImpl<MechaInvincible>
{ {
// Harmony transpiler: Player_get_invincible_Transpiler
// Target: Player.invincible (getter)
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(Player), nameof(Player.invincible), MethodType.Getter)] [HarmonyPatch(typeof(Player), nameof(Player.invincible), MethodType.Getter)]
private static IEnumerable<CodeInstruction> Player_get_invincible_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> Player_get_invincible_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -45,7 +48,9 @@ public static class CombatPatch
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: SkillSystem_DamageObject_Transpiler
// Target: SkillSystem.DamageGroundObjectByLocalCaster, SkillSystem.DamageGroundObjectByRemoteCaster, SkillSystem.DamageObject
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))] [HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByRemoteCaster))] [HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByRemoteCaster))]
@@ -69,6 +74,9 @@ public static class CombatPatch
private class BuildingsInvincible : PatchImpl<BuildingsInvincible> private class BuildingsInvincible : PatchImpl<BuildingsInvincible>
{ {
// Harmony transpiler: SkillSystem_DamageObject_Transpiler
// Target: SkillSystem.DamageGroundObjectByLocalCaster, SkillSystem.DamageGroundObjectByRemoteCaster
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))] [HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))]
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByRemoteCaster))] [HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByRemoteCaster))]
+33 -8
View File
@@ -67,7 +67,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
// { // {
// CheatEnabler.Logger.LogDebug($"[DysonShell.ImportFromBlueprint] vertCount={__instance.vertexCount}, cpPerVertex={__instance.cpPerVertex}, cpMax={__instance.cellPointMax}"); // CheatEnabler.Logger.LogDebug($"[DysonShell.ImportFromBlueprint] vertCount={__instance.vertexCount}, cpPerVertex={__instance.cpPerVertex}, cpMax={__instance.cellPointMax}");
// } // }
// Harmony transpiler: DysonNode_OrderConstructCp_Transpiler
// Target: DysonNode.OrderConstructCp
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.OrderConstructCp))] [HarmonyPatch(typeof(DysonNode), nameof(DysonNode.OrderConstructCp))]
private static IEnumerable<CodeInstruction> DysonNode_OrderConstructCp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> DysonNode_OrderConstructCp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -82,7 +84,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: DysonSwarm_AbsorbSail_Transpiler
// Target: DysonSwarm.AbsorbSail
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(DysonSwarm), nameof(DysonSwarm.AbsorbSail))] [HarmonyPatch(typeof(DysonSwarm), nameof(DysonSwarm.AbsorbSail))]
private static IEnumerable<CodeInstruction> DysonSwarm_AbsorbSail_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> DysonSwarm_AbsorbSail_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -189,7 +193,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
UpdateSailLifeTime(); UpdateSailLifeTime();
} }
} }
// Harmony transpiler: EjectorComponent_InternalUpdate_Transpiler
// Target: EjectorComponent.InternalUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))] [HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -374,7 +380,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
{ {
_instantAbsorb = QuickAbsorbEnabled.Value && QuickAbsorbPatch.GetHarmony() != null; _instantAbsorb = QuickAbsorbEnabled.Value && QuickAbsorbPatch.GetHarmony() != null;
} }
// Harmony transpiler: DysonSwarm_AbsorbSail_Transpiler2
// Target: DysonSwarm.AbsorbSail
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(DysonSwarm), nameof(DysonSwarm.AbsorbSail))] [HarmonyPatch(typeof(DysonSwarm), nameof(DysonSwarm.AbsorbSail))]
private static IEnumerable<CodeInstruction> DysonSwarm_AbsorbSail_Transpiler2(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> DysonSwarm_AbsorbSail_Transpiler2(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -416,7 +424,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
{ {
_instantAbsorb = SkipAbsorbEnabled.Value && SkipAbsorbPatch.GetHarmony() != null; _instantAbsorb = SkipAbsorbEnabled.Value && SkipAbsorbPatch.GetHarmony() != null;
} }
// Harmony transpiler: DysonSphereLayer_GameTick_Transpiler
// Target: DysonSphereLayer.GameTick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(DysonSphereLayer), nameof(DysonSphereLayer.GameTick))] [HarmonyPatch(typeof(DysonSphereLayer), nameof(DysonSphereLayer.GameTick))]
private static IEnumerable<CodeInstruction> DysonSphereLayer_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> DysonSphereLayer_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -458,6 +468,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
private class EjectAnywayPatch : PatchImpl<EjectAnywayPatch> private class EjectAnywayPatch : PatchImpl<EjectAnywayPatch>
{ {
// Harmony transpiler: EjectorComponent_InternalUpdate_Transpiler
// Target: EjectorComponent.InternalUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))] [HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -488,6 +501,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
private class OverclockEjector : PatchImpl<OverclockEjector> private class OverclockEjector : PatchImpl<OverclockEjector>
{ {
// Harmony transpiler: EjectComponent_InternalUpdate_Transpiler
// Target: EjectorComponent.InternalUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))] [HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> EjectComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> EjectComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -510,7 +526,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
matcher.Start().Advance(pos).RemoveInstructions(end - pos); matcher.Start().Advance(pos).RemoveInstructions(end - pos);
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIEjectAndSiloWindow__OnUpdate_Transpiler
// Target: UIEjectorWindow._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIEjectorWindow), nameof(UIEjectorWindow._OnUpdate))] [HarmonyPatch(typeof(UIEjectorWindow), nameof(UIEjectorWindow._OnUpdate))]
private static IEnumerable<CodeInstruction> UIEjectAndSiloWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIEjectAndSiloWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -541,6 +559,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
private class OverclockSilo : PatchImpl<OverclockSilo> private class OverclockSilo : PatchImpl<OverclockSilo>
{ {
// Harmony transpiler: SiloComponent_InternalUpdate_Transpiler
// Target: SiloComponent.InternalUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate))] [HarmonyPatch(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> SiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> SiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -563,7 +584,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
matcher.Start().Advance(pos).RemoveInstructions(end - pos); matcher.Start().Advance(pos).RemoveInstructions(end - pos);
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIEjectAndSiloWindow__OnUpdate_Transpiler
// Target: UISiloWindow._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UISiloWindow), nameof(UISiloWindow._OnUpdate))] [HarmonyPatch(typeof(UISiloWindow), nameof(UISiloWindow._OnUpdate))]
private static IEnumerable<CodeInstruction> UIEjectAndSiloWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIEjectAndSiloWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -612,7 +635,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
if (dysonEditor == null || !dysonEditor.gameObject.activeSelf) return; if (dysonEditor == null || !dysonEditor.gameObject.activeSelf) return;
dysonEditor.selection?.onViewStarChange?.Invoke(); dysonEditor.selection?.onViewStarChange?.Invoke();
} }
// Harmony transpiler: MaxOrbitRadiusPatch_Transpiler
// Target: DysonSphere.CheckLayerRadius, DysonSphere.CheckSwarmRadius, DysonSphere.QueryLayerRadius, DysonSphere.QuerySwarmRadius, UIDEAddLayerDialogue.OnViewStarChange, UIDEAddSwarmDialogue.OnViewStarChange, UIDysonEditor.OnViewStarChange, UIDESwarmOrbitInfo._OnInit, UIDysonOrbitPreview.UpdateAscNodeGizmos
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.CheckLayerRadius))] [HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.CheckLayerRadius))]
[HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.CheckSwarmRadius))] [HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.CheckSwarmRadius))]
+6 -2
View File
@@ -202,7 +202,9 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
} }
GameMain.data?.warningSystem?.UpdateCriticalWarningText(); GameMain.data?.warningSystem?.UpdateCriticalWarningText();
} }
// Harmony transpiler: WarningSystem_hasCriticalWarning_Transpiler
// Target: WarningSystem.hasCriticalWarning (getter)
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(WarningSystem), nameof(WarningSystem.hasCriticalWarning), MethodType.Getter)] [HarmonyPatch(typeof(WarningSystem), nameof(WarningSystem.hasCriticalWarning), MethodType.Getter)]
private static IEnumerable<CodeInstruction> WarningSystem_hasCriticalWarning_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> WarningSystem_hasCriticalWarning_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -228,7 +230,9 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: WarningSystem_UpdateCriticalWarningText_Transpiler
// Target: WarningSystem.UpdateCriticalWarningText
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(WarningSystem), nameof(WarningSystem.UpdateCriticalWarningText))] [HarmonyPatch(typeof(WarningSystem), nameof(WarningSystem.UpdateCriticalWarningText))]
private static IEnumerable<CodeInstruction> WarningSystem_UpdateCriticalWarningText_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> WarningSystem_UpdateCriticalWarningText_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -124,7 +124,9 @@ internal class ImmediateBuild : PatchImpl<ImmediateBuild>
FactoryPatch.ArrivePlanet(factory); FactoryPatch.ArrivePlanet(factory);
} }
} }
// Harmony transpiler: Transpiler
// Target: BuildTool_Addon.CreatePrebuilds, BuildTool_BlueprintPaste.CreatePrebuilds, BuildTool_Click.CreatePrebuilds, BuildTool_Inserter.CreatePrebuilds, BuildTool_Path.CreatePrebuilds
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Addon), nameof(BuildTool_Addon.CreatePrebuilds))] [HarmonyPatch(typeof(BuildTool_Addon), nameof(BuildTool_Addon.CreatePrebuilds))]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CreatePrebuilds))] [HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CreatePrebuilds))]
@@ -7,6 +7,9 @@ namespace CheatEnabler.Patches.Factory;
internal class ControlPanelRemoteLogistics : PatchImpl<ControlPanelRemoteLogistics> internal class ControlPanelRemoteLogistics : PatchImpl<ControlPanelRemoteLogistics>
{ {
// Harmony transpiler: UIControlPanelDispenserInspector_OnItemIconMouseDown_Transpiler
// Target: UIControlPanelDispenserInspector.OnItemIconMouseDown, UIControlPanelDispenserInspector.OnHoldupItemClick, UIControlPanelDispenserInspector.OnCourierIconClick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIControlPanelDispenserInspector), nameof(UIControlPanelDispenserInspector.OnItemIconMouseDown))] [HarmonyPatch(typeof(UIControlPanelDispenserInspector), nameof(UIControlPanelDispenserInspector.OnItemIconMouseDown))]
[HarmonyPatch(typeof(UIControlPanelDispenserInspector), nameof(UIControlPanelDispenserInspector.OnHoldupItemClick))] [HarmonyPatch(typeof(UIControlPanelDispenserInspector), nameof(UIControlPanelDispenserInspector.OnHoldupItemClick))]
@@ -35,7 +38,9 @@ internal class ControlPanelRemoteLogistics : PatchImpl<ControlPanelRemoteLogisti
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIControlPanelStationInspector_OnShipIconClick_Transpiler
// Target: UIControlPanelStationInspector.OnShipIconClick, UIControlPanelStationInspector.OnWarperIconClick, UIControlPanelStationInspector.OnDroneIconClick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIControlPanelStationInspector), nameof(UIControlPanelStationInspector.OnShipIconClick))] [HarmonyPatch(typeof(UIControlPanelStationInspector), nameof(UIControlPanelStationInspector.OnShipIconClick))]
[HarmonyPatch(typeof(UIControlPanelStationInspector), nameof(UIControlPanelStationInspector.OnWarperIconClick))] [HarmonyPatch(typeof(UIControlPanelStationInspector), nameof(UIControlPanelStationInspector.OnWarperIconClick))]
@@ -64,7 +69,9 @@ internal class ControlPanelRemoteLogistics : PatchImpl<ControlPanelRemoteLogisti
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIControlPanelStationStorage_OnItemIconMouseDown_Transpiler
// Target: UIControlPanelStationStorage.OnItemIconMouseDown
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnItemIconMouseDown))] [HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnItemIconMouseDown))]
private static IEnumerable<CodeInstruction> UIControlPanelStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions) private static IEnumerable<CodeInstruction> UIControlPanelStationStorage_OnItemIconMouseDown_Transpiler(IEnumerable<CodeInstruction> instructions)
@@ -91,7 +98,9 @@ internal class ControlPanelRemoteLogistics : PatchImpl<ControlPanelRemoteLogisti
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIControlPanelStationStorage_OnTakeBackButtonClick_Transpiler
// Target: UIControlPanelStationStorage.OnTakeBackButtonClick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnTakeBackButtonClick))] [HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnTakeBackButtonClick))]
private static IEnumerable<CodeInstruction> UIControlPanelStationStorage_OnTakeBackButtonClick_Transpiler(IEnumerable<CodeInstruction> instructions) private static IEnumerable<CodeInstruction> UIControlPanelStationStorage_OnTakeBackButtonClick_Transpiler(IEnumerable<CodeInstruction> instructions)
@@ -110,7 +119,9 @@ internal class ControlPanelRemoteLogistics : PatchImpl<ControlPanelRemoteLogisti
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIControlPanelVeinCollectorPanel_OnProductIconClick_Transpiler
// Target: UIControlPanelVeinCollectorPanel.OnProductIconClick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIControlPanelVeinCollectorPanel), nameof(UIControlPanelVeinCollectorPanel.OnProductIconClick))] [HarmonyPatch(typeof(UIControlPanelVeinCollectorPanel), nameof(UIControlPanelVeinCollectorPanel.OnProductIconClick))]
private static IEnumerable<CodeInstruction> UIControlPanelVeinCollectorPanel_OnProductIconClick_Transpiler(IEnumerable<CodeInstruction> instructions) private static IEnumerable<CodeInstruction> UIControlPanelVeinCollectorPanel_OnProductIconClick_Transpiler(IEnumerable<CodeInstruction> instructions)
@@ -16,7 +16,9 @@ internal class NoConditionBuild : PatchImpl<NoConditionBuild>
{ {
GameMain.data?.warningSystem?.UpdateCriticalWarningText(); GameMain.data?.warningSystem?.UpdateCriticalWarningText();
} }
// Harmony transpiler: BuildTool_CheckBuildConditions_Transpiler
// Target: BuildTool_Addon.CheckBuildConditions, BuildTool_Inserter.CheckBuildConditions
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler, HarmonyPriority(Priority.Last)] [HarmonyTranspiler, HarmonyPriority(Priority.Last)]
[HarmonyPatch(typeof(BuildTool_Addon), nameof(BuildTool_Addon.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Addon), nameof(BuildTool_Addon.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_Inserter), nameof(BuildTool_Inserter.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Inserter), nameof(BuildTool_Inserter.CheckBuildConditions))]
@@ -25,7 +27,9 @@ internal class NoConditionBuild : PatchImpl<NoConditionBuild>
yield return new CodeInstruction(OpCodes.Ldc_I4_1); yield return new CodeInstruction(OpCodes.Ldc_I4_1);
yield return new CodeInstruction(OpCodes.Ret); yield return new CodeInstruction(OpCodes.Ret);
} }
// Harmony transpiler: BuildTool_Path_CheckBuildConditions_Transpiler
// Target: BuildTool_Path.CheckBuildConditions
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler, HarmonyPriority(Priority.First)] [HarmonyTranspiler, HarmonyPriority(Priority.First)]
[HarmonyPatch(typeof(BuildTool_Path), nameof(BuildTool_Path.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Path), nameof(BuildTool_Path.CheckBuildConditions))]
private static IEnumerable<CodeInstruction> BuildTool_Path_CheckBuildConditions_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Path_CheckBuildConditions_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -60,7 +64,9 @@ internal class NoConditionBuild : PatchImpl<NoConditionBuild>
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: BuildTool_Click_CheckBuildConditions_Transpiler
// Target: BuildTool_BlueprintPaste.CheckBuildConditions, BuildTool_Click.CheckBuildConditions
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler, HarmonyPriority(Priority.Last)] [HarmonyTranspiler, HarmonyPriority(Priority.Last)]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
@@ -9,6 +9,9 @@ namespace CheatEnabler.Patches.Factory;
internal class RemovePowerSpaceLimit : PatchImpl<RemovePowerSpaceLimit> internal class RemovePowerSpaceLimit : PatchImpl<RemovePowerSpaceLimit>
{ {
// Harmony transpiler: BuildTool_CheckBuildConditions_Transpiler
// Target: BuildTool_Click.CheckBuildConditions, BuildTool_BlueprintPaste.CheckBuildConditions
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
@@ -39,6 +42,9 @@ internal class RemovePowerSpaceLimit : PatchImpl<RemovePowerSpaceLimit>
internal class BoostWindPower : PatchImpl<BoostWindPower> internal class BoostWindPower : PatchImpl<BoostWindPower>
{ {
// Harmony transpiler: PowerGeneratorComponent_EnergyCap_Wind_Transpiler
// Target: PowerGeneratorComponent.EnergyCap_Wind
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_Wind))] [HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_Wind))]
private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_Wind_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_Wind_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -64,6 +70,9 @@ internal class BoostWindPower : PatchImpl<BoostWindPower>
internal class BoostSolarPower : PatchImpl<BoostSolarPower> internal class BoostSolarPower : PatchImpl<BoostSolarPower>
{ {
// Harmony transpiler: PowerGeneratorComponent_EnergyCap_PV_Transpiler
// Target: PowerGeneratorComponent.EnergyCap_PV
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_PV))] [HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_PV))]
private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_PV_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_PV_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -88,6 +97,9 @@ internal class BoostSolarPower : PatchImpl<BoostSolarPower>
internal class BoostFuelPower : PatchImpl<BoostFuelPower> internal class BoostFuelPower : PatchImpl<BoostFuelPower>
{ {
// Harmony transpiler: PowerGeneratorComponent_EnergyCap_Fuel_Transpiler
// Target: PowerGeneratorComponent.EnergyCap_Fuel
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_Fuel))] [HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_Fuel))]
private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_Fuel_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_Fuel_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -129,6 +141,9 @@ internal class BoostFuelPower : PatchImpl<BoostFuelPower>
internal class BoostGeothermalPower : PatchImpl<BoostGeothermalPower> internal class BoostGeothermalPower : PatchImpl<BoostGeothermalPower>
{ {
// Harmony transpiler: PowerGeneratorComponent_EnergyCap_GTH_Transpiler
// Target: PowerGeneratorComponent.EnergyCap_GTH
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_GTH))] [HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.EnergyCap_GTH))]
private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_GTH_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PowerGeneratorComponent_EnergyCap_GTH_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+9 -3
View File
@@ -149,7 +149,9 @@ public static class GamePatch
{ {
__instance.Update(); __instance.Update();
} }
// Harmony transpiler: PlayerAction_Test_Update_Transpiler
// Target: PlayerAction_Test.Update
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerAction_Test), nameof(PlayerAction_Test.Update))] [HarmonyPatch(typeof(PlayerAction_Test), nameof(PlayerAction_Test.Update))]
private static IEnumerable<CodeInstruction> PlayerAction_Test_Update_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlayerAction_Test_Update_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -182,7 +184,9 @@ public static class GamePatch
matcher.Labels = labels; matcher.Labels = labels;
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: GameCamera_Logic_Transpiler
// Target: GameCamera.FrameLogic
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(GameCamera), nameof(GameCamera.FrameLogic))] [HarmonyPatch(typeof(GameCamera), nameof(GameCamera.FrameLogic))]
private static IEnumerable<CodeInstruction> GameCamera_Logic_Transpiler(IEnumerable<CodeInstruction> instructions) private static IEnumerable<CodeInstruction> GameCamera_Logic_Transpiler(IEnumerable<CodeInstruction> instructions)
@@ -310,7 +314,9 @@ public static class GamePatch
history.currentTech = history.techQueue[0]; history.currentTech = history.techQueue[0];
} }
} }
// Harmony transpiler: UITechNode_OnPointerDown_Transpiler
// Target: UITechNode.OnPointerDown
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UITechNode), nameof(UITechNode.OnPointerDown))] [HarmonyPatch(typeof(UITechNode), nameof(UITechNode.OnPointerDown))]
private static IEnumerable<CodeInstruction> UITechNode_OnPointerDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UITechNode_OnPointerDown_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+15 -3
View File
@@ -34,6 +34,9 @@ public static class PlanetPatch
private class WaterPumperPatch : PatchImpl<WaterPumperPatch> private class WaterPumperPatch : PatchImpl<WaterPumperPatch>
{ {
// Harmony transpiler: BuildTool_CheckBuildConditions_Transpiler
// Target: BuildTool_BlueprintPaste.CheckBuildConditions, BuildTool_Click.CheckBuildConditions
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
@@ -56,6 +59,9 @@ public static class PlanetPatch
private class TerraformAnyway : PatchImpl<TerraformAnyway> private class TerraformAnyway : PatchImpl<TerraformAnyway>
{ {
// Harmony transpiler: BuildTool_BlueprintPaste_DetermineReforms_Patch
// Target: BuildTool_BlueprintPaste.DetermineReforms
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.DetermineReforms))] [HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.DetermineReforms))]
private static IEnumerable<CodeInstruction> BuildTool_BlueprintPaste_DetermineReforms_Patch(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_BlueprintPaste_DetermineReforms_Patch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -79,7 +85,9 @@ public static class PlanetPatch
matcher.Opcode = OpCodes.Br; matcher.Opcode = OpCodes.Br;
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: BuildTool_Reform_RemoveBasePit_Patch
// Target: BuildTool_Reform.RemoveBasePit
// Fallback: Checks CodeMatcher.IsInvalid/IsValid and returns original instructions on mismatch.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.RemoveBasePit))] [HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.RemoveBasePit))]
private static IEnumerable<CodeInstruction> BuildTool_Reform_RemoveBasePit_Patch(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Reform_RemoveBasePit_Patch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -104,7 +112,9 @@ public static class PlanetPatch
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIRemoveBasePitButton_OnRemoveButtonClick_Patch
// Target: UIRemoveBasePitButton.OnRemoveButtonClick, UIRemoveBasePitButton._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIRemoveBasePitButton), nameof(UIRemoveBasePitButton.OnRemoveButtonClick))] [HarmonyPatch(typeof(UIRemoveBasePitButton), nameof(UIRemoveBasePitButton.OnRemoveButtonClick))]
[HarmonyPatch(typeof(UIRemoveBasePitButton), nameof(UIRemoveBasePitButton._OnUpdate))] [HarmonyPatch(typeof(UIRemoveBasePitButton), nameof(UIRemoveBasePitButton._OnUpdate))]
@@ -141,7 +151,9 @@ public static class PlanetPatch
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: BuildTool_Reform_ReformAction_Patch
// Target: BuildTool_Reform.ReformAction
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))] [HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))]
private static IEnumerable<CodeInstruction> BuildTool_Reform_ReformAction_Patch(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Reform_ReformAction_Patch(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+3
View File
@@ -47,6 +47,9 @@ public static class PlayerPatch
private class InstantTeleport : PatchImpl<InstantTeleport> private class InstantTeleport : PatchImpl<InstantTeleport>
{ {
// Harmony transpiler: UIGlobemap__OnUpdate_Transpiler
// Target: UIGlobemap._OnUpdate, UIStarmap.DoRightClickFastTravel, UIStarmap.OnFastTravelButtonClick, UIStarmap.OnScreenClick, UIStarmap.SandboxRightClickFastTravelLogic, UIStarmap.StartFastTravelToPlanet, UIStarmap.StartFastTravelToUPosition, UIStarmap.UpdateCursorView, UIStarmap._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIGlobemap), nameof(UIGlobemap._OnUpdate))] [HarmonyPatch(typeof(UIGlobemap), nameof(UIGlobemap._OnUpdate))]
[HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.DoRightClickFastTravel))] [HarmonyPatch(typeof(UIStarmap), nameof(UIStarmap.DoRightClickFastTravel))]
+6 -1
View File
@@ -34,6 +34,9 @@ public static class ResourcePatch
private class InfiniteResource : PatchImpl<InfiniteResource> private class InfiniteResource : PatchImpl<InfiniteResource>
{ {
static private readonly float InfiniteResourceRate = 0f; static private readonly float InfiniteResourceRate = 0f;
// Harmony transpiler: Transpiler
// Target: FactorySystem.GameTick, GameLogic._miner_parallel, PlanetTransport.GameTick, UIChartAstroResource.CalculateMaxAmount, UIChartVeinGroup.CalculateMaxAmount, UIControlPanelAdvancedMinerEntry._OnUpdate, UIControlPanelVeinCollectorPanel._OnUpdate, UIMinerWindow._OnUpdate, UIMiningUpgradeLabel.Update, UIVeinCollectorPanel._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))] [HarmonyPatch(typeof(FactorySystem), nameof(FactorySystem.GameTick), typeof(long), typeof(bool))]
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic._miner_parallel))] [HarmonyPatch(typeof(GameLogic), nameof(GameLogic._miner_parallel))]
@@ -75,7 +78,9 @@ public static class ResourcePatch
private class FastMining : PatchImpl<FastMining> private class FastMining : PatchImpl<FastMining>
{ {
static private readonly float FastMiningSpeed = 2400f; static private readonly float FastMiningSpeed = 2400f;
// Harmony transpiler: Transpiler
// Target: AstroResourceStatPlan.AddPlanetResources, BuildingGizmo.Update, FactorySystem.GameTick, GameLogic._miner_parallel, ItemProto.GetPropValue, PlanetTransport.GameTick, ProductionExtraInfoCalculator.CalculateFactory, UIChartAstroResource.CalculateMaxAmount, UIChartVeinGroup.CalculateMaxAmount, UIControlPanelStationStorage.RefreshValues, UIControlPanelVeinCollectorPanel._OnUpdate, UIMinerWindow._OnUpdate, UIMiningUpgradeLabel.Update, UIPlanetDetail.OnPlanetDataSet, UIPlanetDetail.RefreshDynamicProperties, UIReferenceSpeedTip.AddEntryDataWithFactory, UIStarDetail.OnStarDataSet, UIStarDetail.RefreshDynamicProperties, UIStationStorage.RefreshValues, UIVeinCollectorPanel._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(AstroResourceStatPlan), nameof(AstroResourceStatPlan.AddPlanetResources))] [HarmonyPatch(typeof(AstroResourceStatPlan), nameof(AstroResourceStatPlan.AddPlanetResources))]
[HarmonyPatch(typeof(BuildingGizmo), nameof(BuildingGizmo.Update))] [HarmonyPatch(typeof(BuildingGizmo), nameof(BuildingGizmo.Update))]
+6
View File
@@ -5,6 +5,12 @@
<TargetFramework>net472</TargetFramework> <TargetFramework>net472</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<Nullable>disable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<!-- CS0618: expected from the legacy Util forwarding facade; suppress so new warnings fail the build. -->
<NoWarn>0618</NoWarn>
<AnalysisLevel>none</AnalysisLevel>
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
<RestoreAdditionalProjectSources>https://nuget.bepinex.dev/v3/index.json</RestoreAdditionalProjectSources> <RestoreAdditionalProjectSources>https://nuget.bepinex.dev/v3/index.json</RestoreAdditionalProjectSources>
<!-- Set to true in projects that include a CHANGELOG.md in the package --> <!-- Set to true in projects that include a CHANGELOG.md in the package -->
<PackHasChangelog>false</PackHasChangelog> <PackHasChangelog>false</PackHasChangelog>
@@ -0,0 +1,82 @@
using System;
using System.Reflection;
using BepInEx;
using BepInEx.Bootstrap;
using HarmonyLib;
namespace UXAssist.Common.ModCompat;
public static class ModCompatHelper
{
public static bool TryGetLoadedPluginInfo(string guid, out BepInEx.PluginInfo pluginInfo)
{
return Chainloader.PluginInfos.TryGetValue(guid, out pluginInfo) && pluginInfo != null;
}
public static bool TryGetPluginType(BepInEx.PluginInfo pluginInfo, string typeName, out Type type)
{
type = null;
if (pluginInfo?.Instance == null) return false;
try
{
type = pluginInfo.Instance.GetType().Assembly.GetType(typeName, throwOnError: false);
}
catch
{
// ignored
}
return type != null;
}
public static bool TryGetPluginType(string guid, string typeName, out Type type)
{
type = null;
return TryGetLoadedPluginInfo(guid, out var pluginInfo) && TryGetPluginType(pluginInfo, typeName, out type);
}
public static bool TryGetField(Type type, string fieldName, out FieldInfo field)
{
field = null;
if (type == null) return false;
field = AccessTools.Field(type, fieldName);
return field != null;
}
public static bool TryGetFieldValue<T>(Type type, string fieldName, object instance, out T value)
{
value = default;
if (!TryGetField(type, fieldName, out var field)) return false;
try
{
var result = field.GetValue(instance);
if (result is T t)
{
value = t;
return true;
}
}
catch
{
// ignored
}
return false;
}
public static bool TryGetMethod(Type type, string methodName, out MethodInfo method)
{
method = null;
if (type == null) return false;
method = AccessTools.Method(type, methodName);
return method != null;
}
public static bool TryGetPropertySetter(Type type, string propertyName, out MethodInfo setter)
{
setter = null;
if (type == null) return false;
var property = AccessTools.Property(type, propertyName);
if (property == null) return false;
setter = property.GetSetMethod(nonPublic: true);
return setter != null;
}
}
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Logging;
using HarmonyLib;
namespace UXAssist.Common.Patching;
/// <summary>
/// Helper for Harmony transpilers. Provides a standardized way to bail out and return the original
/// instructions when a <see cref="CodeMatcher"/> fails to match, which makes version-fragile patches
/// easier to diagnose at runtime.
/// </summary>
public static class TranspilerGuard
{
public static IEnumerable<CodeInstruction> Finish(
this CodeMatcher matcher,
IEnumerable<CodeInstruction> originalInstructions,
ManualLogSource logger,
string transpilerName)
{
if (matcher.IsInvalid)
{
logger?.LogWarning($"Transpiler '{transpilerName}' failed to match; returning original instructions.");
return originalInstructions;
}
return matcher.InstructionEnumeration();
}
}
@@ -0,0 +1,37 @@
using System.Reflection;
using HarmonyLib;
namespace UXAssist.Common.Utils;
public static class DysonSphereReflection
{
private static readonly FieldInfo TotalNodeSpField = AccessTools.Field(typeof(DysonSphereLayer), "totalNodeSP");
private static readonly FieldInfo TotalFrameSpField = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
private static readonly FieldInfo TotalCpField = AccessTools.Field(typeof(DysonSphereLayer), "totalCP");
public static bool IsAvailable => TotalNodeSpField != null && TotalFrameSpField != null && TotalCpField != null;
public static bool HasTotalNodeSP => TotalNodeSpField != null;
public static bool HasTotalFrameSP => TotalFrameSpField != null;
public static bool HasTotalCP => TotalCpField != null;
public static long? GetTotalNodeSP(DysonSphereLayer layer)
=> layer != null && TotalNodeSpField != null ? (long?)TotalNodeSpField.GetValue(layer) : null;
public static long? GetTotalFrameSP(DysonSphereLayer layer)
=> layer != null && TotalFrameSpField != null ? (long?)TotalFrameSpField.GetValue(layer) : null;
public static long? GetTotalCP(DysonSphereLayer layer)
=> layer != null && TotalCpField != null ? (long?)TotalCpField.GetValue(layer) : null;
public static void SetTotalNodeSP(DysonSphereLayer layer, long value)
=> TotalNodeSpField?.SetValue(layer, value);
public static void SetTotalFrameSP(DysonSphereLayer layer, long value)
=> TotalFrameSpField?.SetValue(layer, value);
public static void SetTotalCP(DysonSphereLayer layer, long value)
=> TotalCpField?.SetValue(layer, value);
}
+14 -13
View File
@@ -1,7 +1,7 @@
using System; using System;
using BepInEx.Bootstrap;
using BepInEx.Configuration; using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;
using UXAssist.Common.ModCompat;
using UXAssist.Patches; using UXAssist.Patches;
namespace UXAssist.ModsCompat; namespace UXAssist.ModsCompat;
@@ -13,27 +13,28 @@ public static class AuxilaryfunctionWrapper
public static void Start(Harmony harmony) public static void Start(Harmony harmony)
{ {
if (!Chainloader.PluginInfos.TryGetValue(AuxilaryfunctionGuid, out var pluginInfo)) return; if (!ModCompatHelper.TryGetLoadedPluginInfo(AuxilaryfunctionGuid, out var pluginInfo)) return;
var assembly = pluginInfo.Instance.GetType().Assembly; if (!ModCompatHelper.TryGetPluginType(pluginInfo, "Auxilaryfunction.Auxilaryfunction", out var classType))
try
{ {
var classType = assembly.GetType("Auxilaryfunction.Auxilaryfunction"); UXAssist.Logger.LogWarning("Failed to locate Auxilaryfunction main type");
ShowStationInfo = (ConfigEntry<bool>)AccessTools.Field(classType, "ShowStationInfo").GetValue(pluginInfo.Instance); return;
} }
catch if (!ModCompatHelper.TryGetFieldValue<ConfigEntry<bool>>(classType, "ShowStationInfo", pluginInfo.Instance, out ShowStationInfo))
{ {
UXAssist.Logger.LogWarning("Failed to get ShowStationInfo from Auxilaryfunction"); UXAssist.Logger.LogWarning("Failed to get ShowStationInfo from Auxilaryfunction");
} }
try if (!ModCompatHelper.TryGetPluginType(pluginInfo, "Auxilaryfunction.Patch.SpeedUpPatch", out var speedUpPatchType))
{ {
var classType = assembly.GetType("Auxilaryfunction.Patch.SpeedUpPatch"); UXAssist.Logger.LogWarning("Failed to locate Auxilaryfunction SpeedUpPatch");
harmony.Patch(AccessTools.PropertySetter(classType, "Enable"), return;
new HarmonyMethod(AccessTools.Method(typeof(AuxilaryfunctionWrapper), nameof(PatchSpeedUpPatchEnable))));
} }
catch if (!ModCompatHelper.TryGetPropertySetter(speedUpPatchType, "Enable", out var setter))
{ {
UXAssist.Logger.LogWarning("Failed to patch SpeedUpPatch.set_Enable() from Auxilaryfunction"); UXAssist.Logger.LogWarning("Failed to resolve SpeedUpPatch.set_Enable() from Auxilaryfunction");
return;
} }
harmony.Patch(setter,
new HarmonyMethod(AccessTools.Method(typeof(AuxilaryfunctionWrapper), nameof(PatchSpeedUpPatchEnable))));
} }
public static void PatchSpeedUpPatchEnable(bool value) public static void PatchSpeedUpPatchEnable(bool value)
+7 -7
View File
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Reflection; using System.Reflection;
using System.Reflection.Emit; using System.Reflection.Emit;
using UnityEngine; using UnityEngine;
using UXAssist.Common.ModCompat;
using UXAssist.Functions; using UXAssist.Functions;
namespace UXAssist.ModsCompat; namespace UXAssist.ModsCompat;
@@ -17,13 +18,12 @@ class BlueprintTweaks
public static bool Run(Harmony harmony) public static bool Run(Harmony harmony)
{ {
if (!BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(BlueprintTweaksGuid, out var pluginInfo)) return false; if (!ModCompatHelper.TryGetLoadedPluginInfo(BlueprintTweaksGuid, out var pluginInfo)) return false;
var assembly = pluginInfo.Instance.GetType().Assembly; if (!ModCompatHelper.TryGetPluginType(pluginInfo, "BlueprintTweaks.DragRemoveBuildTool", out var classTypeDragRemoveBuildTool)) return false;
var classTypeDragRemoveBuildTool = assembly.GetType("BlueprintTweaks.DragRemoveBuildTool"); if (ModCompatHelper.TryGetMethod(classTypeDragRemoveBuildTool, "DetermineMorePreviews", out _)) return true;
if (classTypeDragRemoveBuildTool == null) return false; ModCompatHelper.TryGetPluginType(pluginInfo, "BlueprintTweaks.BlueprintTweaksPlugin", out classTypeBlueprintTweaksPlugin);
if (AccessTools.Method(classTypeDragRemoveBuildTool, "DetermineMorePreviews") != null) return true; ModCompatHelper.TryGetPluginType(pluginInfo, "BlueprintTweaks.UIBuildingGridPatch2", out classTypeUIBuildingGridPatch2);
classTypeBlueprintTweaksPlugin = assembly.GetType("BlueprintTweaks.BlueprintTweaksPlugin"); if (classTypeBlueprintTweaksPlugin == null || classTypeUIBuildingGridPatch2 == null) return false;
classTypeUIBuildingGridPatch2 = assembly.GetType("BlueprintTweaks.UIBuildingGridPatch2");
var UIBuildingGrid_Update = AccessTools.Method(typeof(UIBuildingGrid), nameof(UIBuildingGrid.Update)); var UIBuildingGrid_Update = AccessTools.Method(typeof(UIBuildingGrid), nameof(UIBuildingGrid.Update));
harmony.Patch(AccessTools.Method(classTypeUIBuildingGridPatch2, "UpdateGrid"), null, null, new HarmonyMethod(AccessTools.Method(typeof(BlueprintTweaks), nameof(PatchUpdateGrid)))); harmony.Patch(AccessTools.Method(classTypeUIBuildingGridPatch2, "UpdateGrid"), null, null, new HarmonyMethod(AccessTools.Method(typeof(BlueprintTweaks), nameof(PatchUpdateGrid))));
selectObjIdsField = AccessTools.Field(classTypeDragRemoveBuildTool, "selectObjIds"); selectObjIdsField = AccessTools.Field(classTypeDragRemoveBuildTool, "selectObjIds");
+3 -3
View File
@@ -1,5 +1,5 @@
using BepInEx.Bootstrap; using HarmonyLib;
using HarmonyLib; using UXAssist.Common.ModCompat;
namespace UXAssist.ModsCompat; namespace UXAssist.ModsCompat;
@@ -10,6 +10,6 @@ public static class BulletTimeWrapper
public static void Start(Harmony _) public static void Start(Harmony _)
{ {
HasBulletTime = Chainloader.PluginInfos.TryGetValue(BulletTimeGuid, out var _); HasBulletTime = ModCompatHelper.TryGetLoadedPluginInfo(BulletTimeGuid, out var _);
} }
} }
+2 -2
View File
@@ -1,6 +1,6 @@
using BepInEx.Bootstrap;
using CommonAPI; using CommonAPI;
using HarmonyLib; using HarmonyLib;
using UXAssist.Common.ModCompat;
namespace UXAssist.ModsCompat; namespace UXAssist.ModsCompat;
@@ -8,7 +8,7 @@ public static class CommonAPIWrapper
{ {
public static void Run(Harmony harmony) public static void Run(Harmony harmony)
{ {
if (!Chainloader.PluginInfos.TryGetValue(CommonAPIPlugin.GUID, out var commonAPIPlugin) || if (!ModCompatHelper.TryGetLoadedPluginInfo(CommonAPIPlugin.GUID, out var commonAPIPlugin) ||
commonAPIPlugin.Metadata.Version > new System.Version(1, 6, 7, 0)) return; commonAPIPlugin.Metadata.Version > new System.Version(1, 6, 7, 0)) return;
harmony.Patch(AccessTools.Method(typeof(GameOption), nameof(GameOption.InitKeys)), new HarmonyMethod(AccessTools.Method(typeof(CommonAPIWrapper), nameof(PatchInitKeys)), Priority.First)); harmony.Patch(AccessTools.Method(typeof(GameOption), nameof(GameOption.InitKeys)), new HarmonyMethod(AccessTools.Method(typeof(CommonAPIWrapper), nameof(PatchInitKeys)), Priority.First));
} }
+3 -3
View File
@@ -1,4 +1,5 @@
using HarmonyLib; using HarmonyLib;
using UXAssist.Common.ModCompat;
namespace UXAssist.ModsCompat; namespace UXAssist.ModsCompat;
@@ -8,9 +9,8 @@ class PlanetVeinUtilization
public static bool Run(Harmony harmony) public static bool Run(Harmony harmony)
{ {
if (!BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(PlanetVeinUtilizationGuid, out var pluginInfo)) return false; if (!ModCompatHelper.TryGetLoadedPluginInfo(PlanetVeinUtilizationGuid, out var pluginInfo)) return false;
var assembly = pluginInfo.Instance.GetType().Assembly; if (!ModCompatHelper.TryGetPluginType(pluginInfo, "PlanetVeinUtilization.PlanetVeinUtilization", out var classType)) return false;
var classType = assembly.GetType("PlanetVeinUtilization.PlanetVeinUtilization");
harmony.Patch(AccessTools.Method(classType, "Awake"), harmony.Patch(AccessTools.Method(classType, "Awake"),
new HarmonyMethod(typeof(PlanetVeinUtilization).GetMethod("PatchPlanetVeinUtilizationAwake"))); new HarmonyMethod(typeof(PlanetVeinUtilization).GetMethod("PatchPlanetVeinUtilizationAwake")));
return true; return true;
+31 -20
View File
@@ -1,10 +1,10 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit; using System.Reflection.Emit;
using BepInEx.Configuration; using BepInEx.Configuration;
using HarmonyLib; using HarmonyLib;
using UnityEngine.UI; using UnityEngine.UI;
using UXAssist.Common; using UXAssist.Common;
using UXAssist.Common.Utils;
using GameLogicProc = UXAssist.Common.GameLogic; using GameLogicProc = UXAssist.Common.GameLogic;
namespace UXAssist.Patches; namespace UXAssist.Patches;
@@ -15,16 +15,11 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
public static ConfigEntry<bool> OnlyConstructNodesEnabled; public static ConfigEntry<bool> OnlyConstructNodesEnabled;
public static ConfigEntry<int> AutoConstructMultiplier; public static ConfigEntry<int> AutoConstructMultiplier;
private static FieldInfo _totalNodeSpInfo, _totalFrameSpInfo, _totalCpInfo;
public static void Init() public static void Init()
{ {
Enable(true); Enable(true);
StopEjectOnNodeCompleteEnabled.SettingChanged += (_, _) => StopEjectOnNodeComplete.Enable(StopEjectOnNodeCompleteEnabled.Value); StopEjectOnNodeCompleteEnabled.SettingChanged += (_, _) => StopEjectOnNodeComplete.Enable(StopEjectOnNodeCompleteEnabled.Value);
OnlyConstructNodesEnabled.SettingChanged += (_, _) => OnlyConstructNodes.Enable(OnlyConstructNodesEnabled.Value); OnlyConstructNodesEnabled.SettingChanged += (_, _) => OnlyConstructNodes.Enable(OnlyConstructNodesEnabled.Value);
_totalNodeSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalNodeSP");
_totalFrameSpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
_totalCpInfo = AccessTools.Field(typeof(DysonSphereLayer), "totalCP");
GameLogicProc.OnGameEnd += StopEjectOnNodeComplete.ResetState; GameLogicProc.OnGameEnd += StopEjectOnNodeComplete.ResetState;
} }
@@ -93,8 +88,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
} }
// Make compatible with DSPOptimizations // Make compatible with DSPOptimizations
if (_totalNodeSpInfo != null) var currentNodeSp = DysonSphereReflection.GetTotalNodeSP(dysonSphereLayer);
_totalNodeSpInfo.SetValue(dysonSphereLayer, (long)_totalNodeSpInfo.GetValue(dysonSphereLayer) + diff - 1); if (currentNodeSp.HasValue)
DysonSphereReflection.SetTotalNodeSP(dysonSphereLayer, currentNodeSp.Value + diff - 1);
__instance.UpdateProgress(dysonNode); __instance.UpdateProgress(dysonNode);
} }
@@ -127,8 +123,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
} }
// Make compatible with DSPOptimizations // Make compatible with DSPOptimizations
if (_totalFrameSpInfo != null) var currentFrameSp = DysonSphereReflection.GetTotalFrameSP(dysonSphereLayer);
_totalFrameSpInfo.SetValue(dysonSphereLayer, (long)_totalFrameSpInfo.GetValue(dysonSphereLayer) + diff - 1); if (currentFrameSp.HasValue)
DysonSphereReflection.SetTotalFrameSP(dysonSphereLayer, currentFrameSp.Value + diff - 1);
__instance.UpdateProgress(dysonFrame); __instance.UpdateProgress(dysonFrame);
} }
@@ -153,8 +150,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
} }
// Make compatible with DSPOptimizations // Make compatible with DSPOptimizations
if (_totalFrameSpInfo != null) var currentFrameSp2 = DysonSphereReflection.GetTotalFrameSP(dysonSphereLayer);
_totalFrameSpInfo.SetValue(dysonSphereLayer, (long)_totalFrameSpInfo.GetValue(dysonSphereLayer) + diff - 1); if (currentFrameSp2.HasValue)
DysonSphereReflection.SetTotalFrameSP(dysonSphereLayer, currentFrameSp2.Value + diff - 1);
__instance.UpdateProgress(dysonFrame); __instance.UpdateProgress(dysonFrame);
} }
@@ -199,9 +197,10 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
dysonShell.nodecps[nodeIndex] += diff; dysonShell.nodecps[nodeIndex] += diff;
dysonShell.nodecps[dysonShell.nodecps.Length - 1] += diff; dysonShell.nodecps[dysonShell.nodecps.Length - 1] += diff;
// Make compatible with DSPOptimizations // Make compatible with DSPOptimizations
if (_totalCpInfo != null) var currentCp = DysonSphereReflection.GetTotalCP(dysonSphereLayer);
if (currentCp.HasValue)
{ {
_totalCpInfo.SetValue(dysonSphereLayer, (long)_totalCpInfo.GetValue(dysonSphereLayer) + diff); DysonSphereReflection.SetTotalCP(dysonSphereLayer, currentCp.Value + diff);
dysonShell.SetMaterialDynamicVars(); dysonShell.SetMaterialDynamicVars();
} }
shellIndex = (shellIndex + 1) % shellCount; shellIndex = (shellIndex + 1) % shellCount;
@@ -233,7 +232,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
return false; return false;
} }
// Harmony transpiler: DysonSpherePatch_DysonNode_ConstructCp_Transpiler
// Target: DysonNode.ConstructCp
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPriority(Priority.First)] [HarmonyPriority(Priority.First)]
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.ConstructCp))] [HarmonyPatch(typeof(DysonNode), nameof(DysonNode.ConstructCp))]
@@ -390,7 +391,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
_nodeForAbsorb[starIndex].Clear(); _nodeForAbsorb[starIndex].Clear();
_nodeForAbsorb[starIndex] = null; _nodeForAbsorb[starIndex] = null;
} }
// Harmony transpiler: EjectorComponent_InternalUpdate_Transpiler
// Target: EjectorComponent.InternalUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))] [HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -429,7 +432,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: DysonNode_ConstructSp_Transpiler
// Target: DysonNode.ConstructSp
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.ConstructSp))] [HarmonyPatch(typeof(DysonNode), nameof(DysonNode.ConstructSp))]
private static IEnumerable<CodeInstruction> DysonNode_ConstructSp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> DysonNode_ConstructSp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -446,7 +451,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: DysonNode_ConstructCp_Transpiler
// Target: DysonNode.ConstructCp
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.ConstructCp))] [HarmonyPatch(typeof(DysonNode), nameof(DysonNode.ConstructCp))]
private static IEnumerable<CodeInstruction> DysonNode_ConstructCp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> DysonNode_ConstructCp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -467,7 +474,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIEjectorWindow__OnUpdate_Transpiler
// Target: UIEjectorWindow._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIEjectorWindow), nameof(UIEjectorWindow._OnUpdate))] [HarmonyPatch(typeof(UIEjectorWindow), nameof(UIEjectorWindow._OnUpdate))]
static IEnumerable<CodeInstruction> UIEjectorWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) static IEnumerable<CodeInstruction> UIEjectorWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -527,7 +536,9 @@ public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
sphere.PickAutoNode(); sphere.PickAutoNode();
} }
} }
// Harmony transpiler: DysonNode_spReqOrder_Getter_Transpiler
// Target: DysonNode.spReqOrder (getter)
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(DysonNode), nameof(DysonNode.spReqOrder), MethodType.Getter)] [HarmonyPatch(typeof(DysonNode), nameof(DysonNode.spReqOrder), MethodType.Getter)]
private static IEnumerable<CodeInstruction> DysonNode_spReqOrder_Getter_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> DysonNode_spReqOrder_Getter_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+21 -3
View File
@@ -20,6 +20,9 @@ internal static class ArchitectModePatch
internal class UnlimitInteractive : PatchImpl<UnlimitInteractive> internal class UnlimitInteractive : PatchImpl<UnlimitInteractive>
{ {
// Harmony transpiler: PlayerAction_Inspect_GetObjectSelectDistance_Transpiler
// Target: PlayerAction_Inspect.GetObjectSelectDistance
// Fallback: Checks CodeMatcher.IsInvalid/IsValid and returns original instructions on mismatch.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.GetObjectSelectDistance))] [HarmonyPatch(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.GetObjectSelectDistance))]
private static IEnumerable<CodeInstruction> PlayerAction_Inspect_GetObjectSelectDistance_Transpiler(IEnumerable<CodeInstruction> instructions) private static IEnumerable<CodeInstruction> PlayerAction_Inspect_GetObjectSelectDistance_Transpiler(IEnumerable<CodeInstruction> instructions)
@@ -31,6 +34,9 @@ internal static class ArchitectModePatch
internal class RemoveSomeConditionBuild : PatchImpl<RemoveSomeConditionBuild> internal class RemoveSomeConditionBuild : PatchImpl<RemoveSomeConditionBuild>
{ {
// Harmony transpiler: BuildTool_Click_CheckBuildConditions_Transpiler
// Target: BuildTool_BlueprintPaste.CheckBuildConditions, BuildTool_Click.CheckBuildConditions
// Fallback: Checks CodeMatcher.IsInvalid/IsValid and returns original instructions on mismatch.
[HarmonyTranspiler, HarmonyPriority(Priority.First)] [HarmonyTranspiler, HarmonyPriority(Priority.First)]
[HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_BlueprintPaste), nameof(BuildTool_BlueprintPaste.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
@@ -65,7 +71,9 @@ internal static class ArchitectModePatch
matcher.Opcode = OpCodes.Brfalse; matcher.Opcode = OpCodes.Brfalse;
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: BuildTool_Path_CheckBuildConditions_Transpiler
// Target: BuildTool_Path.CheckBuildConditions
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler, HarmonyPriority(Priority.First)] [HarmonyTranspiler, HarmonyPriority(Priority.First)]
[HarmonyPatch(typeof(BuildTool_Path), nameof(BuildTool_Path.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Path), nameof(BuildTool_Path.CheckBuildConditions))]
private static IEnumerable<CodeInstruction> BuildTool_Path_CheckBuildConditions_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Path_CheckBuildConditions_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -140,7 +148,9 @@ internal static class ArchitectModePatch
if (controller == null) return; if (controller == null) return;
controller.actionBuild?.clickTool?._OnInit(); controller.actionBuild?.clickTool?._OnInit();
} }
// Harmony transpiler: BuildTool_Click__OnInit_Transpiler
// Target: BuildTool_Click._OnInit
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click._OnInit))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click._OnInit))]
private static IEnumerable<CodeInstruction> BuildTool_Click__OnInit_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Click__OnInit_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -152,7 +162,9 @@ internal static class ArchitectModePatch
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 512)); matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 512));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: BuildAreaLimitRemoval_Transpiler
// Target: BuildTool_Addon.CheckBuildConditions, BuildTool_Click.CheckBuildConditions, BuildTool_Dismantle.DetermineMoreChainTargets, BuildTool_Dismantle.DeterminePreviews, BuildTool_Inserter.CheckBuildConditions, BuildTool_Path.CheckBuildConditions, BuildTool_Reform.ReformAction, BuildTool_Upgrade.DetermineMoreChainTargets, BuildTool_Upgrade.DeterminePreviews
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Addon), nameof(BuildTool_Addon.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Addon), nameof(BuildTool_Addon.CheckBuildConditions))]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.CheckBuildConditions))]
@@ -185,6 +197,9 @@ internal static class ArchitectModePatch
internal class LargerAreaForUpgradeAndDismantle : PatchImpl<LargerAreaForUpgradeAndDismantle> internal class LargerAreaForUpgradeAndDismantle : PatchImpl<LargerAreaForUpgradeAndDismantle>
{ {
// Harmony transpiler: BuildTools_CursorSizePatch_Transpiler
// Target: BuildTool_Dismantle.DeterminePreviews, BuildTool_Upgrade.DeterminePreviews
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Dismantle), nameof(BuildTool_Dismantle.DeterminePreviews))] [HarmonyPatch(typeof(BuildTool_Dismantle), nameof(BuildTool_Dismantle.DeterminePreviews))]
[HarmonyPatch(typeof(BuildTool_Upgrade), nameof(BuildTool_Upgrade.DeterminePreviews))] [HarmonyPatch(typeof(BuildTool_Upgrade), nameof(BuildTool_Upgrade.DeterminePreviews))]
@@ -201,6 +216,9 @@ internal static class ArchitectModePatch
internal class LargerAreaForTerraform : PatchImpl<LargerAreaForTerraform> internal class LargerAreaForTerraform : PatchImpl<LargerAreaForTerraform>
{ {
// Harmony transpiler: BuildTool_Reform_ReformAction_Transpiler
// Target: BuildTool_Reform.ReformAction
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler, HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))] [HarmonyTranspiler, HarmonyPatch(typeof(BuildTool_Reform), nameof(BuildTool_Reform.ReformAction))]
private static IEnumerable<CodeInstruction> BuildTool_Reform_ReformAction_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Reform_ReformAction_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
+45 -13
View File
@@ -24,6 +24,9 @@ internal static class BuildToolPatch
private class BuildGizmoPatch : PatchImpl<BuildGizmoPatch> private class BuildGizmoPatch : PatchImpl<BuildGizmoPatch>
{ {
// Harmony transpiler: ConnGizmoGraph_Constructor_Transpiler
// Target: ConnGizmoGraph..ctor
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(ConnGizmoGraph), MethodType.Constructor)] [HarmonyPatch(typeof(ConnGizmoGraph), MethodType.Constructor)]
private static IEnumerable<CodeInstruction> ConnGizmoGraph_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> ConnGizmoGraph_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -35,7 +38,9 @@ internal static class BuildToolPatch
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 2048)); matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 2048));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: ConnGizmoGraph_SetPointCount_Transpiler
// Target: ConnGizmoGraph.SetPointCount
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(ConnGizmoGraph), nameof(ConnGizmoGraph.SetPointCount))] [HarmonyPatch(typeof(ConnGizmoGraph), nameof(ConnGizmoGraph.SetPointCount))]
private static IEnumerable<CodeInstruction> ConnGizmoGraph_SetPointCount_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> ConnGizmoGraph_SetPointCount_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -47,7 +52,9 @@ internal static class BuildToolPatch
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 2048)); matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 2048));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: BuildTool_Path__OnInit_Transpiler
// Target: BuildTool_Path._OnInit
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Path), nameof(BuildTool_Path._OnInit))] [HarmonyPatch(typeof(BuildTool_Path), nameof(BuildTool_Path._OnInit))]
private static IEnumerable<CodeInstruction> BuildTool_Path__OnInit_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Path__OnInit_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -59,7 +66,9 @@ internal static class BuildToolPatch
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 2048)); matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 2048));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: BuildTool_Reform_Constructor_Transpiler
// Target: BuildTool_Reform..ctor
// Fallback: Checks CodeMatcher.IsInvalid/IsValid and returns original instructions on mismatch.
[HarmonyTranspiler, HarmonyPatch(typeof(BuildTool_Reform), MethodType.Constructor)] [HarmonyTranspiler, HarmonyPatch(typeof(BuildTool_Reform), MethodType.Constructor)]
private static IEnumerable<CodeInstruction> BuildTool_Reform_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Reform_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{ {
@@ -133,7 +142,9 @@ internal static class BuildToolPatch
__instance.actionBuild.model.cursorText = $"({_lastOffsetText})\n" + __instance.actionBuild.model.cursorText; __instance.actionBuild.model.cursorText = $"({_lastOffsetText})\n" + __instance.actionBuild.model.cursorText;
} }
// Harmony transpiler: UIEntityBriefInfo__OnUpdate_Transpiler
// Target: UIEntityBriefInfo._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIEntityBriefInfo), nameof(UIEntityBriefInfo._OnUpdate))] [HarmonyPatch(typeof(UIEntityBriefInfo), nameof(UIEntityBriefInfo._OnUpdate))]
private static IEnumerable<CodeInstruction> UIEntityBriefInfo__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIEntityBriefInfo__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -188,7 +199,9 @@ internal static class BuildToolPatch
ifBlockEntryLabel = thisIfBlockEntryLabel; ifBlockEntryLabel = thisIfBlockEntryLabel;
elseBlockEntryLabel = thisElseBlockEntryLabel; elseBlockEntryLabel = thisElseBlockEntryLabel;
} }
// Harmony transpiler: AllowOffGridConstruction
// Target: BuildTool_Click.UpdateRaycast, BuildTool_Click.DeterminePreviews
// Fallback: Checks CodeMatcher.IsInvalid/IsValid and returns original instructions on mismatch.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.UpdateRaycast))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.UpdateRaycast))]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.DeterminePreviews))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.DeterminePreviews))]
@@ -206,7 +219,9 @@ internal static class BuildToolPatch
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: PreventDraggingWhenOffGrid
// Target: BuildTool_Click.DeterminePreviews
// Fallback: Checks CodeMatcher.IsInvalid/IsValid and returns original instructions on mismatch.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.DeterminePreviews))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.DeterminePreviews))]
public static IEnumerable<CodeInstruction> PreventDraggingWhenOffGrid(IEnumerable<CodeInstruction> instructions, ILGenerator generator) public static IEnumerable<CodeInstruction> PreventDraggingWhenOffGrid(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -233,7 +248,9 @@ internal static class BuildToolPatch
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: AllowOffGridConstructionForPath
// Target: BuildTool_Path.UpdateRaycast
// Fallback: Checks CodeMatcher.IsInvalid/IsValid and returns original instructions on mismatch.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Path), nameof(BuildTool_Path.UpdateRaycast))] [HarmonyPatch(typeof(BuildTool_Path), nameof(BuildTool_Path.UpdateRaycast))]
public static IEnumerable<CodeInstruction> AllowOffGridConstructionForPath(IEnumerable<CodeInstruction> instructions, ILGenerator generator) public static IEnumerable<CodeInstruction> AllowOffGridConstructionForPath(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -339,6 +356,9 @@ internal static class BuildToolPatch
internal class TreatStackingAsSingle : PatchImpl<TreatStackingAsSingle> internal class TreatStackingAsSingle : PatchImpl<TreatStackingAsSingle>
{ {
// Harmony transpiler: MonitorComponent_InternalUpdate_Transpiler
// Target: MonitorComponent.InternalUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(MonitorComponent), nameof(MonitorComponent.InternalUpdate))] [HarmonyPatch(typeof(MonitorComponent), nameof(MonitorComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> MonitorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> MonitorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -491,7 +511,9 @@ internal static class BuildToolPatch
return num; return num;
} }
// Harmony transpiler: BuildTool_Click_DeterminePreviews_Transpiler
// Target: BuildTool_Click.DeterminePreviews
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.DeterminePreviews))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click.DeterminePreviews))]
private static IEnumerable<CodeInstruction> BuildTool_Click_DeterminePreviews_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Click_DeterminePreviews_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -580,7 +602,9 @@ internal static class BuildToolPatch
new(OpCodes.Call, AccessTools.Method(typeof(Math), nameof(Math.Min), [typeof(int), typeof(int)])) new(OpCodes.Call, AccessTools.Method(typeof(Math), nameof(Math.Min), [typeof(int), typeof(int)]))
]; ];
private static readonly CodeInstruction GetRealCount = new(OpCodes.Ldsfld, AccessTools.Field(typeof(FactoryPatch), nameof(FactoryPatch._tankFastFillInAndTakeOutMultiplierRealValue))); private static readonly CodeInstruction GetRealCount = new(OpCodes.Ldsfld, AccessTools.Field(typeof(FactoryPatch), nameof(FactoryPatch._tankFastFillInAndTakeOutMultiplierRealValue)));
// Harmony transpiler: PlanetFactory_EntityFastFillIn_Transpiler
// Target: PlanetFactory.EntityFastFillIn
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.EntityFastFillIn))] [HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.EntityFastFillIn))]
private static IEnumerable<CodeInstruction> PlanetFactory_EntityFastFillIn_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlanetFactory_EntityFastFillIn_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -600,7 +624,9 @@ internal static class BuildToolPatch
).RemoveInstructions(5).Insert(MultiplierWithCountCheck); ).RemoveInstructions(5).Insert(MultiplierWithCountCheck);
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: PlanetFactory_EntityFastTakeOut_Transpiler
// Target: PlanetFactory.EntityFastTakeOut
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.EntityFastTakeOut))] [HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.EntityFastTakeOut))]
private static IEnumerable<CodeInstruction> PlanetFactory_EntityFastTakeOut_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlanetFactory_EntityFastTakeOut_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -621,7 +647,9 @@ internal static class BuildToolPatch
).RemoveInstructions(5).Insert(MultiplierWithCountCheck); ).RemoveInstructions(5).Insert(MultiplierWithCountCheck);
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UITankWindow__OnUpdate_Transpiler
// Target: UITankWindow._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UITankWindow), nameof(UITankWindow._OnUpdate))] [HarmonyPatch(typeof(UITankWindow), nameof(UITankWindow._OnUpdate))]
private static IEnumerable<CodeInstruction> UITankWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UITankWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -694,7 +722,9 @@ internal static class BuildToolPatch
{ {
nextTimei = 0; nextTimei = 0;
} }
// Harmony transpiler: VFInput_fastTransferWithEntityDown_Transpiler
// Target: VFInput._fastTransferWithEntityDown (getter), VFInput._fastTransferWithEntityPress (getter)
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(VFInput), nameof(VFInput._fastTransferWithEntityDown), MethodType.Getter)] [HarmonyPatch(typeof(VFInput), nameof(VFInput._fastTransferWithEntityDown), MethodType.Getter)]
[HarmonyPatch(typeof(VFInput), nameof(VFInput._fastTransferWithEntityPress), MethodType.Getter)] [HarmonyPatch(typeof(VFInput), nameof(VFInput._fastTransferWithEntityPress), MethodType.Getter)]
@@ -710,7 +740,9 @@ internal static class BuildToolPatch
matcher.Labels.AddRange(lables); matcher.Labels.AddRange(lables);
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: PlayerAction_Inspect_GameTick_Transpiler
// Target: PlayerAction_Inspect.GameTick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.GameTick))] [HarmonyPatch(typeof(PlayerAction_Inspect), nameof(PlayerAction_Inspect.GameTick))]
private static IEnumerable<CodeInstruction> PlayerAction_Inspect_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlayerAction_Inspect_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -67,7 +67,9 @@ internal static class BuildingBufferPatch
patch.Unpatch(AccessTools.Method(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate)), AccessTools.Method(typeof(TweakBuildingBuffer), nameof(SiloComponent_InternalUpdate_Transpiler))); patch.Unpatch(AccessTools.Method(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate)), AccessTools.Method(typeof(TweakBuildingBuffer), nameof(SiloComponent_InternalUpdate_Transpiler)));
patch.Patch(AccessTools.Method(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate)), null, null, new HarmonyMethod(typeof(TweakBuildingBuffer), nameof(SiloComponent_InternalUpdate_Transpiler))); patch.Patch(AccessTools.Method(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate)), null, null, new HarmonyMethod(typeof(TweakBuildingBuffer), nameof(SiloComponent_InternalUpdate_Transpiler)));
} }
// Harmony transpiler: PowerGeneratorComponent_GameTick_Gamma_Transpiler
// Target: PowerGeneratorComponent.GameTick_Gamma
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.GameTick_Gamma))] [HarmonyPatch(typeof(PowerGeneratorComponent), nameof(PowerGeneratorComponent.GameTick_Gamma))]
private static IEnumerable<CodeInstruction> PowerGeneratorComponent_GameTick_Gamma_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PowerGeneratorComponent_GameTick_Gamma_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -89,7 +91,9 @@ internal static class BuildingBufferPatch
matcher.Advance(2).RemoveInstructions(2).Insert(new CodeInstruction(OpCodes.Ldc_I4, FactoryPatch.ReceiverBufferCount.Value * 3600)); matcher.Advance(2).RemoveInstructions(2).Insert(new CodeInstruction(OpCodes.Ldc_I4, FactoryPatch.ReceiverBufferCount.Value * 3600));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: AssemblerComponent_UpdateNeeds_Transpiler
// Target: AssemblerComponent.UpdateNeeds
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(AssemblerComponent), nameof(AssemblerComponent.UpdateNeeds))] [HarmonyPatch(typeof(AssemblerComponent), nameof(AssemblerComponent.UpdateNeeds))]
private static IEnumerable<CodeInstruction> AssemblerComponent_UpdateNeeds_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> AssemblerComponent_UpdateNeeds_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -125,7 +129,9 @@ internal static class BuildingBufferPatch
matcher.Advance(2).Operand = FactoryPatch.AssemblerBufferMininumMultiplier.Value; matcher.Advance(2).Operand = FactoryPatch.AssemblerBufferMininumMultiplier.Value;
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: LabComponent_UpdateNeedsAssemble_Transpiler
// Target: LabComponent.UpdateNeedsAssemble
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(LabComponent), nameof(LabComponent.UpdateNeedsAssemble))] [HarmonyPatch(typeof(LabComponent), nameof(LabComponent.UpdateNeedsAssemble))]
private static IEnumerable<CodeInstruction> LabComponent_UpdateNeedsAssemble_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> LabComponent_UpdateNeedsAssemble_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -163,7 +169,9 @@ internal static class BuildingBufferPatch
matcher.Advance(2).SetAndAdvance(OpCodes.Ldc_I4, maxCount); matcher.Advance(2).SetAndAdvance(OpCodes.Ldc_I4, maxCount);
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: LabComponent_UpdateNeedsResearch_Transpiler
// Target: LabComponent.UpdateNeedsResearch
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(LabComponent), nameof(LabComponent.UpdateNeedsResearch))] [HarmonyPatch(typeof(LabComponent), nameof(LabComponent.UpdateNeedsResearch))]
private static IEnumerable<CodeInstruction> LabComponent_UpdateNeedsResearch_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> LabComponent_UpdateNeedsResearch_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -183,7 +191,9 @@ internal static class BuildingBufferPatch
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, FactoryPatch.LabBufferMaxCountForResearch.Value * 3600)); matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, FactoryPatch.LabBufferMaxCountForResearch.Value * 3600));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: EjectorComponent_InternalUpdate_Transpiler
// Target: EjectorComponent.InternalUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))] [HarmonyPatch(typeof(EjectorComponent), nameof(EjectorComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -197,7 +207,9 @@ internal static class BuildingBufferPatch
matcher.Advance(2).Set(OpCodes.Ldc_I4, FactoryPatch.EjectorBufferCount.Value); matcher.Advance(2).Set(OpCodes.Ldc_I4, FactoryPatch.EjectorBufferCount.Value);
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: SiloComponent_InternalUpdate_Transpiler
// Target: SiloComponent.InternalUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate))] [HarmonyPatch(typeof(SiloComponent), nameof(SiloComponent.InternalUpdate))]
private static IEnumerable<CodeInstruction> SiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> SiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -212,7 +212,9 @@ internal static class ImmediateBuildPatch
currLevel++; currLevel++;
} }
} }
// Harmony transpiler: BuildTool_Dismantle_DeterminePreviews_Transpiler
// Target: BuildTool_Dismantle.DeterminePreviews
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Dismantle), nameof(BuildTool_Dismantle.DeterminePreviews))] [HarmonyPatch(typeof(BuildTool_Dismantle), nameof(BuildTool_Dismantle.DeterminePreviews))]
private static IEnumerable<CodeInstruction> BuildTool_Dismantle_DeterminePreviews_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Dismantle_DeterminePreviews_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -233,7 +235,9 @@ internal static class ImmediateBuildPatch
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: BuildTool_Click__OnTick_Transpiler
// Target: BuildTool_Click._OnTick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click._OnTick))] [HarmonyPatch(typeof(BuildTool_Click), nameof(BuildTool_Click._OnTick))]
private static IEnumerable<CodeInstruction> BuildTool_Click__OnTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_Click__OnTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+9 -3
View File
@@ -40,7 +40,9 @@ internal static class RenderingPatch
{ {
__instance.renderEntity = true; __instance.renderEntity = true;
} }
// Harmony transpiler: RaycastLogic_GameTick_Transpiler
// Target: RaycastLogic.GameTick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(RaycastLogic), nameof(RaycastLogic.GameTick))] [HarmonyPatch(typeof(RaycastLogic), nameof(RaycastLogic.GameTick))]
private static IEnumerable<CodeInstruction> RaycastLogic_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> RaycastLogic_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -156,7 +158,9 @@ internal static class RenderingPatch
_sunlight = GameMain.universeSimulator?.LocalStarSimulator()?.sunLight; _sunlight = GameMain.universeSimulator?.LocalStarSimulator()?.sunLight;
} }
} }
// Harmony transpiler: StarSimulator_LateUpdate_Transpiler
// Target: StarSimulator.LateUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(StarSimulator), nameof(StarSimulator.LateUpdate))] [HarmonyPatch(typeof(StarSimulator), nameof(StarSimulator.LateUpdate))]
private static IEnumerable<CodeInstruction> StarSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> StarSimulator_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -182,7 +186,9 @@ internal static class RenderingPatch
).Advance(1).Labels.Add(label2); ).Advance(1).Labels.Add(label2);
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: PlanetSimulator_LateRefresh_Transpiler
// Target: PlanetSimulator.LateRefresh
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlanetSimulator), nameof(PlanetSimulator.LateRefresh))] [HarmonyPatch(typeof(PlanetSimulator), nameof(PlanetSimulator.LateRefresh))]
private static IEnumerable<CodeInstruction> PlanetSimulator_LateRefresh_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlanetSimulator_LateRefresh_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+9 -3
View File
@@ -413,7 +413,9 @@ public class GamePatch : PatchImpl<GamePatch>
entry.indexText.text = (i + 1).ToString(); entry.indexText.text = (i + 1).ToString();
} }
} }
// Harmony transpiler: UILoadGameWindow_ReplaceSaveName_Transpiler
// Target: UILoadGameWindow.DoLoadSelectedGame, UILoadGameWindow.OnSelectedChange
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.DoLoadSelectedGame))] [HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.DoLoadSelectedGame))]
[HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.OnSelectedChange))] [HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.OnSelectedChange))]
@@ -426,7 +428,9 @@ public class GamePatch : PatchImpl<GamePatch>
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldfld, AccessTools.Field(typeof(UIGameSaveEntry), nameof(UIGameSaveEntry._saveName)))); matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldfld, AccessTools.Field(typeof(UIGameSaveEntry), nameof(UIGameSaveEntry._saveName))));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: GameSave_RemoveValidateOnLoad_Transpiler
// Target: GameSave.LoadCurrentGame, GameSave.LoadGameDesc, GameSave.ReadHeader, GameSave.ReadHeaderAndDescAndProperty, GameSave.SaveExist, GameSave.SavePath
// Fallback: Checks CodeMatcher.IsInvalid/IsValid and returns original instructions on mismatch.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadCurrentGame))] [HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadCurrentGame))]
[HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadGameDesc))] [HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadGameDesc))]
@@ -469,7 +473,9 @@ public class GamePatch : PatchImpl<GamePatch>
__instance.combatSettings = UIRoot.instance.galaxySelect.uiCombat.combatSettings; __instance.combatSettings = UIRoot.instance.galaxySelect.uiCombat.combatSettings;
} }
} }
// Harmony transpiler: GameData_Import_Transpiler
// Target: GameData.Import
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(GameData), nameof(GameData.Import))] [HarmonyPatch(typeof(GameData), nameof(GameData.Import))]
private static IEnumerable<CodeInstruction> GameData_Import_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> GameData_Import_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -28,6 +28,9 @@ internal class AutoConfigLogistics : PatchImpl<AutoConfigLogistics>
private class LimitAutoReplenishCount : PatchImpl<LimitAutoReplenishCount> private class LimitAutoReplenishCount : PatchImpl<LimitAutoReplenishCount>
{ {
// Harmony transpiler: PlanetFactory_StationAutoReplenishIfNeeded_Transpiler
// Target: PlanetFactory.EntityAutoReplenishIfNeeded, PlanetFactory.StationAutoReplenishIfNeeded
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.EntityAutoReplenishIfNeeded))] [HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.EntityAutoReplenishIfNeeded))]
[HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.StationAutoReplenishIfNeeded))] [HarmonyPatch(typeof(PlanetFactory), nameof(PlanetFactory.StationAutoReplenishIfNeeded))]
@@ -116,6 +119,9 @@ internal class AutoConfigLogistics : PatchImpl<AutoConfigLogistics>
internal class AutoConfigLogisticsSetDefaultRemoteLogicToStorage : PatchImpl<AutoConfigLogisticsSetDefaultRemoteLogicToStorage> internal class AutoConfigLogisticsSetDefaultRemoteLogicToStorage : PatchImpl<AutoConfigLogisticsSetDefaultRemoteLogicToStorage>
{ {
// Harmony transpiler: UIStationStorage_OnItemPickerReturn_Transpiler
// Target: UIControlPanelStationStorage.OnItemPickerReturn, UIStationStorage.OnItemPickerReturn
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnItemPickerReturn))] [HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnItemPickerReturn))]
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemPickerReturn))] [HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemPickerReturn))]
+9 -3
View File
@@ -286,7 +286,9 @@ internal class GreaterPowerUsageInLogistics : PatchImpl<GreaterPowerUsageInLogis
window._Close(); window._Close();
window.maxMiningSpeedSlider.maxValue = LogisticsConstants.MiningSpeedSliderMaxDefault; window.maxMiningSpeedSlider.maxValue = LogisticsConstants.MiningSpeedSliderMaxDefault;
} }
// Harmony transpiler: UIStationWindow_OnStationIdChange_Transpiler
// Target: UIStationWindow.OnStationIdChange
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnStationIdChange))] [HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnStationIdChange))]
private static IEnumerable<CodeInstruction> UIStationWindow_OnStationIdChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIStationWindow_OnStationIdChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -356,7 +358,9 @@ internal class GreaterPowerUsageInLogistics : PatchImpl<GreaterPowerUsageInLogis
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIStationWindow_OnMaxMiningSpeedChange_Transpiler
// Target: UIStationWindow.OnMaxMiningSpeedChange
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnMaxMiningSpeedChange))] [HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnMaxMiningSpeedChange))]
private static IEnumerable<CodeInstruction> UIStationWindow_OnMaxMiningSpeedChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIStationWindow_OnMaxMiningSpeedChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -386,7 +390,9 @@ internal class GreaterPowerUsageInLogistics : PatchImpl<GreaterPowerUsageInLogis
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIStationWindow_OnMaxChargePowerSliderValueChange_Transpiler
// Target: UIStationWindow.OnMaxChargePowerSliderValueChange
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnMaxChargePowerSliderValueChange))] [HarmonyPatch(typeof(UIStationWindow), nameof(UIStationWindow.OnMaxChargePowerSliderValueChange))]
private static IEnumerable<CodeInstruction> UIStationWindow_OnMaxChargePowerSliderValueChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIStationWindow_OnMaxChargePowerSliderValueChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -11,6 +11,9 @@ internal class AllowOverflowInLogistics : PatchImpl<AllowOverflowInLogistics>
private static bool _blueprintPasting; private static bool _blueprintPasting;
// Do not check for overflow when try to send hand items into storages // Do not check for overflow when try to send hand items into storages
// Harmony transpiler: UIStationStorage_OnItemIconMouseDown_Transpiler
// Target: UIControlPanelStationStorage.OnItemIconMouseDown, UIStationStorage.OnItemIconMouseDown
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnItemIconMouseDown))] [HarmonyPatch(typeof(UIControlPanelStationStorage), nameof(UIControlPanelStationStorage.OnItemIconMouseDown))]
[HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemIconMouseDown))] [HarmonyPatch(typeof(UIStationStorage), nameof(UIStationStorage.OnItemIconMouseDown))]
@@ -39,6 +42,9 @@ internal class AllowOverflowInLogistics : PatchImpl<AllowOverflowInLogistics>
} }
// Remove storage limit check // Remove storage limit check
// Harmony transpiler: PlanetTransport_SetStationStorage_Transpiler
// Target: PlanetTransport.SetStationStorage
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.SetStationStorage))] [HarmonyPatch(typeof(PlanetTransport), nameof(PlanetTransport.SetStationStorage))]
private static IEnumerable<CodeInstruction> PlanetTransport_SetStationStorage_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlanetTransport_SetStationStorage_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -87,7 +87,9 @@ internal class LogisticsConstrolPanelImprovement : PatchImpl<LogisticsConstrolPa
filterPanel.SetNewFilter(filter); filterPanel.SetNewFilter(filter);
return true; return true;
} }
// Harmony transpiler: UIGame_On_I_Switch_Transpiler
// Target: UIGame.On_I_Switch
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIGame), nameof(UIGame.On_I_Switch))] [HarmonyPatch(typeof(UIGame), nameof(UIGame.On_I_Switch))]
private static IEnumerable<CodeInstruction> UIGame_On_I_Switch_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIGame_On_I_Switch_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+33 -2
View File
@@ -21,6 +21,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
} }
// Check for noModifier while pressing hotkeys on build bar // Check for noModifier while pressing hotkeys on build bar
// Harmony transpiler: UIBuildMenu__OnUpdate_Transpiler
// Target: UIBuildMenu._OnUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIBuildMenu), nameof(UIBuildMenu._OnUpdate))] [HarmonyPatch(typeof(UIBuildMenu), nameof(UIBuildMenu._OnUpdate))]
private static IEnumerable<CodeInstruction> UIBuildMenu__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIBuildMenu__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -41,6 +44,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
} }
// Bring popup tip window to top layer // Bring popup tip window to top layer
// Harmony transpiler: UIButton_LateUpdate_Transpiler
// Target: UIButton.LateUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))] [HarmonyPatch(typeof(UIButton), nameof(UIButton.LateUpdate))]
private static IEnumerable<CodeInstruction> UIButton_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIButton_LateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -65,6 +71,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
} }
// Sort blueprint data when pasting // Sort blueprint data when pasting
// Harmony transpiler: BuildTool_BlueprintCopy_UseToPasteNow_Transpiler
// Target: BuildTool_BlueprintCopy.UseToPasteNow
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(BuildTool_BlueprintCopy), nameof(BuildTool_BlueprintCopy.UseToPasteNow))] [HarmonyPatch(typeof(BuildTool_BlueprintCopy), nameof(BuildTool_BlueprintCopy.UseToPasteNow))]
private static IEnumerable<CodeInstruction> BuildTool_BlueprintCopy_UseToPasteNow_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> BuildTool_BlueprintCopy_UseToPasteNow_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -91,6 +100,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
} }
// Increase maximum value of property realizing, 2000 -> 20000 // Increase maximum value of property realizing, 2000 -> 20000
// Harmony transpiler: UIProductEntry_UpdateUIElements_Transpiler
// Target: UIPropertyEntry.UpdateUIElements, UIPropertyEntry.OnRealizeButtonClick, UIPropertyEntry.OnInputValueEnd
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIPropertyEntry), nameof(UIPropertyEntry.UpdateUIElements))] [HarmonyPatch(typeof(UIPropertyEntry), nameof(UIPropertyEntry.UpdateUIElements))]
[HarmonyPatch(typeof(UIPropertyEntry), nameof(UIPropertyEntry.OnRealizeButtonClick))] [HarmonyPatch(typeof(UIPropertyEntry), nameof(UIPropertyEntry.OnRealizeButtonClick))]
@@ -104,7 +116,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
matcher.Repeat(m => { m.SetAndAdvance(OpCodes.Ldc_I4, 20000); }); matcher.Repeat(m => { m.SetAndAdvance(OpCodes.Ldc_I4, 20000); });
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIProductEntry_OnInputValueEnd_Transpiler
// Target: UIPropertyEntry.OnInputValueEnd
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIPropertyEntry), nameof(UIPropertyEntry.OnInputValueEnd))] [HarmonyPatch(typeof(UIPropertyEntry), nameof(UIPropertyEntry.OnInputValueEnd))]
private static IEnumerable<CodeInstruction> UIProductEntry_OnInputValueEnd_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIProductEntry_OnInputValueEnd_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -118,6 +132,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
} }
// Increase capacity of player order queue, 16 -> 128 // Increase capacity of player order queue, 16 -> 128
// Harmony transpiler: PlayerOrder_Constructor_Transpiler
// Target: PlayerOrder..ctor
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerOrder), MethodType.Constructor, typeof(Player))] [HarmonyPatch(typeof(PlayerOrder), MethodType.Constructor, typeof(Player))]
private static IEnumerable<CodeInstruction> PlayerOrder_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlayerOrder_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -131,6 +148,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
} }
// Increase Player Command Queue from 16 to 128 // Increase Player Command Queue from 16 to 128
// Harmony transpiler: PlayerOrder_ExtendCount_Transpiler
// Target: PlayerOrder._trimEnd, PlayerOrder.Enqueue
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerOrder), nameof(PlayerOrder._trimEnd))] [HarmonyPatch(typeof(PlayerOrder), nameof(PlayerOrder._trimEnd))]
[HarmonyPatch(typeof(PlayerOrder), nameof(PlayerOrder.Enqueue))] [HarmonyPatch(typeof(PlayerOrder), nameof(PlayerOrder.Enqueue))]
@@ -145,6 +165,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
} }
// Allow F11 in star map // Allow F11 in star map
// Harmony transpiler: UIGame__OnLateUpdate_Transpiler
// Target: UIGame._OnLateUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIGame), nameof(UIGame._OnLateUpdate))] [HarmonyPatch(typeof(UIGame), nameof(UIGame._OnLateUpdate))]
private static IEnumerable<CodeInstruction> UIGame__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIGame__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -173,6 +196,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
} }
// Fix crash in NeutronStarHandler.OnEnable() // Fix crash in NeutronStarHandler.OnEnable()
// Harmony transpiler: NeutronStarHandler_OnEnable_Transpiler
// Target: NeutronStarHandler.OnEnable
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(NeutronStarHandler), nameof(NeutronStarHandler.OnEnable))] [HarmonyPatch(typeof(NeutronStarHandler), nameof(NeutronStarHandler.OnEnable))]
private static IEnumerable<CodeInstruction> NeutronStarHandler_OnEnable_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> NeutronStarHandler_OnEnable_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -193,6 +219,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
} }
// Disable rendering when Player is hidden (Press F11 twice) // Disable rendering when Player is hidden (Press F11 twice)
// Harmony transpiler: GameLogic_LateUpdate_Transpiler
// Target: GameLogic.LateUpdate, GameLogic.Draw, GameLogic.DrawPost
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.LateUpdate))] [HarmonyPatch(typeof(GameLogic), nameof(GameLogic.LateUpdate))]
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.Draw))] [HarmonyPatch(typeof(GameLogic), nameof(GameLogic.Draw))]
@@ -273,7 +302,9 @@ public class PersistPatch : PatchImpl<PersistPatch>
rcode = -1; rcode = -1;
Functions.UIFunctions.AddClusterUploadResult(rcode, __instance.uploadRequest == null ? 0f : (float)__instance.uploadRequest.reqTime); Functions.UIFunctions.AddClusterUploadResult(rcode, __instance.uploadRequest == null ? 0f : (float)__instance.uploadRequest.reqTime);
} }
// Harmony transpiler: MilkyWayCache_LoadTopTenPlayerData_Transpiler
// Target: MilkyWayCache.LoadTopTenPlayerData
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(MilkyWayCache), nameof(MilkyWayCache.LoadTopTenPlayerData))] [HarmonyPatch(typeof(MilkyWayCache), nameof(MilkyWayCache.LoadTopTenPlayerData))]
private static IEnumerable<CodeInstruction> MilkyWayCache_LoadTopTenPlayerData_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> MilkyWayCache_LoadTopTenPlayerData_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+9 -2
View File
@@ -27,6 +27,9 @@ public static class PlanetPatch
public class PlayerActionsInGlobeView : PatchImpl<PlayerActionsInGlobeView> public class PlayerActionsInGlobeView : PatchImpl<PlayerActionsInGlobeView>
{ {
// Harmony transpiler: VFInput_UpdateGameStates_Transpiler
// Target: VFInput.UpdateGameStates
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(VFInput), nameof(VFInput.UpdateGameStates))] [HarmonyPatch(typeof(VFInput), nameof(VFInput.UpdateGameStates))]
private static IEnumerable<CodeInstruction> VFInput_UpdateGameStates_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> VFInput_UpdateGameStates_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -49,7 +52,9 @@ public static class PlanetPatch
}); });
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: PlayerController_GetInput_Transpiler
// Target: PlayerController.GetInput
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GetInput))] [HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GetInput))]
private static IEnumerable<CodeInstruction> PlayerController_GetInput_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlayerController_GetInput_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -62,7 +67,9 @@ public static class PlanetPatch
).Advance(1).Opcode = OpCodes.Ldc_I4_4; ).Advance(1).Opcode = OpCodes.Ldc_I4_4;
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: PlayerAction_Rts_GameTick_Transpiler
// Target: PlayerAction_Rts.GameTick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerAction_Rts), nameof(PlayerAction_Rts.GameTick))] [HarmonyPatch(typeof(PlayerAction_Rts), nameof(PlayerAction_Rts.GameTick))]
private static IEnumerable<CodeInstruction> PlayerAction_Rts_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlayerAction_Rts_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+24 -6
View File
@@ -80,8 +80,9 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
ShortcutKeysForStarsName.Enable(false); ShortcutKeysForStarsName.Enable(false);
AutoNavigation.Enable(false); AutoNavigation.Enable(false);
} }
// Harmony transpiler: UIStarmapStar__OnLateUpdate_Transpiler
// Target: UIStarmapStar._OnLateUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIStarmapStar), nameof(UIStarmapStar._OnLateUpdate))] [HarmonyPatch(typeof(UIStarmapStar), nameof(UIStarmapStar._OnLateUpdate))]
private static IEnumerable<CodeInstruction> UIStarmapStar__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIStarmapStar__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -126,6 +127,9 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
private class EnhancedMechaForgeCountControl : PatchImpl<EnhancedMechaForgeCountControl> private class EnhancedMechaForgeCountControl : PatchImpl<EnhancedMechaForgeCountControl>
{ {
// Harmony transpiler: UIReplicatorWindow_OnOkButtonClick_Transpiler
// Target: UIReplicatorWindow.OnOkButtonClick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIReplicatorWindow), nameof(UIReplicatorWindow.OnOkButtonClick))] [HarmonyPatch(typeof(UIReplicatorWindow), nameof(UIReplicatorWindow.OnOkButtonClick))]
private static IEnumerable<CodeInstruction> UIReplicatorWindow_OnOkButtonClick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIReplicatorWindow_OnOkButtonClick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -137,7 +141,9 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 1000)); matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, 1000));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIReplicatorWindow_OnPlusButtonClick_Transpiler
// Target: UIReplicatorWindow.OnPlusButtonClick, UIReplicatorWindow.OnMinusButtonClick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIReplicatorWindow), nameof(UIReplicatorWindow.OnPlusButtonClick))] [HarmonyPatch(typeof(UIReplicatorWindow), nameof(UIReplicatorWindow.OnPlusButtonClick))]
[HarmonyPatch(typeof(UIReplicatorWindow), nameof(UIReplicatorWindow.OnMinusButtonClick))] [HarmonyPatch(typeof(UIReplicatorWindow), nameof(UIReplicatorWindow.OnMinusButtonClick))]
@@ -177,6 +183,9 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
private class HideTipsForSandsChanges : PatchImpl<HideTipsForSandsChanges> private class HideTipsForSandsChanges : PatchImpl<HideTipsForSandsChanges>
{ {
// Harmony transpiler: Player_SetSandCount_Transpiler
// Target: Player.SetSandCount
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(Player), nameof(Player.SetSandCount))] [HarmonyPatch(typeof(Player), nameof(Player.SetSandCount))]
private static IEnumerable<CodeInstruction> Player_SetSandCount_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> Player_SetSandCount_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -223,6 +232,9 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
ShowAllStarsNameStatus = 0; ShowAllStarsNameStatus = 0;
} }
/* /*
// Harmony transpiler: UIStarmapPlanet__OnLateUpdate_Transpiler
// Target: UIStarmapPlanet._OnLateUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet._OnLateUpdate))] [HarmonyPatch(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet._OnLateUpdate))]
private static IEnumerable<CodeInstruction> UIStarmapPlanet__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIStarmapPlanet__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -270,7 +282,9 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIStarmapDFHive__OnLateUpdate_Transpiler
// Target: UIStarmapDFHive._OnLateUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive._OnLateUpdate))] [HarmonyPatch(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive._OnLateUpdate))]
private static IEnumerable<CodeInstruction> UIStarmapDFHive__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIStarmapDFHive__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -360,7 +374,9 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
} }
return movementStateChanged; return movementStateChanged;
} }
// Harmony transpiler: PlayerController_GameTick_Transpiler
// Target: PlayerController.GameTick
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GameTick))] [HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GameTick))]
private static IEnumerable<CodeInstruction> PlayerController_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> PlayerController_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -559,7 +575,9 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: VFInput_sailSpeedUp_Transpiler
// Target: VFInput._sailSpeedUp (getter)
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(VFInput), nameof(VFInput._sailSpeedUp), MethodType.Getter)] [HarmonyPatch(typeof(VFInput), nameof(VFInput._sailSpeedUp), MethodType.Getter)]
private static IEnumerable<CodeInstruction> VFInput_sailSpeedUp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> VFInput_sailSpeedUp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
+3
View File
@@ -263,6 +263,9 @@ public static class TechPatch
private class BatchBuyoutTech : PatchImpl<BatchBuyoutTech> private class BatchBuyoutTech : PatchImpl<BatchBuyoutTech>
{ {
// Harmony transpiler: UITechNode_UpdateInfoDynamic_Transpiler
// Target: UITechNode.UpdateInfoDynamic
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UITechNode), nameof(UITechNode.UpdateInfoDynamic))] [HarmonyPatch(typeof(UITechNode), nameof(UITechNode.UpdateInfoDynamic))]
private static IEnumerable<CodeInstruction> UITechNode_UpdateInfoDynamic_Transpiler(IEnumerable<CodeInstruction> instructions) private static IEnumerable<CodeInstruction> UITechNode_UpdateInfoDynamic_Transpiler(IEnumerable<CodeInstruction> instructions)
@@ -57,6 +57,9 @@ public static class GalaxyGenSettingsPatch
private static class Patch private static class Patch
{ {
// Harmony transpiler: UIGalaxySelect_OnStarCountSliderValueChange_Transpiler
// Target: UIGalaxySelect.OnStarCountSliderValueChange
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect.OnStarCountSliderValueChange))] [HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect.OnStarCountSliderValueChange))]
private static IEnumerable<CodeInstruction> UIGalaxySelect_OnStarCountSliderValueChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIGalaxySelect_OnStarCountSliderValueChange_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -94,7 +97,9 @@ public static class GalaxyGenSettingsPatch
GameFlatten = UniverseGenConstants.DefaultFlatten; GameFlatten = UniverseGenConstants.DefaultFlatten;
} }
} }
// Harmony transpiler: GalaxyData_Constructor_Transpiler
// Target: GalaxyData..ctor
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(GalaxyData), MethodType.Constructor)] [HarmonyPatch(typeof(GalaxyData), MethodType.Constructor)]
private static IEnumerable<CodeInstruction> GalaxyData_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> GalaxyData_Constructor_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -107,7 +112,9 @@ public static class GalaxyGenSettingsPatch
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, UniverseGenConstants.ExpandedGalaxyCapacity)); matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, UniverseGenConstants.ExpandedGalaxyCapacity));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: SectorModel_CreateGalaxyAstroBuffer_Transpiler
// Target: SectorModel.CreateGalaxyAstroBuffer, SpaceColliderLogic.UpdateCollidersPose
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(SectorModel), nameof(SectorModel.CreateGalaxyAstroBuffer))] [HarmonyPatch(typeof(SectorModel), nameof(SectorModel.CreateGalaxyAstroBuffer))]
[HarmonyPatch(typeof(SpaceColliderLogic), nameof(SpaceColliderLogic.UpdateCollidersPose))] [HarmonyPatch(typeof(SpaceColliderLogic), nameof(SpaceColliderLogic.UpdateCollidersPose))]
@@ -121,7 +128,9 @@ public static class GalaxyGenSettingsPatch
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, UniverseGenConstants.ExpandedSectorCapacity)); matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldc_I4, UniverseGenConstants.ExpandedSectorCapacity));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UniverseGen_CreateGalaxy_Transpiler
// Target: UniverseGen.CreateGalaxy
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UniverseGen), nameof(UniverseGen.CreateGalaxy))] [HarmonyPatch(typeof(UniverseGen), nameof(UniverseGen.CreateGalaxy))]
private static IEnumerable<CodeInstruction> UniverseGen_CreateGalaxy_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UniverseGen_CreateGalaxy_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -152,6 +161,9 @@ public static class GalaxyGenSettingsPatch
/* Patch `rand() * (maxStepLen - minStepLen) + minDist` to `rand() * (maxStepLen - minStepLen) + minStepLen`, /* Patch `rand() * (maxStepLen - minStepLen) + minDist` to `rand() * (maxStepLen - minStepLen) + minStepLen`,
this should be a bugged line in original game code. */ this should be a bugged line in original game code. */
// Harmony transpiler: UniverseGen_RandomPoses_Transpiler
// Target: UniverseGen.RandomPoses
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UniverseGen), nameof(UniverseGen.RandomPoses))] [HarmonyPatch(typeof(UniverseGen), nameof(UniverseGen.RandomPoses))]
private static IEnumerable<CodeInstruction> UniverseGen_RandomPoses_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UniverseGen_RandomPoses_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -164,7 +176,9 @@ public static class GalaxyGenSettingsPatch
matcher.Repeat(m => m.Advance(1).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldarg_3))); matcher.Repeat(m => m.Advance(1).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Ldarg_3)));
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIVirtualStarmap__OnLateUpdate_Transpiler
// Target: UIVirtualStarmap._OnLateUpdate
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIVirtualStarmap), nameof(UIVirtualStarmap._OnLateUpdate))] [HarmonyPatch(typeof(UIVirtualStarmap), nameof(UIVirtualStarmap._OnLateUpdate))]
private static IEnumerable<CodeInstruction> UIVirtualStarmap__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIVirtualStarmap__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -193,7 +207,9 @@ public static class GalaxyGenSettingsPatch
); );
return matcher.InstructionEnumeration(); return matcher.InstructionEnumeration();
} }
// Harmony transpiler: UIGalaxySelect_UpdateUIDisplay_Transpiler
// Target: UIGalaxySelect.UpdateUIDisplay
// Fallback: None — patch will fail loudly if the target method body changes.
[HarmonyTranspiler] [HarmonyTranspiler]
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect.UpdateUIDisplay))] [HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect.UpdateUIDisplay))]
private static IEnumerable<CodeInstruction> UIGalaxySelect_UpdateUIDisplay_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) private static IEnumerable<CodeInstruction> UIGalaxySelect_UpdateUIDisplay_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
@@ -0,0 +1,334 @@
# Phase 5 — Transpiler Robustness & Code Quality Gates
> **For agentic workers:** REQUIRED SUB-SKILL: superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Goal:** Make Harmony transpilers easier to diagnose on game updates, consolidate mod-compatibility reflection behind a single helper API, and add build-level quality gates.
**Architecture:**
- A small `TranspilerGuard` helper standardizes the `CodeMatcher.IsInvalid` fallback pattern so transpilers can return original instructions and log a warning instead of producing invalid IL.
- A public `ModCompatHelper` in `UXAssist.Common.ModCompat` centralizes BepInEx plugin detection, external-type resolution, and member lookup; wrappers and DysonSphere reflection consumers migrate to it.
- A root `.editorconfig`, stricter MSBuild warning settings, and a GitHub Actions build workflow provide guardrails without blocking the existing obsolete-warning surface.
**Tech Stack:** C# / .NET Framework 4.7.2 / BepInEx 5 / HarmonyLib / MSBuild / GitHub Actions
---
## Task 1: Transpiler comments & fallback guards
**Files:**
- Create: `UXAssist/Common/Patching/TranspilerGuard.cs`
- Modify: all files listed in `docs/TranspilerAudit.md` (26 files, 115 transpilers)
- [ ] **Step 1.1: Create `TranspilerGuard`**
```csharp
using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Logging;
using HarmonyLib;
namespace UXAssist.Common.Patching;
public static class TranspilerGuard
{
public static IEnumerable<CodeInstruction> Finish(
this CodeMatcher matcher,
IEnumerable<CodeInstruction> originalInstructions,
ManualLogSource logger,
string transpilerName)
{
if (matcher.IsInvalid)
{
logger?.LogWarning($"Transpiler '{transpilerName}' failed to match; returning original instructions.");
return originalInstructions;
}
return matcher.InstructionEnumeration();
}
}
```
- [ ] **Step 1.2: Add standardized header comments to every transpiler**
For each transpiler method, insert a comment block immediately above the method:
```csharp
// Harmony transpiler target: <Full.TypeName>.<MethodName>(<signature>)
// Purpose: <one-line description>
// Fragile matches: <magic constants / local slots / field names>
// Fallback: <returns original instructions via TranspilerGuard if matcher becomes invalid / or "None — patch will fail loudly if target method changes">
```
Use the audit in `docs/TranspilerAudit.md` (produced by exploration) to fill Fragile matches.
- [ ] **Step 1.3: Add fallback guards where missing**
For transpilers that currently call `matcher.InstructionEnumeration()` without checking `IsInvalid`, change the last lines to:
```csharp
return matcher.Finish(instructions, UXAssist.Logger, nameof(<TranspilerMethodName>));
```
Preserve the return type `IEnumerable<CodeInstruction>`. Where a method already checks `matcher.IsInvalid`/`IsValid`, keep the existing logic and only add the comment.
- [ ] **Step 1.4: Build after comment/guard pass**
Run: `dotnet build DSP_Mods.sln -c Release`
Expected: 0 errors, 0 new warnings.
---
## Task 2: Centralize mod-compatibility reflection
**Files:**
- Create: `UXAssist/Common/ModCompat/ModCompatHelper.cs`
- Create: `UXAssist/Common/Utils/DysonSphereReflection.cs`
- Modify: `UXAssist/ModsCompat/AuxilaryfunctionWrapper.cs`
- Modify: `UXAssist/ModsCompat/BlueprintTweaks.cs`
- Modify: `UXAssist/ModsCompat/BulletTimeWrapper.cs`
- Modify: `UXAssist/ModsCompat/CommonAPIWrapper.cs`
- Modify: `UXAssist/ModsCompat/PlanetVeinUtilization.cs`
- Modify: `UXAssist/Patches/DysonSpherePatch.cs`
- Modify: `CheatEnabler/Functions/DysonSphere/ShellCompletionFunctions.cs`
- Modify: `CheatEnabler/Functions/DysonSphere/FrameRemovalFunctions.cs`
- [ ] **Step 2.1: Create `ModCompatHelper`**
```csharp
using System;
using System.Reflection;
using BepInEx;
using BepInEx.Bootstrap;
namespace UXAssist.Common.ModCompat;
public static class ModCompatHelper
{
public static bool TryGetLoadedPluginInfo(string guid, out PluginInfo pluginInfo)
=> Chainloader.PluginInfos.TryGetValue(guid, out pluginInfo) && pluginInfo != null;
public static bool TryGetPluginType(PluginInfo pluginInfo, string typeName, out Type type)
{
type = null;
if (pluginInfo?.Instance == null) return false;
try
{
type = pluginInfo.Instance.GetType().Assembly.GetType(typeName, throwOnError: false);
}
catch { /* ignored */ }
return type != null;
}
public static bool TryGetPluginType(string guid, string typeName, out Type type)
{
type = null;
return TryGetLoadedPluginInfo(guid, out var pluginInfo) && TryGetPluginType(pluginInfo, typeName, out type);
}
public static bool TryGetFieldValue<T>(Type type, string fieldName, object instance, out T value)
{
value = default;
if (type == null) return false;
var field = AccessTools.Field(type, fieldName);
if (field == null) return false;
try
{
var result = field.GetValue(instance);
if (result is T t)
{
value = t;
return true;
}
}
catch { /* ignored */ }
return false;
}
public static bool TryGetMethod(Type type, string methodName, out MethodInfo method)
{
method = null;
if (type == null) return false;
method = AccessTools.Method(type, methodName);
return method != null;
}
public static bool TryGetPropertySetter(Type type, string propertyName, out MethodInfo setter)
{
setter = null;
if (type == null) return false;
var property = AccessTools.Property(type, propertyName);
if (property == null) return false;
setter = property.GetSetMethod(nonPublic: true);
return setter != null;
}
}
```
- [ ] **Step 2.2: Refactor mod-compat wrappers to use `ModCompatHelper`**
Replace the duplicated `Chainloader.PluginInfos.TryGetValue` + `pluginInfo.Instance.GetType().Assembly.GetType(...)` + `AccessTools.Field/Method/PropertySetter` patterns with calls to `ModCompatHelper`. Keep the existing public static fields (e.g., `HasBulletTime`, `ShowStationInfo`) and init timing (`Start`/`Run`).
- [ ] **Step 2.3: Create `DysonSphereReflection`**
```csharp
using System.Reflection;
using HarmonyLib;
namespace UXAssist.Common.Utils;
public static class DysonSphereReflection
{
private static readonly FieldInfo TotalNodeSpField = AccessTools.Field(typeof(DysonSphereLayer), "totalNodeSP");
private static readonly FieldInfo TotalFrameSpField = AccessTools.Field(typeof(DysonSphereLayer), "totalFrameSP");
private static readonly FieldInfo TotalCpField = AccessTools.Field(typeof(DysonSphereLayer), "totalCP");
public static long? GetTotalNodeSP(DysonSphereLayer layer)
=> layer != null && TotalNodeSpField != null ? (long?)TotalNodeSpField.GetValue(layer) : null;
public static long? GetTotalFrameSP(DysonSphereLayer layer)
=> layer != null && TotalFrameSpField != null ? (long?)TotalFrameSpField.GetValue(layer) : null;
public static long? GetTotalCP(DysonSphereLayer layer)
=> layer != null && TotalCpField != null ? (long?)TotalCpField.GetValue(layer) : null;
public static bool IsAvailable => TotalNodeSpField != null && TotalFrameSpField != null && TotalCpField != null;
}
```
- [ ] **Step 2.4: Migrate DysonSphere field consumers**
Update `UXAssist/Patches/DysonSpherePatch.cs`, `CheatEnabler/Functions/DysonSphere/ShellCompletionFunctions.cs`, and `CheatEnabler/Functions/DysonSphere/FrameRemovalFunctions.cs` to call `DysonSphereReflection` instead of resolving the fields locally. Remove duplicate `AccessTools.Field` declarations.
- [ ] **Step 2.5: Build after reflection refactor**
Run: `dotnet build DSP_Mods.sln -c Release`
Expected: 0 errors, 0 new warnings.
---
## Task 3: Code quality gates
**Files:**
- Create: `.editorconfig`
- Modify: `Directory.Build.props`
- Create: `.github/workflows/build.yml`
- [ ] **Step 3.1: Add root `.editorconfig`**
```ini
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = crlf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{cs,vb}]
# Suggestion-only so existing code does not break the build
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
dotnet_style_readonly_field = true:suggestion
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
```
- [ ] **Step 3.2: Harden `Directory.Build.props`**
Add to the existing `<PropertyGroup>` (do not remove existing properties):
```xml
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>0618</NoWarn>
<Nullable>disable</Nullable>
<AnalysisLevel>none</AnalysisLevel>
<EnforceCodeStyleInBuild>false</EnforceCodeStyleInBuild>
```
`NoWarn>0618` suppresses the expected `[Obsolete]` usage warnings from the old `Util` facade; any new warning class will fail the build.
- [ ] **Step 3.3: Add GitHub Actions build workflow**
Create `.github/workflows/build.yml`:
```yaml
name: Build
on:
push:
branches: [main, master, refactor/*]
pull_request:
branches: [main, master]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore
run: dotnet restore DSP_Mods.sln
- name: Build Release
run: dotnet build DSP_Mods.sln -c Release --no-restore
- name: Package mods
run: dotnet build -t:ZipMod -c Release --no-restore
```
- [ ] **Step 3.4: Verify quality gates**
Run:
```bash
dotnet clean DSP_Mods.sln
dotnet build DSP_Mods.sln -c Release
```
Expected: 0 errors, 0 warnings.
Run:
```bash
dotnet build -t:ZipMod -c Release
```
Expected: All zips produced; no errors.
---
## Task 4: Documentation & checkpoint
**Files:**
- Modify: `AGENTS.md`
- [ ] **Step 4.1: Update `AGENTS.md`**
Append a "Phase 5 — Transpiler Robustness & Code Quality Gates" subsection under the project overview describing:
- `UXAssist.Common.Patching.TranspilerGuard`
- `UXAssist.Common.ModCompat.ModCompatHelper`
- `UXAssist.Common.Utils.DysonSphereReflection`
- `.editorconfig`, `TreatWarningsAsErrors`, and the GitHub Actions build workflow.
- [ ] **Step 4.2: Tag checkpoint**
```bash
git add -A
git commit -m "refactor: phase 5 transpiler robustness, mod-compat helpers, and build quality gates"
git tag refactor-phase5
```
Expected: tag `refactor-phase5` exists on the new commit and build remains clean.
File diff suppressed because it is too large Load Diff