mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(uxassist): initialize alternating poles when enabling dragging
Initialize Tesla Tower previews on late enable, retry after data loading, and capture original pole prototypes only once for reliable restoration. Refs #51
This commit is contained in:
1 parent
4102597132
commit
ededc3eeaf
3 files changed
+15
-3
No files matched your search
@@ -4,6 +4,7 @@
|
||||
## Changlog
|
||||
|
||||
* 1.6.2 - Unrelease
|
||||
* `Drag building power poles`: Fix invalid alternating previews when enabling the option after loading a save, and restore original spacing when disabling it.
|
||||
* Close building and belt hover popups when opening the pause menu so they cannot obscure menu controls.
|
||||
* `Protect veins from exhaustion`: Exclude protected veins from mining-rate estimates, mining resource counts, and miner hover counts while retaining their remaining reserves.
|
||||
* `Dismantle blueprint selected buildings`: Respect sandbox instant-dismantle settings when discarding logistics station contents, and return them normally outside instant dismantling.
|
||||
@@ -432,6 +433,7 @@
|
||||
## 更新日志
|
||||
|
||||
* 1.6.2 - Unreleased
|
||||
* `拖建电线杆`:修复载入存档后才启用功能时交替放置的预览异常,并在关闭时恢复原有间距。
|
||||
* 打开暂停菜单时关闭建筑和传送带的悬浮提示,避免提示遮挡菜单。
|
||||
* `保护矿脉不会枯竭`:开采速度估算、开采中资源数量和采矿机悬浮信息不再把受保护的矿脉计入开采;仍保留剩余储量显示。
|
||||
* `拆除蓝图选中的建筑`:按沙盒模式的瞬间拆除设置销毁物流站库存;常规拆除时仍正常返还库存。
|
||||
|
||||
@@ -57,6 +57,9 @@ public static class ItemIds
|
||||
public const int FrameMaterial = 1503;
|
||||
public const int DysonSphereComponent = 1802;
|
||||
|
||||
/* Power nodes */
|
||||
public const int TeslaTower = 2201;
|
||||
|
||||
/* Power generators */
|
||||
public const int WindTurbine = 2203;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UXAssist.Common;
|
||||
using UXAssist.Common.GameConstants;
|
||||
using GameLogicProc = UXAssist.Common.GameLogic;
|
||||
|
||||
namespace UXAssist.Patches.Factory;
|
||||
@@ -383,7 +384,8 @@ internal static class BuildToolPatch
|
||||
{
|
||||
GameLogicProc.OnGameBegin += OnGameBegin;
|
||||
GameLogicProc.OnGameEnd += OnGameEnd;
|
||||
FixProto();
|
||||
GameLogicProc.OnDataLoaded += OnGameBegin;
|
||||
OnGameBegin();
|
||||
}
|
||||
|
||||
protected override void OnDisable()
|
||||
@@ -391,6 +393,7 @@ internal static class BuildToolPatch
|
||||
UnfixProto();
|
||||
GameLogicProc.OnGameEnd -= OnGameEnd;
|
||||
GameLogicProc.OnGameBegin -= OnGameBegin;
|
||||
GameLogicProc.OnDataLoaded -= OnGameBegin;
|
||||
}
|
||||
|
||||
public static void AlternatelyChanged()
|
||||
@@ -406,7 +409,11 @@ internal static class BuildToolPatch
|
||||
|
||||
private static void FixProto()
|
||||
{
|
||||
if (DSPGame.IsMenuDemo) return;
|
||||
if (DSPGame.IsMenuDemo || _powerPoleProto == null || OldDragBuild.Count > 0) return;
|
||||
foreach (var id in PowerPoleIds)
|
||||
{
|
||||
if (LDB.items?.Select(id)?.prefabDesc == null) return;
|
||||
}
|
||||
OldDragBuild.Clear();
|
||||
OldDragBuildDist.Clear();
|
||||
foreach (var id in PowerPoleIds)
|
||||
@@ -443,7 +450,7 @@ internal static class BuildToolPatch
|
||||
|
||||
private static void OnGameBegin()
|
||||
{
|
||||
_powerPoleProto ??= LDB.items.Select(2201);
|
||||
_powerPoleProto ??= LDB.items?.Select(ItemIds.TeslaTower);
|
||||
FixProto();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user