mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
feat(uxassist): abbreviate exact blueprint material rates
Use the largest K/M/G suffix that preserves existing display precision with at most one decimal place, falling back to ordinary numbers otherwise. Cover all material categories and formatting boundaries, and update English and Chinese documentation.
This commit is contained in:
1 parent
0cd6008673
commit
35f5cfcdd8
5 files changed
+57
-4
No files matched your search
@@ -6,7 +6,7 @@
|
||||
* 1.6.3 - Unreleased
|
||||
* `Sunlight at night`: Base lighting on the camera and the viewed surface instead of Icarus's facing direction, including planet view. Keep building, terrain, solar-panel, and belt lighting directions synchronized, recover when the active light or planet changes, and restore native lighting when sailing, disabling the feature, or using white rendering mode.
|
||||
* `Quick build Mining Machines`: Add a Factory-tab button that searches dense layouts at the nearest solid vein group using native collision shapes, including interleaving feet, joint placement of nearby miners, and a final pass to fill remaining compatible positions. Mines only the selected group, even when another group of the same resource is nearby. `Allow restoring/burying veins` is off by default: uses only visible nodes and skips all restoration and burial calculations. When enabled, restores available buried nodes and may bury unused nodes to improve coverage. Optimizes summed vein coverage, requires at least 3 covered nodes in the selected group per miner after any burial, and places the full ordinary miner layout regardless of stock, leaving ghosts awaiting missing materials. Accelerates layout searches with up to 4 background workers, capped at half the available logical processors. Writes replayable JSON snapshots during feature tuning and keeps the completion tip visible for about 8 seconds.
|
||||
* `Blueprint descriptions`: Add an `Auto-fill description` button and a `Proliferation` checkbox above the description boxes in the blueprint browser, copy, and paste panels. The button replaces the main description with the blueprint's full-load material flows per minute on separate `Missing`, `Excess`, `Input`, `Output`, and `Research` lines, and writes factory and logistics power demand to a `Power` custom field. Inputs are limited to what downstream buildings can use, matrices made in a blueprint with a research-mode lab are listed under `Research`, and research-mode labs are budgeted at full working power. The checkbox defaults to on when the blueprint contains a Spray Coater. Unknown values are marked instead of shown as zero, other custom fields are preserved, and nothing is saved automatically.
|
||||
* `Blueprint descriptions`: Add an `Auto-fill description` button and a `Proliferation` checkbox above the description boxes in the blueprint browser, copy, and paste panels. The button replaces the main description with the blueprint's full-load material flows per minute on separate `Missing`, `Excess`, `Input`, `Output`, and `Research` lines, and writes factory and logistics power demand to a `Power` custom field. Inputs are limited to what downstream buildings can use, matrices made in a blueprint with a research-mode lab are listed under `Research`, and research-mode labs are budgeted at full working power. Large material rates use the largest exact K/M/G suffix with at most one decimal place, falling back to ordinary numbers when necessary to preserve display precision. The checkbox defaults to on when the blueprint contains a Spray Coater. Unknown values are marked instead of shown as zero, other custom fields are preserved, and nothing is saved automatically.
|
||||
* 1.6.2
|
||||
* `Increase maximum power usage in Logistic Stations and Advanced Mining Machines`: Fix zero or corrupted mining speeds when adjusting an Advanced Mining Machine's speed slider with the option enabled.
|
||||
* `Tweak building buffers`: Restore the Ray Receiver Graviton Lens buffer setting on DSP 0.10.35.29104 and later, and correct the displayed native buffer value to 2.
|
||||
@@ -441,7 +441,7 @@
|
||||
* 1.6.3 - Unreleased
|
||||
* `夜间日光灯`:按镜头和当前观察位置的地表方向计算光照,不再跟随机甲朝向,行星视图也适用。统一建筑、地表、太阳能板和传送带的光照方向,在光源或行星切换后恢复功能,并在航行、关闭功能或白模渲染时恢复原版光照。
|
||||
* `快速铺设采矿机`:在「工厂」页增加按钮,按游戏实际碰撞体在最近的固体矿脉搜索密集布局,支持脚部交错、邻近矿机联动调整及结束前补入剩余可用位置。仅开采选中的矿脉,不混入附近同种资源的其他矿脉。「允许恢复/掩埋矿物」默认关闭:仅使用可见矿点,跳过所有恢复和掩埋计算;开启后,恢复可恢复的掩埋矿点,并允许掩埋未被使用的矿点来提高覆盖数。以各台矿机覆盖矿点数之和为目标,要求每台在掩埋后仍覆盖选中矿脉的至少 3 个矿点,不受库存限制地生成完整布局,缺少采矿机的位置保留待建造虚影。使用最多 4 个后台线程加速布局搜索,线程数不超过可用逻辑线程数的一半。功能调试期间输出可离线重放的 JSON 数据,完成提示保留约 8 秒。
|
||||
* `蓝图说明`:在蓝图浏览、复制和粘贴界面的说明框上方增加「自动填写说明」按钮和「增产」复选框。点击按钮会用蓝图满负荷运行时每分钟的物料流量替换原说明,按需分行列出「缺少」「多余」「输入」「输出」「研究」,并将工厂与物流耗电写入「耗电」自定义字段。输入量以下游建筑实际能消耗的量为限;蓝图含研究模式研究站时,蓝图内产出的矩阵列入「研究」行,研究模式研究站均按满负荷计入耗电。蓝图含喷涂机时,复选框默认勾选。无法计算的数值会单独标注而不显示为零,其他自定义字段保持不变,也不会自动保存蓝图。
|
||||
* `蓝图说明`:在蓝图浏览、复制和粘贴界面的说明框上方增加「自动填写说明」按钮和「增产」复选框。点击按钮会用蓝图满负荷运行时每分钟的物料流量替换原说明,按需分行列出「缺少」「多余」「输入」「输出」「研究」,并将工厂与物流耗电写入「耗电」自定义字段。输入量以下游建筑实际能消耗的量为限;蓝图含研究模式研究站时,蓝图内产出的矩阵列入「研究」行,研究模式研究站均按满负荷计入耗电。较大的物料流量使用能精确表示的最大 K/M/G 单位,小数最多一位;无法保留显示精度时,保留普通数字。蓝图含喷涂机时,复选框默认勾选。无法计算的数值会单独标注而不显示为零,其他自定义字段保持不变,也不会自动保存蓝图。
|
||||
* 1.6.2
|
||||
* `提升物流塔和大型采矿机的最大功耗`:修复启用后调整大型采矿机开采速度时出现 0% 或异常速度的问题。
|
||||
* `调整建筑输入缓冲`:修复 DSP 0.10.35.29104 及后续版本中射线接收器透镜缓冲设置不生效的问题,并将显示的游戏原始值更正为 2。
|
||||
|
||||
@@ -64,6 +64,7 @@ public sealed class BlueprintDescriptionText
|
||||
public static class BlueprintDescriptionFormatter
|
||||
{
|
||||
private const double Tolerance = 1e-9;
|
||||
private static readonly string[] RateUnits = { "K", "M", "G" };
|
||||
private static readonly string[] PowerUnits = { "W", "kW", "MW", "GW", "TW" };
|
||||
|
||||
public static BlueprintDescriptionText Format(ProductionReport report, Func<int, string> itemTag,
|
||||
@@ -147,7 +148,21 @@ public static class BlueprintDescriptionFormatter
|
||||
var tag = itemTag(itemId);
|
||||
if (string.IsNullOrEmpty(tag))
|
||||
throw new InvalidOperationException("An item in the blueprint report has no native icon tag.");
|
||||
return tag + " x" + FormatNumber(rate);
|
||||
return tag + " x" + FormatRate(rate);
|
||||
}
|
||||
|
||||
private static string FormatRate(double value)
|
||||
{
|
||||
var rounded = RoundForDisplay(value);
|
||||
for (var unit = RateUnits.Length - 1; unit >= 0; unit--)
|
||||
{
|
||||
var scale = Math.Pow(1000, unit + 1);
|
||||
// Keep the existing display precision; abbreviate only exact tenths of a unit.
|
||||
if (rounded >= scale && rounded % (scale / 10) == 0)
|
||||
return (rounded / scale).ToString("0.#", CultureInfo.InvariantCulture) + RateUnits[unit];
|
||||
}
|
||||
|
||||
return FormatNumber(value);
|
||||
}
|
||||
|
||||
private static string FormatPower(double? watts, BlueprintDescriptionLabels labels)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* Fix a bug that warning popup on `Veins Utilization` upgraded to level 8000+
|
||||
* Sort blueprint structures before saving, to reduce generated blueprint data size a little
|
||||
* Add an `Auto-fill description` button and a `Proliferation` checkbox to the blueprint browser, copy, and paste panels, to fill the description with the blueprint's material flows per minute and its power demand
|
||||
* Large material rates use the largest exact `K`/`M`/`G` suffix with at most one decimal place; rates that cannot be shortened without losing display precision keep their ordinary format
|
||||
* Increase maximum count of Metadata Instantiations to 20000 (from 2000)
|
||||
* Increase capacity of player order queue to 128 (from 16)
|
||||
* Enable `Hide UI` (`F11` by default) in Star Map view, hiding UI and other scene elements
|
||||
@@ -221,6 +222,7 @@
|
||||
* 修复了`矿物利用`升级到8000级以上时弹出警告的bug
|
||||
* 保存蓝图前对建筑进行排序,以减少生成的蓝图数据大小
|
||||
* 在蓝图浏览、复制和粘贴界面增加「自动填写说明」按钮和「增产」复选框,用蓝图每分钟的物料流量和耗电自动填写说明
|
||||
* 较大的物料流量使用能精确表示的最大 `K`/`M`/`G` 单位,小数最多一位;无法在保留显示精度的前提下缩写时,保留普通数字格式
|
||||
* 将元数据提取的最大数量增加到20000(原来为2000)
|
||||
* 将玩家指令队列的容量增加到128(原来为16)
|
||||
* 在星图视图中启用 `隐藏 UI` 功能(默认按键为 `F11`),同时隐藏 UI 和场景中的其他元素
|
||||
|
||||
@@ -68,7 +68,7 @@ Native research uses the current lab technology's matrix point requirements, wit
|
||||
|
||||
The shared `UIBlueprintInspector` in browser, copy, and paste modes hosts `Auto-fill description` with `Proliferation` immediately to its right in one row above every description box. Move the first native inspector group down once, and offset later groups and the scroll height after each native refresh so the controls do not split the smaller fields from the main description. The checkbox initially reflects the blueprint's Spray Coater prefab capability and tracks content changes until manually changed in the current editing session; changing it does not modify the blueprint. Clicking the button captures only `blueprint.buildings` with `BlueprintSelectionReader.FromBlueprint` on the game thread, then runs `FactoryBlackBoxAnalyzer` against the captured catalog. The maximum supported proliferation level applies while each building keeps its acceleration or extra-products mode. Input coating is assumed to be supplied externally; no spray routing or spray consumption is inferred from the Spray Coater.
|
||||
|
||||
`BlueprintDescriptionFormatter` builds replacement multiline `blueprint.desc` text in this order: optional `Missing:` and `Excess:` lines for intermediate shortages and true overbuild; `Input:` for external inputs capped by downstream demand; `Output:` for ordinary final products and necessary coproduct surplus; and `Research:` for positive net matrix production accepted by a selected research-mode lab. Each warning category has one label followed by comma-separated items; warnings do not repeat in Input, and a matrix on Research does not repeat in Output. It uses `SteadyStateExternalSupply` for complete and independently known partial inputs, labeling partial values as known portions. The assumed lab adds no numerical matrix consumption or external input; other buildings' known matrix demand is subtracted from the Research rate. Omit each empty line, including Research when no produced matrix remains. A single optional `Power` custom field separates factory and configured logistics consumption, omitting categories with no demand and removing the field altogether if neither consumes power; a present but unknown category displays `Unknown` rather than zero. Material rates remain items per minute even though the description labels omit the unit. Rates are rounded only for display, ordered by item ID within each category, and use native item icon/name tags with comma-separated entries inside each description line. Uncertain final-product, overbuild, or coproduct conclusions are omitted. Veins and other scene objects are not blueprint entries or requested parameters.
|
||||
`BlueprintDescriptionFormatter` builds replacement multiline `blueprint.desc` text in this order: optional `Missing:` and `Excess:` lines for intermediate shortages and true overbuild; `Input:` for external inputs capped by downstream demand; `Output:` for ordinary final products and necessary coproduct surplus; and `Research:` for positive net matrix production accepted by a selected research-mode lab. Each warning category has one label followed by comma-separated items; warnings do not repeat in Input, and a matrix on Research does not repeat in Output. It uses `SteadyStateExternalSupply` for complete and independently known partial inputs, labeling partial values as known portions. The assumed lab adds no numerical matrix consumption or external input; other buildings' known matrix demand is subtracted from the Research rate. Omit each empty line, including Research when no produced matrix remains. A single optional `Power` custom field separates factory and configured logistics consumption, omitting categories with no demand and removing the field altogether if neither consumes power; a present but unknown category displays `Unknown` rather than zero. Material rates remain items per minute even though the description labels omit the unit. Rates are rounded only for display. Large displayed rates use the largest exact K/M/G suffix with at most one decimal place (for example, 1,234,000 becomes 1234K); if no suffix preserves that display precision, keep the ordinary number. Rates are ordered by item ID within each category, and use native item icon/name tags with comma-separated entries inside each description line. Uncertain final-product, overbuild, or coproduct conclusions are omitted. Veins and other scene objects are not blueprint entries or requested parameters.
|
||||
|
||||
`BlueprintDescriptionFields` matches only exact English or Simplified Chinese power field titles, updates or removes matching power fields, and collapses duplicate matches; all other fields, including input/output custom fields, stay intact. The inspector first collects pending custom-field edits, checks the native 2,000-character description limit and `kMaxFieldCount`, and applies native `ExternalFieldEscape` and `ExternalFieldUnescape` rules to the remaining power field. An invalid blueprint, unavailable catalog, failed calculation, malformed fields, overlong description, or insufficient capacity does not overwrite the description or generated fields. A successful update replaces the original description, synchronizes its native input control, and refreshes the inspector and share-code preview through the native modification path, leaving save and copy actions to the native buttons. Native `Refresh` recalculates the later groups' positions and the scroll height but not the first group's position, and `Refresh(forModify: true)` does not reload `descTextInput`, so assign it explicitly. `BlueprintData.Validate` strips newlines from custom fields, so multiline text belongs only in the main description. Recheck these inspector behaviors against the original DLL after game updates. The formatting and field updater remain pure-managed so `ProductionCheck` can verify them without loading Unity.
|
||||
|
||||
|
||||
@@ -2157,6 +2157,42 @@ internal static class Program
|
||||
rounded.Description == "输出:" + rounded.Output,
|
||||
"no consumers means no power field and an output-only report has one line");
|
||||
|
||||
foreach (var (rate, expected) in new[]
|
||||
{
|
||||
(1000.0, "1K"), (1200.0, "1.2K"), (1200.0000000001, "1.2K"),
|
||||
(1000000.0, "1M"), (1200000.0, "1.2M"),
|
||||
(1000000000.0, "1G"), (1200000000.0, "1.2G"),
|
||||
(1234000.0, "1234K"), (1234500.0, "1234.5K"), (1230000000.0, "1230M"),
|
||||
(12345.0, "12345"), (1200.01, "1200.01"),
|
||||
(999999.0, "999999"), (999999.99, "999999.99"),
|
||||
(0.125, "0.125"), (0.00001, "0.00001"), (0.0000001, "1E-7")
|
||||
})
|
||||
{
|
||||
var materialReport = new ProductionReport(ProductionStatus.Complete, true, true,
|
||||
new[]
|
||||
{
|
||||
new ProductionItemFlow(61, 0, rate, 0, 0, 0, 0, rate,
|
||||
false, Array.Empty<int>(), Array.Empty<int>(), intermediateShortage: rate),
|
||||
new ProductionItemFlow(62, rate, 0, 0, 0, 0, rate, 0,
|
||||
false, Array.Empty<int>(), Array.Empty<int>(), overbuildSurplus: rate),
|
||||
new ProductionItemFlow(63, 0, rate, 0, 0, 0, 0, rate,
|
||||
false, Array.Empty<int>(), Array.Empty<int>()),
|
||||
new ProductionItemFlow(64, rate, 0, 0, 0, 0, rate, 0,
|
||||
true, Array.Empty<int>(), Array.Empty<int>()),
|
||||
new ProductionItemFlow(65, rate, 0, 0, 0, 0, rate, 0,
|
||||
true, Array.Empty<int>(), Array.Empty<int>(), isResearchProduct: true)
|
||||
}, Array.Empty<ProductionGroupFlow>(), Array.Empty<ProductionDiagnostic>(),
|
||||
new ProductionPower(0, 0, 0, 0, 0, 0, ProductionPowerScope.SelectedFacilities),
|
||||
new ProductionPowerBreakdown(0, 0, true, true));
|
||||
var materialText = BlueprintDescriptionFormatter.Format(materialReport, TestItemTag, labels);
|
||||
Check(materialText.Warnings == "缺少:" + TestItemTag(61) + " x" + expected +
|
||||
"\n多余:" + TestItemTag(62) + " x" + expected &&
|
||||
materialText.Input == TestItemTag(63) + " x" + expected &&
|
||||
materialText.Output == TestItemTag(64) + " x" + expected &&
|
||||
materialText.Research == TestItemTag(65) + " x" + expected,
|
||||
$"all material categories abbreviate {rate} without additional display rounding");
|
||||
}
|
||||
|
||||
var inputOnlyReport = new ProductionReport(ProductionStatus.Complete, true, true,
|
||||
new[] { new ProductionItemFlow(51, 0, 3, 0, 0, 0, 0, 3,
|
||||
false, Array.Empty<int>(), Array.Empty<int>()) },
|
||||
|
||||
Reference in new issue
Block a user