mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(mods): restore architect mode and clear stale station panels
Restore architect inventory handling and use 999 virtual items, including logistics bots, drones, and vessels. Recycle removed station panels and refresh overlays independently of typing guards. Bump CheatEnabler to 2.4.6 and UXAssist to 1.6.1, with release notes and synchronized package manifests.
This commit is contained in:
1 parent
d084f9cf75
commit
1c5073c6ac
12 files changed
+145
-105
No files matched your search
@@ -20,13 +20,14 @@
|
||||
- `Directory.Build.props` supplies common frameworks, BepInEx packages, game references, warning policy, and the `UpdateGameDlls` dependency. `Directory.Build.targets` defines `ZipMod` and `CopyToParentPackage`.
|
||||
- Normal validation: `dotnet build <project>/<project>.csproj -c Release --no-restore`.
|
||||
- Refresh game references explicitly with `dotnet build UpdateGameDlls/UpdateGameDlls.csproj`; the script compares timestamps and uses `assembly-publicizer --strip --overwrite`. Missing DSP or the publicizer is a warning, not a build failure.
|
||||
- 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`.
|
||||
- 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 English `CHANGELOG.md` release heading aligned with `<Version>`, carrying forward existing unreleased notes without rewriting historical entries.
|
||||
- Treat warnings as errors except the intentional obsolete API warning `0618`; do not weaken this policy to hide new warnings.
|
||||
|
||||
## Architecture
|
||||
|
||||
- `ModFeatureRegistry` discovers dependent-mod features during `Awake`; feature initialization is eager, while UXAssist alone drives the deferred start, input, update, and uninitialization lifecycle. Keep dispatchers internal and idempotent.
|
||||
- Proto-dependent features must tolerate calls before preload completes and retry via `UXAssist.Common.GameLogic.OnDataLoaded`. Mark changes applied only after capturing valid originals and successfully mutating the proto.
|
||||
- Architect-mode virtual stock applies only to player inventory and construction previews, including logistics bots, drones, and vessels. Keep cached package statistics consistent for inlined getters, preserve physical capacity and native ref/out contracts, and restore native statistics on disable.
|
||||
- Dispatch UXAssist shortcuts from the postfix of `VFInput.OnUpdate`, after DSP refreshes modifier and UI state. Keep typing/menu guards and per-frame registry guards; do not poll from an independent `Update()` or logic-tick callback.
|
||||
- Register localization keys through each project registration class and use `.Translate()` with keys. Do not add Chinese literals at call sites.
|
||||
- Prefer `UXAssist/Common/GameConstants` for item, tech, logistics, and Dyson sphere constants instead of inline literals.
|
||||
@@ -34,7 +35,8 @@
|
||||
- Use `ModCompatHelper` for external plugin/type/member resolution and preserve legacy public type identities when refactoring reflection targets. Use `DysonSphereReflection` for DSPOptimizations-compatible Dyson sphere fields.
|
||||
- Performance-sensitive Harmony transpilers must include the standard target/fallback header and use `TranspilerGuard` when a matcher can fail; returning original instructions is the fallback. Match named enum members and semantic calls or fields instead of hard-coded enum values or local-variable slots. Validate injected stack operand types and branch destinations, not just successful matching.
|
||||
- `PatchImpl<T>.Enable(true)` must remain fail-soft: log, unpatch, and leave the patch unset if Harmony application fails so config delegate chains remain consistent.
|
||||
- Overlay UI state must converge from actual game state on periodic updates, not depend only on one-shot event or patch callbacks. Cloned controls must reset runtime state while retaining source styles; use `UXAssist.UI.Util.GetPreferredWidth` for dynamic text and `ResetButton` for cloned buttons. Shared button sizing must use anchor-relative child positions so text and icons remain aligned after a button pivot changes.
|
||||
- Overlay UI state must converge from actual game state on periodic updates, not depend only on one-shot event or patch callbacks. Treat replacement of a planet transport as a lifecycle boundary and clear its dependent overlays once. Station IDs are reusable indices, and a stable planet ID or factory reference does not imply stable transport ownership. Cloned controls must reset runtime state while retaining source styles; use `UXAssist.UI.Util.GetPreferredWidth` for dynamic text and `ResetButton` for cloned buttons. Shared button sizing must use anchor-relative child positions so text and icons remain aligned after a button pivot changes.
|
||||
- Logistics station overlays must refresh through the native UI lifecycle, independently of typing guards. Reconcile cached tips against live station/entity identities and recycle local tips when stations are removed.
|
||||
- UI-only options must preserve native progression, statistics, and event delivery. Suppress presentation handlers rather than bypassing authoritative game-state setters.
|
||||
- LiveStreamAssist browser overlays must use single-flight polling and discard stale work after connection changes. Compound queries must reject mixed session IDs; cache only positive production indices so newly tracked items remain discoverable.
|
||||
- LiveStreamAssist production reads must schedule the native extra-info calculator for queried factories independently of the statistics UI. Deduplicate and throttle refreshes, let active native batches finish, and clear pending factory indices and deadlines at session boundaries.
|
||||
@@ -59,6 +61,6 @@
|
||||
|
||||
## Review Standard
|
||||
|
||||
- Fix root causes with minimal focused changes. Do not alter unrelated behavior, add copyright headers, commit changes, push branches, or create branches unless requested. Commit only task-related files and leave unrelated working-tree changes untouched. Use normal pushes; do not rewrite remote history unless explicitly requested.
|
||||
- Fix root causes with minimal focused changes. Do not alter unrelated behavior, add copyright headers, commit changes, push branches, or create branches unless requested. Stage and commit only explicitly named task-related files, leaving unrelated working-tree changes untouched. Use normal pushes; do not rewrite remote history unless explicitly requested.
|
||||
- Before handoff, run the narrowest relevant build or test, then `git diff --check`. Mention unrelated pre-existing failures instead of changing them.
|
||||
- For game updates, also check Harmony target resolution and affected IL patterns against the original game DLL; compilation alone does not validate runtime patches.
|
||||
Binary file not shown.
@@ -3,7 +3,10 @@
|
||||
|
||||
## Changlog
|
||||
|
||||
* Unreleased
|
||||
* 2.4.6
|
||||
* `Architect mode`: Restore infinite-building behavior and keep construction previews, inventory queries, and cached package statistics in sync.
|
||||
* `Architect mode`: Increase the default virtual stock from 100 to 999 and explicitly include Logistics Bots, Logistics Drones, and Logistics Vessels.
|
||||
* `Architect mode`: Fix item withdrawal results without consuming real stock or affecting unrelated storage. Preserve physical package capacity and restore native statistics when the mode is disabled.
|
||||
* `PowerGlobalCoverage`: Fix a startup crash before wind-turbine prefabs finish loading. Retry after preload without corrupting activation state or the original power ranges, and tolerate unallocated factory data.
|
||||
* 2.4.5
|
||||
* Support Dyson Sphere Program 0.10.35.29057.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
|
||||
<Description>DSP MOD - CheatEnabler</Description>
|
||||
<Version>2.4.5</Version>
|
||||
<Version>2.4.6</Version>
|
||||
<PackageId>CheatEnabler</PackageId>
|
||||
<RootNamespace>CheatEnabler</RootNamespace>
|
||||
<PackHasChangelog>true</PackHasChangelog>
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
using System;
|
||||
using HarmonyLib;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Common.GameConstants;
|
||||
|
||||
namespace CheatEnabler.Patches.Factory;
|
||||
|
||||
[PatchSetCallbackFlag(PatchCallbackFlag.CallOnDisableAfterUnpatch)]
|
||||
internal class ArchitectMode : PatchImpl<ArchitectMode>
|
||||
{
|
||||
private static bool[] _canBuildItems;
|
||||
private const int DefaultItemCount = 999;
|
||||
private static readonly AccessTools.FieldRef<BuildTool, StorageComponent> BuildToolPackage =
|
||||
AccessTools.FieldRefAccess<BuildTool, StorageComponent>(nameof(BuildTool.tmpPackage));
|
||||
|
||||
protected override void OnEnable()
|
||||
{
|
||||
RefreshPackageStatistics();
|
||||
var factory = GameMain.mainPlayer?.factory;
|
||||
if (factory?.planet?.data != null)
|
||||
{
|
||||
@@ -16,43 +22,114 @@ internal class ArchitectMode : PatchImpl<ArchitectMode>
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
{
|
||||
RefreshPackageStatistics();
|
||||
}
|
||||
|
||||
private static void RefreshPackageStatistics()
|
||||
{
|
||||
var player = GameMain.mainPlayer;
|
||||
if (player?.package == null) return;
|
||||
player.packageUtility?.statistics?.Count(player.package);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PackageStatistics), nameof(PackageStatistics.Count))]
|
||||
private static void CountPackageItemsPatch(PackageStatistics __instance)
|
||||
{
|
||||
if (__instance != GameMain.mainPlayer?.packageUtility?.statistics) return;
|
||||
var items = LDB.items?.dataArray;
|
||||
if (items == null) return;
|
||||
foreach (var item in items)
|
||||
{
|
||||
if (item == null || !IsArchitectItem(item.ID)) continue;
|
||||
var count = __instance.itemBundle.GetCount(item.ID);
|
||||
if (count < DefaultItemCount) __instance.itemBundle.Add(item.ID, DefaultItemCount - count, 0);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.TakeTailItems), [typeof(int), typeof(int), typeof(int), typeof(bool)],
|
||||
[ArgumentType.Ref, ArgumentType.Ref, ArgumentType.Out, ArgumentType.Normal])]
|
||||
public static bool TakeTailItemsPatch(StorageComponent __instance, int itemId, int count, ref int inc)
|
||||
{
|
||||
if (count <= 0 || !IsPlayerStorage(__instance) || !IsArchitectItem(itemId)) return true;
|
||||
inc = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.TakeTailItems), [typeof(int), typeof(int), typeof(int[]), typeof(int), typeof(bool)],
|
||||
[ArgumentType.Ref, ArgumentType.Ref, ArgumentType.Normal, ArgumentType.Out, ArgumentType.Normal])]
|
||||
public static bool TakeTailItemsPatch(StorageComponent __instance, int itemId)
|
||||
private static bool TakeTailItemsWithNeedsPatch(StorageComponent __instance, int itemId, int count, int[] needs, ref int inc, ref bool __result)
|
||||
{
|
||||
if (__instance == null || GameMain.mainPlayer == null || __instance.id != GameMain.mainPlayer.package.id) return true;
|
||||
if (itemId <= 0) return true;
|
||||
if (_canBuildItems == null)
|
||||
{
|
||||
DoInit();
|
||||
}
|
||||
if (needs == null || Array.IndexOf(needs, itemId) < 0) return true;
|
||||
if (TakeTailItemsPatch(__instance, itemId, count, ref inc)) return true;
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
return itemId >= 12000 || !_canBuildItems[itemId];
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerPackageUtility), nameof(PlayerPackageUtility.TryTakeItemFromAllPackages))]
|
||||
private static bool TryTakeItemFromAllPackagesPatch(PlayerPackageUtility __instance, int itemId, int count, ref int inc)
|
||||
{
|
||||
if (__instance.player == null || __instance.player != GameMain.mainPlayer || count <= 0 || !IsArchitectItem(itemId)) return true;
|
||||
inc = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerPackageUtility), nameof(PlayerPackageUtility.TakeItemFromAllPackages))]
|
||||
private static bool TakeItemFromAllPackagesPatch(PlayerPackageUtility __instance, int itemId, int count, ref int inc)
|
||||
{
|
||||
return TryTakeItemFromAllPackagesPatch(__instance, itemId, count, ref inc);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.GetItemCount), typeof(int))]
|
||||
public static void GetItemCountPatch(StorageComponent __instance, int itemId, ref int __result)
|
||||
{
|
||||
if (__result > 99) return;
|
||||
if (__instance == null || GameMain.mainPlayer == null || __instance.id != GameMain.mainPlayer.package.id) return;
|
||||
if (itemId <= 0) return;
|
||||
if (_canBuildItems == null)
|
||||
{
|
||||
DoInit();
|
||||
}
|
||||
if (itemId < 12000 && _canBuildItems[itemId]) __result = 100;
|
||||
if (__result >= DefaultItemCount || !IsPlayerStorage(__instance) || !IsArchitectItem(itemId)) return;
|
||||
__result = DefaultItemCount;
|
||||
}
|
||||
|
||||
private static void DoInit()
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(StorageComponent), nameof(StorageComponent.GetItemCount), [typeof(int), typeof(int)],
|
||||
[ArgumentType.Normal, ArgumentType.Out])]
|
||||
private static void GetItemCountWithIncPatch(StorageComponent __instance, int itemId, ref int __result)
|
||||
{
|
||||
_canBuildItems = new bool[12000];
|
||||
foreach (var ip in LDB.items.dataArray)
|
||||
GetItemCountPatch(__instance, itemId, ref __result);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(PlayerPackageUtility), nameof(PlayerPackageUtility.GetPackageItemCount))]
|
||||
private static void GetPackageItemCountPatch(PlayerPackageUtility __instance, int itemId, ref int __result)
|
||||
{
|
||||
if (__instance.player == null || __instance.player != GameMain.mainPlayer || __result >= DefaultItemCount || !IsArchitectItem(itemId)) return;
|
||||
__result = DefaultItemCount;
|
||||
}
|
||||
|
||||
private static bool IsPlayerStorage(StorageComponent storage)
|
||||
{
|
||||
var player = GameMain.mainPlayer;
|
||||
if (storage == null || player == null) return false;
|
||||
if (storage == player.package) return true;
|
||||
var buildTools = player.controller?.actionBuild?.tools;
|
||||
if (buildTools == null) return false;
|
||||
foreach (var buildTool in buildTools)
|
||||
{
|
||||
if ((ip.Type == EItemType.Logistics || ip.CanBuild) && ip.ID < 12000) _canBuildItems[ip.ID] = true;
|
||||
if (buildTool != null && storage == BuildToolPackage(buildTool)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsArchitectItem(int itemId)
|
||||
{
|
||||
if (itemId <= 0) return false;
|
||||
if (itemId is ItemIds.LogisticsBot or ItemIds.LogisticsDrone or ItemIds.LogisticsVessel) return true;
|
||||
var item = LDB.items?.Select(itemId);
|
||||
return item != null && (item.Type == EItemType.Logistics || item.CanBuild);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "CheatEnabler",
|
||||
"version_number": "2.4.5",
|
||||
"version_number": "2.4.6",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
|
||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||
"dependencies": [
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
|
||||
## Changlog
|
||||
|
||||
* Unreleased
|
||||
* 1.6.1
|
||||
* `Real-time logistic stations info panel`: Clear old panels after `Initialize this planet`, even though the planet ID remains unchanged.
|
||||
* `Real-time logistic stations info panel`: Continue refreshing while typing and remove dismantled stations on the next UI update, with fewer lifecycle hooks and redundant per-frame checks.
|
||||
* `Do not render factory entities`: Fix activation after DSP 0.10.35.29057 by removing fixed local-variable slots from raycast filtering. Preserve belts and optional sorter visibility.
|
||||
* 1.6.0
|
||||
* Support Dyson Sphere Program 0.10.35.29057.
|
||||
|
||||
@@ -30,6 +30,9 @@ public static class ItemIds
|
||||
public const int ProliferatorMkIII = 1143;
|
||||
|
||||
/* Logistics carriers */
|
||||
public const int LogisticsDrone = 5001;
|
||||
public const int LogisticsVessel = 5002;
|
||||
public const int LogisticsBot = 5003;
|
||||
public const int SpaceWarper = 1126;
|
||||
|
||||
/* Matrices */
|
||||
|
||||
@@ -95,8 +95,6 @@ public static class LogisticsPatch
|
||||
RealtimeLogisticsInfoPanel.Enable(false);
|
||||
}
|
||||
|
||||
public static void OnUpdate() => RealtimeInfoPanelPatch.OnUpdate();
|
||||
|
||||
public static void OnInputUpdate()
|
||||
{
|
||||
if (DSPGame.IsMenuDemo) return;
|
||||
|
||||
@@ -13,17 +13,6 @@ using Object = UnityEngine.Object;
|
||||
|
||||
namespace UXAssist.Patches.Logistics;
|
||||
|
||||
internal static class RealtimeInfoPanelPatch
|
||||
{
|
||||
public static void OnUpdate()
|
||||
{
|
||||
if (LogisticsPatch.RealtimeLogisticsInfoPanelEnabled.Value)
|
||||
{
|
||||
RealtimeLogisticsInfoPanel.StationInfoPanelsUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class LogisticsConstrolPanelImprovement : PatchImpl<LogisticsConstrolPanelImprovement>
|
||||
{
|
||||
private static int ItemIdHintUnderMouse()
|
||||
@@ -182,7 +171,7 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
private static readonly Color OrderInColor = new(108f / 255, 187f / 255, 214f / 255);
|
||||
private static readonly Color OrderOutColor = new(255f / 255, 161f / 255, 109.5f / 255);
|
||||
|
||||
private static int _lastPlanetId;
|
||||
private static PlanetTransport _lastTransport;
|
||||
|
||||
private static int _localStorageMax = LogisticsConstants.DefaultLocalStorageMax;
|
||||
private static int _remoteStorageMax = LogisticsConstants.DefaultRemoteStorageMax;
|
||||
@@ -220,23 +209,8 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
|
||||
internal static void Enable(bool on)
|
||||
{
|
||||
// Toggle the defensive localPlanet setter hook regardless of whether the GUI
|
||||
// root has been initialized yet (InitGUI may run later via OnDataLoaded).
|
||||
LocalPlanetWatcher.Enable(on);
|
||||
if (_stationTipsRoot == null) return;
|
||||
if (!on)
|
||||
{
|
||||
HideAndRecycleStationTips();
|
||||
return;
|
||||
}
|
||||
if (DSPGame.IsMenuDemo || !GameMain.isRunning)
|
||||
{
|
||||
_lastPlanetId = 0;
|
||||
_stationTipsRoot.SetActive(false);
|
||||
return;
|
||||
}
|
||||
_lastPlanetId = GameMain.data?.localPlanet?.id ?? 0;
|
||||
_stationTipsRoot.SetActive(_lastPlanetId != 0);
|
||||
PanelUpdatePatch.Enable(on);
|
||||
if (!on) HideAndRecycleStationTips();
|
||||
}
|
||||
|
||||
internal static void EnableBars(bool on)
|
||||
@@ -513,10 +487,10 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
{
|
||||
if (!stationTip) return;
|
||||
var go = stationTip.gameObject;
|
||||
go.SetActive(false);
|
||||
if (_stationTipsRecycleCount < StationTipsRecycle.Length)
|
||||
{
|
||||
stationTip.ResetStationTip();
|
||||
go.SetActive(false);
|
||||
StationTipsRecycle[_stationTipsRecycleCount++] = stationTip;
|
||||
}
|
||||
else
|
||||
@@ -525,7 +499,6 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
// StationTip MonoBehaviour). Destroying only the component would leave the
|
||||
// GameObject and all its UI children orphaned under _stationTipsRoot,
|
||||
// causing "ghost" tips to remain visible whenever the root is reactivated.
|
||||
go.SetActive(false);
|
||||
Object.Destroy(go);
|
||||
}
|
||||
}
|
||||
@@ -551,7 +524,7 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
{
|
||||
_stationTipsRoot?.SetActive(false);
|
||||
RecycleStationTips();
|
||||
_lastPlanetId = 0;
|
||||
_lastTransport = null;
|
||||
}
|
||||
|
||||
private static StationTip AllocateStationTip()
|
||||
@@ -572,25 +545,16 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
|
||||
internal static void StationInfoPanelsUpdate()
|
||||
{
|
||||
if (DSPGame.IsMenuDemo || !GameMain.isRunning) return;
|
||||
var localPlanet = GameMain.data?.localPlanet;
|
||||
if (localPlanet == null || !localPlanet.factoryLoaded)
|
||||
{
|
||||
_stationTipsRoot.SetActive(false);
|
||||
if (_lastPlanetId == 0) return;
|
||||
RecycleStationTips();
|
||||
_lastPlanetId = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_lastPlanetId != localPlanet.id)
|
||||
{
|
||||
RecycleStationTips();
|
||||
_lastPlanetId = localPlanet.id;
|
||||
}
|
||||
|
||||
var factory = localPlanet.factory;
|
||||
if (_stationTipsRoot == null) return;
|
||||
var localPlanet = DSPGame.IsMenuDemo || !GameMain.isRunning ? null : GameMain.data?.localPlanet;
|
||||
var factory = localPlanet is { factoryLoaded: true } ? localPlanet.factory : null;
|
||||
var transport = factory?.transport;
|
||||
if (_lastTransport != transport)
|
||||
{
|
||||
RecycleStationTips();
|
||||
_lastTransport = transport;
|
||||
}
|
||||
|
||||
if (transport is not { stationCursor: > 1 } || (UIGame.viewMode != EViewMode.Normal && UIGame.viewMode != EViewMode.Globe))
|
||||
{
|
||||
_stationTipsRoot.SetActive(false);
|
||||
@@ -610,6 +574,7 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
var forward = GameCamera.main.transform.forward;
|
||||
var realRadius = localPlanet.realRadius;
|
||||
|
||||
var stationPool = transport.stationPool;
|
||||
var stationCount = transport.stationCursor;
|
||||
if (stationCount > _stationTips.Length)
|
||||
{
|
||||
@@ -623,26 +588,26 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
Array.Resize(ref _stationTips, newSize);
|
||||
}
|
||||
|
||||
for (var i = stationCount - 1; i > 0; i--)
|
||||
for (var stationId = stationCount - 1; stationId > 0; stationId--)
|
||||
{
|
||||
var stationComponent = transport.stationPool[i];
|
||||
if (stationComponent == null || i != stationComponent.id)
|
||||
var stationComponent = stationPool[stationId];
|
||||
if (stationComponent == null || stationId != stationComponent.id)
|
||||
{
|
||||
RecycleStationTip(i);
|
||||
RecycleStationTip(stationId);
|
||||
continue;
|
||||
}
|
||||
var storageArray = stationComponent.storage;
|
||||
if (storageArray == null)
|
||||
{
|
||||
RecycleStationTip(i);
|
||||
RecycleStationTip(stationId);
|
||||
continue;
|
||||
}
|
||||
|
||||
var stationTip = _stationTips[i];
|
||||
var stationTip = _stationTips[stationId];
|
||||
if (!stationTip)
|
||||
{
|
||||
stationTip = AllocateStationTip();
|
||||
_stationTips[i] = stationTip;
|
||||
_stationTips[stationId] = stationTip;
|
||||
}
|
||||
|
||||
var position = factory.entityPool[stationComponent.entityId].pos.normalized;
|
||||
@@ -699,23 +664,13 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
}
|
||||
}
|
||||
|
||||
// Defensive Harmony hook on GameData.localPlanet setter.
|
||||
// It guarantees tips are hidden and recycled when the local planet id changes,
|
||||
// even if UXAssist.Update() is skipped that frame (e.g. by VFInput.inputing
|
||||
// while the player is typing while transitioning between planets, or by a brief
|
||||
// !GameMain.isRunning state during loading). _lastPlanetId is reset to 0 here so
|
||||
// the next StationInfoPanelsUpdate() re-validates factoryLoaded/transport/viewMode
|
||||
// and re-allocates fresh tips for the new planet.
|
||||
private class LocalPlanetWatcher : PatchImpl<LocalPlanetWatcher>
|
||||
private class PanelUpdatePatch : PatchImpl<PanelUpdatePatch>
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GameData), nameof(GameData.localPlanet), MethodType.Setter)]
|
||||
private static void GameData_localPlanet_Setter_Prefix(GameData __instance, PlanetData value)
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(UIGame), nameof(UIGame._OnUpdate))]
|
||||
private static void UIGame_OnUpdate_Postfix()
|
||||
{
|
||||
var oldId = __instance.localPlanet?.id ?? 0;
|
||||
var newId = value?.id ?? 0;
|
||||
if (oldId == newId) return;
|
||||
HideAndRecycleStationTips();
|
||||
StationInfoPanelsUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -839,7 +794,7 @@ internal static class RealtimeLogisticsInfoPanel
|
||||
internal void ResetStationTip()
|
||||
{
|
||||
_layout = EStationTipLayout.None;
|
||||
for (var i = _storageMaxSlotCount - 1; i >= 0; i--)
|
||||
for (var i = _storageItems.Length - 1; i >= 0; i--)
|
||||
{
|
||||
_countTexts[i].gameObject.SetActive(false);
|
||||
_sliderBg[i].gameObject.SetActive(false);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||
<Description>DSP MOD - UXAssist</Description>
|
||||
<Version>1.6.0</Version>
|
||||
<Version>1.6.1</Version>
|
||||
<PackageId>UXAssist</PackageId>
|
||||
<RootNamespace>UXAssist</RootNamespace>
|
||||
<PackHasChangelog>true</PackHasChangelog>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "UXAssist",
|
||||
"version_number": "1.6.0",
|
||||
"version_number": "1.6.1",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||
"dependencies": [
|
||||
|
||||
Reference in new issue
Block a user