mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-22 18:19:02 +08:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74baa2428e | ||
|
|
9fb75f70b8 | ||
|
|
4c0ad9c27f | ||
|
|
5e6cfe7fa5 | ||
|
|
a1ba5266bb | ||
|
|
ba2648a3e3 | ||
|
|
325536fc79 | ||
|
|
ec00212669 | ||
|
|
64a23e9772 |
No files matched your search
@@ -25,6 +25,7 @@
|
|||||||
- Keep temporary verification projects under the mod's excluded root `obj/` directory. Remove abandoned generated outputs when their source project is gone so the SDK source glob cannot compile them into the mod.
|
- Keep temporary verification projects under the mod's excluded root `obj/` directory. Remove abandoned generated outputs when their source project is gone so the SDK source glob cannot compile them into the mod.
|
||||||
- Refresh game references explicitly with `dotnet build UpdateGameDlls/UpdateGameDlls.csproj`; the script publicizes installed DLLs in staging and compares generated content hashes so checkout timestamps cannot hide game updates. Missing DSP or the publicizer is a warning, not a build failure. If `assembly-publicizer` requires an unavailable .NET runtime, retry with process-local `DOTNET_ROLL_FORWARD=Major` rather than changing global runtime settings. Verify discovery warnings against the actual configured library directories and original managed DLLs; absence from the VDF `apps` list alone does not establish that DSP is uninstalled.
|
- Refresh game references explicitly with `dotnet build UpdateGameDlls/UpdateGameDlls.csproj`; the script publicizes installed DLLs in staging and compares generated content hashes so checkout timestamps cannot hide game updates. Missing DSP or the publicizer is a warning, not a build failure. If `assembly-publicizer` requires an unavailable .NET runtime, retry with process-local `DOTNET_ROLL_FORWARD=Major` rather than changing global runtime settings. Verify discovery warnings against the actual configured library directories and original managed DLLs; absence from the VDF `apps` list alone does not establish that DSP is uninstalled.
|
||||||
- Package main mods with `dotnet build -t:ZipMod -c Release`; package preloaders with `dotnet build -t:CopyToParentPackage -c Release`. The mod `.csproj` `<Version>` is the single version source and packaging synchronizes `package/manifest.json`. Keep the latest English and Chinese changelog headings and notes aligned with `<Version>`; preserve existing unreleased notes and historical entries. Describe relevant triggers when documenting fixes to previously released behavior.
|
- Package main mods with `dotnet build -t:ZipMod -c Release`; package preloaders with `dotnet build -t:CopyToParentPackage -c Release`. The mod `.csproj` `<Version>` is the single version source and packaging synchronizes `package/manifest.json`. Keep the latest English and Chinese changelog headings and notes aligned with `<Version>`; preserve existing unreleased notes and historical entries. Describe relevant triggers when documenting fixes to previously released behavior.
|
||||||
|
- When delivering UXAssist changes for local use in r2modman (R2), run `ZipMod`, verify that the zip contains the current DLL, manifest, icon, README, and changelog, and report the zip's full Windows path.
|
||||||
- Treat warnings as errors except the intentional obsolete API warning `0618`; do not weaken this policy to hide new warnings.
|
- Treat warnings as errors except the intentional obsolete API warning `0618`; do not weaken this policy to hide new warnings.
|
||||||
- Export Thunderstore package icons as 256x256 PNG files and verify their format and dimensions. For circular exports, apply an antialiased alpha mask to the approved artwork instead of regenerating it; preserve RGB pixels and make the exterior fully transparent. Convey the mod's function through familiar, conventionally oriented symbols rather than lettering. Preserve DSP motifs and consistent materials across related mod icons. During localized edits, preserve all unrequested geometry, placement and styling from the chosen reference; do not redesign surrounding structures to produce an overlap. Use clear foreground occlusion for intersecting forms without losing the main symbol's silhouette, and check contrast in 64x64 and 32x32 side-by-side previews. Keep unselected icon candidates under `artifacts/`, outside release package directories.
|
- Export Thunderstore package icons as 256x256 PNG files and verify their format and dimensions. For circular exports, apply an antialiased alpha mask to the approved artwork instead of regenerating it; preserve RGB pixels and make the exterior fully transparent. Convey the mod's function through familiar, conventionally oriented symbols rather than lettering. Preserve DSP motifs and consistent materials across related mod icons. During localized edits, preserve all unrequested geometry, placement and styling from the chosen reference; do not redesign surrounding structures to produce an overlap. Use clear foreground occlusion for intersecting forms without losing the main symbol's silhouette, and check contrast in 64x64 and 32x32 side-by-side previews. Keep unselected icon candidates under `artifacts/`, outside release package directories.
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
## Changlog
|
## Changlog
|
||||||
|
|
||||||
* 2.4.8
|
* 2.4.8
|
||||||
|
* Require UXAssist 1.6.3 or later for the shared production API. Older versions are rejected before initialization instead of failing while loading belt-signal features.
|
||||||
* `Mecha and Drones/Fleets invincible`: Fix mecha HP and energy shield protection failing when enabled after taking damage, and restore protection for space fleets.
|
* `Mecha and Drones/Fleets invincible`: Fix mecha HP and energy shield protection failing when enabled after taking damage, and restore protection for space fleets.
|
||||||
* `Finish build immediately`: Fix possible errors when starting a new game. Construction begins after the opening cutscene ends or is skipped.
|
* `Finish build immediately`: Fix possible errors when starting a new game. Construction begins after the opening cutscene ends or is skipped.
|
||||||
* `Belt signal item generation`:
|
* `Belt signal item generation`:
|
||||||
@@ -208,6 +209,7 @@
|
|||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
* 2.4.8
|
* 2.4.8
|
||||||
|
* 需要 UXAssist 1.6.3 或更高版本提供共享生产计算 API。旧版本会在初始化前被拒绝加载,避免加载传送带信号功能时出错。
|
||||||
* `机甲和战斗无人机无敌`:修复受伤后启用时机甲耐久度和能量护盾保护可能失效的问题,并恢复太空编队的无敌保护。
|
* `机甲和战斗无人机无敌`:修复受伤后启用时机甲耐久度和能量护盾保护可能失效的问题,并恢复太空编队的无敌保护。
|
||||||
* `建造秒完成`:修复开始新游戏时可能报错的问题。建造会在开场动画播放结束或跳过后开始。
|
* `建造秒完成`:修复开始新游戏时可能报错的问题。建造会在开场动画播放结束或跳过后开始。
|
||||||
* `传送带信号物品生成`:
|
* `传送带信号物品生成`:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using UXAssist.Common.ModFeatures;
|
|||||||
namespace CheatEnabler;
|
namespace CheatEnabler;
|
||||||
|
|
||||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||||
[BepInDependency(UXAssist.PluginInfo.PLUGIN_GUID)]
|
[BepInDependency(UXAssist.PluginInfo.PLUGIN_GUID, "1.6.3")]
|
||||||
public class CheatEnabler : BaseUnityPlugin
|
public class CheatEnabler : BaseUnityPlugin
|
||||||
{
|
{
|
||||||
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.ModFeatures;
|
|
||||||
using CheatEnabler;
|
using CheatEnabler;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions.DysonSphere;
|
namespace CheatEnabler.Functions.DysonSphere;
|
||||||
|
|
||||||
[ModFeature("DysonSphereResolver")]
|
|
||||||
public static class DysonSphereResolver
|
public static class DysonSphereResolver
|
||||||
{
|
{
|
||||||
public static (global::DysonSphere sphere, StarData star)? ResolveCurrent()
|
public static (global::DysonSphere sphere, StarData star)? ResolveCurrent()
|
||||||
|
|||||||
@@ -3,13 +3,11 @@ using HarmonyLib;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.GameConstants;
|
using UXAssist.Common.GameConstants;
|
||||||
using UXAssist.Common.ModFeatures;
|
|
||||||
using UXAssist.Common.Utils;
|
using UXAssist.Common.Utils;
|
||||||
using CheatEnabler;
|
using CheatEnabler;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions.DysonSphere;
|
namespace CheatEnabler.Functions.DysonSphere;
|
||||||
|
|
||||||
[ModFeature("FrameRemovalFunctions")]
|
|
||||||
public static class FrameRemovalFunctions
|
public static class FrameRemovalFunctions
|
||||||
{
|
{
|
||||||
public static void RemoveAllFrames()
|
public static void RemoveAllFrames()
|
||||||
|
|||||||
@@ -7,12 +7,10 @@ using static CheatEnabler.Functions.DysonSphere.GeometryHelpers;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.GameConstants;
|
using UXAssist.Common.GameConstants;
|
||||||
using UXAssist.Common.ModFeatures;
|
|
||||||
using CheatEnabler;
|
using CheatEnabler;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions.DysonSphere;
|
namespace CheatEnabler.Functions.DysonSphere;
|
||||||
|
|
||||||
[ModFeature("IllegalShellFunctions")]
|
|
||||||
public static class IllegalShellFunctions
|
public static class IllegalShellFunctions
|
||||||
{
|
{
|
||||||
private static void EnsureDysonShellMaps()
|
private static void EnsureDysonShellMaps()
|
||||||
@@ -41,7 +39,7 @@ public static class IllegalShellFunctions
|
|||||||
layer.shellCursor = 1;
|
layer.shellCursor = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FinalizeDysonSphereChanges(global::DysonSphere sphere, DysonSphereLayer layer, bool notify = false, bool resetRenderMasks = false)
|
private static void FinalizeDysonSphereChanges(global::DysonSphere sphere, bool notify = false, bool resetRenderMasks = false)
|
||||||
{
|
{
|
||||||
if (sphere == null) return;
|
if (sphere == null) return;
|
||||||
sphere.CheckAutoNodes();
|
sphere.CheckAutoNodes();
|
||||||
@@ -140,7 +138,7 @@ public static class IllegalShellFunctions
|
|||||||
node.RecalcSpReq();
|
node.RecalcSpReq();
|
||||||
node.RecalcCpReq();
|
node.RecalcCpReq();
|
||||||
}
|
}
|
||||||
FinalizeDysonSphereChanges(dysonSphere, layer, true, true);
|
FinalizeDysonSphereChanges(dysonSphere, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void KeepMaxProductionShells()
|
public static void KeepMaxProductionShells()
|
||||||
@@ -245,7 +243,7 @@ public static class IllegalShellFunctions
|
|||||||
node.RecalcCpReq();
|
node.RecalcCpReq();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FinalizeDysonSphereChanges(dysonSphere, null);
|
FinalizeDysonSphereChanges(dysonSphere);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateIllegalDysonShellQuickly(int triangleCount)
|
public static void CreateIllegalDysonShellQuickly(int triangleCount)
|
||||||
@@ -317,7 +315,7 @@ public static class IllegalShellFunctions
|
|||||||
node.RecalcSpReq();
|
node.RecalcSpReq();
|
||||||
node.RecalcCpReq();
|
node.RecalcCpReq();
|
||||||
}
|
}
|
||||||
FinalizeDysonSphereChanges(dysonSphere, layer, true);
|
FinalizeDysonSphereChanges(dysonSphere, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -433,7 +431,7 @@ public static class IllegalShellFunctions
|
|||||||
|
|
||||||
var shellsChanged = CreateIllegalDysonShellWithMaxOutputForLayer(layer);
|
var shellsChanged = CreateIllegalDysonShellWithMaxOutputForLayer(layer);
|
||||||
|
|
||||||
FinalizeDysonSphereChanges(dysonSphere, layer, shellsChanged, true);
|
FinalizeDysonSphereChanges(dysonSphere, shellsChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateIllegalDysonShellWithMaxOutputForAllLayers()
|
public static void CreateIllegalDysonShellWithMaxOutputForAllLayers()
|
||||||
@@ -449,7 +447,7 @@ public static class IllegalShellFunctions
|
|||||||
shellsChanged = CreateIllegalDysonShellWithMaxOutputForLayer(layer) || shellsChanged;
|
shellsChanged = CreateIllegalDysonShellWithMaxOutputForLayer(layer) || shellsChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
FinalizeDysonSphereChanges(dysonSphere, dysonSphere.layersSorted.FirstOrDefault(l => l != null), shellsChanged, true);
|
FinalizeDysonSphereChanges(dysonSphere, shellsChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateIllegalDysonShellsSpecially()
|
public static void CreateIllegalDysonShellsSpecially()
|
||||||
@@ -477,8 +475,6 @@ public static class IllegalShellFunctions
|
|||||||
|
|
||||||
for (var idx = 1; idx <= 2; idx++)
|
for (var idx = 1; idx <= 2; idx++)
|
||||||
{
|
{
|
||||||
Dictionary<(int, int), int> availableFrames = [];
|
|
||||||
HashSet<int> unusedFrameIds = [];
|
|
||||||
var layer = dysonSphere.layersIdBased[idx];
|
var layer = dysonSphere.layersIdBased[idx];
|
||||||
if (layer != null)
|
if (layer != null)
|
||||||
{
|
{
|
||||||
@@ -571,6 +567,6 @@ public static class IllegalShellFunctions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FinalizeDysonSphereChanges(dysonSphere, dysonSphere.layersIdBased[2], shellsChanged, true);
|
FinalizeDysonSphereChanges(dysonSphere, shellsChanged, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,13 +3,11 @@ using System.Linq;
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.ModFeatures;
|
|
||||||
using UXAssist.Common.Utils;
|
using UXAssist.Common.Utils;
|
||||||
using CheatEnabler;
|
using CheatEnabler;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions.DysonSphere;
|
namespace CheatEnabler.Functions.DysonSphere;
|
||||||
|
|
||||||
[ModFeature("ShellCompletionFunctions")]
|
|
||||||
public static class ShellCompletionFunctions
|
public static class ShellCompletionFunctions
|
||||||
{
|
{
|
||||||
public static void CompleteShellsInstantly()
|
public static void CompleteShellsInstantly()
|
||||||
|
|||||||
@@ -1,11 +1,9 @@
|
|||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
using CheatEnabler.Functions.DysonSphere;
|
using CheatEnabler.Functions.DysonSphere;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.ModFeatures;
|
|
||||||
|
|
||||||
namespace CheatEnabler.Functions;
|
namespace CheatEnabler.Functions;
|
||||||
|
|
||||||
[ModFeature("CheatDysonSphere", Order = 20)]
|
|
||||||
public static class DysonSphereFunctions
|
public static class DysonSphereFunctions
|
||||||
{
|
{
|
||||||
public const int MinShellsCountForFunctions = 1;
|
public const int MinShellsCountForFunctions = 1;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
using UXAssist.Common.ModFeatures;
|
|
||||||
|
|
||||||
namespace CheatEnabler.Functions;
|
namespace CheatEnabler.Functions;
|
||||||
|
|
||||||
[ModFeature("PlanetFunctions")]
|
|
||||||
public static class PlanetFunctions
|
public static class PlanetFunctions
|
||||||
{
|
{
|
||||||
public static void BuryAllVeins(bool bury)
|
public static void BuryAllVeins(bool bury)
|
||||||
@@ -35,4 +33,4 @@ public static class PlanetFunctions
|
|||||||
}
|
}
|
||||||
GameMain.gpuiManager.SyncAllGPUBuffer();
|
GameMain.gpuiManager.SyncAllGPUBuffer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,11 +2,9 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.GameConstants;
|
using UXAssist.Common.GameConstants;
|
||||||
using UXAssist.Common.ModFeatures;
|
|
||||||
|
|
||||||
namespace CheatEnabler.Functions;
|
namespace CheatEnabler.Functions;
|
||||||
|
|
||||||
[ModFeature("PlayerFunctions")]
|
|
||||||
public static class PlayerFunctions
|
public static class PlayerFunctions
|
||||||
{
|
{
|
||||||
public static void Init()
|
public static void Init()
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
private static Dictionary<int, BeltSignal>[] _signalBelts;
|
private static Dictionary<int, BeltSignal>[] _signalBelts;
|
||||||
private static Dictionary<long, int> _portalFrom;
|
private static Dictionary<long, int> _portalFrom;
|
||||||
private static Dictionary<int, HashSet<long>> _portalTo;
|
private static Dictionary<int, HashSet<long>> _portalTo;
|
||||||
private static int _signalBeltsCapacity;
|
|
||||||
private static bool _initialized;
|
private static bool _initialized;
|
||||||
private static ProductionCatalog _sourceCatalog;
|
private static ProductionCatalog _sourceCatalog;
|
||||||
private static ProductionItem _preferredProliferator;
|
private static ProductionItem _preferredProliferator;
|
||||||
@@ -50,7 +49,6 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
_signalBelts = null;
|
_signalBelts = null;
|
||||||
_portalFrom = null;
|
_portalFrom = null;
|
||||||
_portalTo = null;
|
_portalTo = null;
|
||||||
_signalBeltsCapacity = 0;
|
|
||||||
PendingSources.Clear();
|
PendingSources.Clear();
|
||||||
ClearSourceCache();
|
ClearSourceCache();
|
||||||
}
|
}
|
||||||
@@ -84,7 +82,6 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
GameLogicProc.OnGameBegin -= OnGameBegin;
|
GameLogicProc.OnGameBegin -= OnGameBegin;
|
||||||
_initialized = false;
|
_initialized = false;
|
||||||
_signalBelts = null;
|
_signalBelts = null;
|
||||||
_signalBeltsCapacity = 0;
|
|
||||||
PendingSources.Clear();
|
PendingSources.Clear();
|
||||||
ClearSourceCache();
|
ClearSourceCache();
|
||||||
}
|
}
|
||||||
@@ -181,7 +178,6 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
{
|
{
|
||||||
if (DSPGame.IsMenuDemo) return;
|
if (DSPGame.IsMenuDemo) return;
|
||||||
_signalBelts = new Dictionary<int, BeltSignal>[64];
|
_signalBelts = new Dictionary<int, BeltSignal>[64];
|
||||||
_signalBeltsCapacity = 64;
|
|
||||||
_portalFrom = [];
|
_portalFrom = [];
|
||||||
_portalTo = [];
|
_portalTo = [];
|
||||||
|
|
||||||
@@ -225,13 +221,12 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
{
|
{
|
||||||
Dictionary<int, BeltSignal> obj;
|
Dictionary<int, BeltSignal> obj;
|
||||||
if (index < 0) return null;
|
if (index < 0) return null;
|
||||||
if (index >= _signalBeltsCapacity)
|
if (index >= _signalBelts.Length)
|
||||||
{
|
{
|
||||||
var newCapacity = _signalBeltsCapacity * 2;
|
var newCapacity = _signalBelts.Length * 2;
|
||||||
var newSignalBelts = new Dictionary<int, BeltSignal>[newCapacity];
|
var newSignalBelts = new Dictionary<int, BeltSignal>[newCapacity];
|
||||||
Array.Copy(_signalBelts, newSignalBelts, _signalBeltsCapacity);
|
Array.Copy(_signalBelts, newSignalBelts, _signalBelts.Length);
|
||||||
_signalBelts = newSignalBelts;
|
_signalBelts = newSignalBelts;
|
||||||
_signalBeltsCapacity = newCapacity;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -246,7 +241,7 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
|
|
||||||
private static Dictionary<int, BeltSignal> GetSignalBelts(int index)
|
private static Dictionary<int, BeltSignal> GetSignalBelts(int index)
|
||||||
{
|
{
|
||||||
return index >= 0 && index < _signalBeltsCapacity ? _signalBelts[index] : null;
|
return index >= 0 && _signalBelts != null && index < _signalBelts.Length ? _signalBelts[index] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetSignalBelt(int factory, int beltId, int signalId, int number)
|
private static void SetSignalBelt(int factory, int beltId, int signalId, int number)
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ internal static class TechClickHandler
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
TechLog.Warn($"click handling failed: {e}");
|
CheatEnabler.Logger.LogWarning($"[TechTweaks] click handling failed: {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ internal static class TechClickHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TechKeyCombo.TryDecode(out int steps))
|
if (!TryDecodeModifiers(out int steps))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -54,4 +54,32 @@ internal static class TechClickHandler
|
|||||||
TechUnlock.Run(history, techProto, steps);
|
TechUnlock.Run(history, techProto, steps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool TryDecodeModifiers(out int steps)
|
||||||
|
{
|
||||||
|
steps = 0;
|
||||||
|
|
||||||
|
if (VFInput.shift)
|
||||||
|
{
|
||||||
|
if (VFInput.alt) return false;
|
||||||
|
steps = VFInput.control ? 100 : 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VFInput.control)
|
||||||
|
{
|
||||||
|
if (VFInput.alt) return false;
|
||||||
|
steps = 10;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VFInput.alt)
|
||||||
|
{
|
||||||
|
// Alt applies or reverts every level available to this click.
|
||||||
|
steps = int.MaxValue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ internal static class TechDowngrade
|
|||||||
{
|
{
|
||||||
if (!TryGetLastAppliedLevel(history, techProto, out int lastApplied) || steps <= 0) return;
|
if (!TryGetLastAppliedLevel(history, techProto, out int lastApplied) || steps <= 0) return;
|
||||||
|
|
||||||
int target = steps == TechKeyCombo.LevelToMax
|
int target = steps == int.MaxValue
|
||||||
? techProto.Level - 1
|
? techProto.Level - 1
|
||||||
: System.Math.Max(techProto.Level - 1, lastApplied - steps);
|
: System.Math.Max(techProto.Level - 1, lastApplied - steps);
|
||||||
Targets.Clear();
|
Targets.Clear();
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ namespace CheatEnabler.Patches.Tech
|
|||||||
// a downgrade can walk thousands of levels and must not flood the log.
|
// a downgrade can walk thousands of levels and must not flood the log.
|
||||||
if (UnknownFuncsWarned.Add(func))
|
if (UnknownFuncsWarned.Add(func))
|
||||||
{
|
{
|
||||||
TechLog.Warn($"revert: no inverse known for tech function {func} (value={value}, level={level}); " +
|
CheatEnabler.Logger.LogWarning($"[TechTweaks] revert: no inverse known for tech function {func} (value={value}, level={level}); " +
|
||||||
"the field was left untouched. A game update may have added a new function.");
|
"the field was left untouched. A game update may have added a new function.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,7 +429,7 @@ namespace CheatEnabler.Patches.Tech
|
|||||||
ModeConfig freeMode = Configs.freeMode;
|
ModeConfig freeMode = Configs.freeMode;
|
||||||
if (freeMode == null)
|
if (freeMode == null)
|
||||||
{
|
{
|
||||||
TechLog.Warn($"recompute of tech function {func} skipped: Configs.freeMode is not available");
|
CheatEnabler.Logger.LogWarning($"[TechTweaks] recompute of tech function {func} skipped: Configs.freeMode is not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -819,7 +819,7 @@ namespace CheatEnabler.Patches.Tech
|
|||||||
if (Configs.freeMode == null || history.gameData == null || player?.mecha == null ||
|
if (Configs.freeMode == null || history.gameData == null || player?.mecha == null ||
|
||||||
player.package?.grids == null || player.deliveryPackage?.grids == null)
|
player.package?.grids == null || player.deliveryPackage?.grids == null)
|
||||||
{
|
{
|
||||||
TechLog.Warn("downgrade skipped: game data is not ready");
|
CheatEnabler.Logger.LogWarning("[TechTweaks] downgrade skipped: game data is not ready");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,7 +836,7 @@ namespace CheatEnabler.Patches.Tech
|
|||||||
int func = proto.UnlockFunctions[j];
|
int func = proto.UnlockFunctions[j];
|
||||||
if (!(func is >= 1 and <= 45 or >= 61 and <= 86 or 99))
|
if (!(func is >= 1 and <= 45 or >= 61 and <= 86 or 99))
|
||||||
{
|
{
|
||||||
TechLog.Warn($"downgrade skipped: unsupported tech function {func} in tech {proto.ID}");
|
CheatEnabler.Logger.LogWarning($"[TechTweaks] downgrade skipped: unsupported tech function {func} in tech {proto.ID}");
|
||||||
UIRealtimeTip.Popup(Localization.TechDowngradeUnsupportedFunction.Translate());
|
UIRealtimeTip.Popup(Localization.TechDowngradeUnsupportedFunction.Translate());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,59 +0,0 @@
|
|||||||
namespace CheatEnabler.Patches.Tech;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The key-modifier semantics shared by the upgrade and the downgrade side.
|
|
||||||
///
|
|
||||||
/// Both directions use the same modifier mapping:
|
|
||||||
///
|
|
||||||
/// <list type="table">
|
|
||||||
/// <item><term>Shift</term><description>+1 / -1</description></item>
|
|
||||||
/// <item><term>Ctrl</term><description>+10 / -10</description></item>
|
|
||||||
/// <item><term>Ctrl + Shift</term><description>+100 / -100</description></item>
|
|
||||||
/// <item><term>Alt</term><description>to MAX / back to locked</description></item>
|
|
||||||
/// <item><term>Shift + Alt, Ctrl + Alt</term><description>ignored</description></item>
|
|
||||||
/// </list>
|
|
||||||
/// </summary>
|
|
||||||
internal static class TechKeyCombo
|
|
||||||
{
|
|
||||||
/// <summary>Sentinel for the "Alt" combination: apply or revert everything this click can.</summary>
|
|
||||||
public const int LevelToMax = int.MaxValue;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Decodes the currently held modifiers.
|
|
||||||
/// Returns false when the combination carries no meaning and the click must be left alone.
|
|
||||||
/// </summary>
|
|
||||||
public static bool TryDecode(out int steps)
|
|
||||||
{
|
|
||||||
steps = 0;
|
|
||||||
|
|
||||||
if (VFInput.shift)
|
|
||||||
{
|
|
||||||
if (VFInput.alt)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
steps = VFInput.control ? 100 : 1;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VFInput.control)
|
|
||||||
{
|
|
||||||
if (VFInput.alt)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
steps = 10;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VFInput.alt)
|
|
||||||
{
|
|
||||||
steps = LevelToMax;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
namespace CheatEnabler.Patches.Tech;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Single funnel for the tech unlock / downgrade feature's log output.
|
|
||||||
///
|
|
||||||
/// Only real problems are reported: a Harmony target that no longer resolves, a tech function without
|
|
||||||
/// a known inverse, or a refused package resize. Those are conditions the player or the maintainer
|
|
||||||
/// needs to know about after a game update.
|
|
||||||
/// </summary>
|
|
||||||
internal static class TechLog
|
|
||||||
{
|
|
||||||
public static void Warn(string message)
|
|
||||||
{
|
|
||||||
CheatEnabler.Logger.LogWarning("[TechTweaks] " + message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -17,7 +17,7 @@ internal static class TechUnlock
|
|||||||
{
|
{
|
||||||
// Mirrors the built-in maxLevel argument: "to MAX" passes the default, the other combinations
|
// Mirrors the built-in maxLevel argument: "to MAX" passes the default, the other combinations
|
||||||
// pass -(steps) so the loop advances exactly `steps` levels.
|
// pass -(steps) so the loop advances exactly `steps` levels.
|
||||||
int maxLevel = steps == TechKeyCombo.LevelToMax ? 10000 : -steps;
|
int maxLevel = steps == int.MaxValue ? 10000 : -steps;
|
||||||
|
|
||||||
UnlockTechRecursive(history, techProto, maxLevel);
|
UnlockTechRecursive(history, techProto, maxLevel);
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ The item icon selects the output; no hotkey is needed.
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
* Requires UXAssist 1.6.3 or later. When upgrading manually, replace the old UXAssist DLL and remove duplicate copies from the BepInEx plugins folder.
|
||||||
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
|
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
|
||||||
* You can download [BepInEx here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
|
* You can download [BepInEx here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
|
||||||
* If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
|
* If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
|
||||||
@@ -198,6 +199,7 @@ The item icon selects the output; no hotkey is needed.
|
|||||||
|
|
||||||
## 注意事项
|
## 注意事项
|
||||||
|
|
||||||
|
* 需要 UXAssist 1.6.3 或更高版本。手动升级时,请替换旧的 UXAssist DLL,并删除 BepInEx 插件目录中的重复副本。
|
||||||
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突
|
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突
|
||||||
* 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)(选择x64版本)下载`BepInEx`
|
* 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)(选择x64版本)下载`BepInEx`
|
||||||
* 如果使用r2modman,你可以点击`Settings` -> `Browse profile folder`,然后将下载的zip解压到该文件夹并覆盖现有文件
|
* 如果使用r2modman,你可以点击`Settings` -> `Browse profile folder`,然后将下载的zip解压到该文件夹并覆盖现有文件
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ namespace CheatEnabler;
|
|||||||
|
|
||||||
public static class UIConfigWindow
|
public static class UIConfigWindow
|
||||||
{
|
{
|
||||||
private static RectTransform _windowTrans;
|
|
||||||
|
|
||||||
private static UIButton _resignGameBtn;
|
private static UIButton _resignGameBtn;
|
||||||
private static UIButton _clearBanBtn;
|
private static UIButton _clearBanBtn;
|
||||||
|
|
||||||
@@ -76,13 +74,12 @@ public static class UIConfigWindow
|
|||||||
|
|
||||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||||
{
|
{
|
||||||
_windowTrans = trans;
|
|
||||||
// General tab
|
// General tab
|
||||||
var x = 0f;
|
var x = 0f;
|
||||||
var y = 10f;
|
var y = 10f;
|
||||||
wnd.AddSplitter(trans, 10f);
|
wnd.AddSplitter(trans, 10f);
|
||||||
wnd.AddTabGroup(trans, "Cheat Enabler", "tab-group-cheatenabler");
|
wnd.AddTabGroup(trans, "Cheat Enabler", "tab-group-cheatenabler");
|
||||||
var tab1 = wnd.AddTab(_windowTrans, "General");
|
var tab1 = wnd.AddTab(trans, "General");
|
||||||
var cb = wnd.AddCheckBox(x, y, tab1, GamePatch.DevShortcutsEnabled, "Enable Dev Shortcuts");
|
var cb = wnd.AddCheckBox(x, y, tab1, GamePatch.DevShortcutsEnabled, "Enable Dev Shortcuts");
|
||||||
x += cb.Width + 5f;
|
x += cb.Width + 5f;
|
||||||
y += 6f;
|
y += 6f;
|
||||||
@@ -107,7 +104,7 @@ public static class UIConfigWindow
|
|||||||
y = 10f;
|
y = 10f;
|
||||||
_resignGameBtn = wnd.AddButton(x, y, 300f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; });
|
_resignGameBtn = wnd.AddButton(x, y, 300f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; });
|
||||||
|
|
||||||
var tab2 = wnd.AddTab(_windowTrans, "Factory");
|
var tab2 = wnd.AddTab(trans, "Factory");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ImmediateEnabled, "Finish build immediately");
|
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ImmediateEnabled, "Finish build immediately");
|
||||||
@@ -170,7 +167,7 @@ public static class UIConfigWindow
|
|||||||
wnd.AddText2(x + 32f, y, tab2, "Boost fuel power 2", 13);
|
wnd.AddText2(x + 32f, y, tab2, "Boost fuel power 2", 13);
|
||||||
|
|
||||||
// Planet Tab
|
// Planet Tab
|
||||||
var tab3 = wnd.AddTab(_windowTrans, "Planet");
|
var tab3 = wnd.AddTab(trans, "Planet");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddCheckBox(x, y, tab3, ResourcePatch.InfiniteResourceEnabled, "Infinite Natural Resources");
|
wnd.AddCheckBox(x, y, tab3, ResourcePatch.InfiniteResourceEnabled, "Infinite Natural Resources");
|
||||||
@@ -207,7 +204,7 @@ public static class UIConfigWindow
|
|||||||
GameMain.localPlanet.factory.PlanetReformRevert();
|
GameMain.localPlanet.factory.PlanetReformRevert();
|
||||||
});
|
});
|
||||||
|
|
||||||
var tab4 = wnd.AddTab(_windowTrans, "Dyson Sphere");
|
var tab4 = wnd.AddTab(trans, "Dyson Sphere");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
||||||
@@ -299,7 +296,7 @@ public static class UIConfigWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat");
|
var tab5 = wnd.AddTab(trans, "Mecha/Combat");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible");
|
wnd.AddCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible");
|
||||||
@@ -315,11 +312,6 @@ public static class UIConfigWindow
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateUI()
|
private static void UpdateUI()
|
||||||
{
|
|
||||||
UpdateButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void UpdateButtons()
|
|
||||||
{
|
{
|
||||||
if (_resignGameBtn == null || _clearBanBtn == null) return;
|
if (_resignGameBtn == null || _clearBanBtn == null) return;
|
||||||
var data = GameMain.data;
|
var data = GameMain.data;
|
||||||
|
|||||||
@@ -5,6 +5,6 @@
|
|||||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"xiaoye97-BepInEx-5.4.17",
|
"xiaoye97-BepInEx-5.4.17",
|
||||||
"soarqin-UXAssist-1.4.0"
|
"soarqin-UXAssist-1.6.3"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
+5
-23
@@ -28,31 +28,14 @@ public static class BeltSignal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static byte[] LoadEmbeddedResource(string path, Assembly assembly = null)
|
private static Sprite LoadDustbinSprite()
|
||||||
{
|
{
|
||||||
if (assembly == null)
|
using var stream = Assembly.GetExecutingAssembly()
|
||||||
{
|
.GetManifestResourceStream("Dustbin.assets.icon.signal-410.png")!;
|
||||||
assembly = Assembly.GetCallingAssembly();
|
|
||||||
}
|
|
||||||
var info = assembly.GetName();
|
|
||||||
var name = info.Name;
|
|
||||||
using var stream = assembly.GetManifestResourceStream($"{name}.{path.Replace('/', '.')}")!;
|
|
||||||
var buffer = new byte[stream.Length];
|
var buffer = new byte[stream.Length];
|
||||||
_ = stream.Read(buffer, 0, buffer.Length);
|
_ = stream.Read(buffer, 0, buffer.Length);
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Texture2D LoadEmbeddedTexture(string path, Assembly assembly = null)
|
|
||||||
{
|
|
||||||
var fileData = LoadEmbeddedResource(path, assembly);
|
|
||||||
var tex = new Texture2D(2, 2);
|
var tex = new Texture2D(2, 2);
|
||||||
tex.LoadImage(fileData);
|
tex.LoadImage(buffer);
|
||||||
return tex;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Sprite LoadEmbeddedSprite(string path, Assembly assembly = null)
|
|
||||||
{
|
|
||||||
var tex = LoadEmbeddedTexture(path, assembly);
|
|
||||||
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +44,6 @@ public static class BeltSignal
|
|||||||
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
||||||
{
|
{
|
||||||
if (_initialized) return;
|
if (_initialized) return;
|
||||||
var assembly = Assembly.GetExecutingAssembly();
|
|
||||||
var signals = LDB._signals;
|
var signals = LDB._signals;
|
||||||
var index = signals.dataArray.Length;
|
var index = signals.dataArray.Length;
|
||||||
var p = new SignalProto
|
var p = new SignalProto
|
||||||
@@ -70,7 +52,7 @@ public static class BeltSignal
|
|||||||
Name = "DUSTBIN",
|
Name = "DUSTBIN",
|
||||||
GridIndex = 3110,
|
GridIndex = 3110,
|
||||||
IconPath = "Assets/signal-410.png",
|
IconPath = "Assets/signal-410.png",
|
||||||
_iconSprite = LoadEmbeddedSprite("assets/icon/signal-410.png", assembly),
|
_iconSprite = LoadDustbinSprite(),
|
||||||
SID = ""
|
SID = ""
|
||||||
};
|
};
|
||||||
p.name = p.Name.Translate();
|
p.name = p.Name.Translate();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
* 1.5.0
|
* 1.5.0
|
||||||
* `Storage dustbin`: Destroy splitter input to a storage placed above it, including stacked and proliferated cargo. Enabling dustbin mode also clears cached full-storage state.
|
* `Storage dustbin`: Destroy splitter input to a storage placed above it, including stacked and proliferated cargo. Enabling dustbin mode also clears cached full-storage state. Move the checkbox to the title bar to prevent overlap with the English automation input label.
|
||||||
* `Tank dustbin`: Fix single tanks blocking liquid input after receiving their first stack, both with and without dustbin mode.
|
* `Tank dustbin`: Fix single tanks blocking liquid input after receiving their first stack, both with and without dustbin mode.
|
||||||
* `Belt signal dustbin`: Restore item disposal and startup compatibility with the current game simulation loop after DSP 0.10.33/0.10.34 updates.
|
* `Belt signal dustbin`: Restore item disposal and startup compatibility with the current game simulation loop after DSP 0.10.33/0.10.34 updates.
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
* 1.5.0
|
* 1.5.0
|
||||||
* `储物仓垃圾桶`:销毁四向分流器送入上方储物仓的物品,包括堆叠和喷涂增产剂的物品;启用垃圾桶时清除已满状态缓存。
|
* `储物仓垃圾桶`:销毁四向分流器送入上方储物仓的物品,包括堆叠和喷涂增产剂的物品;启用垃圾桶时清除已满状态缓存。将复选框移至标题栏,避免与英文自动化输入说明重叠。
|
||||||
* `储液罐垃圾桶`:修复单层储液罐装入第一批液体后停止输入的问题,普通储存和垃圾桶模式均可正常工作。
|
* `储液罐垃圾桶`:修复单层储液罐装入第一批液体后停止输入的问题,普通储存和垃圾桶模式均可正常工作。
|
||||||
* `传送带信号垃圾桶`:适配当前游戏的模拟循环,修复 DSP 0.10.33/0.10.34 更新后的启动报错和物品无法销毁问题。
|
* `传送带信号垃圾桶`:适配当前游戏的模拟循环,修复 DSP 0.10.33/0.10.34 更新后的启动报错和物品无法销毁问题。
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.IO;
|
|||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NebulaAPI;
|
using NebulaAPI;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Dustbin;
|
namespace Dustbin;
|
||||||
|
|
||||||
@@ -106,7 +105,7 @@ public static class StoragePatch
|
|||||||
[HarmonyPatch(typeof(UIStorageWindow), nameof(UIStorageWindow._OnCreate))]
|
[HarmonyPatch(typeof(UIStorageWindow), nameof(UIStorageWindow._OnCreate))]
|
||||||
private static void UIStorageWindow__OnCreate_Postfix(UIStorageWindow __instance)
|
private static void UIStorageWindow__OnCreate_Postfix(UIStorageWindow __instance)
|
||||||
{
|
{
|
||||||
_storageDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 50f, 50f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin");
|
_storageDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 220f, 26f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin");
|
||||||
var window = __instance;
|
var window = __instance;
|
||||||
_storageDustbinCheckBox.OnChecked += () =>
|
_storageDustbinCheckBox.OnChecked += () =>
|
||||||
{
|
{
|
||||||
@@ -134,10 +133,6 @@ public static class StoragePatch
|
|||||||
var storagePool = __instance.factoryStorage.storagePool;
|
var storagePool = __instance.factoryStorage.storagePool;
|
||||||
if (storagePool[storageId].id != storageId) return;
|
if (storagePool[storageId].id != storageId) return;
|
||||||
_storageDustbinCheckBox.Checked = storagePool[storageId].IsDustbin;
|
_storageDustbinCheckBox.Checked = storagePool[storageId].IsDustbin;
|
||||||
if (__instance.transform is RectTransform rectTrans)
|
|
||||||
{
|
|
||||||
_storageDustbinCheckBox.rectTrans.anchoredPosition3D = new Vector3(190, 57 - rectTrans.sizeDelta.y, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adopt fix from starfi5h's NebulaCompatiblilityAssist */
|
/* Adopt fix from starfi5h's NebulaCompatiblilityAssist */
|
||||||
@@ -145,8 +140,8 @@ public static class StoragePatch
|
|||||||
[HarmonyPatch(typeof(UIStorageGrid), nameof(UIStorageGrid.OnStorageSizeChanged))]
|
[HarmonyPatch(typeof(UIStorageGrid), nameof(UIStorageGrid.OnStorageSizeChanged))]
|
||||||
private static void UIStorageGrid_OnStorageSizeChanged_Postfix()
|
private static void UIStorageGrid_OnStorageSizeChanged_Postfix()
|
||||||
{
|
{
|
||||||
// Due to storage window is empty when open in client, the size will change after receiving data from host
|
// Storage data arrives asynchronously on multiplayer clients.
|
||||||
_lastStorageId = 0; // Refresh UI to reposition button on client side
|
_lastStorageId = 0; // Refresh checkbox state on the client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,9 +20,6 @@ public class HideTips : BaseUnityPlugin
|
|||||||
private static bool _noResearchCompletionPopups = true;
|
private static bool _noResearchCompletionPopups = true;
|
||||||
private static bool _noResearchCompletionTips;
|
private static bool _noResearchCompletionTips;
|
||||||
private static bool _skipPrologue = true;
|
private static bool _skipPrologue = true;
|
||||||
// private static bool _hideMenuDemo;
|
|
||||||
|
|
||||||
private static Harmony _patch;
|
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
@@ -34,21 +31,8 @@ public class HideTips : BaseUnityPlugin
|
|||||||
_noResearchCompletionPopups = Config.Bind("General", "NoResearchCompletionPopups", _noResearchCompletionPopups, "Disable Research Completion Popup Windows").Value;
|
_noResearchCompletionPopups = Config.Bind("General", "NoResearchCompletionPopups", _noResearchCompletionPopups, "Disable Research Completion Popup Windows").Value;
|
||||||
_noResearchCompletionTips = Config.Bind("General", "NoResearchCompletionTips", _noResearchCompletionTips, "Disable Research Completion Tips").Value;
|
_noResearchCompletionTips = Config.Bind("General", "NoResearchCompletionTips", _noResearchCompletionTips, "Disable Research Completion Tips").Value;
|
||||||
_skipPrologue = Config.Bind("General", "SkipPrologue", _skipPrologue, "Skip prologue for new game").Value;
|
_skipPrologue = Config.Bind("General", "SkipPrologue", _skipPrologue, "Skip prologue for new game").Value;
|
||||||
// _hideMenuDemo = Config.Bind("General", "HideMenuDemo", _hideMenuDemo, "Disable title screen demo scene loading").Value;
|
|
||||||
if (!_cfgEnabled) return;
|
if (!_cfgEnabled) return;
|
||||||
Harmony.CreateAndPatchAll(typeof(HideTips));
|
Harmony.CreateAndPatchAll(typeof(HideTips));
|
||||||
/*
|
|
||||||
if (_hideMenuDemo)
|
|
||||||
{
|
|
||||||
_patch = Harmony.CreateAndPatchAll(typeof(HideMenuDemo));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDestroy()
|
|
||||||
{
|
|
||||||
_patch?.UnpatchSelf();
|
|
||||||
_patch = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
@@ -146,74 +130,3 @@ public class HideTips : BaseUnityPlugin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
[HarmonyPatch]
|
|
||||||
class HideMenuDemo
|
|
||||||
{
|
|
||||||
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.StartDemoGame), typeof(int))]
|
|
||||||
private static bool DSPGame_StartDemoGame_Prefix()
|
|
||||||
{
|
|
||||||
if (DSPGame.Game != null)
|
|
||||||
{
|
|
||||||
DSPGame.EndGame();
|
|
||||||
}
|
|
||||||
|
|
||||||
DSPGame.IsMenuDemo = true;
|
|
||||||
DSPGame.CreateGameMainObject();
|
|
||||||
DSPGame.Game.isMenuDemo = true;
|
|
||||||
DSPGame.Game.CreateIconSet();
|
|
||||||
GameMain.data = new GameData();
|
|
||||||
GameMain.data.mainPlayer = Player.Create(GameMain.data, 1);
|
|
||||||
GameMain.data.galaxy = new GalaxyData
|
|
||||||
{
|
|
||||||
starCount = 0
|
|
||||||
};
|
|
||||||
|
|
||||||
if (GameMain.universeSimulator != null)
|
|
||||||
{
|
|
||||||
UnityEngine.Object.Destroy(GameMain.universeSimulator.gameObject);
|
|
||||||
}
|
|
||||||
GameMain.universeSimulator = UnityEngine.Object.Instantiate(Configs.builtin.universeSimulatorPrefab);
|
|
||||||
GameMain.universeSimulator.spaceAudio = new GameObject("Space Audio")
|
|
||||||
{
|
|
||||||
transform =
|
|
||||||
{
|
|
||||||
parent = GameMain.universeSimulator.transform
|
|
||||||
}
|
|
||||||
}.AddComponent<SpaceAudio>();
|
|
||||||
GameMain.Begin();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(VFPreload), nameof(VFPreload.IsMenuDemoLoaded))]
|
|
||||||
private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result)
|
|
||||||
{
|
|
||||||
__result = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.LateUpdate))]
|
|
||||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.LateUpdate))]
|
|
||||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.FixedUpdate))]
|
|
||||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Update))]
|
|
||||||
[HarmonyPatch(typeof(GameCamera), nameof(GameCamera.LateUpdate))]
|
|
||||||
private static bool DSPGame_LateUpdate_Prefix()
|
|
||||||
{
|
|
||||||
return !DSPGame.IsMenuDemo;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Begin))]
|
|
||||||
private static bool GameMain_Begin_Prefix()
|
|
||||||
{
|
|
||||||
if (!DSPGame.IsMenuDemo) return true;
|
|
||||||
DSPGame.Game._loading = false;
|
|
||||||
DSPGame.Game._running = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@@ -21,17 +21,6 @@ function New-OpCts {
|
|||||||
[Threading.CancellationTokenSource]::new([TimeSpan]::FromSeconds($TimeoutSec))
|
[Threading.CancellationTokenSource]::new([TimeSpan]::FromSeconds($TimeoutSec))
|
||||||
}
|
}
|
||||||
|
|
||||||
function Get-ConnSocket {
|
|
||||||
param($Conn)
|
|
||||||
if ($null -eq $Conn) { return $null }
|
|
||||||
if ($Conn -is [hashtable]) {
|
|
||||||
if ($Conn.ContainsKey('Ws')) { return $Conn['Ws'] }
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
if ($Conn.PSObject.Properties.Name -contains 'Ws') { return $Conn.Ws }
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
function Connect-Api {
|
function Connect-Api {
|
||||||
param([string] $Uri)
|
param([string] $Uri)
|
||||||
$ws = [Net.WebSockets.ClientWebSocket]::new()
|
$ws = [Net.WebSockets.ClientWebSocket]::new()
|
||||||
@@ -49,7 +38,8 @@ function Connect-Api {
|
|||||||
|
|
||||||
function Close-Api {
|
function Close-Api {
|
||||||
param($Conn)
|
param($Conn)
|
||||||
$ws = Get-ConnSocket $Conn
|
if ($null -eq $Conn) { return }
|
||||||
|
$ws = $Conn.Ws
|
||||||
if ($null -eq $ws) { return }
|
if ($null -eq $ws) { return }
|
||||||
$cts = New-OpCts
|
$cts = New-OpCts
|
||||||
try {
|
try {
|
||||||
@@ -64,7 +54,7 @@ function Close-Api {
|
|||||||
|
|
||||||
function Send-Text {
|
function Send-Text {
|
||||||
param($Conn, [string] $Text, [bool] $End = $true)
|
param($Conn, [string] $Text, [bool] $End = $true)
|
||||||
$ws = Get-ConnSocket $Conn
|
$ws = $Conn.Ws
|
||||||
$bytes = $utf8.GetBytes($Text)
|
$bytes = $utf8.GetBytes($Text)
|
||||||
$seg = [ArraySegment[byte]]::new($bytes)
|
$seg = [ArraySegment[byte]]::new($bytes)
|
||||||
$cts = New-OpCts
|
$cts = New-OpCts
|
||||||
@@ -75,7 +65,7 @@ function Send-Text {
|
|||||||
|
|
||||||
function Receive-Message {
|
function Receive-Message {
|
||||||
param($Conn)
|
param($Conn)
|
||||||
$ws = Get-ConnSocket $Conn
|
$ws = $Conn.Ws
|
||||||
$buffer = [byte[]]::new(65536)
|
$buffer = [byte[]]::new(65536)
|
||||||
$ms = [IO.MemoryStream]::new()
|
$ms = [IO.MemoryStream]::new()
|
||||||
$cts = New-OpCts
|
$cts = New-OpCts
|
||||||
@@ -183,7 +173,7 @@ try {
|
|||||||
|
|
||||||
$cts = New-OpCts
|
$cts = New-OpCts
|
||||||
try {
|
try {
|
||||||
$null = (Get-ConnSocket $conn).SendAsync(
|
$null = $conn.Ws.SendAsync(
|
||||||
[ArraySegment[byte]]::new([byte[]](1, 2, 3)),
|
[ArraySegment[byte]]::new([byte[]](1, 2, 3)),
|
||||||
[Net.WebSockets.WebSocketMessageType]::Binary,
|
[Net.WebSockets.WebSocketMessageType]::Binary,
|
||||||
$true,
|
$true,
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
using HarmonyLib;
|
|
||||||
|
|
||||||
namespace MechaDronesTweaks;
|
|
||||||
|
|
||||||
class FastDronesRemover
|
|
||||||
{
|
|
||||||
public const string FastDronesGuid = "com.dkoppstein.plugin.DSP.FastDrones";
|
|
||||||
private const string FastDronesVersion = "0.0.5";
|
|
||||||
|
|
||||||
public static bool Run(Harmony harmony)
|
|
||||||
{
|
|
||||||
if (!BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(FastDronesGuid, out var pluginInfo) ||
|
|
||||||
pluginInfo.Metadata.Version.ToString() != FastDronesVersion) return false;
|
|
||||||
var assembly = pluginInfo.Instance.GetType().Assembly;
|
|
||||||
var classType = assembly.GetType("com.dkoppstein.plugin.DSP.FastDrones.FastDronesPlugin");
|
|
||||||
harmony.Patch(AccessTools.Method(classType, "Start"),
|
|
||||||
new HarmonyMethod(typeof(FastDronesRemover).GetMethod("PatchFastDronesStart")));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool PatchFastDronesStart()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,9 +9,11 @@ using UnityEngine;
|
|||||||
namespace MechaDronesTweaks;
|
namespace MechaDronesTweaks;
|
||||||
|
|
||||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||||
[BepInDependency(FastDronesRemover.FastDronesGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
[BepInDependency(FastDronesGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
||||||
public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
||||||
{
|
{
|
||||||
|
private const string FastDronesGuid = "com.dkoppstein.plugin.DSP.FastDrones";
|
||||||
|
|
||||||
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
||||||
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
||||||
|
|
||||||
@@ -22,8 +24,13 @@ public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
|||||||
/* Remove FastDrones MOD if loaded */
|
/* Remove FastDrones MOD if loaded */
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (FastDronesRemover.Run(_harmony))
|
if (BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(FastDronesGuid, out var pluginInfo) &&
|
||||||
|
pluginInfo.Metadata.Version.ToString() == "0.0.5")
|
||||||
{
|
{
|
||||||
|
var assembly = pluginInfo.Instance.GetType().Assembly;
|
||||||
|
var classType = assembly.GetType("com.dkoppstein.plugin.DSP.FastDrones.FastDronesPlugin");
|
||||||
|
_harmony.Patch(AccessTools.Method(classType, "Start"),
|
||||||
|
new HarmonyMethod(AccessTools.Method(typeof(MechaDronesTweaksPlugin), nameof(PatchFastDronesStart))));
|
||||||
Logger.LogInfo("Unpatch FastDrones - OK");
|
Logger.LogInfo("Unpatch FastDrones - OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +40,8 @@ public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool PatchFastDronesStart() => false;
|
||||||
|
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
MechaDronesTweaks.UseFixedSpeed = Config.Bind("MechaDrones", "UseFixedSpeed", MechaDronesTweaks.UseFixedSpeed,
|
MechaDronesTweaks.UseFixedSpeed = Config.Bind("MechaDrones", "UseFixedSpeed", MechaDronesTweaks.UseFixedSpeed,
|
||||||
@@ -54,10 +63,6 @@ public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
|||||||
MechaDronesTweaks.EnergyMultiplier,
|
MechaDronesTweaks.EnergyMultiplier,
|
||||||
new ConfigDescription("Energy consumption multiplier for mecha drones",
|
new ConfigDescription("Energy consumption multiplier for mecha drones",
|
||||||
new AcceptableValueRange<float>(0f, 1f))).Value;
|
new AcceptableValueRange<float>(0f, 1f))).Value;
|
||||||
MechaDronesTweaks.EnergyMultiplier = Config.Bind("MechaDrones", "EnergyMultiplier",
|
|
||||||
MechaDronesTweaks.EnergyMultiplier,
|
|
||||||
new ConfigDescription("Energy consumption multiplier for mecha drones",
|
|
||||||
new AcceptableValueRange<float>(0f, 1f))).Value;
|
|
||||||
|
|
||||||
_harmony.PatchAll(typeof(MechaDronesTweaks));
|
_harmony.PatchAll(typeof(MechaDronesTweaks));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,21 +104,6 @@ public class Patch : BaseUnityPlugin, IModCanSave
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Belt fix for GalacticScale old versions, should be of no use now.
|
|
||||||
[HarmonyTranspiler, HarmonyPatch(typeof(BuildTool_Path), "CheckBuildConditions")]
|
|
||||||
private static IEnumerable<CodeInstruction> BuildTool_Path_CheckBuildConditions_Transpiler(
|
|
||||||
IEnumerable<CodeInstruction> instructions)
|
|
||||||
{
|
|
||||||
foreach (var instr in instructions)
|
|
||||||
{
|
|
||||||
if (instr.opcode == OpCodes.Ldc_R4 && instr.OperandIs(0.28f))
|
|
||||||
{
|
|
||||||
instr.operand = 0.21f;
|
|
||||||
}
|
|
||||||
yield return instr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
[HarmonyPostfix, HarmonyPatch(typeof(LabComponent), "SetFunction")]
|
[HarmonyPostfix, HarmonyPatch(typeof(LabComponent), "SetFunction")]
|
||||||
private static void LabComponent_SetFunction_Postfix(ref LabComponent __instance)
|
private static void LabComponent_SetFunction_Postfix(ref LabComponent __instance)
|
||||||
@@ -380,20 +365,6 @@ public class Patch : BaseUnityPlugin, IModCanSave
|
|||||||
foreach (var proto in LDB.items.dataArray)
|
foreach (var proto in LDB.items.dataArray)
|
||||||
{
|
{
|
||||||
var prefabDesc = proto.prefabDesc;
|
var prefabDesc = proto.prefabDesc;
|
||||||
/* Fix collision sizes, for GalacticScale old versions, should be of no use now.
|
|
||||||
FixExtValue(ref prefabDesc.buildCollider.ext.x);
|
|
||||||
FixExtValue(ref prefabDesc.buildCollider.ext.y);
|
|
||||||
FixExtValue(ref prefabDesc.buildCollider.ext.z);
|
|
||||||
if (prefabDesc.buildColliders != null)
|
|
||||||
{
|
|
||||||
for (var i = 0; i < prefabDesc.buildColliders.Length; i++)
|
|
||||||
{
|
|
||||||
FixExtValue(ref prefabDesc.buildColliders[i].ext.x);
|
|
||||||
FixExtValue(ref prefabDesc.buildColliders[i].ext.y);
|
|
||||||
FixExtValue(ref prefabDesc.buildColliders[i].ext.z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (prefabDesc.isInserter)
|
if (prefabDesc.isInserter)
|
||||||
{
|
{
|
||||||
@@ -472,16 +443,4 @@ public class Patch : BaseUnityPlugin, IModCanSave
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
}
|
||||||
private static void FixExtValue(ref float v)
|
|
||||||
{
|
|
||||||
if (v == 0f)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var b = Math.Abs(v);
|
|
||||||
v = (v - b) * 0.75f + b;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
+70
-109
@@ -24,23 +24,23 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
foreach (var planet in GameMain.data.factories)
|
foreach (var planet in GameMain.data.factories)
|
||||||
{
|
{
|
||||||
if (planet == null) continue;
|
if (planet == null) continue;
|
||||||
if (OptimizePool((in EntityData n) => n.id, () =>
|
if (OptimizePool((in EntityData n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
planet.entityCapacity = 0;
|
planet.entityCapacity = 0;
|
||||||
planet.SetEntityCapacity(1024);
|
planet.SetEntityCapacity(1024);
|
||||||
},
|
},
|
||||||
ref planet.entityPool, ref planet.entityCursor, ref planet.entityCapacity,
|
ref planet.entityPool, ref planet.entityCursor,
|
||||||
ref planet.entityRecycle, ref planet.entityRecycleCursor))
|
ref planet.entityRecycle, ref planet.entityRecycleCursor))
|
||||||
{
|
{
|
||||||
Logger.LogDebug($"Optimized `{nameof(planet.entityPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(planet.entityPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OptimizePool((in PrebuildData n) => n.id, () =>
|
if (OptimizePool((in PrebuildData n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
planet.prebuildCapacity = 0;
|
planet.prebuildCapacity = 0;
|
||||||
planet.SetPrebuildCapacity(256);
|
planet.SetPrebuildCapacity(256);
|
||||||
},
|
},
|
||||||
ref planet.prebuildPool, ref planet.prebuildCursor, ref planet.prebuildCapacity,
|
ref planet.prebuildPool, ref planet.prebuildCursor,
|
||||||
ref planet.prebuildRecycle, ref planet.prebuildRecycleCursor))
|
ref planet.prebuildRecycle, ref planet.prebuildRecycleCursor))
|
||||||
{
|
{
|
||||||
Logger.LogDebug($"Optimized `{nameof(planet.prebuildPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(planet.prebuildPool)}` on Planet {planet.planetId}");
|
||||||
@@ -49,152 +49,152 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var cargoTraffic = planet.cargoTraffic;
|
var cargoTraffic = planet.cargoTraffic;
|
||||||
if (cargoTraffic != null)
|
if (cargoTraffic != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in BeltComponent n) => n.id, () =>
|
if (OptimizePool((in BeltComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.beltCapacity = 0;
|
cargoTraffic.beltCapacity = 0;
|
||||||
cargoTraffic.SetBeltCapacity(16);
|
cargoTraffic.SetBeltCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.beltPool, ref cargoTraffic.beltCursor, ref cargoTraffic.beltCapacity,
|
ref cargoTraffic.beltPool, ref cargoTraffic.beltCursor,
|
||||||
ref cargoTraffic.beltRecycle, ref cargoTraffic.beltRecycleCursor))
|
ref cargoTraffic.beltRecycle, ref cargoTraffic.beltRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.beltPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.beltPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in CargoPath n) => n?.id ?? 0, () =>
|
if (OptimizePool((in CargoPath n, int index) => (n?.id ?? 0) == index, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.pathCapacity = 0;
|
cargoTraffic.pathCapacity = 0;
|
||||||
cargoTraffic.SetPathCapacity(16);
|
cargoTraffic.SetPathCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.pathPool, ref cargoTraffic.pathCursor, ref cargoTraffic.pathCapacity,
|
ref cargoTraffic.pathPool, ref cargoTraffic.pathCursor,
|
||||||
ref cargoTraffic.pathRecycle, ref cargoTraffic.pathRecycleCursor))
|
ref cargoTraffic.pathRecycle, ref cargoTraffic.pathRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pathPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pathPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in SplitterComponent n) => n.id, () =>
|
if (OptimizePool((in SplitterComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.splitterCapacity = 0;
|
cargoTraffic.splitterCapacity = 0;
|
||||||
cargoTraffic.SetSplitterCapacity(16);
|
cargoTraffic.SetSplitterCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.splitterPool, ref cargoTraffic.splitterCursor, ref cargoTraffic.splitterCapacity,
|
ref cargoTraffic.splitterPool, ref cargoTraffic.splitterCursor,
|
||||||
ref cargoTraffic.splitterRecycle, ref cargoTraffic.splitterRecycleCursor))
|
ref cargoTraffic.splitterRecycle, ref cargoTraffic.splitterRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.splitterPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.splitterPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in MonitorComponent n) => n.id, () =>
|
if (OptimizePool((in MonitorComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.monitorCapacity = 0;
|
cargoTraffic.monitorCapacity = 0;
|
||||||
cargoTraffic.SetMonitorCapacity(16);
|
cargoTraffic.SetMonitorCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.monitorPool, ref cargoTraffic.monitorCursor, ref cargoTraffic.monitorCapacity,
|
ref cargoTraffic.monitorPool, ref cargoTraffic.monitorCursor,
|
||||||
ref cargoTraffic.monitorRecycle, ref cargoTraffic.monitorRecycleCursor))
|
ref cargoTraffic.monitorRecycle, ref cargoTraffic.monitorRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.monitorPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.monitorPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in SpraycoaterComponent n) => n.id, () =>
|
if (OptimizePool((in SpraycoaterComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.spraycoaterCapacity = 0;
|
cargoTraffic.spraycoaterCapacity = 0;
|
||||||
cargoTraffic.SetSpraycoaterCapacity(16);
|
cargoTraffic.SetSpraycoaterCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.spraycoaterPool, ref cargoTraffic.spraycoaterCursor, ref cargoTraffic.spraycoaterCapacity,
|
ref cargoTraffic.spraycoaterPool, ref cargoTraffic.spraycoaterCursor,
|
||||||
ref cargoTraffic.spraycoaterRecycle, ref cargoTraffic.spraycoaterRecycleCursor))
|
ref cargoTraffic.spraycoaterRecycle, ref cargoTraffic.spraycoaterRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.spraycoaterPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.spraycoaterPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PilerComponent n) => n.id, () =>
|
if (OptimizePool((in PilerComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.pilerCapacity = 0;
|
cargoTraffic.pilerCapacity = 0;
|
||||||
cargoTraffic.SetPilerCapacity(16);
|
cargoTraffic.SetPilerCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.pilerPool, ref cargoTraffic.pilerCursor, ref cargoTraffic.pilerCapacity,
|
ref cargoTraffic.pilerPool, ref cargoTraffic.pilerCursor,
|
||||||
ref cargoTraffic.pilerRecycle, ref cargoTraffic.pilerRecycleCursor))
|
ref cargoTraffic.pilerRecycle, ref cargoTraffic.pilerRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pilerPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pilerPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
var factoryStorage = planet.factoryStorage;
|
var factoryStorage = planet.factoryStorage;
|
||||||
if (factoryStorage != null)
|
if (factoryStorage != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in StorageComponent n) => n?.id ?? 0, () =>
|
if (OptimizePool((in StorageComponent n, int index) => (n?.id ?? 0) == index, () =>
|
||||||
{
|
{
|
||||||
factoryStorage.storageCapacity = 0;
|
factoryStorage.storageCapacity = 0;
|
||||||
factoryStorage.SetStorageCapacity(64);
|
factoryStorage.SetStorageCapacity(64);
|
||||||
},
|
},
|
||||||
ref factoryStorage.storagePool, ref factoryStorage.storageCursor, ref factoryStorage.storageCapacity,
|
ref factoryStorage.storagePool, ref factoryStorage.storageCursor,
|
||||||
ref factoryStorage.storageRecycle, ref factoryStorage.storageRecycleCursor))
|
ref factoryStorage.storageRecycle, ref factoryStorage.storageRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factoryStorage.storagePool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factoryStorage.storagePool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in TankComponent n) => n.id, () =>
|
if (OptimizePool((in TankComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
factoryStorage.tankCapacity = 0;
|
factoryStorage.tankCapacity = 0;
|
||||||
factoryStorage.SetTankCapacity(256);
|
factoryStorage.SetTankCapacity(256);
|
||||||
},
|
},
|
||||||
ref factoryStorage.tankPool, ref factoryStorage.tankCursor, ref factoryStorage.tankCapacity,
|
ref factoryStorage.tankPool, ref factoryStorage.tankCursor,
|
||||||
ref factoryStorage.tankRecycle, ref factoryStorage.tankRecycleCursor))
|
ref factoryStorage.tankRecycle, ref factoryStorage.tankRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factoryStorage.tankPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factoryStorage.tankPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
var factorySystem = planet.factorySystem;
|
var factorySystem = planet.factorySystem;
|
||||||
if (factorySystem != null)
|
if (factorySystem != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in MinerComponent n) => n.id, () =>
|
if (OptimizePool((in MinerComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
factorySystem.minerCapacity = 0;
|
factorySystem.minerCapacity = 0;
|
||||||
factorySystem.SetMinerCapacity(256);
|
factorySystem.SetMinerCapacity(256);
|
||||||
},
|
},
|
||||||
ref factorySystem.minerPool, ref factorySystem.minerCursor, ref factorySystem.minerCapacity,
|
ref factorySystem.minerPool, ref factorySystem.minerCursor,
|
||||||
ref factorySystem.minerRecycle, ref factorySystem.minerRecycleCursor))
|
ref factorySystem.minerRecycle, ref factorySystem.minerRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.minerPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.minerPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in InserterComponent n) => n.id, () =>
|
if (OptimizePool((in InserterComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
factorySystem.inserterCapacity = 0;
|
factorySystem.inserterCapacity = 0;
|
||||||
factorySystem.SetInserterCapacity(256);
|
factorySystem.SetInserterCapacity(256);
|
||||||
},
|
},
|
||||||
ref factorySystem.inserterPool, ref factorySystem.inserterCursor, ref factorySystem.inserterCapacity,
|
ref factorySystem.inserterPool, ref factorySystem.inserterCursor,
|
||||||
ref factorySystem.inserterRecycle, ref factorySystem.inserterRecycleCursor))
|
ref factorySystem.inserterRecycle, ref factorySystem.inserterRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.inserterPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.inserterPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in AssemblerComponent n) => n.id, () =>
|
if (OptimizePool((in AssemblerComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
factorySystem.assemblerCapacity = 0;
|
factorySystem.assemblerCapacity = 0;
|
||||||
factorySystem.SetAssemblerCapacity(256);
|
factorySystem.SetAssemblerCapacity(256);
|
||||||
},
|
},
|
||||||
ref factorySystem.assemblerPool, ref factorySystem.assemblerCursor, ref factorySystem.assemblerCapacity,
|
ref factorySystem.assemblerPool, ref factorySystem.assemblerCursor,
|
||||||
ref factorySystem.assemblerRecycle, ref factorySystem.assemblerRecycleCursor))
|
ref factorySystem.assemblerRecycle, ref factorySystem.assemblerRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.assemblerPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.assemblerPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in FractionatorComponent n) => n.id, () =>
|
if (OptimizePool((in FractionatorComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
factorySystem.fractionatorCapacity = 0;
|
factorySystem.fractionatorCapacity = 0;
|
||||||
factorySystem.SetFractionatorCapacity(32);
|
factorySystem.SetFractionatorCapacity(32);
|
||||||
},
|
},
|
||||||
ref factorySystem.fractionatorPool, ref factorySystem.fractionatorCursor, ref factorySystem.fractionatorCapacity,
|
ref factorySystem.fractionatorPool, ref factorySystem.fractionatorCursor,
|
||||||
ref factorySystem.fractionatorRecycle, ref factorySystem.fractionatorRecycleCursor))
|
ref factorySystem.fractionatorRecycle, ref factorySystem.fractionatorRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.fractionatorPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.fractionatorPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in EjectorComponent n) => n.id, () =>
|
if (OptimizePool((in EjectorComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
factorySystem.ejectorCapacity = 0;
|
factorySystem.ejectorCapacity = 0;
|
||||||
factorySystem.SetEjectorCapacity(32);
|
factorySystem.SetEjectorCapacity(32);
|
||||||
},
|
},
|
||||||
ref factorySystem.ejectorPool, ref factorySystem.ejectorCursor, ref factorySystem.ejectorCapacity,
|
ref factorySystem.ejectorPool, ref factorySystem.ejectorCursor,
|
||||||
ref factorySystem.ejectorRecycle, ref factorySystem.ejectorRecycleCursor))
|
ref factorySystem.ejectorRecycle, ref factorySystem.ejectorRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.ejectorPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.ejectorPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in SiloComponent n) => n.id, () =>
|
if (OptimizePool((in SiloComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
factorySystem.siloCapacity = 0;
|
factorySystem.siloCapacity = 0;
|
||||||
factorySystem.SetSiloCapacity(32);
|
factorySystem.SetSiloCapacity(32);
|
||||||
},
|
},
|
||||||
ref factorySystem.siloPool, ref factorySystem.siloCursor, ref factorySystem.siloCapacity,
|
ref factorySystem.siloPool, ref factorySystem.siloCursor,
|
||||||
ref factorySystem.siloRecycle, ref factorySystem.siloRecycleCursor))
|
ref factorySystem.siloRecycle, ref factorySystem.siloRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.siloPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.siloPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in LabComponent n) => n.id, () =>
|
if (OptimizePool((in LabComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
factorySystem.labCapacity = 0;
|
factorySystem.labCapacity = 0;
|
||||||
factorySystem.SetLabCapacity(256);
|
factorySystem.SetLabCapacity(256);
|
||||||
},
|
},
|
||||||
ref factorySystem.labPool, ref factorySystem.labCursor, ref factorySystem.labCapacity,
|
ref factorySystem.labPool, ref factorySystem.labCursor,
|
||||||
ref factorySystem.labRecycle, ref factorySystem.labRecycleCursor))
|
ref factorySystem.labRecycle, ref factorySystem.labRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.labPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.labPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
var transport = planet.transport;
|
var transport = planet.transport;
|
||||||
if (transport != null)
|
if (transport != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in StationComponent n) => n?.id ?? 0, () =>
|
if (OptimizePool((in StationComponent n, int index) => (n?.id ?? 0) == index, () =>
|
||||||
{
|
{
|
||||||
transport.stationCapacity = 0;
|
transport.stationCapacity = 0;
|
||||||
transport.SetStationCapacity(16);
|
transport.SetStationCapacity(16);
|
||||||
},
|
},
|
||||||
ref transport.stationPool, ref transport.stationCursor, ref transport.stationCapacity,
|
ref transport.stationPool, ref transport.stationCursor,
|
||||||
ref transport.stationRecycle, ref transport.stationRecycleCursor))
|
ref transport.stationRecycle, ref transport.stationRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(transport.stationPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(transport.stationPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in DispenserComponent n) => n?.id ?? 0, () =>
|
if (OptimizePool((in DispenserComponent n, int index) => (n?.id ?? 0) == index, () =>
|
||||||
{
|
{
|
||||||
transport.dispenserCapacity = 0;
|
transport.dispenserCapacity = 0;
|
||||||
transport.SetDispenserCapacity(8);
|
transport.SetDispenserCapacity(8);
|
||||||
},
|
},
|
||||||
ref transport.dispenserPool, ref transport.dispenserCursor, ref transport.dispenserCapacity,
|
ref transport.dispenserPool, ref transport.dispenserCursor,
|
||||||
ref transport.dispenserRecycle, ref transport.dispenserRecycleCursor))
|
ref transport.dispenserRecycle, ref transport.dispenserRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(transport.dispenserPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(transport.dispenserPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
@@ -202,54 +202,54 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var powerSystem = planet.powerSystem;
|
var powerSystem = planet.powerSystem;
|
||||||
if (powerSystem != null)
|
if (powerSystem != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in PowerGeneratorComponent n) => n.id, () =>
|
if (OptimizePool((in PowerGeneratorComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
powerSystem.genCapacity = 0;
|
powerSystem.genCapacity = 0;
|
||||||
powerSystem.SetGeneratorCapacity(8);
|
powerSystem.SetGeneratorCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.genPool, ref powerSystem.genCursor, ref powerSystem.genCapacity,
|
ref powerSystem.genPool, ref powerSystem.genCursor,
|
||||||
ref powerSystem.genRecycle, ref powerSystem.genRecycleCursor))
|
ref powerSystem.genRecycle, ref powerSystem.genRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.genPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.genPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerNodeComponent n) => n.id, () =>
|
if (OptimizePool((in PowerNodeComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
powerSystem.nodeCapacity = 0;
|
powerSystem.nodeCapacity = 0;
|
||||||
powerSystem.SetNodeCapacity(8);
|
powerSystem.SetNodeCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.nodePool, ref powerSystem.nodeCursor, ref powerSystem.nodeCapacity,
|
ref powerSystem.nodePool, ref powerSystem.nodeCursor,
|
||||||
ref powerSystem.nodeRecycle, ref powerSystem.nodeRecycleCursor))
|
ref powerSystem.nodeRecycle, ref powerSystem.nodeRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.nodePool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.nodePool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerConsumerComponent n) => n.id, () =>
|
if (OptimizePool((in PowerConsumerComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
powerSystem.consumerCapacity = 0;
|
powerSystem.consumerCapacity = 0;
|
||||||
powerSystem.SetConsumerCapacity(8);
|
powerSystem.SetConsumerCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.consumerPool, ref powerSystem.consumerCursor, ref powerSystem.consumerCapacity,
|
ref powerSystem.consumerPool, ref powerSystem.consumerCursor,
|
||||||
ref powerSystem.consumerRecycle, ref powerSystem.consumerRecycleCursor))
|
ref powerSystem.consumerRecycle, ref powerSystem.consumerRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.consumerPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.consumerPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerAccumulatorComponent n) => n.id, () =>
|
if (OptimizePool((in PowerAccumulatorComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
powerSystem.accCapacity = 0;
|
powerSystem.accCapacity = 0;
|
||||||
powerSystem.SetAccumulatorCapacity(8);
|
powerSystem.SetAccumulatorCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.accPool, ref powerSystem.accCursor, ref powerSystem.accCapacity,
|
ref powerSystem.accPool, ref powerSystem.accCursor,
|
||||||
ref powerSystem.accRecycle, ref powerSystem.accRecycleCursor))
|
ref powerSystem.accRecycle, ref powerSystem.accRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.accPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.accPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerExchangerComponent n) => n.id, () =>
|
if (OptimizePool((in PowerExchangerComponent n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
powerSystem.excCapacity = 0;
|
powerSystem.excCapacity = 0;
|
||||||
powerSystem.SetExchangerCapacity(8);
|
powerSystem.SetExchangerCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.excPool, ref powerSystem.excCursor, ref powerSystem.excCapacity,
|
ref powerSystem.excPool, ref powerSystem.excCursor,
|
||||||
ref powerSystem.excRecycle, ref powerSystem.excRecycleCursor))
|
ref powerSystem.excRecycle, ref powerSystem.excRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.excPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.excPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerNetwork n) => n?.id ?? 0, () =>
|
if (OptimizePool((in PowerNetwork n, int index) => (n?.id ?? 0) == index, () =>
|
||||||
{
|
{
|
||||||
powerSystem.netCapacity = 0;
|
powerSystem.netCapacity = 0;
|
||||||
powerSystem.SetNetworkCapacity(8);
|
powerSystem.SetNetworkCapacity(8);
|
||||||
powerSystem.netPool[0] = new PowerNetwork();
|
powerSystem.netPool[0] = new PowerNetwork();
|
||||||
powerSystem.netPool[0].Reset(0);
|
powerSystem.netPool[0].Reset(0);
|
||||||
},
|
},
|
||||||
ref powerSystem.netPool, ref powerSystem.netCursor, ref powerSystem.netCapacity,
|
ref powerSystem.netPool, ref powerSystem.netCursor,
|
||||||
ref powerSystem.netRecycle, ref powerSystem.netRecycleCursor))
|
ref powerSystem.netRecycle, ref powerSystem.netRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.netPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.netPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
@@ -257,12 +257,12 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var trashContainer = GameMain.data.trashSystem?.container;
|
var trashContainer = GameMain.data.trashSystem?.container;
|
||||||
if (trashContainer != null)
|
if (trashContainer != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in TrashObject n) => n.item == 0, () =>
|
if (OptimizePool((in TrashObject n, int index) => n.item != 0, () =>
|
||||||
{
|
{
|
||||||
trashContainer.trashCapacity = 0;
|
trashContainer.trashCapacity = 0;
|
||||||
trashContainer.SetTrashCapacity(16);
|
trashContainer.SetTrashCapacity(16);
|
||||||
},
|
},
|
||||||
ref trashContainer.trashObjPool, ref trashContainer.trashCursor, ref trashContainer.trashCapacity,
|
ref trashContainer.trashObjPool, ref trashContainer.trashCursor,
|
||||||
ref trashContainer.trashRecycle, ref trashContainer.trashRecycleCursor))
|
ref trashContainer.trashRecycle, ref trashContainer.trashRecycleCursor))
|
||||||
{
|
{
|
||||||
Logger.LogDebug($"Optimized `{nameof(trashContainer.trashObjPool)}`");
|
Logger.LogDebug($"Optimized `{nameof(trashContainer.trashObjPool)}`");
|
||||||
@@ -271,12 +271,12 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var warningSystem = GameMain.data.warningSystem;
|
var warningSystem = GameMain.data.warningSystem;
|
||||||
if (warningSystem != null)
|
if (warningSystem != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in WarningData n) => n.id, () =>
|
if (OptimizePool((in WarningData n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
warningSystem.warningCapacity = 0;
|
warningSystem.warningCapacity = 0;
|
||||||
warningSystem.SetWarningCapacity(32);
|
warningSystem.SetWarningCapacity(32);
|
||||||
},
|
},
|
||||||
ref warningSystem.warningPool, ref warningSystem.warningCursor, ref warningSystem.warningCapacity,
|
ref warningSystem.warningPool, ref warningSystem.warningCursor,
|
||||||
ref warningSystem.warningRecycle, ref warningSystem.warningRecycleCursor))
|
ref warningSystem.warningRecycle, ref warningSystem.warningRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(warningSystem.warningPool)}`");
|
Logger.LogDebug($"Optimized `{nameof(warningSystem.warningPool)}`");
|
||||||
}
|
}
|
||||||
@@ -286,48 +286,48 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
foreach (var dysonSphere in dysonSpheres)
|
foreach (var dysonSphere in dysonSpheres)
|
||||||
{
|
{
|
||||||
if (dysonSphere == null) continue;
|
if (dysonSphere == null) continue;
|
||||||
if (OptimizePool((in DysonRocket n) => n.id, () =>
|
if (OptimizePool((in DysonRocket n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
dysonSphere.rocketCapacity = 0;
|
dysonSphere.rocketCapacity = 0;
|
||||||
dysonSphere.SetRocketCapacity(256);
|
dysonSphere.SetRocketCapacity(256);
|
||||||
},
|
},
|
||||||
ref dysonSphere.rocketPool, ref dysonSphere.rocketCursor, ref dysonSphere.rocketCapacity,
|
ref dysonSphere.rocketPool, ref dysonSphere.rocketCursor,
|
||||||
ref dysonSphere.rocketRecycle, ref dysonSphere.rocketRecycleCursor))
|
ref dysonSphere.rocketRecycle, ref dysonSphere.rocketRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(dysonSphere.rocketPool)}` on Star {dysonSphere.starData.id}");
|
Logger.LogDebug($"Optimized `{nameof(dysonSphere.rocketPool)}` on Star {dysonSphere.starData.id}");
|
||||||
if (OptimizePool((in DysonNodeRData n) => n.id, () =>
|
if (OptimizePool((in DysonNodeRData n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
dysonSphere.nrdCapacity = 0;
|
dysonSphere.nrdCapacity = 0;
|
||||||
dysonSphere.SetNrdCapacity(128);
|
dysonSphere.SetNrdCapacity(128);
|
||||||
},
|
},
|
||||||
ref dysonSphere.nrdPool, ref dysonSphere.nrdCursor, ref dysonSphere.nrdCapacity,
|
ref dysonSphere.nrdPool, ref dysonSphere.nrdCursor,
|
||||||
ref dysonSphere.nrdRecycle, ref dysonSphere.nrdRecycleCursor))
|
ref dysonSphere.nrdRecycle, ref dysonSphere.nrdRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(dysonSphere.nrdPool)}` on Star {dysonSphere.starData.id}");
|
Logger.LogDebug($"Optimized `{nameof(dysonSphere.nrdPool)}` on Star {dysonSphere.starData.id}");
|
||||||
if (dysonSphere.layersIdBased == null) continue;
|
if (dysonSphere.layersIdBased == null) continue;
|
||||||
foreach (var layer in dysonSphere.layersSorted)
|
foreach (var layer in dysonSphere.layersSorted)
|
||||||
{
|
{
|
||||||
if (layer == null) continue;
|
if (layer == null) continue;
|
||||||
if (OptimizePool((in DysonNode n) => n?.id ?? 0, () =>
|
if (OptimizePool((in DysonNode n, int index) => (n?.id ?? 0) == index, () =>
|
||||||
{
|
{
|
||||||
layer.nodeCapacity = 64;
|
layer.nodeCapacity = 64;
|
||||||
layer.SetNodeCapacity(64);
|
layer.SetNodeCapacity(64);
|
||||||
},
|
},
|
||||||
ref layer.nodePool, ref layer.nodeCursor, ref layer.nodeCapacity,
|
ref layer.nodePool, ref layer.nodeCursor,
|
||||||
ref layer.nodeRecycle, ref layer.nodeRecycleCursor))
|
ref layer.nodeRecycle, ref layer.nodeRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(layer.nodePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
Logger.LogDebug($"Optimized `{nameof(layer.nodePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
||||||
if (OptimizePool((in DysonFrame n) => n?.id ?? 0, () =>
|
if (OptimizePool((in DysonFrame n, int index) => (n?.id ?? 0) == index, () =>
|
||||||
{
|
{
|
||||||
layer.frameCapacity = 64;
|
layer.frameCapacity = 64;
|
||||||
layer.SetFrameCapacity(64);
|
layer.SetFrameCapacity(64);
|
||||||
},
|
},
|
||||||
ref layer.framePool, ref layer.frameCursor, ref layer.frameCapacity,
|
ref layer.framePool, ref layer.frameCursor,
|
||||||
ref layer.frameRecycle, ref layer.frameRecycleCursor))
|
ref layer.frameRecycle, ref layer.frameRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(layer.framePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
Logger.LogDebug($"Optimized `{nameof(layer.framePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
||||||
if (OptimizePool((in DysonShell n) => n?.id ?? 0, () =>
|
if (OptimizePool((in DysonShell n, int index) => (n?.id ?? 0) == index, () =>
|
||||||
{
|
{
|
||||||
layer.shellCapacity = 64;
|
layer.shellCapacity = 64;
|
||||||
layer.SetShellCapacity(64);
|
layer.SetShellCapacity(64);
|
||||||
},
|
},
|
||||||
ref layer.shellPool, ref layer.shellCursor, ref layer.shellCapacity,
|
ref layer.shellPool, ref layer.shellCursor,
|
||||||
ref layer.shellRecycle, ref layer.shellRecycleCursor))
|
ref layer.shellRecycle, ref layer.shellRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(layer.shellPool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
Logger.LogDebug($"Optimized `{nameof(layer.shellPool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
||||||
}
|
}
|
||||||
@@ -335,12 +335,12 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var swarm = dysonSphere.swarm;
|
var swarm = dysonSphere.swarm;
|
||||||
if (swarm != null)
|
if (swarm != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in SailBullet n) => n.id, () =>
|
if (OptimizePool((in SailBullet n, int index) => n.id == index, () =>
|
||||||
{
|
{
|
||||||
swarm.bulletCapacity = 0;
|
swarm.bulletCapacity = 0;
|
||||||
swarm.SetBulletCapacity(128);
|
swarm.SetBulletCapacity(128);
|
||||||
},
|
},
|
||||||
ref swarm.bulletPool, ref swarm.bulletCursor, ref swarm.bulletCapacity,
|
ref swarm.bulletPool, ref swarm.bulletCursor,
|
||||||
ref swarm.bulletRecycle, ref swarm.bulletRecycleCursor))
|
ref swarm.bulletRecycle, ref swarm.bulletRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(swarm.bulletPool)}` on Star {dysonSphere.starData.id}");
|
Logger.LogDebug($"Optimized `{nameof(swarm.bulletPool)}` on Star {dysonSphere.starData.id}");
|
||||||
}
|
}
|
||||||
@@ -350,12 +350,10 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
GC.Collect();
|
GC.Collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
private delegate int GetId<T>(in T s);
|
private delegate bool IsOccupied<T>(in T s, int index);
|
||||||
|
|
||||||
private delegate void SetToInitialCapacity();
|
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private static bool OptimizePool<T>(GetId<T> getter, SetToInitialCapacity initCapacity, ref T[] pool, ref int cursor, ref int capacity, ref int[] recycle, ref int recycleCursor)
|
private static bool OptimizePool<T>(IsOccupied<T> isOccupied, Action initCapacity, ref T[] pool, ref int cursor, ref int[] recycle, ref int recycleCursor)
|
||||||
{
|
{
|
||||||
if (cursor <= 1) return false;
|
if (cursor <= 1) return false;
|
||||||
if (recycleCursor == cursor - 1)
|
if (recycleCursor == cursor - 1)
|
||||||
@@ -369,7 +367,7 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var pos = cursor - 1;
|
var pos = cursor - 1;
|
||||||
while (pos > 0)
|
while (pos > 0)
|
||||||
{
|
{
|
||||||
if (getter(pool[pos]) == pos) break;
|
if (isOccupied(pool[pos], pos)) break;
|
||||||
pos--;
|
pos--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -391,41 +389,4 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private delegate bool IsEmpty<T>(in T s);
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
|
||||||
private static bool OptimizePool<T>(IsEmpty<T> checker, SetToInitialCapacity initCapacity, ref T[] pool, ref int cursor, ref int capacity, ref int[] recycle, ref int recycleCursor)
|
|
||||||
{
|
|
||||||
if (cursor <= 1) return false;
|
|
||||||
if (recycleCursor == cursor - 1)
|
|
||||||
{
|
|
||||||
cursor = 1;
|
|
||||||
recycleCursor = 0;
|
|
||||||
initCapacity();
|
|
||||||
Logger.LogDebug("Resetted pool to initial status");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
var pos = cursor - 1;
|
|
||||||
while (pos > 0)
|
|
||||||
{
|
|
||||||
if (!checker(pool[pos])) break;
|
|
||||||
pos--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pos + 1 == cursor) return false;
|
|
||||||
if (pos == 0)
|
|
||||||
{
|
|
||||||
cursor = 1;
|
|
||||||
recycleCursor = 0;
|
|
||||||
initCapacity();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
cursor = pos + 1;
|
|
||||||
Array.Sort(recycle, 0, recycleCursor);
|
|
||||||
var idx = Array.BinarySearch(recycle, 0, recycleCursor, pos + 1);
|
|
||||||
recycleCursor = idx < 0 ? ~idx : idx;
|
|
||||||
Logger.LogDebug($"Shrinked pool size to {cursor} and recycle size to {recycleCursor}");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,9 @@
|
|||||||
## Changlog
|
## Changlog
|
||||||
|
|
||||||
* 1.6.4
|
* 1.6.4
|
||||||
|
* `Reverse conveyor belt`: Enable it on the Factory tab and press `Alt+R` over a built belt to reverse it without opening its panel. The shortcut can be changed in the system options.
|
||||||
* `Hide battle-related techs in Peace mode`: Fix an array index error when opening the tech tree after switching from a Peace-mode save to a Combat-mode save in the same game process, including when disabling the option after loading another Peace-mode save.
|
* `Hide battle-related techs in Peace mode`: Fix an array index error when opening the tech tree after switching from a Peace-mode save to a Combat-mode save in the same game process, including when disabling the option after loading another Peace-mode save.
|
||||||
|
* `Auto-cruise`: Fix the mecha diving back into the ground right after taking off from a moon that is close to its gas giant.
|
||||||
* 1.6.3
|
* 1.6.3
|
||||||
* `Quick build Mining Machines`:
|
* `Quick build Mining Machines`:
|
||||||
* Add a Factory-tab button to arrange ordinary Mining Machines densely around the nearest solid vein group. Each miner covers at least 3 nodes from that group, without including nearby groups. Layouts are not limited by stock; missing miners remain as ghosts awaiting materials. Placement respects construction range and does not include belts or power facilities. Click again to cancel a search.
|
* Add a Factory-tab button to arrange ordinary Mining Machines densely around the nearest solid vein group. Each miner covers at least 3 nodes from that group, without including nearby groups. Layouts are not limited by stock; missing miners remain as ghosts awaiting materials. Placement respects construction range and does not include belts or power facilities. Click again to cancel a search.
|
||||||
@@ -447,7 +449,9 @@
|
|||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
* 1.6.4
|
* 1.6.4
|
||||||
|
* `反转传送带`:在「工厂」页启用后,将鼠标移到已建成的传送带上,按 `Alt+R` 直接反转,无需打开面板;可在系统选项中修改快捷键。
|
||||||
* `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。
|
* `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。
|
||||||
|
* `自动巡航`:修复从紧邻气态巨星的卫星上起飞后,机甲又扎回地面的问题。
|
||||||
* 1.6.3
|
* 1.6.3
|
||||||
* `快速铺设采矿机`:
|
* `快速铺设采矿机`:
|
||||||
* 在「工厂」页增加按钮,自动在最近的固体矿脉周围密集铺设普通采矿机。每台至少覆盖选中矿脉的 3 个矿点,不混入附近其他矿脉。布局数量不受库存限制,采矿机不足的位置保留待建造虚影。遵守建造范围,不自动铺设传送带和电力设施。计算期间再次点击可取消。
|
* 在「工厂」页增加按钮,自动在最近的固体矿脉周围密集铺设普通采矿机。每台至少覆盖选中矿脉的 3 个矿点,不混入附近其他矿脉。布局数量不受库存限制,采矿机不足的位置保留待建造虚影。遵守建造范围,不自动铺设传送带和电力设施。计算期间再次点击可取消。
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public static class FactoryConfigProvider
|
|||||||
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled => FactoryPatch.TankFastFillInAndTakeOutEnabled;
|
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled => FactoryPatch.TankFastFillInAndTakeOutEnabled;
|
||||||
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier => FactoryPatch.TankFastFillInAndTakeOutMultiplier;
|
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier => FactoryPatch.TankFastFillInAndTakeOutMultiplier;
|
||||||
public static ConfigEntry<bool> CutConveyorBeltEnabled => FactoryPatch.CutConveyorBeltEnabled;
|
public static ConfigEntry<bool> CutConveyorBeltEnabled => FactoryPatch.CutConveyorBeltEnabled;
|
||||||
|
public static ConfigEntry<bool> ReverseConveyorBeltEnabled => FactoryPatch.ReverseConveyorBeltEnabled;
|
||||||
public static ConfigEntry<bool> TweakBuildingBufferEnabled => FactoryPatch.TweakBuildingBufferEnabled;
|
public static ConfigEntry<bool> TweakBuildingBufferEnabled => FactoryPatch.TweakBuildingBufferEnabled;
|
||||||
public static ConfigEntry<int> AssemblerBufferTimeMultiplier => FactoryPatch.AssemblerBufferTimeMultiplier;
|
public static ConfigEntry<int> AssemblerBufferTimeMultiplier => FactoryPatch.AssemblerBufferTimeMultiplier;
|
||||||
public static ConfigEntry<int> AssemblerBufferMininumMultiplier => FactoryPatch.AssemblerBufferMininumMultiplier;
|
public static ConfigEntry<int> AssemblerBufferMininumMultiplier => FactoryPatch.AssemblerBufferMininumMultiplier;
|
||||||
|
|||||||
@@ -133,21 +133,6 @@ public static class I18N
|
|||||||
ApplyIndexers();
|
ApplyIndexers();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the localized text for the given key in the currently active language,
|
|
||||||
/// falling back to the key itself when no entry is registered.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="key">The lookup key.</param>
|
|
||||||
/// <returns>The localized text, or <paramref name="key"/> if no entry exists.</returns>
|
|
||||||
internal static string Translate(string key)
|
|
||||||
{
|
|
||||||
if (!Entries.TryGetValue(key, out var loc)) return key;
|
|
||||||
var languageIndex = Localization.currentLanguageIndex;
|
|
||||||
if (languageIndex >= 0 && languageIndex < Localization.Languages.Length && Localization.Languages[languageIndex].lcId == 2052)
|
|
||||||
return loc.Zh;
|
|
||||||
return loc.En;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(Localization), nameof(Localization.LoadSettings))]
|
[HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(Localization), nameof(Localization.LoadSettings))]
|
||||||
private static void Localization_LoadSettings_Postfix()
|
private static void Localization_LoadSettings_Postfix()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public static class I18NKeys
|
|||||||
public const string KEYToggleDoNotRenderEntities = "KEYToggleDoNotRenderEntities";
|
public const string KEYToggleDoNotRenderEntities = "KEYToggleDoNotRenderEntities";
|
||||||
public const string KEYOffgridForPaths = "KEYOffgridForPaths";
|
public const string KEYOffgridForPaths = "KEYOffgridForPaths";
|
||||||
public const string KEYCutConveyorBelt = "KEYCutConveyorBelt";
|
public const string KEYCutConveyorBelt = "KEYCutConveyorBelt";
|
||||||
|
public const string KEYReverseConveyorBelt = "KEYReverseConveyorBelt";
|
||||||
public const string KEYDismantleBlueprintSelection = "KEYDismantleBlueprintSelection";
|
public const string KEYDismantleBlueprintSelection = "KEYDismantleBlueprintSelection";
|
||||||
public const string KEYSelectAllBuildingsInBlueprintCopy = "KEYSelectAllBuildingsInBlueprintCopy";
|
public const string KEYSelectAllBuildingsInBlueprintCopy = "KEYSelectAllBuildingsInBlueprintCopy";
|
||||||
public const string KEYUPSSpeedDown = "KEYUPSSpeedDown";
|
public const string KEYUPSSpeedDown = "KEYUPSSpeedDown";
|
||||||
@@ -111,6 +112,7 @@ public static class I18NKeys
|
|||||||
public const string FastFillInToAndTakeOutFromTanks = "Fast fill in to and take out from tanks";
|
public const string FastFillInToAndTakeOutFromTanks = "Fast fill in to and take out from tanks";
|
||||||
public const string SpeedRatio = "Speed Ratio";
|
public const string SpeedRatio = "Speed Ratio";
|
||||||
public const string CutConveyorBeltWithShortcutKey = "Cut conveyor belt (with shortcut key)";
|
public const string CutConveyorBeltWithShortcutKey = "Cut conveyor belt (with shortcut key)";
|
||||||
|
public const string ReverseConveyorBeltWithShortcutKey = "Reverse conveyor belt (with shortcut key)";
|
||||||
public const string ProtectVeinsFromExhaustion = "Protect veins from exhaustion";
|
public const string ProtectVeinsFromExhaustion = "Protect veins from exhaustion";
|
||||||
public const string ProtectVeinsFromExhaustionTips = "Protect veins from exhaustion tips";
|
public const string ProtectVeinsFromExhaustionTips = "Protect veins from exhaustion tips";
|
||||||
public const string DoNotRenderFactoryEntities = "Do not render factory entities";
|
public const string DoNotRenderFactoryEntities = "Do not render factory entities";
|
||||||
@@ -301,6 +303,7 @@ public static class I18NKeys
|
|||||||
I18N.Add(KEYToggleDoNotRenderEntities, "[UXA] Toggle Do Not Render Factory Entities", "[UXA] 切换不渲染工厂建筑实体");
|
I18N.Add(KEYToggleDoNotRenderEntities, "[UXA] Toggle Do Not Render Factory Entities", "[UXA] 切换不渲染工厂建筑实体");
|
||||||
I18N.Add(KEYOffgridForPaths, "[UXA] Build belts offgrid", "[UXA] 脱离网格建造传送带");
|
I18N.Add(KEYOffgridForPaths, "[UXA] Build belts offgrid", "[UXA] 脱离网格建造传送带");
|
||||||
I18N.Add(KEYCutConveyorBelt, "[UXA] Cut conveyor belt", "[UXA] 切割传送带");
|
I18N.Add(KEYCutConveyorBelt, "[UXA] Cut conveyor belt", "[UXA] 切割传送带");
|
||||||
|
I18N.Add(KEYReverseConveyorBelt, "[UXA] Reverse conveyor belt", "[UXA] 反转传送带");
|
||||||
I18N.Add(KEYDismantleBlueprintSelection, "[UXA] Dismantle blueprint selected buildings", "[UXA] 拆除蓝图选中的建筑");
|
I18N.Add(KEYDismantleBlueprintSelection, "[UXA] Dismantle blueprint selected buildings", "[UXA] 拆除蓝图选中的建筑");
|
||||||
I18N.Add(KEYSelectAllBuildingsInBlueprintCopy, "[UXA] Select all buildings in Blueprint Copy Mode", "[UXA] 蓝图复制时选择所有建筑");
|
I18N.Add(KEYSelectAllBuildingsInBlueprintCopy, "[UXA] Select all buildings in Blueprint Copy Mode", "[UXA] 蓝图复制时选择所有建筑");
|
||||||
I18N.Add(KEYUPSSpeedDown, "[UXA] Decrease logical frame rate", "[UXA] 降低逻辑帧率");
|
I18N.Add(KEYUPSSpeedDown, "[UXA] Decrease logical frame rate", "[UXA] 降低逻辑帧率");
|
||||||
@@ -370,6 +373,7 @@ Hold Ctrl/Shift/Alt to change the count rapidly.
|
|||||||
I18N.Add(FastFillInToAndTakeOutFromTanks, "Fast fill in to and take out from tanks", "储液罐快速注入和抽取液体");
|
I18N.Add(FastFillInToAndTakeOutFromTanks, "Fast fill in to and take out from tanks", "储液罐快速注入和抽取液体");
|
||||||
I18N.Add(SpeedRatio, "Speed Ratio", "速度倍率");
|
I18N.Add(SpeedRatio, "Speed Ratio", "速度倍率");
|
||||||
I18N.Add(CutConveyorBeltWithShortcutKey, "Cut conveyor belt (with shortcut key)", "切割传送带(使用快捷键)");
|
I18N.Add(CutConveyorBeltWithShortcutKey, "Cut conveyor belt (with shortcut key)", "切割传送带(使用快捷键)");
|
||||||
|
I18N.Add(ReverseConveyorBeltWithShortcutKey, "Reverse conveyor belt (with shortcut key)", "反转传送带(使用快捷键)");
|
||||||
I18N.Add(ProtectVeinsFromExhaustion, "Protect veins from exhaustion", "保护矿脉不会耗尽");
|
I18N.Add(ProtectVeinsFromExhaustion, "Protect veins from exhaustion", "保护矿脉不会耗尽");
|
||||||
I18N.Add(ProtectVeinsFromExhaustionTips, """
|
I18N.Add(ProtectVeinsFromExhaustionTips, """
|
||||||
By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.
|
By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ namespace UXAssist.Common;
|
|||||||
|
|
||||||
public enum KnownItemId : int
|
public enum KnownItemId : int
|
||||||
{
|
{
|
||||||
Drone = 5001,
|
Drone = GameConstants.ItemIds.LogisticsDrone,
|
||||||
Ship = 5002,
|
Ship = GameConstants.ItemIds.LogisticsVessel,
|
||||||
Bot = 5003,
|
Bot = GameConstants.ItemIds.LogisticsBot,
|
||||||
Warper = 1210,
|
Warper = GameConstants.ItemIds.SpaceWarper,
|
||||||
}
|
}
|
||||||
@@ -80,12 +80,6 @@ public static class WinApi
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Errors
|
|
||||||
|
|
||||||
private const int ERROR_INSUFFICIENT_BUFFER = 122;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Structs
|
#region Structs
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
|||||||
@@ -24,6 +24,43 @@ public static class FactoryFunctions
|
|||||||
cargoTraffic.AlterBeltConnections(beltId, 0, i0, i1, i2);
|
cargoTraffic.AlterBeltConnections(beltId, 0, i0, i1, i2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ReverseConveyorBelt(PlanetFactory factory, int beltId)
|
||||||
|
{
|
||||||
|
var traffic = factory?.cargoTraffic;
|
||||||
|
var player = GameMain.mainPlayer;
|
||||||
|
var window = UIRoot.instance?.uiGame?.beltWindow;
|
||||||
|
if (traffic == null || player == null || window == null || beltId <= 0 || beltId >= traffic.beltPool.Length) return;
|
||||||
|
|
||||||
|
ref var belt = ref traffic.beltPool[beltId];
|
||||||
|
if (belt.id != beltId) return;
|
||||||
|
var path = traffic.GetCargoPath(belt.segPathId);
|
||||||
|
// Match the native reverse button's limit of 2 to 1023 belts in one path.
|
||||||
|
const int maxBeltCount = 1023;
|
||||||
|
if (path == null || path.belts.Count < 2 || path.belts.Count > maxBeltCount) return;
|
||||||
|
|
||||||
|
var oldFactory = window.factory;
|
||||||
|
var oldTraffic = window.traffic;
|
||||||
|
var oldPlayer = window.player;
|
||||||
|
var oldBeltId = window._beltId;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
window.factory = factory;
|
||||||
|
window.traffic = traffic;
|
||||||
|
window.player = player;
|
||||||
|
// The beltId setter refreshes the visible inspector, so bind the backing field directly.
|
||||||
|
window._beltId = beltId;
|
||||||
|
// Nebula intercepts this native entry point to synchronize reversals.
|
||||||
|
window.OnReverseButtonClick(0);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
window._beltId = oldBeltId;
|
||||||
|
window.factory = oldFactory;
|
||||||
|
window.traffic = oldTraffic;
|
||||||
|
window.player = oldPlayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static bool ObjectIsBeltOrInserter(PlanetFactory factory, int objId)
|
public static bool ObjectIsBeltOrInserter(PlanetFactory factory, int objId)
|
||||||
{
|
{
|
||||||
if (objId == 0) return false;
|
if (objId == 0) return false;
|
||||||
|
|||||||
@@ -27,14 +27,6 @@ internal static class MenuButtonUI
|
|||||||
I18N.OnInitialized += RecreateConfigWindow;
|
I18N.OnInitialized += RecreateConfigWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Start()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Uninit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void OnInputUpdate()
|
public static void OnInputUpdate()
|
||||||
{
|
{
|
||||||
if (_toggleKey.keyValue)
|
if (_toggleKey.keyValue)
|
||||||
@@ -43,10 +35,6 @@ internal static class MenuButtonUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnUpdate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void ToggleConfigWindow()
|
public static void ToggleConfigWindow()
|
||||||
{
|
{
|
||||||
if (!_configWinInitialized)
|
if (!_configWinInitialized)
|
||||||
|
|||||||
@@ -35,10 +35,6 @@ internal static class MilkyWayUI
|
|||||||
GameLogicProc.OnGameEnd += ResetState;
|
GameLogicProc.OnGameEnd += ResetState;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Start()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Uninit()
|
public static void Uninit()
|
||||||
{
|
{
|
||||||
GameLogicProc.OnGameEnd -= ResetState;
|
GameLogicProc.OnGameEnd -= ResetState;
|
||||||
@@ -50,14 +46,6 @@ internal static class MilkyWayUI
|
|||||||
_topTenPlayerData = null;
|
_topTenPlayerData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnInputUpdate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void OnUpdate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void AddClusterUploadResult(int result, float requestTime)
|
public static void AddClusterUploadResult(int result, float requestTime)
|
||||||
{
|
{
|
||||||
lock (_clusterUploadResultsLock)
|
lock (_clusterUploadResultsLock)
|
||||||
|
|||||||
@@ -58,26 +58,6 @@ internal static class StarmapFilterUI
|
|||||||
{1000, 23},
|
{1000, 23},
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void Init()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Start()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void Uninit()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void OnInputUpdate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void OnUpdate()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InitStarmapButtons()
|
public static void InitStarmapButtons()
|
||||||
{
|
{
|
||||||
var uiRoot = UIRoot.instance;
|
var uiRoot = UIRoot.instance;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ public static class UIFunctions
|
|||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
MenuButtonUI.Init();
|
MenuButtonUI.Init();
|
||||||
StarmapFilterUI.Init();
|
|
||||||
MilkyWayUI.Init();
|
MilkyWayUI.Init();
|
||||||
|
|
||||||
UXAssist.RegisterExporter(ExportClusterUploadResults);
|
UXAssist.RegisterExporter(ExportClusterUploadResults);
|
||||||
@@ -19,32 +18,22 @@ public static class UIFunctions
|
|||||||
|
|
||||||
public static void Start()
|
public static void Start()
|
||||||
{
|
{
|
||||||
MenuButtonUI.Start();
|
|
||||||
StarmapFilterUI.Start();
|
|
||||||
MilkyWayUI.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Uninit()
|
public static void Uninit()
|
||||||
{
|
{
|
||||||
MenuButtonUI.Uninit();
|
|
||||||
StarmapFilterUI.Uninit();
|
|
||||||
MilkyWayUI.Uninit();
|
MilkyWayUI.Uninit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnInputUpdate()
|
public static void OnInputUpdate()
|
||||||
{
|
{
|
||||||
MenuButtonUI.OnInputUpdate();
|
MenuButtonUI.OnInputUpdate();
|
||||||
StarmapFilterUI.OnInputUpdate();
|
|
||||||
MilkyWayUI.OnInputUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnUpdate()
|
public static void OnUpdate()
|
||||||
{
|
{
|
||||||
MenuButtonUI.OnUpdate();
|
|
||||||
AutoCruiseUI.OnUpdate();
|
AutoCruiseUI.OnUpdate();
|
||||||
AutoConstructUI.OnUpdate();
|
AutoConstructUI.OnUpdate();
|
||||||
StarmapFilterUI.OnUpdate();
|
|
||||||
MilkyWayUI.OnUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InitMenuButtons()
|
public static void InitMenuButtons()
|
||||||
|
|||||||
@@ -46,19 +46,6 @@ public static class WindowFunctions
|
|||||||
process.PriorityClass = (ProcessPriorityClass)ProrityFlags[ProcessPriority.Value];
|
process.PriorityClass = (ProcessPriorityClass)ProrityFlags[ProcessPriority.Value];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetPriorityName(int priority)
|
|
||||||
{
|
|
||||||
return priority switch
|
|
||||||
{
|
|
||||||
WinApi.HIGH_PRIORITY_CLASS => I18NKeys.High.Translate(),
|
|
||||||
WinApi.ABOVE_NORMAL_PRIORITY_CLASS => I18NKeys.AboveNormal.Translate(),
|
|
||||||
WinApi.NORMAL_PRIORITY_CLASS => I18NKeys.Normal.Translate(),
|
|
||||||
WinApi.BELOW_NORMAL_PRIORITY_CLASS => I18NKeys.BelowNormal.Translate(),
|
|
||||||
WinApi.IDLE_PRIORITY_CLASS => I18NKeys.Idle.Translate(),
|
|
||||||
_ => I18NKeys.Unknown.Translate()
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SetWindowTitle()
|
public static void SetWindowTitle()
|
||||||
{
|
{
|
||||||
// Get profile name from command line arguments, and set window title accordingly
|
// Get profile name from command line arguments, and set window title accordingly
|
||||||
|
|||||||
@@ -10,15 +10,6 @@ namespace UXAssist.Patches.Factory;
|
|||||||
|
|
||||||
internal static class ArchitectModePatch
|
internal static class ArchitectModePatch
|
||||||
{
|
{
|
||||||
public static void Enable(bool enable)
|
|
||||||
{
|
|
||||||
UnlimitInteractive.Enable(enable);
|
|
||||||
RemoveSomeConditionBuild.Enable(enable);
|
|
||||||
RemoveBuildRangeLimit.Enable(enable);
|
|
||||||
LargerAreaForUpgradeAndDismantle.Enable(enable);
|
|
||||||
LargerAreaForTerraform.Enable(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class UnlimitInteractive : PatchImpl<UnlimitInteractive>
|
internal class UnlimitInteractive : PatchImpl<UnlimitInteractive>
|
||||||
{
|
{
|
||||||
// Harmony transpiler: PlayerAction_Inspect_GetObjectSelectDistance_Transpiler
|
// Harmony transpiler: PlayerAction_Inspect_GetObjectSelectDistance_Transpiler
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
@@ -14,11 +13,6 @@ namespace UXAssist.Patches.Factory;
|
|||||||
[ModFeature("BeltSignalsForBuyOut")]
|
[ModFeature("BeltSignalsForBuyOut")]
|
||||||
internal static class BeltSignalPatch
|
internal static class BeltSignalPatch
|
||||||
{
|
{
|
||||||
public static void Enable(bool enable)
|
|
||||||
{
|
|
||||||
BeltSignalsForBuyOut.Enable(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InitPersist()
|
public static void InitPersist()
|
||||||
{
|
{
|
||||||
BeltSignalsForBuyOut.InitPersist();
|
BeltSignalsForBuyOut.InitPersist();
|
||||||
@@ -125,23 +119,6 @@ internal static class BeltSignalPatch
|
|||||||
_loaded = true;
|
_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RemoveBeltSignalProtos()
|
|
||||||
{
|
|
||||||
if (!_initialized || !_loaded) return;
|
|
||||||
var signals = LDB._signals;
|
|
||||||
if (signals.dataIndices.TryGetValue(301, out var index))
|
|
||||||
{
|
|
||||||
signals.dataArray = [.. signals.dataArray.Take(index), .. signals.dataArray.Skip(index + 6)];
|
|
||||||
for (var id = 301; id <= 306; id++)
|
|
||||||
signals.dataIndices.Remove(id);
|
|
||||||
var len = signals.dataArray.Length;
|
|
||||||
for (; index < len; index++)
|
|
||||||
signals.dataIndices[signals.dataArray[index].ID] = index;
|
|
||||||
}
|
|
||||||
|
|
||||||
_loaded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void InitSignalBelts()
|
private static void InitSignalBelts()
|
||||||
{
|
{
|
||||||
if (!GameMain.isRunning) return;
|
if (!GameMain.isRunning) return;
|
||||||
|
|||||||
@@ -79,8 +79,6 @@ internal static class BuildToolPatch
|
|||||||
|
|
||||||
internal class OffGridBuilding : PatchImpl<OffGridBuilding>
|
internal class OffGridBuilding : PatchImpl<OffGridBuilding>
|
||||||
{
|
{
|
||||||
// private const float SteppedRotationDegrees = 15f;
|
|
||||||
|
|
||||||
private static bool _initialized;
|
private static bool _initialized;
|
||||||
|
|
||||||
private static void SetupRichTextSupport()
|
private static void SetupRichTextSupport()
|
||||||
@@ -292,62 +290,6 @@ internal static class BuildToolPatch
|
|||||||
return matcher.InstructionEnumeration();
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public static IEnumerable<CodeInstruction> PatchToPerformSteppedRotate(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
|
||||||
{
|
|
||||||
var matcher = new CodeMatcher(instructions, generator);
|
|
||||||
|
|
||||||
MatchIgnoreGridAndCheckIfRotatable(matcher, out var ifBlockEntryLabel, out var elseBlockEntryLabel);
|
|
||||||
|
|
||||||
if (matcher.IsInvalid)
|
|
||||||
return instructions;
|
|
||||||
|
|
||||||
while (!matcher.Labels.Contains(elseBlockEntryLabel.Value))
|
|
||||||
matcher.Advance(1);
|
|
||||||
|
|
||||||
Label? ifBlockExitLabel = null;
|
|
||||||
|
|
||||||
matcher.MatchBack(false, new CodeMatch(ci => ci.Branches(out ifBlockExitLabel)));
|
|
||||||
|
|
||||||
if (matcher.IsInvalid)
|
|
||||||
return instructions;
|
|
||||||
|
|
||||||
while (!matcher.Labels.Contains(ifBlockEntryLabel.Value))
|
|
||||||
matcher.Advance(-1);
|
|
||||||
|
|
||||||
var instructionToClone = matcher.Instruction.Clone();
|
|
||||||
var overwriteWith = CodeInstruction.LoadField(typeof(VFInput), nameof(VFInput.control));
|
|
||||||
|
|
||||||
matcher.SetAndAdvance(overwriteWith.opcode, overwriteWith.operand);
|
|
||||||
matcher.Insert(instructionToClone);
|
|
||||||
matcher.CreateLabel(out var existingEntryLabel);
|
|
||||||
matcher.InsertAndAdvance(
|
|
||||||
new CodeInstruction(OpCodes.Brfalse, existingEntryLabel),
|
|
||||||
new CodeInstruction(OpCodes.Ldarg_0),
|
|
||||||
CodeInstruction.Call(typeof(OffGridBuilding), nameof(RotateStepped)),
|
|
||||||
new CodeInstruction(OpCodes.Br, ifBlockExitLabel)
|
|
||||||
);
|
|
||||||
|
|
||||||
return matcher.InstructionEnumeration();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RotateStepped(BuildTool_Click instance)
|
|
||||||
{
|
|
||||||
if (VFInput._rotate.onDown)
|
|
||||||
{
|
|
||||||
instance.yaw += SteppedRotationDegrees;
|
|
||||||
instance.yaw = Mathf.Repeat(instance.yaw, 360f);
|
|
||||||
instance.yaw = Mathf.Round(instance.yaw / SteppedRotationDegrees) * SteppedRotationDegrees;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VFInput._counterRotate.onDown)
|
|
||||||
{
|
|
||||||
instance.yaw -= SteppedRotationDegrees;
|
|
||||||
instance.yaw = Mathf.Repeat(instance.yaw, 360f);
|
|
||||||
instance.yaw = Mathf.Round(instance.yaw / SteppedRotationDegrees) * SteppedRotationDegrees;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class TreatStackingAsSingle : PatchImpl<TreatStackingAsSingle>
|
internal class TreatStackingAsSingle : PatchImpl<TreatStackingAsSingle>
|
||||||
|
|||||||
@@ -8,11 +8,6 @@ namespace UXAssist.Patches.Factory;
|
|||||||
|
|
||||||
internal static class BuildingBufferPatch
|
internal static class BuildingBufferPatch
|
||||||
{
|
{
|
||||||
public static void Enable(bool enable)
|
|
||||||
{
|
|
||||||
TweakBuildingBuffer.Enable(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
internal class TweakBuildingBuffer : PatchImpl<TweakBuildingBuffer>
|
internal class TweakBuildingBuffer : PatchImpl<TweakBuildingBuffer>
|
||||||
{
|
{
|
||||||
public static void RefreshAssemblerBufferMultipliers()
|
public static void RefreshAssemblerBufferMultipliers()
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public static class FactoryPatch
|
|||||||
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled;
|
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled;
|
||||||
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier;
|
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier;
|
||||||
public static ConfigEntry<bool> CutConveyorBeltEnabled;
|
public static ConfigEntry<bool> CutConveyorBeltEnabled;
|
||||||
|
public static ConfigEntry<bool> ReverseConveyorBeltEnabled;
|
||||||
public static ConfigEntry<bool> TweakBuildingBufferEnabled;
|
public static ConfigEntry<bool> TweakBuildingBufferEnabled;
|
||||||
public static ConfigEntry<int> AssemblerBufferTimeMultiplier;
|
public static ConfigEntry<int> AssemblerBufferTimeMultiplier;
|
||||||
public static ConfigEntry<int> AssemblerBufferMininumMultiplier;
|
public static ConfigEntry<int> AssemblerBufferMininumMultiplier;
|
||||||
@@ -56,6 +57,7 @@ public static class FactoryPatch
|
|||||||
internal static PressKeyBind _doNotRenderEntitiesKey;
|
internal static PressKeyBind _doNotRenderEntitiesKey;
|
||||||
internal static PressKeyBind _offgridfForPathsKey;
|
internal static PressKeyBind _offgridfForPathsKey;
|
||||||
internal static PressKeyBind _cutConveyorBeltKey;
|
internal static PressKeyBind _cutConveyorBeltKey;
|
||||||
|
internal static PressKeyBind _reverseConveyorBeltKey;
|
||||||
internal static PressKeyBind _dismantleBlueprintSelectionKey;
|
internal static PressKeyBind _dismantleBlueprintSelectionKey;
|
||||||
internal static PressKeyBind _selectAllBuildingsInBlueprintCopyKey;
|
internal static PressKeyBind _selectAllBuildingsInBlueprintCopyKey;
|
||||||
|
|
||||||
@@ -86,6 +88,14 @@ public static class FactoryPatch
|
|||||||
name = "CutConveyorBelt",
|
name = "CutConveyorBelt",
|
||||||
canOverride = true
|
canOverride = true
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
_reverseConveyorBeltKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||||
|
{
|
||||||
|
key = new CombineKey((int)KeyCode.R, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
|
||||||
|
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||||
|
name = "ReverseConveyorBelt",
|
||||||
|
canOverride = true
|
||||||
|
}
|
||||||
);
|
);
|
||||||
_dismantleBlueprintSelectionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
_dismantleBlueprintSelectionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||||
{
|
{
|
||||||
@@ -215,6 +225,13 @@ public static class FactoryPatch
|
|||||||
Functions.FactoryFunctions.CutConveyorBelt(cargoTraffic, beltId);
|
Functions.FactoryFunctions.CutConveyorBelt(cargoTraffic, beltId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ReverseConveyorBeltEnabled.Value && _reverseConveyorBeltKey.keyValue
|
||||||
|
&& GameMain.isRunning && !GameMain.isPaused && !VFInput.onGUI)
|
||||||
|
{
|
||||||
|
var raycast = GameMain.mainPlayer?.controller?.cmd.raycast;
|
||||||
|
if (raycast != null && raycast.castEntity.id > 0 && raycast.castEntity.beltId > 0)
|
||||||
|
Functions.FactoryFunctions.ReverseConveyorBelt(raycast.planet?.factory, raycast.castEntity.beltId);
|
||||||
|
}
|
||||||
if (ShortcutKeysForBlueprintCopyEnabled.Value)
|
if (ShortcutKeysForBlueprintCopyEnabled.Value)
|
||||||
{
|
{
|
||||||
if (_dismantleBlueprintSelectionKey.keyValue)
|
if (_dismantleBlueprintSelectionKey.keyValue)
|
||||||
|
|||||||
@@ -10,11 +10,6 @@ namespace UXAssist.Patches.Factory;
|
|||||||
[ModFeature("VeinProtection")]
|
[ModFeature("VeinProtection")]
|
||||||
internal static partial class VeinProtectionPatch
|
internal static partial class VeinProtectionPatch
|
||||||
{
|
{
|
||||||
public static void Enable(bool enable)
|
|
||||||
{
|
|
||||||
ProtectVeinsFromExhaustion.Enable(enable);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void InitConfig()
|
public static void InitConfig()
|
||||||
{
|
{
|
||||||
ProtectVeinsFromExhaustion.InitConfig();
|
ProtectVeinsFromExhaustion.InitConfig();
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
public static ConfigEntry<bool> EnableWindowResizeEnabled;
|
public static ConfigEntry<bool> EnableWindowResizeEnabled;
|
||||||
public static ConfigEntry<bool> LoadLastWindowRectEnabled;
|
public static ConfigEntry<bool> LoadLastWindowRectEnabled;
|
||||||
|
|
||||||
// public static ConfigEntry<bool> AutoSaveOptEnabled;
|
|
||||||
public static ConfigEntry<bool> ConvertSavesFromPeaceEnabled;
|
public static ConfigEntry<bool> ConvertSavesFromPeaceEnabled;
|
||||||
public static ConfigEntry<Vector4> LastWindowRect;
|
public static ConfigEntry<Vector4> LastWindowRect;
|
||||||
public static ConfigEntry<bool> ProfileBasedSaveFolderEnabled;
|
public static ConfigEntry<bool> ProfileBasedSaveFolderEnabled;
|
||||||
@@ -81,7 +80,6 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
FixLastWindowRect();
|
FixLastWindowRect();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// AutoSaveOptEnabled.SettingChanged += (_, _) => AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
|
|
||||||
ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
||||||
ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath();
|
ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath();
|
||||||
ProfileBasedOptionEnabled.SettingChanged += (_, _) => ProfileBasedOption.Enable(ProfileBasedOptionEnabled.Value);
|
ProfileBasedOptionEnabled.SettingChanged += (_, _) => ProfileBasedOption.Enable(ProfileBasedOptionEnabled.Value);
|
||||||
@@ -112,7 +110,6 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
||||||
// AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
|
|
||||||
ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
||||||
Enable(true);
|
Enable(true);
|
||||||
|
|
||||||
@@ -123,7 +120,6 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
{
|
{
|
||||||
Enable(false);
|
Enable(false);
|
||||||
EnableWindowResize.Enable(false);
|
EnableWindowResize.Enable(false);
|
||||||
// AutoSaveOpt.Enable(false);
|
|
||||||
ConvertSavesFromPeace.Enable(false);
|
ConvertSavesFromPeace.Enable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,145 +307,6 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
private class AutoSaveOpt: PatchImpl<AutoSaveOpt>
|
|
||||||
{
|
|
||||||
protected override void OnEnable()
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(GameConfig.gameSaveFolder + "AutoSaves/");
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(GameSave), nameof(GameSave.AutoSave))]
|
|
||||||
private static bool GameSave_AutoSave_Prefix(ref bool __result)
|
|
||||||
{
|
|
||||||
if (!GameSave.SaveCurrentGame(GameSave.AutoSaveTmp))
|
|
||||||
{
|
|
||||||
GlobalObject.SaveOpCounter();
|
|
||||||
__result = false;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var tmpFilename = GameConfig.gameSaveFolder + GameSave.AutoSaveTmp + GameSave.saveExt;
|
|
||||||
var targetFilename = $"{GameConfig.gameSaveFolder}AutoSaves/[{GameMain.data.gameDesc.clusterString}] {DateTime.Now:yyyy-MM-dd_hh-mm-ss}{GameSave.saveExt}";
|
|
||||||
File.Move(tmpFilename, targetFilename);
|
|
||||||
__result = true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPostfix]
|
|
||||||
[HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.RefreshList))]
|
|
||||||
public static void UILoadGameWindow_RefreshList_Postfix(UILoadGameWindow __instance)
|
|
||||||
{
|
|
||||||
var baseDir = GameConfig.gameSaveFolder + "AutoSaves/";
|
|
||||||
var files = Directory.GetFiles(baseDir, "*" + GameSave.saveExt, SearchOption.TopDirectoryOnly);
|
|
||||||
var entries = __instance.entries;
|
|
||||||
var entries2 = new List<UIGameSaveEntry>();
|
|
||||||
var entryPrefab = __instance.entryPrefab;
|
|
||||||
var entryPrefabParent = entryPrefab.transform.parent;
|
|
||||||
foreach (var f in files)
|
|
||||||
{
|
|
||||||
var fileInfo = new FileInfo(f);
|
|
||||||
var entry = Object.Instantiate(entryPrefab, entryPrefabParent);
|
|
||||||
entry.fileInfo = fileInfo;
|
|
||||||
entries2.Add(entry);
|
|
||||||
}
|
|
||||||
entries2.Sort((x, y) => -x.fileDate.CompareTo(y.fileDate));
|
|
||||||
if (entries2.Count > 10)
|
|
||||||
entries2.RemoveRange(10, entries2.Count - 10);
|
|
||||||
var autoSaveText = ">> " + I18NKeys.AutoSaveEntry.Translate();
|
|
||||||
foreach (var entry in entries2)
|
|
||||||
{
|
|
||||||
entry.indexText.text = "";
|
|
||||||
var saveName = entry.saveName;
|
|
||||||
entry._saveName = $"AutoSaves/{saveName}";
|
|
||||||
var quoteIndex = saveName.IndexOf('[');
|
|
||||||
if (quoteIndex >= 0)
|
|
||||||
{
|
|
||||||
var quoteIndex2 = saveName.IndexOf(']', quoteIndex + 1);
|
|
||||||
if (quoteIndex2 > 0) saveName = saveName.Substring(quoteIndex, quoteIndex2 + 1 - quoteIndex);
|
|
||||||
}
|
|
||||||
entry.nameText.text = $"{autoSaveText} {saveName}";
|
|
||||||
entry.nameText.fontStyle = FontStyle.Italic;
|
|
||||||
entry.nameText.color = new Color(1f, 1f, 1f, 0.7f);
|
|
||||||
entry.timeText.text = $"{entry.fileDate:yyyy-MM-dd HH:mm:ss}";
|
|
||||||
GameSave.ReadModes(entry.fileInfo.FullName, out var isSandbox, out var isPeace);
|
|
||||||
if (entry.sandboxIcon != null)
|
|
||||||
{
|
|
||||||
entry.sandboxIcon.gameObject.SetActive(isSandbox);
|
|
||||||
}
|
|
||||||
if (entry.combatIcon != null)
|
|
||||||
{
|
|
||||||
entry.combatIcon.gameObject.SetActive(!isPeace);
|
|
||||||
}
|
|
||||||
entry.selected = false;
|
|
||||||
entry.gameObject.SetActive(true);
|
|
||||||
}
|
|
||||||
entries.AddRange(entries2);
|
|
||||||
entries.Sort((x, y) => -x.fileDate.CompareTo(y.fileDate));
|
|
||||||
var displayIndex = 1;
|
|
||||||
for (var i = 0; i < entries.Count; i++)
|
|
||||||
{
|
|
||||||
var entry = entries[i];
|
|
||||||
entry.index = i + 1;
|
|
||||||
entry.rectTrans.anchoredPosition = new Vector2(entry.rectTrans.anchoredPosition.x, -40 * i);
|
|
||||||
if (string.IsNullOrEmpty(entry.indexText.text)) continue;
|
|
||||||
entry.indexText.text = displayIndex.ToString();
|
|
||||||
displayIndex++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPostfix]
|
|
||||||
[HarmonyPatch(typeof(UISaveGameWindow), nameof(UISaveGameWindow.RefreshList))]
|
|
||||||
public static void UISaveGameWindow_RefreshList_Postfix(UISaveGameWindow __instance)
|
|
||||||
{
|
|
||||||
var entries = __instance.entries;
|
|
||||||
entries.Sort((x, y) => -x.fileDate.CompareTo(y.fileDate));
|
|
||||||
for (var i = 0; i < entries.Count; i++)
|
|
||||||
{
|
|
||||||
var entry = entries[i];
|
|
||||||
entry.index = i + 1;
|
|
||||||
entry.rectTrans.anchoredPosition = new Vector2(entry.rectTrans.anchoredPosition.x, -40 * i);
|
|
||||||
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]
|
|
||||||
[HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.DoLoadSelectedGame))]
|
|
||||||
[HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.OnSelectedChange))]
|
|
||||||
private static IEnumerable<CodeInstruction> UILoadGameWindow_ReplaceSaveName_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
|
||||||
{
|
|
||||||
var matcher = new CodeMatcher(instructions, generator);
|
|
||||||
matcher.Start().MatchForward(false,
|
|
||||||
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(UIGameSaveEntry), nameof(UIGameSaveEntry.saveName)))
|
|
||||||
);
|
|
||||||
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldfld, AccessTools.Field(typeof(UIGameSaveEntry), nameof(UIGameSaveEntry._saveName))));
|
|
||||||
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]
|
|
||||||
[HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadCurrentGame))]
|
|
||||||
[HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadGameDesc))]
|
|
||||||
[HarmonyPatch(typeof(GameSave), nameof(GameSave.ReadHeader))]
|
|
||||||
[HarmonyPatch(typeof(GameSave), nameof(GameSave.ReadHeaderAndDescAndProperty))]
|
|
||||||
[HarmonyPatch(typeof(GameSave), nameof(GameSave.SaveExist))]
|
|
||||||
[HarmonyPatch(typeof(GameSave), nameof(GameSave.SavePath))]
|
|
||||||
private static IEnumerable<CodeInstruction> GameSave_RemoveValidateOnLoad_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
|
||||||
{
|
|
||||||
var matcher = new CodeMatcher(instructions, generator);
|
|
||||||
matcher.Start().MatchForward(false,
|
|
||||||
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(CommonUtils), nameof(CommonUtils.ValidFileName)))
|
|
||||||
);
|
|
||||||
matcher.RemoveInstruction();
|
|
||||||
return matcher.InstructionEnumeration();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
private class ConvertSavesFromPeace : PatchImpl<ConvertSavesFromPeace>
|
private class ConvertSavesFromPeace : PatchImpl<ConvertSavesFromPeace>
|
||||||
{
|
{
|
||||||
private static bool _needConvert;
|
private static bool _needConvert;
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ internal static class RealtimeLogisticsInfoPanel
|
|||||||
|| rectPoint.x is < -4096f or > 4096f
|
|| rectPoint.x is < -4096f or > 4096f
|
||||||
|| rectPoint.y is < -4096f or > 4096f
|
|| rectPoint.y is < -4096f or > 4096f
|
||||||
|| Phys.RayCastSphere(localPosition, vec / magnitude, magnitude, Vector3.zero, realRadius, out _)
|
|| Phys.RayCastSphere(localPosition, vec / magnitude, magnitude, Vector3.zero, realRadius, out _)
|
||||||
|| storageArray.Select(x => x.itemId).All(x => x == 0))
|
|| storageArray.All(storage => storage.itemId == 0))
|
||||||
{
|
{
|
||||||
stationTip.gameObject.SetActive(false);
|
stationTip.gameObject.SetActive(false);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
+41
-107
@@ -204,110 +204,6 @@ 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]
|
|
||||||
[HarmonyPatch(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet._OnLateUpdate))]
|
|
||||||
private static IEnumerable<CodeInstruction> UIStarmapPlanet__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
|
||||||
{
|
|
||||||
var matcher = new CodeMatcher(instructions, generator);
|
|
||||||
matcher.MatchForward(false,
|
|
||||||
new CodeMatch(OpCodes.Ldarg_0),
|
|
||||||
new CodeMatch(OpCodes.Ldloc_3),
|
|
||||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet.projected)))
|
|
||||||
);
|
|
||||||
matcher.Advance(3);
|
|
||||||
matcher.CreateLabel(out var jumpPos1);
|
|
||||||
matcher.InsertAndAdvance(
|
|
||||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))),
|
|
||||||
new CodeInstruction(OpCodes.Ldc_I4_2),
|
|
||||||
new CodeInstruction(OpCodes.Ceq),
|
|
||||||
new CodeInstruction(OpCodes.Brfalse, jumpPos1),
|
|
||||||
new CodeInstruction(OpCodes.Ldc_I4_0),
|
|
||||||
new CodeInstruction(OpCodes.Stloc_3)
|
|
||||||
);
|
|
||||||
matcher.MatchForward(false,
|
|
||||||
new CodeMatch(OpCodes.Ldarg_0),
|
|
||||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet.gameHistory))),
|
|
||||||
new CodeMatch(OpCodes.Ldarg_0),
|
|
||||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet.planet))),
|
|
||||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PlanetData), nameof(PlanetData.id))),
|
|
||||||
new CodeMatch(OpCodes.Callvirt, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.GetPlanetPin))),
|
|
||||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
|
||||||
new CodeMatch(ci => ci.Branches(out _)),
|
|
||||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
|
||||||
new CodeMatch(ci => ci.IsStloc()),
|
|
||||||
new CodeMatch(ci => ci.Branches(out _))
|
|
||||||
);
|
|
||||||
matcher.CreateLabelAt(matcher.Pos + 8, out var jumpPos);
|
|
||||||
var labels = matcher.Labels;
|
|
||||||
matcher.Labels = [];
|
|
||||||
matcher.InsertAndAdvance(
|
|
||||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))).WithLabels(labels),
|
|
||||||
new CodeInstruction(OpCodes.Ldc_I4_1),
|
|
||||||
new CodeInstruction(OpCodes.Ceq),
|
|
||||||
new CodeInstruction(OpCodes.Brtrue, jumpPos),
|
|
||||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(PlayerPatch), nameof(_showAllStarsNameKey))),
|
|
||||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(KeyBindings), nameof(KeyBindings.IsKeyPressing))),
|
|
||||||
new CodeInstruction(OpCodes.Brtrue, jumpPos)
|
|
||||||
);
|
|
||||||
return matcher.InstructionEnumeration();
|
|
||||||
}
|
|
||||||
// Harmony transpiler: UIStarmapDFHive__OnLateUpdate_Transpiler
|
|
||||||
// Target: UIStarmapDFHive._OnLateUpdate
|
|
||||||
// Fallback: None — patch will fail loudly if the target method body changes.
|
|
||||||
[HarmonyTranspiler]
|
|
||||||
[HarmonyPatch(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive._OnLateUpdate))]
|
|
||||||
private static IEnumerable<CodeInstruction> UIStarmapDFHive__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
|
||||||
{
|
|
||||||
var matcher = new CodeMatcher(instructions, generator);
|
|
||||||
matcher.MatchForward(false,
|
|
||||||
new CodeMatch(OpCodes.Ldarg_0),
|
|
||||||
new CodeMatch(ci => ci.IsLdloc()),
|
|
||||||
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive.projected)))
|
|
||||||
);
|
|
||||||
matcher.Advance(3);
|
|
||||||
matcher.CreateLabel(out var jumpPos1);
|
|
||||||
matcher.InsertAndAdvance(
|
|
||||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))),
|
|
||||||
new CodeInstruction(OpCodes.Ldc_I4_2),
|
|
||||||
new CodeInstruction(OpCodes.Ceq),
|
|
||||||
new CodeInstruction(OpCodes.Brfalse, jumpPos1),
|
|
||||||
new CodeInstruction(OpCodes.Ldc_I4_0),
|
|
||||||
new CodeInstruction(OpCodes.Stloc_S, 4)
|
|
||||||
);
|
|
||||||
matcher.MatchForward(false,
|
|
||||||
new CodeMatch(OpCodes.Ldarg_0),
|
|
||||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive.gameHistory))),
|
|
||||||
new CodeMatch(OpCodes.Ldarg_0),
|
|
||||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive.hive))),
|
|
||||||
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EnemyDFHiveSystem), nameof(EnemyDFHiveSystem.hiveStarId))),
|
|
||||||
new CodeMatch(OpCodes.Ldc_I4, 1000000),
|
|
||||||
new CodeMatch(OpCodes.Sub),
|
|
||||||
new CodeMatch(OpCodes.Callvirt, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.GetHivePin))),
|
|
||||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
|
||||||
new CodeMatch(ci => ci.Branches(out _)),
|
|
||||||
new CodeMatch(OpCodes.Ldc_I4_1),
|
|
||||||
new CodeMatch(ci => ci.IsStloc()),
|
|
||||||
new CodeMatch(ci => ci.Branches(out _))
|
|
||||||
);
|
|
||||||
matcher.CreateLabelAt(matcher.Pos + 10, out var jumpPos);
|
|
||||||
var labels = matcher.Labels;
|
|
||||||
matcher.Labels = [];
|
|
||||||
matcher.InsertAndAdvance(
|
|
||||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))).WithLabels(labels),
|
|
||||||
new CodeInstruction(OpCodes.Ldc_I4_1),
|
|
||||||
new CodeInstruction(OpCodes.Ceq),
|
|
||||||
new CodeInstruction(OpCodes.Brtrue, jumpPos),
|
|
||||||
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(PlayerPatch), nameof(_showAllStarsNameKey))),
|
|
||||||
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(KeyBindings), nameof(KeyBindings.IsKeyPressing))),
|
|
||||||
new CodeInstruction(OpCodes.Brtrue, jumpPos)
|
|
||||||
);
|
|
||||||
return matcher.InstructionEnumeration();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -758,6 +654,19 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
return default;
|
return default;
|
||||||
|
|
||||||
VectorLF3 baseDir = toTarget.normalized;
|
VectorLF3 baseDir = toTarget.normalized;
|
||||||
|
|
||||||
|
// The mecha can be inside several path radii at once. Stars and planets keep priority over
|
||||||
|
// hives: a hive's range is wide enough to cover a whole planet, and leaving the hive first
|
||||||
|
// can steer a mecha that has just taken off back into the ground.
|
||||||
|
// Among stars and planets, a moon close to its gas giant puts a mecha on the moon inside both
|
||||||
|
// ranges, and the giant comes first in the list. Leaving only the giant sends a mecha that
|
||||||
|
// takes off from the moon's giant-facing side back into the ground, because "away from the
|
||||||
|
// giant" points down there. Leave all of them together, each weighted by how deep the mecha
|
||||||
|
// is inside its range: their safety margins are equal, so the nearest surface dominates.
|
||||||
|
VectorLF3 bodiesInward = default;
|
||||||
|
VectorLF3 hiveInward = default;
|
||||||
|
bool insideBody = false;
|
||||||
|
bool insideHive = false;
|
||||||
foreach (Obstacle obstacle in obstacles)
|
foreach (Obstacle obstacle in obstacles)
|
||||||
{
|
{
|
||||||
double pathRadius = GetReachablePathRadius(obstacle);
|
double pathRadius = GetReachablePathRadius(obstacle);
|
||||||
@@ -766,10 +675,34 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
|
|
||||||
VectorLF3 toObstacle = obstacle.Position - playerPos;
|
VectorLF3 toObstacle = obstacle.Position - playerPos;
|
||||||
double obstacleDistance = toObstacle.magnitude;
|
double obstacleDistance = toObstacle.magnitude;
|
||||||
if (obstacleDistance < pathRadius)
|
if (obstacleDistance >= pathRadius)
|
||||||
return ComputeEscapeDirection(currentDirection, toObstacle, baseDir);
|
continue;
|
||||||
|
|
||||||
|
if (obstacle.HasSurface)
|
||||||
|
{
|
||||||
|
bodiesInward += SafeNorm(toObstacle, baseDir) * (pathRadius - obstacleDistance);
|
||||||
|
insideBody = true;
|
||||||
|
}
|
||||||
|
else if (!insideHive)
|
||||||
|
{
|
||||||
|
hiveInward = toObstacle;
|
||||||
|
insideHive = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insideBody)
|
||||||
|
return ComputeEscapeDirection(currentDirection, bodiesInward, baseDir);
|
||||||
|
if (insideHive)
|
||||||
|
return ComputeEscapeDirection(currentDirection, hiveInward, baseDir);
|
||||||
|
|
||||||
|
foreach (Obstacle obstacle in obstacles)
|
||||||
|
{
|
||||||
|
double pathRadius = GetReachablePathRadius(obstacle);
|
||||||
|
if (pathRadius <= 0.0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (IsSegmentBlocked(playerPos, _targetUniversePosition, obstacle.Position, pathRadius))
|
if (IsSegmentBlocked(playerPos, _targetUniversePosition, obstacle.Position, pathRadius))
|
||||||
return ComputeTangentDirection(currentDirection, toObstacle, pathRadius, baseDir);
|
return ComputeTangentDirection(currentDirection, obstacle.Position - playerPos, pathRadius, baseDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseDir;
|
return baseDir;
|
||||||
@@ -1229,6 +1162,7 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
{
|
{
|
||||||
public VectorLF3 Position { get; } = position;
|
public VectorLF3 Position { get; } = position;
|
||||||
public double PathRadius { get; } = radius + safetyMargin;
|
public double PathRadius { get; } = radius + safetyMargin;
|
||||||
|
public bool HasSurface { get; } = radius > 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -106,11 +106,6 @@ public class UIPatch : PatchImpl<UIPatch>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Vector2 GetAdjustedSizeDelta(Vector2 origSizeDelta)
|
|
||||||
{
|
|
||||||
return new Vector2(origSizeDelta.x + 40f, origSizeDelta.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnDisable()
|
protected override void OnDisable()
|
||||||
{
|
{
|
||||||
if (planetVeinCount != null)
|
if (planetVeinCount != null)
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ public static class BlueprintDescriptionFormatter
|
|||||||
var input = new List<string>();
|
var input = new List<string>();
|
||||||
var output = new SortedDictionary<int, double>();
|
var output = new SortedDictionary<int, double>();
|
||||||
var research = new SortedDictionary<int, double>();
|
var research = new SortedDictionary<int, double>();
|
||||||
foreach (var flow in report.ItemFlows.Values.OrderBy(flow => flow.ItemId))
|
var orderedFlows = report.ItemFlows.Values.OrderBy(flow => flow.ItemId).ToArray();
|
||||||
|
foreach (var flow in orderedFlows)
|
||||||
{
|
{
|
||||||
var shortage = Math.Min(flow.IntermediateShortage,
|
var shortage = Math.Min(flow.IntermediateShortage,
|
||||||
flow.SteadyStateExternalSupply ?? flow.RequiredExternalSupply);
|
flow.SteadyStateExternalSupply ?? flow.RequiredExternalSupply);
|
||||||
@@ -98,14 +99,14 @@ public static class BlueprintDescriptionFormatter
|
|||||||
|
|
||||||
if (report.MaterialComplete)
|
if (report.MaterialComplete)
|
||||||
{
|
{
|
||||||
foreach (var flow in report.ItemFlows.Values.OrderBy(flow => flow.ItemId))
|
foreach (var flow in orderedFlows)
|
||||||
{
|
{
|
||||||
if (flow.OverbuildSurplus.GetValueOrDefault() > Tolerance)
|
if (flow.OverbuildSurplus.GetValueOrDefault() > Tolerance)
|
||||||
excess.Add(FormatItem(flow.ItemId, flow.OverbuildSurplus.Value, itemTag));
|
excess.Add(FormatItem(flow.ItemId, flow.OverbuildSurplus.Value, itemTag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var flow in report.ItemFlows.Values.OrderBy(flow => flow.ItemId))
|
foreach (var flow in orderedFlows)
|
||||||
{
|
{
|
||||||
var requiredSupply = flow.SteadyStateExternalSupply ?? flow.RequiredExternalSupply;
|
var requiredSupply = flow.SteadyStateExternalSupply ?? flow.RequiredExternalSupply;
|
||||||
if (requiredSupply > Tolerance && flow.IntermediateShortage <= Tolerance)
|
if (requiredSupply > Tolerance && flow.IntermediateShortage <= Tolerance)
|
||||||
|
|||||||
@@ -119,8 +119,7 @@ public static class ProductionCatalogReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new ProductionCatalog(items, recipes, buildings,
|
return new ProductionCatalog(items, recipes, buildings,
|
||||||
(double[])Cargo.accTableMilli.Clone(), (double[])Cargo.incTableMilli.Clone(),
|
Cargo.accTableMilli, Cargo.incTableMilli, Cargo.powerTableRatio, technologies, matrixIds);
|
||||||
(double[])Cargo.powerTableRatio.Clone(), technologies, matrixIds);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddSpecialRecipes(IEnumerable<ItemProto> itemProtos,
|
private static void AddSpecialRecipes(IEnumerable<ItemProto> itemProtos,
|
||||||
|
|||||||
@@ -60,6 +60,9 @@
|
|||||||
* Cut conveyor belt
|
* Cut conveyor belt
|
||||||
* Press shortcut key to cut conveyor belt under cursor.
|
* Press shortcut key to cut conveyor belt under cursor.
|
||||||
* The default shortcut key is Alt+X, you can set it in system options panel.
|
* The default shortcut key is Alt+X, you can set it in system options panel.
|
||||||
|
* Reverse conveyor belt
|
||||||
|
* Enable it on the Factory tab, hover over a built belt, and press `Alt+R` to reverse it without opening its panel.
|
||||||
|
* Change the shortcut in the system options. Reversal follows the native button's scope and limits.
|
||||||
* Treat stack items as single in monitor components
|
* Treat stack items as single in monitor components
|
||||||
* Quick build and dismantle stacking labs/storages/tanks
|
* Quick build and dismantle stacking labs/storages/tanks
|
||||||
* Fast fill in to and take out from tanks
|
* Fast fill in to and take out from tanks
|
||||||
@@ -268,6 +271,9 @@
|
|||||||
* 切割传送带
|
* 切割传送带
|
||||||
* 按快捷键切割光标位置的传送带
|
* 按快捷键切割光标位置的传送带
|
||||||
* 默认快捷键是Alt+X,可以在系统选项面板中设置
|
* 默认快捷键是Alt+X,可以在系统选项面板中设置
|
||||||
|
* 反转传送带
|
||||||
|
* 在「工厂」页启用后,将鼠标移到已建成的传送带上,按 `Alt+R` 直接反转,无需打开面板。
|
||||||
|
* 可在系统选项中修改快捷键,反转范围和限制与原版按钮一致。
|
||||||
* 在流速计中将堆叠物品视为单个物品
|
* 在流速计中将堆叠物品视为单个物品
|
||||||
* 快速建造和拆除堆叠研究站/储物仓/储液罐
|
* 快速建造和拆除堆叠研究站/储物仓/储液罐
|
||||||
* 储液罐快速注入和抽取液体
|
* 储液罐快速注入和抽取液体
|
||||||
|
|||||||
@@ -32,8 +32,6 @@ public class MyKeyBinder : MonoBehaviour
|
|||||||
|
|
||||||
[SerializeField] public UIButton setNoneKeyUIButton;
|
[SerializeField] public UIButton setNoneKeyUIButton;
|
||||||
|
|
||||||
private bool _nextNotOn;
|
|
||||||
|
|
||||||
protected void OnDestroy()
|
protected void OnDestroy()
|
||||||
{
|
{
|
||||||
OnFree?.Invoke();
|
OnFree?.Invoke();
|
||||||
@@ -223,11 +221,6 @@ public class MyKeyBinder : MonoBehaviour
|
|||||||
{
|
{
|
||||||
inputUIButton.highlighted = true;
|
inputUIButton.highlighted = true;
|
||||||
|
|
||||||
if (!_nextNotOn) return;
|
|
||||||
_nextNotOn = false;
|
|
||||||
inputUIButton.highlighted = false;
|
|
||||||
setTheKeyToggle.isOn = false;
|
|
||||||
waitingText.gameObject.SetActive(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnSetDefaultKeyClick(int data)
|
public void OnSetDefaultKeyClick(int data)
|
||||||
|
|||||||
@@ -559,15 +559,6 @@ public abstract class MyWindowManager
|
|||||||
win._Destroy();
|
win._Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public static void SetRect(ManualBehaviour win, RectTransform rect)
|
|
||||||
{
|
|
||||||
var rectTransform = win.GetComponent<RectTransform>();
|
|
||||||
//rectTransform.position =
|
|
||||||
//rectTransform.sizeDelta = rect;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public class Patch : PatchImpl<Patch>
|
public class Patch : PatchImpl<Patch>
|
||||||
{
|
{
|
||||||
protected override void OnEnable()
|
protected override void OnEnable()
|
||||||
@@ -586,14 +577,6 @@ public abstract class MyWindowManager
|
|||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
//_Create -> _Init
|
|
||||||
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnCreate))]
|
|
||||||
public static void UIGame__OnCreate_Postfix()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnDestroy))]
|
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnDestroy))]
|
||||||
public static void UIRoot__OnDestroy_Postfix()
|
public static void UIRoot__OnDestroy_Postfix()
|
||||||
{
|
{
|
||||||
@@ -612,17 +595,6 @@ public abstract class MyWindowManager
|
|||||||
InitAllWindows();
|
InitAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnFree))]
|
|
||||||
public static void UIGame__OnFree_Postfix()
|
|
||||||
{
|
|
||||||
foreach (var win in Windows)
|
|
||||||
{
|
|
||||||
win._Free();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnUpdate))]
|
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnUpdate))]
|
||||||
public static void UIRoot__OnUpdate_Postfix()
|
public static void UIRoot__OnUpdate_Postfix()
|
||||||
{
|
{
|
||||||
|
|||||||
+14
-36
@@ -96,37 +96,19 @@ public static class UIConfigWindow
|
|||||||
|
|
||||||
private class AutoConfigDispenserChargePowerMapper() : MyWindow.RangeValueMapper<int>(3, 30)
|
private class AutoConfigDispenserChargePowerMapper() : MyWindow.RangeValueMapper<int>(3, 30)
|
||||||
{
|
{
|
||||||
public override string FormatValue(string format, int value)
|
public override string FormatValue(string format, int value) => FormatPower(value * 300000L);
|
||||||
{
|
|
||||||
var sb = new StringBuilder(" ");
|
|
||||||
StringBuilderUtility.WriteKMG(sb, 8, value * 300000L, false);
|
|
||||||
sb.Append('W');
|
|
||||||
return sb.ToString().Trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AutoConfigBattleBaseChargePowerMapper() : MyWindow.RangeValueMapper<int>(4, 40)
|
private class AutoConfigBattleBaseChargePowerMapper() : MyWindow.RangeValueMapper<int>(4, 40)
|
||||||
{
|
{
|
||||||
|
|
||||||
public override string FormatValue(string format, int value)
|
public override string FormatValue(string format, int value) => FormatPower(value * 300000L);
|
||||||
{
|
|
||||||
var sb = new StringBuilder(" ");
|
|
||||||
StringBuilderUtility.WriteKMG(sb, 8, value * 300000L, false);
|
|
||||||
sb.Append('W');
|
|
||||||
return sb.ToString().Trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AutoConfigPLSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
private class AutoConfigPLSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
||||||
{
|
{
|
||||||
|
|
||||||
public override string FormatValue(string format, int value)
|
public override string FormatValue(string format, int value) => FormatPower(value * 3000000L);
|
||||||
{
|
|
||||||
var sb = new StringBuilder(" ");
|
|
||||||
StringBuilderUtility.WriteKMG(sb, 8, value * 3000000L, false);
|
|
||||||
sb.Append('W');
|
|
||||||
return sb.ToString().Trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AutoConfigCarrierMinDeliverMapper() : MyWindow.RangeValueMapper<int>(0, 10)
|
private class AutoConfigCarrierMinDeliverMapper() : MyWindow.RangeValueMapper<int>(0, 10)
|
||||||
@@ -147,13 +129,7 @@ public static class UIConfigWindow
|
|||||||
|
|
||||||
private class AutoConfigILSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
private class AutoConfigILSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
||||||
{
|
{
|
||||||
public override string FormatValue(string format, int value)
|
public override string FormatValue(string format, int value) => FormatPower(value * 15000000L);
|
||||||
{
|
|
||||||
var sb = new StringBuilder(" ");
|
|
||||||
StringBuilderUtility.WriteKMG(sb, 8, value * 15000000L, false);
|
|
||||||
sb.Append('W');
|
|
||||||
return sb.ToString().Trim();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AutoConfigILSMaxTripShipMapper() : MyWindow.RangeValueMapper<int>(1, 41)
|
private class AutoConfigILSMaxTripShipMapper() : MyWindow.RangeValueMapper<int>(1, 41)
|
||||||
@@ -192,6 +168,14 @@ public static class UIConfigWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string FormatPower(long watts)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder(" ");
|
||||||
|
StringBuilderUtility.WriteKMG(sb, 8, watts, false);
|
||||||
|
sb.Append('W');
|
||||||
|
return sb.ToString().Trim();
|
||||||
|
}
|
||||||
|
|
||||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||||
{
|
{
|
||||||
UnityEngine.UI.Text txt;
|
UnityEngine.UI.Text txt;
|
||||||
@@ -203,14 +187,6 @@ public static class UIConfigWindow
|
|||||||
wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, I18NKeys.EnableGameWindowResize);
|
wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, I18NKeys.EnableGameWindowResize);
|
||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, I18NKeys.RemeberWindowPositionAndSizeOnLastExit);
|
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, I18NKeys.RemeberWindowPositionAndSizeOnLastExit);
|
||||||
/*
|
|
||||||
y += 30f;
|
|
||||||
wnd.AddCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism");
|
|
||||||
x = 200f;
|
|
||||||
y += 6f;
|
|
||||||
wnd.AddTipsButton2(x, y, tab1, "Better auto-save mechanism", "Better auto-save mechanism tips", "auto-save-opt-tips");
|
|
||||||
x = 0f;
|
|
||||||
*/
|
|
||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab1, GamePatch.ConvertSavesFromPeaceEnabled, I18NKeys.ConvertOldSavesToCombatModeOnLoading);
|
wnd.AddCheckBox(x, y, tab1, GamePatch.ConvertSavesFromPeaceEnabled, I18NKeys.ConvertOldSavesToCombatModeOnLoading);
|
||||||
MyCheckBox checkBoxForMeasureTextWidth;
|
MyCheckBox checkBoxForMeasureTextWidth;
|
||||||
@@ -269,6 +245,8 @@ public static class UIConfigWindow
|
|||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.CutConveyorBeltEnabled, I18NKeys.CutConveyorBeltWithShortcutKey);
|
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.CutConveyorBeltEnabled, I18NKeys.CutConveyorBeltWithShortcutKey);
|
||||||
y += 36f;
|
y += 36f;
|
||||||
|
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.ReverseConveyorBeltEnabled, I18NKeys.ReverseConveyorBeltWithShortcutKey);
|
||||||
|
y += 36f;
|
||||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.TreatStackingAsSingleEnabled, I18NKeys.TreatStackItemsAsSingleInMonitorComponents);
|
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.TreatStackingAsSingleEnabled, I18NKeys.TreatStackItemsAsSingleInMonitorComponents);
|
||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.QuickBuildAndDismantleLabsEnabled, I18NKeys.QuickBuildAndDismantleStackingLabs);
|
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.QuickBuildAndDismantleLabsEnabled, I18NKeys.QuickBuildAndDismantleStackingLabs);
|
||||||
|
|||||||
@@ -89,10 +89,6 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
|||||||
"Profile-based option");
|
"Profile-based option");
|
||||||
GamePatch.DefaultProfileName = Config.Bind("Game", "DefaultProfileName", "Default",
|
GamePatch.DefaultProfileName = Config.Bind("Game", "DefaultProfileName", "Default",
|
||||||
"Default profile name, used when profile-based save folder is enabled. Use original game save folder if matched");
|
"Default profile name, used when profile-based save folder is enabled. Use original game save folder if matched");
|
||||||
/*
|
|
||||||
GamePatch.AutoSaveOptEnabled = Config.Bind("Game", "AutoSaveOpt", false,
|
|
||||||
"Better auto-save mechanism");
|
|
||||||
*/
|
|
||||||
GamePatch.ConvertSavesFromPeaceEnabled = Config.Bind("Game", "ConvertSavesFromPeace", false,
|
GamePatch.ConvertSavesFromPeaceEnabled = Config.Bind("Game", "ConvertSavesFromPeace", false,
|
||||||
"Convert saves from Peace mode to Combat mode on save loading");
|
"Convert saves from Peace mode to Combat mode on save loading");
|
||||||
GamePatch.GameUpsFactor = _dummyConfig.Bind("Game", "GameUpsFactor", 1.0,
|
GamePatch.GameUpsFactor = _dummyConfig.Bind("Game", "GameUpsFactor", 1.0,
|
||||||
@@ -153,6 +149,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
|||||||
FactoryPatch.TankFastFillInAndTakeOutMultiplier = Config.Bind("Factory", "TankFastFillInAndTakeOutMultiplier", 1000, "Speed multiplier for fast filling in to and takeing out from tanks");
|
FactoryPatch.TankFastFillInAndTakeOutMultiplier = Config.Bind("Factory", "TankFastFillInAndTakeOutMultiplier", 1000, "Speed multiplier for fast filling in to and takeing out from tanks");
|
||||||
FactoryPatch.CutConveyorBeltEnabled = Config.Bind("Factory", "CutConveyorBeltShortcut", false,
|
FactoryPatch.CutConveyorBeltEnabled = Config.Bind("Factory", "CutConveyorBeltShortcut", false,
|
||||||
"Cut conveyor belt (with shortcut key)");
|
"Cut conveyor belt (with shortcut key)");
|
||||||
|
FactoryPatch.ReverseConveyorBeltEnabled = Config.Bind("Factory", "ReverseConveyorBeltShortcut", false,
|
||||||
|
"Reverse conveyor belt (with shortcut key)");
|
||||||
FactoryPatch.TweakBuildingBufferEnabled = Config.Bind("Factory", "TweakBuildingBuffer", false,
|
FactoryPatch.TweakBuildingBufferEnabled = Config.Bind("Factory", "TweakBuildingBuffer", false,
|
||||||
"Tweak buffer count for assemblers and power generators");
|
"Tweak buffer count for assemblers and power generators");
|
||||||
FactoryPatch.AssemblerBufferTimeMultiplier = Config.Bind("Factory", "AssemblerBufferTimeMultiplier", 4, new ConfigDescription("Assembler buffer time multiplier in seconds", new AcceptableValueRange<int>(2, 10)));
|
FactoryPatch.AssemblerBufferTimeMultiplier = Config.Bind("Factory", "AssemblerBufferTimeMultiplier", 4, new ConfigDescription("Assembler buffer time multiplier in seconds", new AcceptableValueRange<int>(2, 10)));
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using UXAssist.Common.ModFeatures;
|
|
||||||
|
|
||||||
namespace UniverseGenTweaks;
|
namespace UniverseGenTweaks;
|
||||||
|
|
||||||
[ModFeature("UniverseGenSave", Order = 13)]
|
|
||||||
public static class GalaxyGenSave
|
public static class GalaxyGenSave
|
||||||
{
|
{
|
||||||
public static void Export(BinaryWriter w)
|
public static void Export(BinaryWriter w)
|
||||||
|
|||||||
@@ -12,10 +12,6 @@ namespace UniverseGenTweaks;
|
|||||||
[ModFeature("UniverseGenGalaxySelectUI", Order = 10)]
|
[ModFeature("UniverseGenGalaxySelectUI", Order = 10)]
|
||||||
public static class GalaxySelectUIPatch
|
public static class GalaxySelectUIPatch
|
||||||
{
|
{
|
||||||
private static Text _minDistTitle;
|
|
||||||
private static Text _minStepTitle;
|
|
||||||
private static Text _maxStepTitle;
|
|
||||||
private static Text _flattenTitle;
|
|
||||||
private static Slider _minDistSlider;
|
private static Slider _minDistSlider;
|
||||||
private static Slider _minStepSlider;
|
private static Slider _minStepSlider;
|
||||||
private static Slider _maxStepSlider;
|
private static Slider _maxStepSlider;
|
||||||
@@ -62,28 +58,28 @@ public static class GalaxySelectUIPatch
|
|||||||
{
|
{
|
||||||
__instance.starCountSlider.maxValue = MoreSettings.MaxStarCount.Value;
|
__instance.starCountSlider.maxValue = MoreSettings.MaxStarCount.Value;
|
||||||
|
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _minDistTitle, out _minDistSlider, out _minDistText, out var minDistLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out var minDistTitle, out _minDistSlider, out _minDistText, out var minDistLocalizer);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _minStepTitle, out _minStepSlider, out _minStepText, out var minStepLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out var minStepTitle, out _minStepSlider, out _minStepText, out var minStepLocalizer);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _maxStepTitle, out _maxStepSlider, out _maxStepText, out var maxStepLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out var maxStepTitle, out _maxStepSlider, out _maxStepText, out var maxStepLocalizer);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out _flattenTitle, out _flattenSlider, out _flattenText, out var flattenLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out var flattenTitle, out _flattenSlider, out _flattenText, out var flattenLocalizer);
|
||||||
minDistLocalizer.stringKey = Localization.StarDistanceMin;
|
minDistLocalizer.stringKey = Localization.StarDistanceMin;
|
||||||
_minDistTitle.text = Localization.StarDistanceMin.Translate();
|
minDistTitle.text = Localization.StarDistanceMin.Translate();
|
||||||
minStepLocalizer.stringKey = Localization.StepDistanceMin;
|
minStepLocalizer.stringKey = Localization.StepDistanceMin;
|
||||||
_minStepTitle.text = Localization.StepDistanceMin.Translate();
|
minStepTitle.text = Localization.StepDistanceMin.Translate();
|
||||||
maxStepLocalizer.stringKey = Localization.StepDistanceMax;
|
maxStepLocalizer.stringKey = Localization.StepDistanceMax;
|
||||||
_maxStepTitle.text = Localization.StepDistanceMax.Translate();
|
maxStepTitle.text = Localization.StepDistanceMax.Translate();
|
||||||
flattenLocalizer.stringKey = Localization.Flatness;
|
flattenLocalizer.stringKey = Localization.Flatness;
|
||||||
_flattenTitle.text = Localization.Flatness.Translate();
|
flattenTitle.text = Localization.Flatness.Translate();
|
||||||
|
|
||||||
_minDistTitle.name = "min-dist";
|
minDistTitle.name = "min-dist";
|
||||||
_minStepTitle.name = "min-step";
|
minStepTitle.name = "min-step";
|
||||||
_maxStepTitle.name = "max-step";
|
maxStepTitle.name = "max-step";
|
||||||
_flattenTitle.name = "flatten";
|
flattenTitle.name = "flatten";
|
||||||
|
|
||||||
TransformDeltaY(_minDistTitle.transform, UniverseGenConstants.SliderRowSpacing);
|
TransformDeltaY(minDistTitle.transform, UniverseGenConstants.SliderRowSpacing);
|
||||||
TransformDeltaY(_minStepTitle.transform, UniverseGenConstants.SliderRowSpacing * 2);
|
TransformDeltaY(minStepTitle.transform, UniverseGenConstants.SliderRowSpacing * 2);
|
||||||
TransformDeltaY(_maxStepTitle.transform, UniverseGenConstants.SliderRowSpacing * 3);
|
TransformDeltaY(maxStepTitle.transform, UniverseGenConstants.SliderRowSpacing * 3);
|
||||||
TransformDeltaY(_flattenTitle.transform, UniverseGenConstants.SliderRowSpacing * 4);
|
TransformDeltaY(flattenTitle.transform, UniverseGenConstants.SliderRowSpacing * 4);
|
||||||
TransformDeltaY(__instance.darkFogToggle.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
TransformDeltaY(__instance.darkFogToggle.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
||||||
TransformDeltaY(__instance.resourceMultiplierSlider.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
TransformDeltaY(__instance.resourceMultiplierSlider.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
||||||
TransformDeltaY(__instance.sandboxToggle.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
TransformDeltaY(__instance.sandboxToggle.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
||||||
@@ -113,10 +109,7 @@ public static class GalaxySelectUIPatch
|
|||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnUnregEvent))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnUnregEvent))]
|
||||||
private static void UIGalaxySelect__OnUnregEvent_Postfix()
|
private static void UIGalaxySelect__OnUnregEvent_Postfix()
|
||||||
{
|
{
|
||||||
_minDistSlider.onValueChanged.RemoveAllListeners();
|
RemoveAllListeners();
|
||||||
_minStepSlider.onValueChanged.RemoveAllListeners();
|
|
||||||
_maxStepSlider.onValueChanged.RemoveAllListeners();
|
|
||||||
_flattenSlider.onValueChanged.RemoveAllListeners();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ namespace UniverseGenTweaks;
|
|||||||
|
|
||||||
public static class UIConfigWindow
|
public static class UIConfigWindow
|
||||||
{
|
{
|
||||||
private static RectTransform _windowTrans;
|
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
MyConfigWindow.OnUICreated += CreateUI;
|
MyConfigWindow.OnUICreated += CreateUI;
|
||||||
@@ -16,13 +14,12 @@ public static class UIConfigWindow
|
|||||||
|
|
||||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||||
{
|
{
|
||||||
_windowTrans = trans;
|
|
||||||
// General tab
|
// General tab
|
||||||
var x = 0f;
|
var x = 0f;
|
||||||
var y = 10f;
|
var y = 10f;
|
||||||
wnd.AddSplitter(trans, 10f);
|
wnd.AddSplitter(trans, 10f);
|
||||||
wnd.AddTabGroup(trans, Localization.UniverseGen, "tab-group-galaxygen");
|
wnd.AddTabGroup(trans, Localization.UniverseGen, "tab-group-galaxygen");
|
||||||
var tab1 = wnd.AddTab(_windowTrans, "General");
|
var tab1 = wnd.AddTab(trans, "General");
|
||||||
MyCheckBox.CreateCheckBox(x, y, tab1, MoreSettings.Enabled, Localization.EnableMoreSettingsOnUniverseGen);
|
MyCheckBox.CreateCheckBox(x, y, tab1, MoreSettings.Enabled, Localization.EnableMoreSettingsOnUniverseGen);
|
||||||
x += 20f;
|
x += 20f;
|
||||||
y += 26f;
|
y += 26f;
|
||||||
@@ -70,7 +67,7 @@ public static class UIConfigWindow
|
|||||||
EpicDifficulty.OilMultiplier.Value = val;
|
EpicDifficulty.OilMultiplier.Value = val;
|
||||||
sl2.SetLabelText(val.ToString(sl2.labelFormat));
|
sl2.SetLabelText(val.ToString(sl2.labelFormat));
|
||||||
};
|
};
|
||||||
var tab2 = wnd.AddTab(_windowTrans, Localization.BirthStar);
|
var tab2 = wnd.AddTab(trans, Localization.BirthStar);
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
MyCheckBox.CreateCheckBox(x, y, tab2, BirthPlanetPatch.SitiVeinsOnBirthPlanet, Localization.SiliconTitaniumOnBirthPlanet);
|
MyCheckBox.CreateCheckBox(x, y, tab2, BirthPlanetPatch.SitiVeinsOnBirthPlanet, Localization.SiliconTitaniumOnBirthPlanet);
|
||||||
@@ -94,4 +91,4 @@ public static class UIConfigWindow
|
|||||||
y += 36f;
|
y += 36f;
|
||||||
MyCheckBox.CreateCheckBox(x, y, tab2, BirthPlanetPatch.HighLuminosityBirthStar, Localization.BirthStarHasHighLuminosity);
|
MyCheckBox.CreateCheckBox(x, y, tab2, BirthPlanetPatch.HighLuminosityBirthStar, Localization.BirthStarHasHighLuminosity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
// Checks the auto-cruise obstacle avoidance of a built UXAssist.dll without Unity. The avoidance math and
|
||||||
|
// its inputs are private to PlayerPatch.AutoNavigation, so they are reached through reflection.
|
||||||
|
internal static class AutoCruiseAvoidanceTests
|
||||||
|
{
|
||||||
|
private const BindingFlags Members =
|
||||||
|
BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||||
|
|
||||||
|
private const double PlanetRadius = 200.0;
|
||||||
|
private const double GasGiantRadius = 800.0;
|
||||||
|
private const double TakeoffAltitude = 49.0;
|
||||||
|
|
||||||
|
private static readonly VectorLF3 Up = new(0.0, 1.0, 0.0);
|
||||||
|
private static readonly VectorLF3 East = new(1.0, 0.0, 0.0);
|
||||||
|
private static readonly VectorLF3 North = new(0.0, 0.0, 1.0);
|
||||||
|
|
||||||
|
// A mecha that has just left a planet centred on the origin, still moving along the ground, with a
|
||||||
|
// destination far away in a direction that no obstacle of these checks blocks.
|
||||||
|
private static readonly VectorLF3 Mecha = Up * (PlanetRadius + TakeoffAltitude);
|
||||||
|
private static readonly VectorLF3 Target = North * (100.0 * GalaxyData.AU);
|
||||||
|
|
||||||
|
private static Type _navigation;
|
||||||
|
private static Type _obstacle;
|
||||||
|
private static int _checks;
|
||||||
|
private static int _failures;
|
||||||
|
|
||||||
|
private static void Check(bool condition, string message)
|
||||||
|
{
|
||||||
|
_checks++;
|
||||||
|
if (condition) return;
|
||||||
|
_failures++;
|
||||||
|
Console.WriteLine("FAIL " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MemberInfo Member(string name)
|
||||||
|
{
|
||||||
|
MemberInfo[] members = _navigation.GetMember(name, Members);
|
||||||
|
if (members.Length != 1)
|
||||||
|
throw new MissingMemberException($"PlayerPatch.AutoNavigation.{name} was not found; update this check to match the renamed member.");
|
||||||
|
return members[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double Constant(string name) => (double)((FieldInfo)Member(name)).GetRawConstantValue();
|
||||||
|
|
||||||
|
private static object Obstacle(VectorLF3 position, double radius, double safetyMargin) =>
|
||||||
|
Activator.CreateInstance(_obstacle, Members, null, [position, radius, safetyMargin], null);
|
||||||
|
|
||||||
|
private static VectorLF3 Direction(VectorLF3 heading, params object[] obstacles)
|
||||||
|
{
|
||||||
|
((FieldInfo)Member("_targetUniversePosition")).SetValue(null, Target);
|
||||||
|
((FieldInfo)Member("_targetUniverseVelocity")).SetValue(null, default(VectorLF3));
|
||||||
|
((FieldInfo)Member("_targetArriveThresholdRadius")).SetValue(null, 4000.0);
|
||||||
|
var list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(_obstacle));
|
||||||
|
foreach (object obstacle in obstacles) list.Add(obstacle);
|
||||||
|
return (VectorLF3)((MethodInfo)Member("ComputeDirection")).Invoke(null, [Mecha, heading, list]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int Main(string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length != 1) throw new ArgumentException("Usage: AutoCruiseAvoidanceTests <UXAssist.dll>");
|
||||||
|
Assembly mod = Assembly.LoadFrom(args[0]);
|
||||||
|
_navigation = mod.GetType("UXAssist.Patches.PlayerPatch+AutoNavigation", true);
|
||||||
|
_obstacle = mod.GetType("UXAssist.Patches.PlayerPatch+Obstacle", true);
|
||||||
|
double planetMargin = Constant("PlanetSafeRadius");
|
||||||
|
double hiveMargin = Constant("HiveSafeRadius");
|
||||||
|
|
||||||
|
object planet = Obstacle(default, PlanetRadius, planetMargin);
|
||||||
|
|
||||||
|
Check(VectorLF3.Dot(Direction(East), North) > 0.999,
|
||||||
|
"With nothing in the way the mecha must head straight for the target.");
|
||||||
|
|
||||||
|
VectorLF3 takeoff = Direction(East, planet);
|
||||||
|
Check(VectorLF3.Dot(takeoff, Up) > 0.85,
|
||||||
|
$"Taking off from a planet must climb away from it (heading vs. local up {VectorLF3.Dot(takeoff, Up):0.000}).");
|
||||||
|
|
||||||
|
// A hive's range is wide enough to cover a planet next to its orbit. Here the hive is straight
|
||||||
|
// overhead, so "away from the hive" points into the ground.
|
||||||
|
object hive = Obstacle(Mecha + Up * 8000.0, 0.0, hiveMargin);
|
||||||
|
VectorLF3 underHive = Direction(East, planet, hive);
|
||||||
|
Check((underHive - takeoff).magnitude < 1e-9,
|
||||||
|
$"A hive range that overlaps the planet must not change the take-off heading (heading vs. local up {VectorLF3.Dot(underHive, Up):0.000}).");
|
||||||
|
|
||||||
|
// A moon close to its gas giant: on the ground of the moon's giant-facing side the mecha is inside
|
||||||
|
// the giant's range too, and "away from the giant" points into the ground. The giant is listed
|
||||||
|
// first, as the planets are in orbit order.
|
||||||
|
VectorLF3 toGiant = (Up * 0.5 + East * Math.Sqrt(0.75)) * 2520.0;
|
||||||
|
object giant = Obstacle(Mecha + toGiant, GasGiantRadius, planetMargin);
|
||||||
|
foreach (VectorLF3 heading in new[] { East, -East, North })
|
||||||
|
{
|
||||||
|
VectorLF3 fromMoon = Direction(heading, giant, planet);
|
||||||
|
Check(VectorLF3.Dot(fromMoon, Up) > 0.75,
|
||||||
|
$"Taking off from a moon inside its gas giant's range must climb away from the moon (heading vs. local up {VectorLF3.Dot(fromMoon, Up):0.000}).");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Away from any surface a hive is still left behind.
|
||||||
|
object nearbyHive = Obstacle(Mecha + East * 8000.0, 0.0, hiveMargin);
|
||||||
|
VectorLF3 fromHive = Direction(North, nearbyHive);
|
||||||
|
Check(VectorLF3.Dot(fromHive, -East) > 0.85,
|
||||||
|
$"Inside a hive's range alone the mecha must fly away from the hive (heading vs. away {VectorLF3.Dot(fromHive, -East):0.000}).");
|
||||||
|
|
||||||
|
Console.WriteLine(_failures == 0
|
||||||
|
? $"Auto-cruise avoidance checks passed ({_checks} checks)."
|
||||||
|
: $"Auto-cruise avoidance checks: {_failures} of {_checks} failed.");
|
||||||
|
return _failures == 0 ? 0 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
#requires -Version 5.1
|
||||||
|
# Runs the auto-cruise obstacle avoidance of a built UXAssist.dll against the original game assemblies, without Unity.
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([string]$GameRoot, [string]$UXAssistDll)
|
||||||
|
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$repoRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..\..'))
|
||||||
|
if (-not $GameRoot) {
|
||||||
|
$steamRoot = (Get-ItemProperty -LiteralPath 'HKCU:\Software\Valve\Steam' -Name SteamPath).SteamPath
|
||||||
|
$vdf = Get-Content -LiteralPath (Join-Path $steamRoot 'steamapps\libraryfolders.vdf') -Raw
|
||||||
|
foreach ($entry in [regex]::Matches($vdf, '"path"\s+"([^"]+)"')) {
|
||||||
|
$library = $entry.Groups[1].Value.Replace('\\', '\')
|
||||||
|
$candidate = Join-Path $library 'steamapps\common\Dyson Sphere Program'
|
||||||
|
if (Test-Path -LiteralPath (Join-Path $candidate 'DSPGAME_Data\Managed\Assembly-CSharp.dll')) {
|
||||||
|
$GameRoot = $candidate
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-not $GameRoot) { throw 'DSP installation not found. Pass -GameRoot with the installed game directory.' }
|
||||||
|
$managed = Join-Path ([IO.Path]::GetFullPath($GameRoot)) 'DSPGAME_Data\Managed'
|
||||||
|
foreach ($name in @('Assembly-CSharp.dll', 'UnityEngine.CoreModule.dll')) {
|
||||||
|
if (-not (Test-Path -LiteralPath (Join-Path $managed $name))) { throw "Missing original game assembly: $name" }
|
||||||
|
}
|
||||||
|
if (-not $UXAssistDll) {
|
||||||
|
& dotnet build (Join-Path $repoRoot 'UXAssist\UXAssist.csproj') -c Release --no-restore -v quiet -nologo
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "UXAssist build failed (exit $LASTEXITCODE)." }
|
||||||
|
$UXAssistDll = Join-Path $repoRoot 'UXAssist\bin\Release\net472\UXAssist.dll'
|
||||||
|
}
|
||||||
|
$modDll = (Resolve-Path -LiteralPath $UXAssistDll).Path
|
||||||
|
$testRoot = Join-Path $repoRoot 'UXAssist\obj\auto-cruise-tests'
|
||||||
|
$null = [IO.Directory]::CreateDirectory($testRoot)
|
||||||
|
# Isolate the temporary console project from the mod's SDK props, packages, and packaging targets.
|
||||||
|
Set-Content -LiteralPath (Join-Path $testRoot 'Directory.Build.props') -Value '<Project />' -Encoding UTF8
|
||||||
|
Set-Content -LiteralPath (Join-Path $testRoot 'Directory.Build.targets') -Value '<Project />' -Encoding UTF8
|
||||||
|
$tests = [Security.SecurityElement]::Escape((Join-Path $PSScriptRoot 'AutoCruiseAvoidanceTests.cs'))
|
||||||
|
$originalDll = [Security.SecurityElement]::Escape((Join-Path $managed 'Assembly-CSharp.dll'))
|
||||||
|
$unityDll = [Security.SecurityElement]::Escape((Join-Path $managed 'UnityEngine.CoreModule.dll'))
|
||||||
|
$project = Join-Path $testRoot 'AutoCruiseTests.csproj'
|
||||||
|
Set-Content -LiteralPath $project -Encoding UTF8 -Value @"
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
|
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||||
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="$tests" />
|
||||||
|
<Reference Include="Assembly-CSharp" HintPath="$originalDll" />
|
||||||
|
<Reference Include="UnityEngine.CoreModule" HintPath="$unityDll" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
"@
|
||||||
|
& dotnet run --project $project -c Release -- $modDll
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "Auto-cruise avoidance checks failed (exit $LASTEXITCODE)." }
|
||||||
Reference in new issue
Block a user