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

-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();