feat: add 'hide sorters too' sub-option for do-not-render feature

When enabled (with the parent feature on), sorters are also hidden,
leaving only belts and their cargo visible. Hidden sorters also become
click-through so clicks reach the belts beneath them.

- RenderingPatch: gate InserterRenderer.Render and the RaycastLogic
  inserter exemption on a new HideSorters flag
- FactoryPatch/UXAssist/FactoryConfigProvider: new
  DoNotRenderEntitiesHideSorters config wired to the flag
- UIConfigWindow/I18NKeys: indented sub-checkbox + EN/zh label
- README/CHANGELOG: document the sub-option; bump to 1.5.9
This commit is contained in:
FyisFe
2026-07-22 14:21:05 +08:00
committed by soarqin
parent 82365b3d16
commit a48ae5ad96
9 changed files with 38 additions and 3 deletions
+3
View File
@@ -25,6 +25,7 @@ public static class FactoryPatch
public static ConfigEntry<bool> QuickBuildAndDismantleLabsEnabled;
public static ConfigEntry<bool> ProtectVeinsFromExhaustionEnabled;
public static ConfigEntry<bool> DoNotRenderEntitiesEnabled;
public static ConfigEntry<bool> DoNotRenderEntitiesHideSortersEnabled;
public static ConfigEntry<bool> DragBuildPowerPolesEnabled;
public static ConfigEntry<bool> DragBuildPowerPolesAlternatelyEnabled;
public static ConfigEntry<bool> AutoConstructButtonEnabled;
@@ -112,6 +113,7 @@ public static class FactoryPatch
QuickBuildAndDismantleLabsEnabled.SettingChanged += (_, _) => FactoryBuildPatches.QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value);
ProtectVeinsFromExhaustionEnabled.SettingChanged += (_, _) => VeinProtectionPatch.ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value);
DoNotRenderEntitiesEnabled.SettingChanged += (_, _) => RenderingPatch.DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
DoNotRenderEntitiesHideSortersEnabled.SettingChanged += (_, _) => RenderingPatch.DoNotRenderEntities.HideSorters = DoNotRenderEntitiesHideSortersEnabled.Value;
DragBuildPowerPolesEnabled.SettingChanged += (_, _) => BuildToolPatch.DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
DragBuildPowerPolesAlternatelyEnabled.SettingChanged += (_, _) => BuildToolPatch.DragBuildPowerPoles.AlternatelyChanged();
AutoConstructButtonEnabled.SettingChanged += (_, _) => FactoryBuildPatches.AutoConstructPatch.Enable(AutoConstructButtonEnabled.Value);
@@ -147,6 +149,7 @@ public static class FactoryPatch
FactoryBuildPatches.QuickBuildAndDismantleLab.Enable(QuickBuildAndDismantleLabsEnabled.Value);
VeinProtectionPatch.ProtectVeinsFromExhaustion.Enable(ProtectVeinsFromExhaustionEnabled.Value);
RenderingPatch.DoNotRenderEntities.Enable(DoNotRenderEntitiesEnabled.Value);
RenderingPatch.DoNotRenderEntities.HideSorters = DoNotRenderEntitiesHideSortersEnabled.Value;
BuildToolPatch.DragBuildPowerPoles.Enable(DragBuildPowerPolesEnabled.Value);
FactoryBuildPatches.AutoConstructPatch.Enable(AutoConstructButtonEnabled.Value);
BeltSignalPatch.BeltSignalsForBuyOut.Enable(BeltSignalsForBuyOutEnabled.Value);
+10 -1
View File
@@ -19,6 +19,8 @@ internal static class RenderingPatch
internal class DoNotRenderEntities : PatchImpl<DoNotRenderEntities>
{
public static bool HideSorters;
[HarmonyPrefix]
[HarmonyPatch(typeof(ObjectRenderer), nameof(ObjectRenderer.Render))]
[HarmonyPatch(typeof(DynamicRenderer), nameof(DynamicRenderer.Render))]
@@ -27,6 +29,13 @@ internal static class RenderingPatch
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(InserterRenderer), nameof(InserterRenderer.Render))]
private static bool InserterRenderer_Render_Prefix()
{
return !HideSorters;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LabRenderer), nameof(LabRenderer.Render))]
private static bool LabRenderer_Render_Prefix()
@@ -69,7 +78,7 @@ internal static class RenderingPatch
new CodeInstruction(OpCodes.Ldarg_0),
new CodeInstruction(OpCodes.Ldloc_S, 33),
new CodeInstruction(OpCodes.Ldloc_S, 35),
Transpilers.EmitDelegate((RaycastLogic l, ColliderData[] colliderPool, int j) => l.factory.entityPool[colliderPool[j].objId].inserterId > 0),
Transpilers.EmitDelegate((RaycastLogic l, ColliderData[] colliderPool, int j) => !HideSorters && l.factory.entityPool[colliderPool[j].objId].inserterId > 0),
new CodeInstruction(OpCodes.Brfalse, branch1)
);
matcher.Labels.Add(branch2);