fix(uxassist): honor sandbox station stock disposal

Let native dismantling choose whether to return or discard station contents instead of refunding them unconditionally before dismantling.

Refs #98
This commit is contained in:
soarqin committed 2026-10-11 03:25:31 +08:00
1 parent d52bf1034a
commit ac16794f07
2 files changed
+2 -18

No files matched your search

+2
View File
@@ -4,6 +4,7 @@
## Changlog
* 1.6.2 - Unrelease
* `Dismantle blueprint selected buildings`: Respect sandbox instant-dismantle settings when discarding logistics station contents, and return them normally outside instant dismantling.
* `Treat stack items as single in monitor components`: Fix the option taking effect at game startup when disabled, until toggled on and off.
* `Building options`: Honor saved toggle states at startup for off-grid construction, power-pole dragging, fast tank transfers, and Ctrl+Shift belt pickup.
* `Belt signals for buy out dark fog items automatically`: Use the current in-game material names and retain the original exchange ratios.
@@ -429,6 +430,7 @@
## 更新日志
* 1.6.2 - Unreleased
* `拆除蓝图选中的建筑`:按沙盒模式的瞬间拆除设置销毁物流站库存;常规拆除时仍正常返还库存。
* `在流速计中将堆叠物品视为单个物品`:修复未勾选时仍在启动游戏后生效、必须切换一次才能关闭的问题。
* `建造选项`:修复不对齐网格建造、拖建电线杆、储液罐快速存取和 Ctrl+Shift 拾取整段传送带物品在启动时忽略已保存开关的问题。
* `用于自动购买黑雾物品的传送带信号`:统一使用当前游戏中的材料名称,保留原有兑换比例。
-18
View File
@@ -92,26 +92,8 @@ public static class FactoryFunctions
buildPreviewsToRemove.Insert(~index, connObjId);
}
}
var entityPool = factory.entityPool;
var stationPool = factory.transport.stationPool;
foreach (var objId in buildPreviewsToRemove)
{
if (objId > 0)
{
int stationId = entityPool[objId].stationId;
if (stationId > 0)
{
StationComponent sc = stationPool[stationId];
if (sc is null || sc.id != stationId) continue;
for (int i = 0; i < sc.storage.Length; i++)
{
int added = player.TryAddItemToPackage(sc.storage[i].itemId, sc.storage[i].count, sc.storage[i].inc, true, objId);
if (added > 0) UIItemup.Up(sc.storage[i].itemId, added);
}
sc.storage = new StationStore[sc.storage.Length];
sc.needs = new int[sc.needs.Length];
}
}
build.DoDismantleObject(objId);
}
blueprintCopyTool.ClearSelection();