StationSlotDustbin
物流塔垃圾格: mark a logistics station slot as trash; when full, belts keep feeding it and the surplus is destroyed. Drones and ships unchanged. Blueprints carry the marks.
| Last updated | 3 days ago |
| Total downloads | 25 |
| Total rating | 0 |
| Categories | Logistics Quality of Life |
| Dependency string | DSPCraftingSpeed-StationSlotDustbin-1.1.1 |
| Dependants | 0 other packages depend on this package |
This mod requires the following mods to function
CommonAPI-DSPModSave
Library that allows to store mod save data separately from vanilla saves
Preferred version: 1.1.4README
Station Slot Dustbin 物流塔垃圾格
Mark a slot of a logistics station as trash: when the slot is full, belts and sorters keep putting the item in and the surplus is destroyed; the slot keeps showing its max. Drones and ships see the slot exactly as in vanilla (full = no demand), so nothing extra is fetched from other stations. Made for a mixed belt into a station (e.g. 氢 and 石墨烯 on one belt): when nobody fetches the hydrogen, the belt no longer stops and the graphene keeps coming in.
物流塔的某一格勾成垃圾格以后:这一格满了,传送带和分拣器照样往里送,多出来的直接销毁,界面上一直显示上限那个数。 运输机、运输船看到的和原版一模一样(满了就不再需求),所以不会因此多从别的塔拉货。给混带进塔用(比如氢和石墨烯同一条传送带进同一座塔): 没人来拉氢的时候,传送带也不会停,石墨烯照样进塔。
怎么用
- 物流塔窗口第二行("星际站点 #…"那一行)的右侧多了一个圆形的小垃圾桶按钮(游戏自带的按钮样式和垃圾桶图标;装了 LSTM 的话在它的定位按钮左边,一样大)。这座塔一格都没勾时图标是白的;有任何一格勾了就变成橙色。 除此之外窗口和原版一样。
- 点按钮弹出一个小面板:每一格一行(物品图标、名字、库存 / 上限),右边一个勾选框,勾上就是"多的销毁"。 面板上写着规则和读档以来这座塔已经销毁的数量。空格不能勾。再点按钮、或者点窗口里别的地方就关掉;切到别的塔时面板跟着换成那座塔。
- 勾了的格子,物品图标右上角有一个很小的橙色垃圾桶标记;没勾的格子和原版完全一样。
- 只有行星内物流运输站和星际物流运输站有这个按钮(轨道采集器、大型采矿机没有)。
- 上限是多少就按多少(1 万、2 万都一样),不用设别的数。
- 开关跟着这一格的物品走:
- 改上限、改供应 / 需求:开关不变;
- 这一格换成别的物品、或者清空:开关自动关掉;
- 用 Station Slot Swap(物流塔格子拖放)交换两格:开关跟着物品一起换过去;
- 拆掉物流塔:它的开关全部清掉。
- 开关存在存档里(通过 DSPModSave,存在存档旁边的
.moddsv文件里)。读档时,存的那一格如果已经不是存的那种物品,这条开关丢掉。 - 蓝图、复制 / 粘贴建筑设置都带着开关(见下面"蓝图")。
设置(com.github.jiesiluo.stationslotdustbin.cfg)
| 设置 | 默认 | 意思 |
|---|---|---|
ButtonOffsetX / ButtonOffsetY |
0 | 按钮位置不合适时往右 / 往上挪多少像素(默认在窗口右上角往左 70、往下 60 像素)。 |
怎么做到的
- 让满了的格子照样收货:原版每一帧给每座塔算一张"哪些物品还能进"的表(
StationComponent.UpdateNeeds,格子满了就把那一格清成 0), 传送带进塔(UpdateInputSlots)和分拣器往塔里放(PlanetFactory.InsertInto)都只看这张表。本模组在UpdateNeeds之后, 把勾了的、满了的格子在表里重新填上物品。这张表别的地方都不看:运输机、运输船的配对和需求量是按 库存 / 上限 / 在途订单 算的 (StationStore.localDemandCount等),所以它们的行为和原版完全一样。 这个后补每帧每座塔都会被多线程调到:查"这座塔有没有勾"是一次无锁的字典查找,读的是开关改变时整个换掉的只读快照;没有任何垃圾格时只看一下快照是不是空的。 - 把多的砍掉:在运输那一步(
PlanetTransport.GameTick)的开头和结尾各砍一次:库存砍回上限,增产点数按比例砍。 开头那次让这一帧的运输机 / 运输船看到的库存不超过上限(和原版满格一样);结尾那次把这一帧卸货顶过上限的部分砍掉(卸货AddItem不看上限)。 一帧里传送带最多多进 12 个入口 × 4 堆叠 = 48 个,所以界面上看到的永远是上限。 - 销毁不记进生产统计(不算"消耗"),和 Dustbin 一样。
和冻结模组一起用(SampleAndHoldSim 的 PlanetFreeze 分支 0.9.3)
- 冻结的星球上照样销毁。 冻结模组每颗星球每帧都跑
PlanetTransport.GameTick,冻结的也跑 (PlanetFreeze\src\Logic\StationLogic.cs的Station_Patch.FactoryTransportGameTick/_Parallel),本模组的砍就在这一步里。 - 销毁的量不算进"每格的增减"。 测量窗口只记"运输之外"的变化(
StationData.ActiveBeforeTransport在任务 1700 开头、ActiveAfterTransport在 1800 结束,中间的不算,StationLogic.cs)。本模组的砍在 1751 里。所以测量时氢那一格记下的是"传送带每帧送进来多少"。 - 对账(
FreezeBalance.cs的WindowsBalanced)对得上:从塔里拿走的(−ItemTotals)+ 生产 − 消耗,工厂生产的氢和送进塔的氢相抵; 销毁不在 ItemTotals 里,也没登记成消耗。登记成消耗反而对不上,所以不登记。 - 满格不会被当成"堵了"。 冻结后,冻结模组每帧把测到的流入加进格子,但最多加到上限,加不进去的记在"欠账"里
(
FreezeCore.Step:a = min(due, max − count),Bank = due − a);欠账到顶并持续 1800 帧就当成"送不进去了"唤醒(Bank), 在那之前这项物品的统计也只记真正加进去的。如果垃圾格一直停在上限,就会反复这样唤醒。 所以只在被冻结的星球上,本模组把垃圾格砍到"上限 − min(256, 上限 / 4)",给它的回放留出空间(只对不向别处要货的格子这样做:本地或星际设成"需求"的格子在冻结的星球上也停在上限,免得留出的空位变成向别的塔要货) (每帧回放最多 64 个,StationData.ActiveEnd把每帧增减限制在 ±64):欠账不涨,不会 Bank 唤醒,统计照常。 格子仍高于一半上限,不会触发"高低变了"(Regime)唤醒。被冻结的星球不会是你脚下的星球,所以你在物流塔窗口里看到的永远是上限。 判断"是否被冻结"是用反射读冻结模组的MainManager.TryGet(...).Mode;没装冻结模组时永远按上限。 - 勾 / 取消时让冻结的星球重新测量。 点勾选框时,本模组用这一格现有的值再设一次
PlanetTransport.SetStationStorage(游戏什么都不改,不刷新运输配对);冻结模组看到"格子设置变了"(FreezeLayoutPatch.AfterSetStorage→ Layout 唤醒)就醒来重测。 冻结模组不用改。
蓝图
开关写在蓝图里物流塔的参数数组中(一座物流塔 2048 个整数):
| 位置 | 内容 |
|---|---|
[2040] |
标记数 0x53534442(十进制 1397965890,"SSDB") |
[2041] |
格式版本 1 |
[2042] |
第 k 位 = 第 k 格(0 起)是垃圾格 |
[2043 + k](k = 0..4) |
第 k 格勾上时那一格的物品 id,否则 0 |
- 一座塔一格都没勾时这 8 个数全是 0(蓝图和没装本模组时一模一样)。
- 游戏只用到 0–334(格子 0–191、接口 192–319、塔的设置 320–334),2048 以后是大型采矿机的矿点(本模组不碰大型采矿机)。
离线测试扫过 626 个处理建筑参数的游戏方法的 IL,没有一个用到 2040–2047;用户装的其他模组(BlueprintTweaks 只改
[k*6]的物品、 BuildToolOpt 换塔时整份复制、UXAssist 只碰大型采矿机 2048 以后、其余不碰物流塔参数)都不撞。没装本模组的人贴这种蓝图,游戏不读这些数,什么都不会发生。 - 复制(做蓝图、复制建筑设置、BuildToolOpt 换塔):
BuildingParameters.CopyFromFactoryObject之后写进去。 - 粘贴蓝图:游戏把参数原样带到预建筑,建成时(
BuildingParameters.ApplyPrebuildParametersToEntity,游戏先设好各格物品) 本模组把标记了的、而且那一格现在正是标记的物品的格子勾上。物品对不上(比如用 BlueprintTweaks 换了物品)就不勾。没有标记的旧蓝图 = 全部不勾。 - 粘贴建筑设置到已建好的塔上(
BuildingParameters.PasteToFactoryObject,游戏只粘贴塔的设置、不改格子): 这座塔每一格如果和复制来的那一格是同一种物品,就照复制来的开关勾上或取消。
不进游戏给蓝图打标记:tools\bpmark.py
python tools\bpmark.py show <蓝图.txt> # 列出每座物流塔的格子,勾了的标 [垃圾格]
python tools\bpmark.py mark <输入.txt> <输出.txt> 氢 # 所有带氢那一格的物流塔:氢那一格勾上(可写多个物品,名字 / 英文名 / id 都行)
python tools\bpmark.py clear <输入.txt> <输出.txt> [物品…] # 取消(不写物品 = 全部取消)
python tools\bpmark.py selftest
用 DSPDense\dspbp.py 解码 / 编码,物品名来自 DSPPlanner\data\game-data.json。写出的文件会再解码一遍(含签名),
并逐个建筑比对:除了改过的塔的那 8 个数,其他一个数都不许变,否则报错不写。
和其他模组一起用
- Dustbin(soarqin):互不相干,装不装都能用。
- Station Slot Swap(物流塔格子拖放):交换时整格连物品一起换,开关按物品认,跟着走。
- PlanetMiner(星球矿机):它往本地需求的格子里挖,挖到
count >= max就停(不看needs)。垃圾格一直停在上限,所以它不会多挖。 例外:在被冻结的星球上垃圾格停在上限下面一点(见上),PlanetMiner 会一直把这点空挖满、再被砍掉,等于一直挖、一直销毁。 只有把"PlanetMiner 挖的本地需求格"勾成垃圾格时才会这样;这是你自己勾的,模组不拦。 - 联机(Nebula):不支持,开关只在本机。
Tests
- Offline (
tests\Offline, no game): pure logic (cut, frozen level, needs kept open, switches, item changes, save / load, concurrent readers, blueprint block) and the built DLL against the real Assembly-CSharp: every patch applied or (where the desktop CLR cannot compile the game method) its argument binding checked; the realStationComponent.UpdateNeedswith the postfix; the cut, slot hooks and blueprint copy / build / paste postfixes on game objects built in the test; the game'sFromParamsArray/ToParamsArraycarry the block; IL scan for 2040..2047. Last run:tests\Offline\last-run.txt. - Blueprint tool:
python tools\bpmark.py selftest. - In-game (
tests\InGameTests, written, not run yet): full slot stays at max and open, switch off = vanilla; a real belt into a full trash slot keeps delivering; a full trash demand slot gets no new drone / ship trips; item change / clear / slot swap; DSPModSave round trip; copy / paste settings; the window (one faint button, panel, rows, marks, empty slot not checkable, click elsewhere, other station, screenshots); collectors show nothing; a frozen planet stays frozen with a trash slot and wakes when switched through the panel.
English summary
- One small trash button in the station window (faint when no slot is trash, red when any is) opens a panel with one checkbox per slot; checked slots get a tiny trash mark on their icon. Planetary and interstellar logistics stations only.
- A checked slot stays open to belts and sorters when full (postfix on
StationComponent.UpdateNeeds), and is cut back to its max at the start and end ofPlanetTransport.GameTick; proliferator points go down in proportion. Drones and ships are untouched (they use count / max / orders, notneeds). - Switches belong to the item in the slot; saved with DSPModSave; carried by blueprints and copy / paste settings in
the station parameters
[2040..2047](format above;tools\bpmark.pywrites them offline). - PlanetFreeze fork: frozen planets are still cut (kept up to 256 below max there, so the replay never banks up), the cut is outside the measured station flows, the balance stays right, switching makes a frozen planet re-measure.
- Harmony patches:
StationComponent.UpdateNeeds(postfix),PlanetTransport.GameTick(prefix + postfix),PlanetTransport.SetStationStorage(prefix + postfix),PlanetTransport.RemoveStationComponent(prefix),BuildingParameters.CopyFromFactoryObject/ApplyPrebuildParametersToEntity/PasteToFactoryObject(postfix),UIStationWindow._OnOpen(postfix). No method that readsUnityEngine.Inputis patched. - Requires CommonAPI-DSPModSave.