mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-22 18:19:02 +08:00
Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7715a2023f | ||
|
|
c000debdc1 | ||
|
|
402d4008fb | ||
|
|
2ddf91ceab | ||
|
|
d941de2810 | ||
|
|
4839f868e1 | ||
|
|
ae44c3ca6a | ||
|
|
cc36edecc7 | ||
|
|
b1b6785572 | ||
|
|
426cdf8975 |
No files matched your search
@@ -3,12 +3,8 @@
|
|||||||
|
|
||||||
## Changlog
|
## Changlog
|
||||||
|
|
||||||
* 2.4.8
|
* 2.4.8 - Unreleased
|
||||||
* `Mecha and Drones/Fleets invincible`: Fix mecha HP and energy shield protection failing when enabled after taking damage, and restore protection for space fleets.
|
* `Belt signal item generation`: Calculate raw-material, intermediate, and proliferator statistics from the game's current recipe data, counting by-products and consumption separately. If an item's recipe data is incomplete, only its upstream statistics pause, with the reason logged; item generation is unaffected. Fix signal belts built or destroyed on another planet, for example by Battlefield Analysis Base drones or Dark Fog attacks, affecting a belt on the current planet instead of their own; a destroyed belt could also keep generating items on a belt later built in its place.
|
||||||
* `Finish build immediately`: Fix possible errors when starting a new game. Construction begins after the opening cutscene ends or is skipped.
|
|
||||||
* `Belt signal item generation`:
|
|
||||||
* Improve raw-material, intermediate, by-product and proliferator statistics using current recipes, with production and consumption counted separately. Incomplete recipe data only pauses the affected upstream statistics; item generation continues.
|
|
||||||
* Fix signal belts built or destroyed on other planets, such as by Battlefield Analysis Base drones or Dark Fog attacks, affecting belts on the current planet. Destroyed signal belts no longer cause replacement belts to keep generating items.
|
|
||||||
* 2.4.7
|
* 2.4.7
|
||||||
* `Dev Shortcuts`: Work immediately when enabled after loading a save, and process each key press once per frame at accelerated game speeds.
|
* `Dev Shortcuts`: Work immediately when enabled after loading a save, and process each key press once per frame at accelerated game speeds.
|
||||||
* Extend `Unlock Tech with Key-Modifiers` with a downgrade mode.
|
* Extend `Unlock Tech with Key-Modifiers` with a downgrade mode.
|
||||||
@@ -207,12 +203,8 @@
|
|||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
* 2.4.8
|
* 2.4.8 - Unreleased
|
||||||
* `机甲和战斗无人机无敌`:修复受伤后启用时机甲耐久度和能量护盾保护可能失效的问题,并恢复太空编队的无敌保护。
|
* `传送带信号物品生成`:原料、中间产物和增产剂的统计改为按游戏当前配方数据计算,并分别计入副产物和消耗。某物品的配方数据不完整时,仅暂停该物品的上游统计并在日志中说明原因,不影响物品生成。修复在其他星球上建造或被摧毁的信号传送带(例如由战场分析基站的无人机建造或被黑雾摧毁)错误影响当前星球上传送带的问题;被摧毁的传送带也可能让之后在原处新建的传送带继续生成物品。
|
||||||
* `建造秒完成`:修复开始新游戏时可能报错的问题。建造会在开场动画播放结束或跳过后开始。
|
|
||||||
* `传送带信号物品生成`:
|
|
||||||
* 按当前配方完善原料、中间产物、副产物和增产剂的统计,分别记录生产和消耗。配方数据不完整时,仅暂停受影响物品的上游统计,物品仍会正常生成。
|
|
||||||
* 修复其他星球上的信号传送带在建造或被摧毁时,错误影响当前星球上传送带的问题,例如战场分析基站无人机建造或黑雾摧毁传送带。被摧毁的信号传送带也不会再让之后替换它的传送带继续生成物品。
|
|
||||||
* 2.4.7
|
* 2.4.7
|
||||||
* `开发模式快捷键`:修复载入存档后启用时不生效的问题;加速游戏时每次按键仍只执行一次。
|
* `开发模式快捷键`:修复载入存档后启用时不生效的问题;加速游戏时每次按键仍只执行一次。
|
||||||
* `使用组合键点击解锁科技` 新增降级模式。
|
* `使用组合键点击解锁科技` 新增降级模式。
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
|
using UXAssist.Common.ModFeatures;
|
||||||
using CheatEnabler;
|
using CheatEnabler;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions.DysonSphere;
|
namespace CheatEnabler.Functions.DysonSphere;
|
||||||
|
|
||||||
|
[ModFeature("DysonSphereResolver")]
|
||||||
public static class DysonSphereResolver
|
public static class DysonSphereResolver
|
||||||
{
|
{
|
||||||
public static (global::DysonSphere sphere, StarData star)? ResolveCurrent()
|
public static (global::DysonSphere sphere, StarData star)? ResolveCurrent()
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ using HarmonyLib;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.GameConstants;
|
using UXAssist.Common.GameConstants;
|
||||||
|
using UXAssist.Common.ModFeatures;
|
||||||
using UXAssist.Common.Utils;
|
using UXAssist.Common.Utils;
|
||||||
using CheatEnabler;
|
using CheatEnabler;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions.DysonSphere;
|
namespace CheatEnabler.Functions.DysonSphere;
|
||||||
|
|
||||||
|
[ModFeature("FrameRemovalFunctions")]
|
||||||
public static class FrameRemovalFunctions
|
public static class FrameRemovalFunctions
|
||||||
{
|
{
|
||||||
public static void RemoveAllFrames()
|
public static void RemoveAllFrames()
|
||||||
|
|||||||
@@ -7,10 +7,12 @@ using static CheatEnabler.Functions.DysonSphere.GeometryHelpers;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.GameConstants;
|
using UXAssist.Common.GameConstants;
|
||||||
|
using UXAssist.Common.ModFeatures;
|
||||||
using CheatEnabler;
|
using CheatEnabler;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions.DysonSphere;
|
namespace CheatEnabler.Functions.DysonSphere;
|
||||||
|
|
||||||
|
[ModFeature("IllegalShellFunctions")]
|
||||||
public static class IllegalShellFunctions
|
public static class IllegalShellFunctions
|
||||||
{
|
{
|
||||||
private static void EnsureDysonShellMaps()
|
private static void EnsureDysonShellMaps()
|
||||||
@@ -39,7 +41,7 @@ public static class IllegalShellFunctions
|
|||||||
layer.shellCursor = 1;
|
layer.shellCursor = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void FinalizeDysonSphereChanges(global::DysonSphere sphere, bool notify = false, bool resetRenderMasks = false)
|
private static void FinalizeDysonSphereChanges(global::DysonSphere sphere, DysonSphereLayer layer, bool notify = false, bool resetRenderMasks = false)
|
||||||
{
|
{
|
||||||
if (sphere == null) return;
|
if (sphere == null) return;
|
||||||
sphere.CheckAutoNodes();
|
sphere.CheckAutoNodes();
|
||||||
@@ -138,7 +140,7 @@ public static class IllegalShellFunctions
|
|||||||
node.RecalcSpReq();
|
node.RecalcSpReq();
|
||||||
node.RecalcCpReq();
|
node.RecalcCpReq();
|
||||||
}
|
}
|
||||||
FinalizeDysonSphereChanges(dysonSphere, true, true);
|
FinalizeDysonSphereChanges(dysonSphere, layer, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void KeepMaxProductionShells()
|
public static void KeepMaxProductionShells()
|
||||||
@@ -243,7 +245,7 @@ public static class IllegalShellFunctions
|
|||||||
node.RecalcCpReq();
|
node.RecalcCpReq();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FinalizeDysonSphereChanges(dysonSphere);
|
FinalizeDysonSphereChanges(dysonSphere, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateIllegalDysonShellQuickly(int triangleCount)
|
public static void CreateIllegalDysonShellQuickly(int triangleCount)
|
||||||
@@ -315,7 +317,7 @@ public static class IllegalShellFunctions
|
|||||||
node.RecalcSpReq();
|
node.RecalcSpReq();
|
||||||
node.RecalcCpReq();
|
node.RecalcCpReq();
|
||||||
}
|
}
|
||||||
FinalizeDysonSphereChanges(dysonSphere, true);
|
FinalizeDysonSphereChanges(dysonSphere, layer, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -431,7 +433,7 @@ public static class IllegalShellFunctions
|
|||||||
|
|
||||||
var shellsChanged = CreateIllegalDysonShellWithMaxOutputForLayer(layer);
|
var shellsChanged = CreateIllegalDysonShellWithMaxOutputForLayer(layer);
|
||||||
|
|
||||||
FinalizeDysonSphereChanges(dysonSphere, shellsChanged, true);
|
FinalizeDysonSphereChanges(dysonSphere, layer, shellsChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateIllegalDysonShellWithMaxOutputForAllLayers()
|
public static void CreateIllegalDysonShellWithMaxOutputForAllLayers()
|
||||||
@@ -447,7 +449,7 @@ public static class IllegalShellFunctions
|
|||||||
shellsChanged = CreateIllegalDysonShellWithMaxOutputForLayer(layer) || shellsChanged;
|
shellsChanged = CreateIllegalDysonShellWithMaxOutputForLayer(layer) || shellsChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
FinalizeDysonSphereChanges(dysonSphere, shellsChanged, true);
|
FinalizeDysonSphereChanges(dysonSphere, dysonSphere.layersSorted.FirstOrDefault(l => l != null), shellsChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateIllegalDysonShellsSpecially()
|
public static void CreateIllegalDysonShellsSpecially()
|
||||||
@@ -475,6 +477,8 @@ public static class IllegalShellFunctions
|
|||||||
|
|
||||||
for (var idx = 1; idx <= 2; idx++)
|
for (var idx = 1; idx <= 2; idx++)
|
||||||
{
|
{
|
||||||
|
Dictionary<(int, int), int> availableFrames = [];
|
||||||
|
HashSet<int> unusedFrameIds = [];
|
||||||
var layer = dysonSphere.layersIdBased[idx];
|
var layer = dysonSphere.layersIdBased[idx];
|
||||||
if (layer != null)
|
if (layer != null)
|
||||||
{
|
{
|
||||||
@@ -567,6 +571,6 @@ public static class IllegalShellFunctions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FinalizeDysonSphereChanges(dysonSphere, shellsChanged, true);
|
FinalizeDysonSphereChanges(dysonSphere, dysonSphere.layersIdBased[2], shellsChanged, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,11 +3,13 @@ using System.Linq;
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
|
using UXAssist.Common.ModFeatures;
|
||||||
using UXAssist.Common.Utils;
|
using UXAssist.Common.Utils;
|
||||||
using CheatEnabler;
|
using CheatEnabler;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions.DysonSphere;
|
namespace CheatEnabler.Functions.DysonSphere;
|
||||||
|
|
||||||
|
[ModFeature("ShellCompletionFunctions")]
|
||||||
public static class ShellCompletionFunctions
|
public static class ShellCompletionFunctions
|
||||||
{
|
{
|
||||||
public static void CompleteShellsInstantly()
|
public static void CompleteShellsInstantly()
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
using CheatEnabler.Functions.DysonSphere;
|
using CheatEnabler.Functions.DysonSphere;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
|
using UXAssist.Common.ModFeatures;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions;
|
namespace CheatEnabler.Functions;
|
||||||
|
|
||||||
|
[ModFeature("CheatDysonSphere", Order = 20)]
|
||||||
public static class DysonSphereFunctions
|
public static class DysonSphereFunctions
|
||||||
{
|
{
|
||||||
public const int MinShellsCountForFunctions = 1;
|
public const int MinShellsCountForFunctions = 1;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using Random = UnityEngine.Random;
|
using Random = UnityEngine.Random;
|
||||||
|
using UXAssist.Common.ModFeatures;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions;
|
namespace CheatEnabler.Functions;
|
||||||
|
|
||||||
|
[ModFeature("PlanetFunctions")]
|
||||||
public static class PlanetFunctions
|
public static class PlanetFunctions
|
||||||
{
|
{
|
||||||
public static void BuryAllVeins(bool bury)
|
public static void BuryAllVeins(bool bury)
|
||||||
|
|||||||
@@ -2,9 +2,11 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.GameConstants;
|
using UXAssist.Common.GameConstants;
|
||||||
|
using UXAssist.Common.ModFeatures;
|
||||||
|
|
||||||
namespace CheatEnabler.Functions;
|
namespace CheatEnabler.Functions;
|
||||||
|
|
||||||
|
[ModFeature("PlayerFunctions")]
|
||||||
public static class PlayerFunctions
|
public static class PlayerFunctions
|
||||||
{
|
{
|
||||||
public static void Init()
|
public static void Init()
|
||||||
@@ -79,10 +81,10 @@ public static class PlayerFunctions
|
|||||||
var propertySystem = DSPGame.propertySystem;
|
var propertySystem = DSPGame.propertySystem;
|
||||||
if (propertySystem == null) return;
|
if (propertySystem == null) return;
|
||||||
PurgePropertySystem(propertySystem);
|
PurgePropertySystem(propertySystem);
|
||||||
var itemCnt = new int[ItemIds.UniverseMatrix - ItemIds.ElectromagneticMatrix + 1];
|
var itemCnt = new int[ItemIds.Metaverse - ItemIds.HydrogenFuelRod + 1];
|
||||||
foreach (var cons in propertySystem.propertyDatas.SelectMany(data => data.totalConsumption.Where(cons => cons.id is >= ItemIds.ElectromagneticMatrix and <= ItemIds.UniverseMatrix)))
|
foreach (var cons in propertySystem.propertyDatas.SelectMany(data => data.totalConsumption.Where(cons => cons.id is >= ItemIds.HydrogenFuelRod and <= ItemIds.Metaverse)))
|
||||||
{
|
{
|
||||||
itemCnt[cons.id - ItemIds.ElectromagneticMatrix] += cons.count;
|
itemCnt[cons.id - ItemIds.HydrogenFuelRod] += cons.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemCnt.All(cnt => cnt == 0))
|
if (itemCnt.All(cnt => cnt == 0))
|
||||||
@@ -95,7 +97,7 @@ public static class PlayerFunctions
|
|||||||
{
|
{
|
||||||
if (itemCnt[i] > 0)
|
if (itemCnt[i] > 0)
|
||||||
{
|
{
|
||||||
msg += $"\n {LDB.items.Select(i + ItemIds.ElectromagneticMatrix).propertyName} x{itemCnt[i]}";
|
msg += $"\n {LDB.items.Select(i + ItemIds.HydrogenFuelRod).propertyName} x{itemCnt[i]}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UIMessageBox.Show(Localization.RemoveAllMetadataConsumptionRecords.Translate(), msg, Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
UIMessageBox.Show(Localization.RemoveAllMetadataConsumptionRecords.Translate(), msg, Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||||
@@ -119,7 +121,7 @@ public static class PlayerFunctions
|
|||||||
var propertySystem = DSPGame.propertySystem;
|
var propertySystem = DSPGame.propertySystem;
|
||||||
if (propertySystem == null) return;
|
if (propertySystem == null) return;
|
||||||
PurgePropertySystem(propertySystem);
|
PurgePropertySystem(propertySystem);
|
||||||
var itemCnt = new int[ItemIds.UniverseMatrix - ItemIds.ElectromagneticMatrix + 1];
|
var itemCnt = new int[ItemIds.Metaverse - ItemIds.HydrogenFuelRod + 1];
|
||||||
var seedKey = DSPGame.GameDesc.seedKey64;
|
var seedKey = DSPGame.GameDesc.seedKey64;
|
||||||
var clusterPropertyData = propertySystem.propertyDatas.FirstOrDefault(cpd => cpd.seedKey == seedKey);
|
var clusterPropertyData = propertySystem.propertyDatas.FirstOrDefault(cpd => cpd.seedKey == seedKey);
|
||||||
if (clusterPropertyData == null)
|
if (clusterPropertyData == null)
|
||||||
@@ -128,9 +130,9 @@ public static class PlayerFunctions
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var currentGamePropertyData = GameMain.data.history.propertyData;
|
var currentGamePropertyData = GameMain.data.history.propertyData;
|
||||||
foreach (var cons in currentGamePropertyData.totalConsumption.Where(cons => cons.id is >= ItemIds.ElectromagneticMatrix and <= ItemIds.UniverseMatrix))
|
foreach (var cons in currentGamePropertyData.totalConsumption.Where(cons => cons.id is >= ItemIds.HydrogenFuelRod and <= ItemIds.Metaverse))
|
||||||
{
|
{
|
||||||
itemCnt[cons.id - ItemIds.ElectromagneticMatrix] += cons.count;
|
itemCnt[cons.id - ItemIds.HydrogenFuelRod] += cons.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemCnt.All(cnt => cnt == 0))
|
if (itemCnt.All(cnt => cnt == 0))
|
||||||
@@ -143,7 +145,7 @@ public static class PlayerFunctions
|
|||||||
{
|
{
|
||||||
if (itemCnt[i] > 0)
|
if (itemCnt[i] > 0)
|
||||||
{
|
{
|
||||||
msg += $"\n {LDB.items.Select(i + ItemIds.ElectromagneticMatrix).propertyName} x{itemCnt[i]}";
|
msg += $"\n {LDB.items.Select(i + ItemIds.HydrogenFuelRod).propertyName} x{itemCnt[i]}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UIMessageBox.Show(Localization.RemoveMetadataConsumptionRecordInCurrentGame.Translate(), msg, Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
UIMessageBox.Show(Localization.RemoveMetadataConsumptionRecordInCurrentGame.Translate(), msg, Localization.Cancel.Translate(), Localization.OK.Translate(), UIMessageBox.QUESTION, null, () =>
|
||||||
@@ -152,8 +154,8 @@ public static class PlayerFunctions
|
|||||||
{
|
{
|
||||||
if (clusterPropertyData.totalConsumption[i].count == 0) continue;
|
if (clusterPropertyData.totalConsumption[i].count == 0) continue;
|
||||||
var id = clusterPropertyData.totalConsumption[i].id;
|
var id = clusterPropertyData.totalConsumption[i].id;
|
||||||
if (id < ItemIds.ElectromagneticMatrix || id > ItemIds.UniverseMatrix) continue;
|
if (id < ItemIds.HydrogenFuelRod || id > ItemIds.Metaverse) continue;
|
||||||
var currentGameCount = itemCnt[id - ItemIds.ElectromagneticMatrix];
|
var currentGameCount = itemCnt[id - ItemIds.HydrogenFuelRod];
|
||||||
if (currentGameCount == 0) continue;
|
if (currentGameCount == 0) continue;
|
||||||
var totalCount = clusterPropertyData.totalConsumption[i].count;
|
var totalCount = clusterPropertyData.totalConsumption[i].count;
|
||||||
clusterPropertyData.totalConsumption[i] = new IDCNT(id, totalCount > currentGameCount ? totalCount - currentGameCount : 0);
|
clusterPropertyData.totalConsumption[i] = new IDCNT(id, totalCount > currentGameCount ? totalCount - currentGameCount : 0);
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Reflection;
|
||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
using UXAssist.Common.ModFeatures;
|
using UXAssist.Common.ModFeatures;
|
||||||
using UXAssist.Common.Patching;
|
|
||||||
|
|
||||||
namespace CheatEnabler.Patches;
|
namespace CheatEnabler.Patches;
|
||||||
|
|
||||||
@@ -49,37 +48,27 @@ public static class CombatPatch
|
|||||||
);
|
);
|
||||||
return matcher.InstructionEnumeration();
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
// Harmony transpiler: Mecha_Invincible_Transpiler
|
// Harmony transpiler: SkillSystem_DamageObject_Transpiler
|
||||||
// Target: Mecha.TakeDamage, Mecha.EnergyShieldResist (both overloads)
|
// Target: SkillSystem.DamageGroundObjectByLocalCaster, SkillSystem.DamageGroundObjectByRemoteCaster, SkillSystem.DamageObject
|
||||||
// Fallback: Return original instructions if the invincibility check is not found.
|
// Fallback: None — patch will fail loudly if the target method body changes.
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(Mecha), nameof(Mecha.TakeDamage))]
|
|
||||||
[HarmonyPatch(typeof(Mecha), nameof(Mecha.EnergyShieldResist), [typeof(int)], [ArgumentType.Ref])]
|
|
||||||
[HarmonyPatch(typeof(Mecha), nameof(Mecha.EnergyShieldResist), [typeof(int), typeof(int)], [ArgumentType.Ref, ArgumentType.Out])]
|
|
||||||
private static IEnumerable<CodeInstruction> Mecha_Invincible_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
|
||||||
{
|
|
||||||
// Repatch the consumers too: an already inlined getter bypasses its own Harmony patch.
|
|
||||||
var original = instructions.ToList();
|
|
||||||
var matcher = new CodeMatcher(original, generator);
|
|
||||||
matcher.MatchForward(false, new CodeMatch(ci => ci.Calls(AccessTools.PropertyGetter(typeof(Player), nameof(Player.invincible)))));
|
|
||||||
if (matcher.IsInvalid) return matcher.Finish(original, CheatEnabler.Logger, nameof(Mecha_Invincible_Transpiler));
|
|
||||||
matcher.Set(OpCodes.Pop, null).Advance(1).Insert(new CodeInstruction(OpCodes.Ldc_I4_1));
|
|
||||||
return matcher.InstructionEnumeration();
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))]
|
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByLocalCaster))]
|
||||||
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByRemoteCaster))]
|
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageGroundObjectByRemoteCaster))]
|
||||||
private static void SkillSystem_DamageGroundObject_Prefix(ref int damage, ref SkillTargetLocal target)
|
|
||||||
{
|
|
||||||
if (target.type == ETargetType.Craft) damage = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
[HarmonyPrefix]
|
|
||||||
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageObject))]
|
[HarmonyPatch(typeof(SkillSystem), nameof(SkillSystem.DamageObject))]
|
||||||
private static void SkillSystem_DamageObject_Prefix(ref int damage, ref SkillTarget target)
|
private static IEnumerable<CodeInstruction> SkillSystem_DamageObject_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
|
||||||
{
|
{
|
||||||
if (target.type == ETargetType.Craft) damage = 0;
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
matcher.MatchForward(false,
|
||||||
|
new CodeMatch(ci => ci.IsLdarg()),
|
||||||
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(SkillTargetLocal), nameof(SkillTargetLocal.type))),
|
||||||
|
new CodeMatch(OpCodes.Ldc_I4_6),
|
||||||
|
new CodeMatch(ci => ci.opcode == OpCodes.Bne_Un || ci.opcode == OpCodes.Bne_Un_S)
|
||||||
|
);
|
||||||
|
matcher.Repeat(m => m.Advance(4).InsertAndAdvance(
|
||||||
|
new CodeInstruction(OpCodes.Ldc_I4_0),
|
||||||
|
new CodeInstruction(OpCodes.Starg_S, __originalMethod.Name == "DamageObject" ? 1 : 2)
|
||||||
|
));
|
||||||
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
private static Dictionary<int, BeltSignal>[] _signalBelts;
|
private static Dictionary<int, BeltSignal>[] _signalBelts;
|
||||||
private static Dictionary<long, int> _portalFrom;
|
private static Dictionary<long, int> _portalFrom;
|
||||||
private static Dictionary<int, HashSet<long>> _portalTo;
|
private static Dictionary<int, HashSet<long>> _portalTo;
|
||||||
|
private static int _signalBeltsCapacity;
|
||||||
private static bool _initialized;
|
private static bool _initialized;
|
||||||
private static ProductionCatalog _sourceCatalog;
|
private static ProductionCatalog _sourceCatalog;
|
||||||
private static ProductionItem _preferredProliferator;
|
private static ProductionItem _preferredProliferator;
|
||||||
@@ -49,6 +50,7 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
_signalBelts = null;
|
_signalBelts = null;
|
||||||
_portalFrom = null;
|
_portalFrom = null;
|
||||||
_portalTo = null;
|
_portalTo = null;
|
||||||
|
_signalBeltsCapacity = 0;
|
||||||
PendingSources.Clear();
|
PendingSources.Clear();
|
||||||
ClearSourceCache();
|
ClearSourceCache();
|
||||||
}
|
}
|
||||||
@@ -82,6 +84,7 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
GameLogicProc.OnGameBegin -= OnGameBegin;
|
GameLogicProc.OnGameBegin -= OnGameBegin;
|
||||||
_initialized = false;
|
_initialized = false;
|
||||||
_signalBelts = null;
|
_signalBelts = null;
|
||||||
|
_signalBeltsCapacity = 0;
|
||||||
PendingSources.Clear();
|
PendingSources.Clear();
|
||||||
ClearSourceCache();
|
ClearSourceCache();
|
||||||
}
|
}
|
||||||
@@ -178,6 +181,7 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
{
|
{
|
||||||
if (DSPGame.IsMenuDemo) return;
|
if (DSPGame.IsMenuDemo) return;
|
||||||
_signalBelts = new Dictionary<int, BeltSignal>[64];
|
_signalBelts = new Dictionary<int, BeltSignal>[64];
|
||||||
|
_signalBeltsCapacity = 64;
|
||||||
_portalFrom = [];
|
_portalFrom = [];
|
||||||
_portalTo = [];
|
_portalTo = [];
|
||||||
|
|
||||||
@@ -221,12 +225,13 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
{
|
{
|
||||||
Dictionary<int, BeltSignal> obj;
|
Dictionary<int, BeltSignal> obj;
|
||||||
if (index < 0) return null;
|
if (index < 0) return null;
|
||||||
if (index >= _signalBelts.Length)
|
if (index >= _signalBeltsCapacity)
|
||||||
{
|
{
|
||||||
var newCapacity = _signalBelts.Length * 2;
|
var newCapacity = _signalBeltsCapacity * 2;
|
||||||
var newSignalBelts = new Dictionary<int, BeltSignal>[newCapacity];
|
var newSignalBelts = new Dictionary<int, BeltSignal>[newCapacity];
|
||||||
Array.Copy(_signalBelts, newSignalBelts, _signalBelts.Length);
|
Array.Copy(_signalBelts, newSignalBelts, _signalBeltsCapacity);
|
||||||
_signalBelts = newSignalBelts;
|
_signalBelts = newSignalBelts;
|
||||||
|
_signalBeltsCapacity = newCapacity;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -241,7 +246,7 @@ internal class BeltSignalGenerator : PatchImpl<BeltSignalGenerator>
|
|||||||
|
|
||||||
private static Dictionary<int, BeltSignal> GetSignalBelts(int index)
|
private static Dictionary<int, BeltSignal> GetSignalBelts(int index)
|
||||||
{
|
{
|
||||||
return index >= 0 && _signalBelts != null && index < _signalBelts.Length ? _signalBelts[index] : null;
|
return index >= 0 && index < _signalBeltsCapacity ? _signalBelts[index] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetSignalBelt(int factory, int beltId, int signalId, int number)
|
private static void SetSignalBelt(int factory, int beltId, int signalId, int number)
|
||||||
|
|||||||
@@ -88,14 +88,14 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
|||||||
ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value);
|
ControlPanelRemoteLogistics.Enable(ControlPanelRemoteLogisticsEnabled.Value);
|
||||||
Enable(true);
|
Enable(true);
|
||||||
CargoTrafficPatch.Enable(true);
|
CargoTrafficPatch.Enable(true);
|
||||||
GameLogicProc.OnGameBegin += OnGameBeginOrGuideComplete;
|
GameLogicProc.OnGameBegin += OnGameBegin_For_ImmBuild;
|
||||||
GameLogicProc.OnDataLoaded += OnDataLoaded;
|
GameLogicProc.OnDataLoaded += OnDataLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Uninit()
|
public static void Uninit()
|
||||||
{
|
{
|
||||||
GameLogicProc.OnDataLoaded -= OnDataLoaded;
|
GameLogicProc.OnDataLoaded -= OnDataLoaded;
|
||||||
GameLogicProc.OnGameBegin -= OnGameBeginOrGuideComplete;
|
GameLogicProc.OnGameBegin -= OnGameBegin_For_ImmBuild;
|
||||||
CargoTrafficPatch.Enable(false);
|
CargoTrafficPatch.Enable(false);
|
||||||
Enable(false);
|
Enable(false);
|
||||||
ImmediateBuild.Enable(false);
|
ImmediateBuild.Enable(false);
|
||||||
@@ -152,8 +152,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
|||||||
if (factory.prebuildCount <= 0) return;
|
if (factory.prebuildCount <= 0) return;
|
||||||
var imm = ImmediateEnabled.Value;
|
var imm = ImmediateEnabled.Value;
|
||||||
var architect = ArchitectModeEnabled.Value;
|
var architect = ArchitectModeEnabled.Value;
|
||||||
if ((!imm && !architect) || GameMain.gameScenario == null ||
|
if ((!imm && !architect) || GameMain.gameScenario == null) return;
|
||||||
GameMain.data?.guideComplete != true) return;
|
|
||||||
var prebuilds = factory.prebuildPool;
|
var prebuilds = factory.prebuildPool;
|
||||||
if (imm)
|
if (imm)
|
||||||
{
|
{
|
||||||
@@ -194,9 +193,7 @@ public class FactoryPatch : PatchImpl<FactoryPatch>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPostfix]
|
private static void OnGameBegin_For_ImmBuild()
|
||||||
[HarmonyPatch(typeof(GameData), nameof(GameData.EndStandardModeGuide))]
|
|
||||||
private static void OnGameBeginOrGuideComplete()
|
|
||||||
{
|
{
|
||||||
if (DSPGame.IsMenuDemo) return;
|
if (DSPGame.IsMenuDemo) return;
|
||||||
var factory = GameMain.mainPlayer?.factory;
|
var factory = GameMain.mainPlayer?.factory;
|
||||||
|
|||||||
@@ -174,7 +174,6 @@ internal class ImmediateBuild : PatchImpl<ImmediateBuild>
|
|||||||
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.FactoryConstructionSystemGameTick))]
|
[HarmonyPatch(typeof(GameLogic), nameof(GameLogic.FactoryConstructionSystemGameTick))]
|
||||||
private static void GameLogic_FactoryConstructionSystemGameTick_Prefix(GameLogic __instance)
|
private static void GameLogic_FactoryConstructionSystemGameTick_Prefix(GameLogic __instance)
|
||||||
{
|
{
|
||||||
if (GameMain.data?.guideComplete != true || GameMain.gameScenario == null) return;
|
|
||||||
var time = __instance.timei;
|
var time = __instance.timei;
|
||||||
if (time % 6 != 0) return;
|
if (time % 6 != 0) return;
|
||||||
var planet = GameMain.localPlanet;
|
var planet = GameMain.localPlanet;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ internal static class TechClickHandler
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
CheatEnabler.Logger.LogWarning($"[TechTweaks] click handling failed: {e}");
|
TechLog.Warn($"click handling failed: {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ internal static class TechClickHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TryDecodeModifiers(out int steps))
|
if (!TechKeyCombo.TryDecode(out int steps))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -54,32 +54,4 @@ internal static class TechClickHandler
|
|||||||
TechUnlock.Run(history, techProto, steps);
|
TechUnlock.Run(history, techProto, steps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool TryDecodeModifiers(out int steps)
|
|
||||||
{
|
|
||||||
steps = 0;
|
|
||||||
|
|
||||||
if (VFInput.shift)
|
|
||||||
{
|
|
||||||
if (VFInput.alt) return false;
|
|
||||||
steps = VFInput.control ? 100 : 1;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VFInput.control)
|
|
||||||
{
|
|
||||||
if (VFInput.alt) return false;
|
|
||||||
steps = 10;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (VFInput.alt)
|
|
||||||
{
|
|
||||||
// Alt applies or reverts every level available to this click.
|
|
||||||
steps = int.MaxValue;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ internal static class TechDowngrade
|
|||||||
{
|
{
|
||||||
if (!TryGetLastAppliedLevel(history, techProto, out int lastApplied) || steps <= 0) return;
|
if (!TryGetLastAppliedLevel(history, techProto, out int lastApplied) || steps <= 0) return;
|
||||||
|
|
||||||
int target = steps == int.MaxValue
|
int target = steps == TechKeyCombo.LevelToMax
|
||||||
? techProto.Level - 1
|
? techProto.Level - 1
|
||||||
: System.Math.Max(techProto.Level - 1, lastApplied - steps);
|
: System.Math.Max(techProto.Level - 1, lastApplied - steps);
|
||||||
Targets.Clear();
|
Targets.Clear();
|
||||||
|
|||||||
@@ -410,7 +410,7 @@ namespace CheatEnabler.Patches.Tech
|
|||||||
// a downgrade can walk thousands of levels and must not flood the log.
|
// a downgrade can walk thousands of levels and must not flood the log.
|
||||||
if (UnknownFuncsWarned.Add(func))
|
if (UnknownFuncsWarned.Add(func))
|
||||||
{
|
{
|
||||||
CheatEnabler.Logger.LogWarning($"[TechTweaks] revert: no inverse known for tech function {func} (value={value}, level={level}); " +
|
TechLog.Warn($"revert: no inverse known for tech function {func} (value={value}, level={level}); " +
|
||||||
"the field was left untouched. A game update may have added a new function.");
|
"the field was left untouched. A game update may have added a new function.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,7 +429,7 @@ namespace CheatEnabler.Patches.Tech
|
|||||||
ModeConfig freeMode = Configs.freeMode;
|
ModeConfig freeMode = Configs.freeMode;
|
||||||
if (freeMode == null)
|
if (freeMode == null)
|
||||||
{
|
{
|
||||||
CheatEnabler.Logger.LogWarning($"[TechTweaks] recompute of tech function {func} skipped: Configs.freeMode is not available");
|
TechLog.Warn($"recompute of tech function {func} skipped: Configs.freeMode is not available");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -819,7 +819,7 @@ namespace CheatEnabler.Patches.Tech
|
|||||||
if (Configs.freeMode == null || history.gameData == null || player?.mecha == null ||
|
if (Configs.freeMode == null || history.gameData == null || player?.mecha == null ||
|
||||||
player.package?.grids == null || player.deliveryPackage?.grids == null)
|
player.package?.grids == null || player.deliveryPackage?.grids == null)
|
||||||
{
|
{
|
||||||
CheatEnabler.Logger.LogWarning("[TechTweaks] downgrade skipped: game data is not ready");
|
TechLog.Warn("downgrade skipped: game data is not ready");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,7 +836,7 @@ namespace CheatEnabler.Patches.Tech
|
|||||||
int func = proto.UnlockFunctions[j];
|
int func = proto.UnlockFunctions[j];
|
||||||
if (!(func is >= 1 and <= 45 or >= 61 and <= 86 or 99))
|
if (!(func is >= 1 and <= 45 or >= 61 and <= 86 or 99))
|
||||||
{
|
{
|
||||||
CheatEnabler.Logger.LogWarning($"[TechTweaks] downgrade skipped: unsupported tech function {func} in tech {proto.ID}");
|
TechLog.Warn($"downgrade skipped: unsupported tech function {func} in tech {proto.ID}");
|
||||||
UIRealtimeTip.Popup(Localization.TechDowngradeUnsupportedFunction.Translate());
|
UIRealtimeTip.Popup(Localization.TechDowngradeUnsupportedFunction.Translate());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
namespace CheatEnabler.Patches.Tech;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The key-modifier semantics shared by the upgrade and the downgrade side.
|
||||||
|
///
|
||||||
|
/// Both directions use the same modifier mapping:
|
||||||
|
///
|
||||||
|
/// <list type="table">
|
||||||
|
/// <item><term>Shift</term><description>+1 / -1</description></item>
|
||||||
|
/// <item><term>Ctrl</term><description>+10 / -10</description></item>
|
||||||
|
/// <item><term>Ctrl + Shift</term><description>+100 / -100</description></item>
|
||||||
|
/// <item><term>Alt</term><description>to MAX / back to locked</description></item>
|
||||||
|
/// <item><term>Shift + Alt, Ctrl + Alt</term><description>ignored</description></item>
|
||||||
|
/// </list>
|
||||||
|
/// </summary>
|
||||||
|
internal static class TechKeyCombo
|
||||||
|
{
|
||||||
|
/// <summary>Sentinel for the "Alt" combination: apply or revert everything this click can.</summary>
|
||||||
|
public const int LevelToMax = int.MaxValue;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decodes the currently held modifiers.
|
||||||
|
/// Returns false when the combination carries no meaning and the click must be left alone.
|
||||||
|
/// </summary>
|
||||||
|
public static bool TryDecode(out int steps)
|
||||||
|
{
|
||||||
|
steps = 0;
|
||||||
|
|
||||||
|
if (VFInput.shift)
|
||||||
|
{
|
||||||
|
if (VFInput.alt)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
steps = VFInput.control ? 100 : 1;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VFInput.control)
|
||||||
|
{
|
||||||
|
if (VFInput.alt)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
steps = 10;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VFInput.alt)
|
||||||
|
{
|
||||||
|
steps = LevelToMax;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
namespace CheatEnabler.Patches.Tech;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Single funnel for the tech unlock / downgrade feature's log output.
|
||||||
|
///
|
||||||
|
/// Only real problems are reported: a Harmony target that no longer resolves, a tech function without
|
||||||
|
/// a known inverse, or a refused package resize. Those are conditions the player or the maintainer
|
||||||
|
/// needs to know about after a game update.
|
||||||
|
/// </summary>
|
||||||
|
internal static class TechLog
|
||||||
|
{
|
||||||
|
public static void Warn(string message)
|
||||||
|
{
|
||||||
|
CheatEnabler.Logger.LogWarning("[TechTweaks] " + message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,7 +17,7 @@ internal static class TechUnlock
|
|||||||
{
|
{
|
||||||
// Mirrors the built-in maxLevel argument: "to MAX" passes the default, the other combinations
|
// Mirrors the built-in maxLevel argument: "to MAX" passes the default, the other combinations
|
||||||
// pass -(steps) so the loop advances exactly `steps` levels.
|
// pass -(steps) so the loop advances exactly `steps` levels.
|
||||||
int maxLevel = steps == int.MaxValue ? 10000 : -steps;
|
int maxLevel = steps == TechKeyCombo.LevelToMax ? 10000 : -steps;
|
||||||
|
|
||||||
UnlockTechRecursive(history, techProto, maxLevel);
|
UnlockTechRecursive(history, techProto, maxLevel);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
* Factory:
|
* Factory:
|
||||||
* Finish build immediately
|
* Finish build immediately
|
||||||
* Completes pending buildings as soon as their required building items are available
|
* Completes pending buildings as soon as their required building items are available
|
||||||
* Starts after the opening cutscene has ended or been skipped
|
|
||||||
* Architect mode
|
* Architect mode
|
||||||
* Unlimited use of buildings, Logistics Bots, Logistics Drones and Interstellar Logistics Vessels
|
* Unlimited use of buildings, Logistics Bots, Logistics Drones and Interstellar Logistics Vessels
|
||||||
* Construction and inventory availability checks show at least 999 of each supported item.
|
* Construction and inventory availability checks show at least 999 of each supported item.
|
||||||
@@ -75,8 +74,7 @@
|
|||||||
* Keep the highest-production shells and remove the others
|
* Keep the highest-production shells and remove the others
|
||||||
* Duplicate the highest-production shells with a configurable shell count
|
* Duplicate the highest-production shells with a configurable shell count
|
||||||
* Mecha/Combat:
|
* Mecha/Combat:
|
||||||
* Mecha and Drones/Fleets invincible
|
* Mecha and Drones/Fleets invicible
|
||||||
* Protects mecha HP and energy shields, ground combat drones, and space fleets, including when enabled during combat.
|
|
||||||
* Buildings invicible
|
* Buildings invicible
|
||||||
* Enable warp without space warpers
|
* Enable warp without space warpers
|
||||||
* Teleport to outer space
|
* Teleport to outer space
|
||||||
@@ -131,7 +129,6 @@ The item icon selects the output; no hotkey is needed.
|
|||||||
* 工厂:
|
* 工厂:
|
||||||
* 建造秒完成
|
* 建造秒完成
|
||||||
* 所需建筑物品齐备后立即完成待建造建筑
|
* 所需建筑物品齐备后立即完成待建造建筑
|
||||||
* 开场动画播放结束或跳过后生效
|
|
||||||
* 建筑师模式
|
* 建筑师模式
|
||||||
* 建筑、配送运输机、物流运输机和星际物流运输船可无限使用
|
* 建筑、配送运输机、物流运输机和星际物流运输船可无限使用
|
||||||
* 建造及库存可用数量检查中,每种受支持物品至少显示 999 个。
|
* 建造及库存可用数量检查中,每种受支持物品至少显示 999 个。
|
||||||
@@ -181,7 +178,6 @@ The item icon selects the output; no hotkey is needed.
|
|||||||
* 从发电量最高的壳复制戴森壳,可设置壳面数量
|
* 从发电量最高的壳复制戴森壳,可设置壳面数量
|
||||||
* 机甲/战斗:
|
* 机甲/战斗:
|
||||||
* 机甲和战斗无人机无敌
|
* 机甲和战斗无人机无敌
|
||||||
* 保护机甲耐久度和能量护盾、地面战斗无人机和太空编队,战斗中开启同样生效。
|
|
||||||
* 建筑无敌
|
* 建筑无敌
|
||||||
* 无需空间翘曲器即可曲速飞行
|
* 无需空间翘曲器即可曲速飞行
|
||||||
* 传送到外太空
|
* 传送到外太空
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ namespace CheatEnabler;
|
|||||||
|
|
||||||
public static class UIConfigWindow
|
public static class UIConfigWindow
|
||||||
{
|
{
|
||||||
|
private static RectTransform _windowTrans;
|
||||||
|
|
||||||
private static UIButton _resignGameBtn;
|
private static UIButton _resignGameBtn;
|
||||||
private static UIButton _clearBanBtn;
|
private static UIButton _clearBanBtn;
|
||||||
|
|
||||||
@@ -74,12 +76,13 @@ public static class UIConfigWindow
|
|||||||
|
|
||||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||||
{
|
{
|
||||||
|
_windowTrans = trans;
|
||||||
// General tab
|
// General tab
|
||||||
var x = 0f;
|
var x = 0f;
|
||||||
var y = 10f;
|
var y = 10f;
|
||||||
wnd.AddSplitter(trans, 10f);
|
wnd.AddSplitter(trans, 10f);
|
||||||
wnd.AddTabGroup(trans, "Cheat Enabler", "tab-group-cheatenabler");
|
wnd.AddTabGroup(trans, "Cheat Enabler", "tab-group-cheatenabler");
|
||||||
var tab1 = wnd.AddTab(trans, "General");
|
var tab1 = wnd.AddTab(_windowTrans, "General");
|
||||||
var cb = wnd.AddCheckBox(x, y, tab1, GamePatch.DevShortcutsEnabled, "Enable Dev Shortcuts");
|
var cb = wnd.AddCheckBox(x, y, tab1, GamePatch.DevShortcutsEnabled, "Enable Dev Shortcuts");
|
||||||
x += cb.Width + 5f;
|
x += cb.Width + 5f;
|
||||||
y += 6f;
|
y += 6f;
|
||||||
@@ -104,7 +107,7 @@ public static class UIConfigWindow
|
|||||||
y = 10f;
|
y = 10f;
|
||||||
_resignGameBtn = wnd.AddButton(x, y, 300f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; });
|
_resignGameBtn = wnd.AddButton(x, y, 300f, tab1, "Assign gamesave to current account", 16, "resign-game-btn", () => { GameMain.data.account = AccountData.me; });
|
||||||
|
|
||||||
var tab2 = wnd.AddTab(trans, "Factory");
|
var tab2 = wnd.AddTab(_windowTrans, "Factory");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ImmediateEnabled, "Finish build immediately");
|
wnd.AddCheckBox(x, y, tab2, FactoryPatch.ImmediateEnabled, "Finish build immediately");
|
||||||
@@ -167,7 +170,7 @@ public static class UIConfigWindow
|
|||||||
wnd.AddText2(x + 32f, y, tab2, "Boost fuel power 2", 13);
|
wnd.AddText2(x + 32f, y, tab2, "Boost fuel power 2", 13);
|
||||||
|
|
||||||
// Planet Tab
|
// Planet Tab
|
||||||
var tab3 = wnd.AddTab(trans, "Planet");
|
var tab3 = wnd.AddTab(_windowTrans, "Planet");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddCheckBox(x, y, tab3, ResourcePatch.InfiniteResourceEnabled, "Infinite Natural Resources");
|
wnd.AddCheckBox(x, y, tab3, ResourcePatch.InfiniteResourceEnabled, "Infinite Natural Resources");
|
||||||
@@ -204,7 +207,7 @@ public static class UIConfigWindow
|
|||||||
GameMain.localPlanet.factory.PlanetReformRevert();
|
GameMain.localPlanet.factory.PlanetReformRevert();
|
||||||
});
|
});
|
||||||
|
|
||||||
var tab4 = wnd.AddTab(trans, "Dyson Sphere");
|
var tab4 = wnd.AddTab(_windowTrans, "Dyson Sphere");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
wnd.AddCheckBox(x, y, tab4, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period");
|
||||||
@@ -296,7 +299,7 @@ public static class UIConfigWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var tab5 = wnd.AddTab(trans, "Mecha/Combat");
|
var tab5 = wnd.AddTab(_windowTrans, "Mecha/Combat");
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
wnd.AddCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible");
|
wnd.AddCheckBox(x, y, tab5, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible");
|
||||||
@@ -312,6 +315,11 @@ public static class UIConfigWindow
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdateUI()
|
private static void UpdateUI()
|
||||||
|
{
|
||||||
|
UpdateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void UpdateButtons()
|
||||||
{
|
{
|
||||||
if (_resignGameBtn == null || _clearBanBtn == null) return;
|
if (_resignGameBtn == null || _clearBanBtn == null) return;
|
||||||
var data = GameMain.data;
|
var data = GameMain.data;
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UXAssist", "UXAssist\UXAssi
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheatEnabler", "CheatEnabler\CheatEnabler.csproj", "{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheatEnabler", "CheatEnabler\CheatEnabler.csproj", "{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LogisticMiner", "LogisticMiner\LogisticMiner.csproj", "{7149D717-C913-4153-9425-38CB9D087F83}"
|
||||||
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HideTips", "HideTips\HideTips.csproj", "{4EABD71D-477F-448B-801B-48F8745A3FA7}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HideTips", "HideTips\HideTips.csproj", "{4EABD71D-477F-448B-801B-48F8745A3FA7}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dustbin", "Dustbin\Dustbin.csproj", "{931F0230-5941-4E49-AB19-66921AF14096}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dustbin", "Dustbin\Dustbin.csproj", "{931F0230-5941-4E49-AB19-66921AF14096}"
|
||||||
@@ -63,6 +65,18 @@ Global
|
|||||||
{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Release|x64.Build.0 = Release|Any CPU
|
{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Release|x86.ActiveCfg = Release|Any CPU
|
{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Release|x86.Build.0 = Release|Any CPU
|
{F9F16B62-D1D3-466B-BE22-E64B9EA957C2}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{7149D717-C913-4153-9425-38CB9D087F83}.Release|x86.Build.0 = Release|Any CPU
|
||||||
{4EABD71D-477F-448B-801B-48F8745A3FA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{4EABD71D-477F-448B-801B-48F8745A3FA7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{4EABD71D-477F-448B-801B-48F8745A3FA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{4EABD71D-477F-448B-801B-48F8745A3FA7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{4EABD71D-477F-448B-801B-48F8745A3FA7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
{4EABD71D-477F-448B-801B-48F8745A3FA7}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
|||||||
@@ -26,11 +26,6 @@
|
|||||||
<_ZipPath>$(_PackageDir)\$(ProjectName)-$(Version).zip</_ZipPath>
|
<_ZipPath>$(_PackageDir)\$(ProjectName)-$(Version).zip</_ZipPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<!-- Refresh referenced preloaders before collecting patchers; other projects skip this target. -->
|
|
||||||
<MSBuild Projects="@(ProjectReference)" Targets="CopyToParentPackage"
|
|
||||||
Properties="Configuration=$(Configuration)"
|
|
||||||
Condition="'$(PackUsePluginsLayout)' == 'true'" />
|
|
||||||
|
|
||||||
<!-- Sync manifest.json version_number from .csproj $(Version) before packaging -->
|
<!-- Sync manifest.json version_number from .csproj $(Version) before packaging -->
|
||||||
<Exec Condition="Exists('$(_PackageDir)\manifest.json')"
|
<Exec Condition="Exists('$(_PackageDir)\manifest.json')"
|
||||||
Command="powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$f='$(_PackageDir)\manifest.json'; $c=[IO.File]::ReadAllText($f); $c=$c -replace '(\u0022version_number\u0022\s*:\s*\u0022)[^\u0022]*(\u0022)','${1}$(Version)${2}'; [IO.File]::WriteAllText($f,$c,[Text.UTF8Encoding]::new($true))"" />
|
Command="powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "$f='$(_PackageDir)\manifest.json'; $c=[IO.File]::ReadAllText($f); $c=$c -replace '(\u0022version_number\u0022\s*:\s*\u0022)[^\u0022]*(\u0022)','${1}$(Version)${2}'; [IO.File]::WriteAllText($f,$c,[Text.UTF8Encoding]::new($true))"" />
|
||||||
|
|||||||
+23
-5
@@ -28,14 +28,31 @@ public static class BeltSignal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Sprite LoadDustbinSprite()
|
private static byte[] LoadEmbeddedResource(string path, Assembly assembly = null)
|
||||||
{
|
{
|
||||||
using var stream = Assembly.GetExecutingAssembly()
|
if (assembly == null)
|
||||||
.GetManifestResourceStream("Dustbin.assets.icon.signal-410.png")!;
|
{
|
||||||
|
assembly = Assembly.GetCallingAssembly();
|
||||||
|
}
|
||||||
|
var info = assembly.GetName();
|
||||||
|
var name = info.Name;
|
||||||
|
using var stream = assembly.GetManifestResourceStream($"{name}.{path.Replace('/', '.')}")!;
|
||||||
var buffer = new byte[stream.Length];
|
var buffer = new byte[stream.Length];
|
||||||
_ = stream.Read(buffer, 0, buffer.Length);
|
_ = stream.Read(buffer, 0, buffer.Length);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Texture2D LoadEmbeddedTexture(string path, Assembly assembly = null)
|
||||||
|
{
|
||||||
|
var fileData = LoadEmbeddedResource(path, assembly);
|
||||||
var tex = new Texture2D(2, 2);
|
var tex = new Texture2D(2, 2);
|
||||||
tex.LoadImage(buffer);
|
tex.LoadImage(fileData);
|
||||||
|
return tex;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Sprite LoadEmbeddedSprite(string path, Assembly assembly = null)
|
||||||
|
{
|
||||||
|
var tex = LoadEmbeddedTexture(path, assembly);
|
||||||
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
return Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +61,7 @@ public static class BeltSignal
|
|||||||
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
private static void VFPreload_InvokeOnLoadWorkEnded_Postfix()
|
||||||
{
|
{
|
||||||
if (_initialized) return;
|
if (_initialized) return;
|
||||||
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
var signals = LDB._signals;
|
var signals = LDB._signals;
|
||||||
var index = signals.dataArray.Length;
|
var index = signals.dataArray.Length;
|
||||||
var p = new SignalProto
|
var p = new SignalProto
|
||||||
@@ -52,7 +70,7 @@ public static class BeltSignal
|
|||||||
Name = "DUSTBIN",
|
Name = "DUSTBIN",
|
||||||
GridIndex = 3110,
|
GridIndex = 3110,
|
||||||
IconPath = "Assets/signal-410.png",
|
IconPath = "Assets/signal-410.png",
|
||||||
_iconSprite = LoadDustbinSprite(),
|
_iconSprite = LoadEmbeddedSprite("assets/icon/signal-410.png", assembly),
|
||||||
SID = ""
|
SID = ""
|
||||||
};
|
};
|
||||||
p.name = p.Name.Translate();
|
p.name = p.Name.Translate();
|
||||||
|
|||||||
@@ -3,12 +3,10 @@
|
|||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
* 1.5.0
|
* 1.4.0
|
||||||
* `Storage dustbin`: Destroy splitter input to a storage placed above it, including stacked and proliferated cargo. Enabling dustbin mode also clears cached full-storage state.
|
* `Storage dustbin`: Destroy splitter input to a storage placed above it, including stacked and proliferated cargo. Enabling dustbin mode also clears cached full-storage state.
|
||||||
* `Tank dustbin`: Fix single tanks blocking liquid input after receiving their first stack, both with and without dustbin mode.
|
* `Tank dustbin`: Fix single tanks blocking liquid input after receiving their first stack, both with and without dustbin mode.
|
||||||
* `Belt signal dustbin`: Restore item disposal and startup compatibility with the current game simulation loop after DSP 0.10.33/0.10.34 updates.
|
* `Belt signal dustbin`: Restore item disposal and startup compatibility with the current game simulation loop after DSP 0.10.33/0.10.34 updates.
|
||||||
|
|
||||||
* 1.4.0
|
|
||||||
* Refactorying Tank input logic codes, for better performance, and resolve a bug [#53](https://github.com/soarqin/DSP_Mods/issues/53)
|
* Refactorying Tank input logic codes, for better performance, and resolve a bug [#53](https://github.com/soarqin/DSP_Mods/issues/53)
|
||||||
* Remove use of AssetBundle, move the belt signal icon into `Assembly Resources`, for better flexibility.
|
* Remove use of AssetBundle, move the belt signal icon into `Assembly Resources`, for better flexibility.
|
||||||
|
|
||||||
@@ -48,12 +46,10 @@
|
|||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
* 1.5.0
|
* 1.4.0
|
||||||
* `储物仓垃圾桶`:销毁四向分流器送入上方储物仓的物品,包括堆叠和喷涂增产剂的物品;启用垃圾桶时清除已满状态缓存。
|
* `储物仓垃圾桶`:销毁四向分流器送入上方储物仓的物品,包括堆叠和喷涂增产剂的物品;启用垃圾桶时清除已满状态缓存。
|
||||||
* `储液罐垃圾桶`:修复单层储液罐装入第一批液体后停止输入的问题,普通储存和垃圾桶模式均可正常工作。
|
* `储液罐垃圾桶`:修复单层储液罐装入第一批液体后停止输入的问题,普通储存和垃圾桶模式均可正常工作。
|
||||||
* `传送带信号垃圾桶`:适配当前游戏的模拟循环,修复 DSP 0.10.33/0.10.34 更新后的启动报错和物品无法销毁问题。
|
* `传送带信号垃圾桶`:适配当前游戏的模拟循环,修复 DSP 0.10.33/0.10.34 更新后的启动报错和物品无法销毁问题。
|
||||||
|
|
||||||
* 1.4.0
|
|
||||||
* 重构储液罐的输入逻辑代码,以提高性能并解决bug [#53](https://github.com/soarqin/DSP_Mods/issues/53)
|
* 重构储液罐的输入逻辑代码,以提高性能并解决bug [#53](https://github.com/soarqin/DSP_Mods/issues/53)
|
||||||
* 移除了AssetBundle的使用,将传送带信号图标移入`Assembly资源`,以获得更好的灵活性
|
* 移除了AssetBundle的使用,将传送带信号图标移入`Assembly资源`,以获得更好的灵活性
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<BepInExPluginGuid>org.soardev.dustbin</BepInExPluginGuid>
|
<BepInExPluginGuid>org.soardev.dustbin</BepInExPluginGuid>
|
||||||
<Description>DSP MOD - Dustbin</Description>
|
<Description>DSP MOD - Dustbin</Description>
|
||||||
<Version>1.5.0</Version>
|
<Version>1.4.0</Version>
|
||||||
<PackageId>Dustbin</PackageId>
|
<PackageId>Dustbin</PackageId>
|
||||||
<RootNamespace>Dustbin</RootNamespace>
|
<RootNamespace>Dustbin</RootNamespace>
|
||||||
<PackHasChangelog>true</PackHasChangelog>
|
<PackHasChangelog>true</PackHasChangelog>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Dustbin",
|
"name": "Dustbin",
|
||||||
"version_number": "1.5.0",
|
"version_number": "1.4.0",
|
||||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/Dustbin",
|
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/Dustbin",
|
||||||
"description": "Can turn Storages and Tanks into Dustbin(Destroy incoming items) / 储物仓和储液罐可以转变为垃圾桶(销毁送进的物品)",
|
"description": "Can turn Storages and Tanks into Dustbin(Destroy incoming items) / 储物仓和储液罐可以转变为垃圾桶(销毁送进的物品)",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ public class HideTips : BaseUnityPlugin
|
|||||||
private static bool _noResearchCompletionPopups = true;
|
private static bool _noResearchCompletionPopups = true;
|
||||||
private static bool _noResearchCompletionTips;
|
private static bool _noResearchCompletionTips;
|
||||||
private static bool _skipPrologue = true;
|
private static bool _skipPrologue = true;
|
||||||
|
// private static bool _hideMenuDemo;
|
||||||
|
|
||||||
|
private static Harmony _patch;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
@@ -31,8 +34,21 @@ public class HideTips : BaseUnityPlugin
|
|||||||
_noResearchCompletionPopups = Config.Bind("General", "NoResearchCompletionPopups", _noResearchCompletionPopups, "Disable Research Completion Popup Windows").Value;
|
_noResearchCompletionPopups = Config.Bind("General", "NoResearchCompletionPopups", _noResearchCompletionPopups, "Disable Research Completion Popup Windows").Value;
|
||||||
_noResearchCompletionTips = Config.Bind("General", "NoResearchCompletionTips", _noResearchCompletionTips, "Disable Research Completion Tips").Value;
|
_noResearchCompletionTips = Config.Bind("General", "NoResearchCompletionTips", _noResearchCompletionTips, "Disable Research Completion Tips").Value;
|
||||||
_skipPrologue = Config.Bind("General", "SkipPrologue", _skipPrologue, "Skip prologue for new game").Value;
|
_skipPrologue = Config.Bind("General", "SkipPrologue", _skipPrologue, "Skip prologue for new game").Value;
|
||||||
|
// _hideMenuDemo = Config.Bind("General", "HideMenuDemo", _hideMenuDemo, "Disable title screen demo scene loading").Value;
|
||||||
if (!_cfgEnabled) return;
|
if (!_cfgEnabled) return;
|
||||||
Harmony.CreateAndPatchAll(typeof(HideTips));
|
Harmony.CreateAndPatchAll(typeof(HideTips));
|
||||||
|
/*
|
||||||
|
if (_hideMenuDemo)
|
||||||
|
{
|
||||||
|
_patch = Harmony.CreateAndPatchAll(typeof(HideMenuDemo));
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDestroy()
|
||||||
|
{
|
||||||
|
_patch?.UnpatchSelf();
|
||||||
|
_patch = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
@@ -130,3 +146,74 @@ public class HideTips : BaseUnityPlugin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
[HarmonyPatch]
|
||||||
|
class HideMenuDemo
|
||||||
|
{
|
||||||
|
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.StartDemoGame), typeof(int))]
|
||||||
|
private static bool DSPGame_StartDemoGame_Prefix()
|
||||||
|
{
|
||||||
|
if (DSPGame.Game != null)
|
||||||
|
{
|
||||||
|
DSPGame.EndGame();
|
||||||
|
}
|
||||||
|
|
||||||
|
DSPGame.IsMenuDemo = true;
|
||||||
|
DSPGame.CreateGameMainObject();
|
||||||
|
DSPGame.Game.isMenuDemo = true;
|
||||||
|
DSPGame.Game.CreateIconSet();
|
||||||
|
GameMain.data = new GameData();
|
||||||
|
GameMain.data.mainPlayer = Player.Create(GameMain.data, 1);
|
||||||
|
GameMain.data.galaxy = new GalaxyData
|
||||||
|
{
|
||||||
|
starCount = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
if (GameMain.universeSimulator != null)
|
||||||
|
{
|
||||||
|
UnityEngine.Object.Destroy(GameMain.universeSimulator.gameObject);
|
||||||
|
}
|
||||||
|
GameMain.universeSimulator = UnityEngine.Object.Instantiate(Configs.builtin.universeSimulatorPrefab);
|
||||||
|
GameMain.universeSimulator.spaceAudio = new GameObject("Space Audio")
|
||||||
|
{
|
||||||
|
transform =
|
||||||
|
{
|
||||||
|
parent = GameMain.universeSimulator.transform
|
||||||
|
}
|
||||||
|
}.AddComponent<SpaceAudio>();
|
||||||
|
GameMain.Begin();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(VFPreload), nameof(VFPreload.IsMenuDemoLoaded))]
|
||||||
|
private static bool VFPreload_IsMenuDemoLoaded_Prefix(ref bool __result)
|
||||||
|
{
|
||||||
|
__result = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(DSPGame), nameof(DSPGame.LateUpdate))]
|
||||||
|
[HarmonyPatch(typeof(GameMain), nameof(GameMain.LateUpdate))]
|
||||||
|
[HarmonyPatch(typeof(GameMain), nameof(GameMain.FixedUpdate))]
|
||||||
|
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Update))]
|
||||||
|
[HarmonyPatch(typeof(GameCamera), nameof(GameCamera.LateUpdate))]
|
||||||
|
private static bool DSPGame_LateUpdate_Prefix()
|
||||||
|
{
|
||||||
|
return !DSPGame.IsMenuDemo;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPriority(Priority.First), HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(GameMain), nameof(GameMain.Begin))]
|
||||||
|
private static bool GameMain_Begin_Prefix()
|
||||||
|
{
|
||||||
|
if (!DSPGame.IsMenuDemo) return true;
|
||||||
|
DSPGame.Game._loading = false;
|
||||||
|
DSPGame.Game._running = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
@@ -21,6 +21,17 @@ function New-OpCts {
|
|||||||
[Threading.CancellationTokenSource]::new([TimeSpan]::FromSeconds($TimeoutSec))
|
[Threading.CancellationTokenSource]::new([TimeSpan]::FromSeconds($TimeoutSec))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-ConnSocket {
|
||||||
|
param($Conn)
|
||||||
|
if ($null -eq $Conn) { return $null }
|
||||||
|
if ($Conn -is [hashtable]) {
|
||||||
|
if ($Conn.ContainsKey('Ws')) { return $Conn['Ws'] }
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
if ($Conn.PSObject.Properties.Name -contains 'Ws') { return $Conn.Ws }
|
||||||
|
return $null
|
||||||
|
}
|
||||||
|
|
||||||
function Connect-Api {
|
function Connect-Api {
|
||||||
param([string] $Uri)
|
param([string] $Uri)
|
||||||
$ws = [Net.WebSockets.ClientWebSocket]::new()
|
$ws = [Net.WebSockets.ClientWebSocket]::new()
|
||||||
@@ -38,8 +49,7 @@ function Connect-Api {
|
|||||||
|
|
||||||
function Close-Api {
|
function Close-Api {
|
||||||
param($Conn)
|
param($Conn)
|
||||||
if ($null -eq $Conn) { return }
|
$ws = Get-ConnSocket $Conn
|
||||||
$ws = $Conn.Ws
|
|
||||||
if ($null -eq $ws) { return }
|
if ($null -eq $ws) { return }
|
||||||
$cts = New-OpCts
|
$cts = New-OpCts
|
||||||
try {
|
try {
|
||||||
@@ -54,7 +64,7 @@ function Close-Api {
|
|||||||
|
|
||||||
function Send-Text {
|
function Send-Text {
|
||||||
param($Conn, [string] $Text, [bool] $End = $true)
|
param($Conn, [string] $Text, [bool] $End = $true)
|
||||||
$ws = $Conn.Ws
|
$ws = Get-ConnSocket $Conn
|
||||||
$bytes = $utf8.GetBytes($Text)
|
$bytes = $utf8.GetBytes($Text)
|
||||||
$seg = [ArraySegment[byte]]::new($bytes)
|
$seg = [ArraySegment[byte]]::new($bytes)
|
||||||
$cts = New-OpCts
|
$cts = New-OpCts
|
||||||
@@ -65,7 +75,7 @@ function Send-Text {
|
|||||||
|
|
||||||
function Receive-Message {
|
function Receive-Message {
|
||||||
param($Conn)
|
param($Conn)
|
||||||
$ws = $Conn.Ws
|
$ws = Get-ConnSocket $Conn
|
||||||
$buffer = [byte[]]::new(65536)
|
$buffer = [byte[]]::new(65536)
|
||||||
$ms = [IO.MemoryStream]::new()
|
$ms = [IO.MemoryStream]::new()
|
||||||
$cts = New-OpCts
|
$cts = New-OpCts
|
||||||
@@ -173,7 +183,7 @@ try {
|
|||||||
|
|
||||||
$cts = New-OpCts
|
$cts = New-OpCts
|
||||||
try {
|
try {
|
||||||
$null = $conn.Ws.SendAsync(
|
$null = (Get-ConnSocket $conn).SendAsync(
|
||||||
[ArraySegment[byte]]::new([byte[]](1, 2, 3)),
|
[ArraySegment[byte]]::new([byte[]](1, 2, 3)),
|
||||||
[Net.WebSockets.WebSocketMessageType]::Binary,
|
[Net.WebSockets.WebSocketMessageType]::Binary,
|
||||||
$true,
|
$true,
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using HarmonyLib;
|
||||||
|
|
||||||
|
namespace MechaDronesTweaks;
|
||||||
|
|
||||||
|
class FastDronesRemover
|
||||||
|
{
|
||||||
|
public const string FastDronesGuid = "com.dkoppstein.plugin.DSP.FastDrones";
|
||||||
|
private const string FastDronesVersion = "0.0.5";
|
||||||
|
|
||||||
|
public static bool Run(Harmony harmony)
|
||||||
|
{
|
||||||
|
if (!BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(FastDronesGuid, out var pluginInfo) ||
|
||||||
|
pluginInfo.Metadata.Version.ToString() != FastDronesVersion) return false;
|
||||||
|
var assembly = pluginInfo.Instance.GetType().Assembly;
|
||||||
|
var classType = assembly.GetType("com.dkoppstein.plugin.DSP.FastDrones.FastDronesPlugin");
|
||||||
|
harmony.Patch(AccessTools.Method(classType, "Start"),
|
||||||
|
new HarmonyMethod(typeof(FastDronesRemover).GetMethod("PatchFastDronesStart")));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool PatchFastDronesStart()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,11 +9,9 @@ using UnityEngine;
|
|||||||
namespace MechaDronesTweaks;
|
namespace MechaDronesTweaks;
|
||||||
|
|
||||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||||
[BepInDependency(FastDronesGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
[BepInDependency(FastDronesRemover.FastDronesGuid, BepInDependency.DependencyFlags.SoftDependency)]
|
||||||
public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
||||||
{
|
{
|
||||||
private const string FastDronesGuid = "com.dkoppstein.plugin.DSP.FastDrones";
|
|
||||||
|
|
||||||
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
||||||
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
BepInEx.Logging.Logger.CreateLogSource(PluginInfo.PLUGIN_NAME);
|
||||||
|
|
||||||
@@ -24,13 +22,8 @@ public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
|||||||
/* Remove FastDrones MOD if loaded */
|
/* Remove FastDrones MOD if loaded */
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (BepInEx.Bootstrap.Chainloader.PluginInfos.TryGetValue(FastDronesGuid, out var pluginInfo) &&
|
if (FastDronesRemover.Run(_harmony))
|
||||||
pluginInfo.Metadata.Version.ToString() == "0.0.5")
|
|
||||||
{
|
{
|
||||||
var assembly = pluginInfo.Instance.GetType().Assembly;
|
|
||||||
var classType = assembly.GetType("com.dkoppstein.plugin.DSP.FastDrones.FastDronesPlugin");
|
|
||||||
_harmony.Patch(AccessTools.Method(classType, "Start"),
|
|
||||||
new HarmonyMethod(AccessTools.Method(typeof(MechaDronesTweaksPlugin), nameof(PatchFastDronesStart))));
|
|
||||||
Logger.LogInfo("Unpatch FastDrones - OK");
|
Logger.LogInfo("Unpatch FastDrones - OK");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,8 +33,6 @@ public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool PatchFastDronesStart() => false;
|
|
||||||
|
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
MechaDronesTweaks.UseFixedSpeed = Config.Bind("MechaDrones", "UseFixedSpeed", MechaDronesTweaks.UseFixedSpeed,
|
MechaDronesTweaks.UseFixedSpeed = Config.Bind("MechaDrones", "UseFixedSpeed", MechaDronesTweaks.UseFixedSpeed,
|
||||||
@@ -63,6 +54,10 @@ public class MechaDronesTweaksPlugin : BaseUnityPlugin
|
|||||||
MechaDronesTweaks.EnergyMultiplier,
|
MechaDronesTweaks.EnergyMultiplier,
|
||||||
new ConfigDescription("Energy consumption multiplier for mecha drones",
|
new ConfigDescription("Energy consumption multiplier for mecha drones",
|
||||||
new AcceptableValueRange<float>(0f, 1f))).Value;
|
new AcceptableValueRange<float>(0f, 1f))).Value;
|
||||||
|
MechaDronesTweaks.EnergyMultiplier = Config.Bind("MechaDrones", "EnergyMultiplier",
|
||||||
|
MechaDronesTweaks.EnergyMultiplier,
|
||||||
|
new ConfigDescription("Energy consumption multiplier for mecha drones",
|
||||||
|
new AcceptableValueRange<float>(0f, 1f))).Value;
|
||||||
|
|
||||||
_harmony.PatchAll(typeof(MechaDronesTweaks));
|
_harmony.PatchAll(typeof(MechaDronesTweaks));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,6 +104,21 @@ public class Patch : BaseUnityPlugin, IModCanSave
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Belt fix for GalacticScale old versions, should be of no use now.
|
||||||
|
[HarmonyTranspiler, HarmonyPatch(typeof(BuildTool_Path), "CheckBuildConditions")]
|
||||||
|
private static IEnumerable<CodeInstruction> BuildTool_Path_CheckBuildConditions_Transpiler(
|
||||||
|
IEnumerable<CodeInstruction> instructions)
|
||||||
|
{
|
||||||
|
foreach (var instr in instructions)
|
||||||
|
{
|
||||||
|
if (instr.opcode == OpCodes.Ldc_R4 && instr.OperandIs(0.28f))
|
||||||
|
{
|
||||||
|
instr.operand = 0.21f;
|
||||||
|
}
|
||||||
|
yield return instr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
[HarmonyPostfix, HarmonyPatch(typeof(LabComponent), "SetFunction")]
|
[HarmonyPostfix, HarmonyPatch(typeof(LabComponent), "SetFunction")]
|
||||||
private static void LabComponent_SetFunction_Postfix(ref LabComponent __instance)
|
private static void LabComponent_SetFunction_Postfix(ref LabComponent __instance)
|
||||||
@@ -365,6 +380,20 @@ public class Patch : BaseUnityPlugin, IModCanSave
|
|||||||
foreach (var proto in LDB.items.dataArray)
|
foreach (var proto in LDB.items.dataArray)
|
||||||
{
|
{
|
||||||
var prefabDesc = proto.prefabDesc;
|
var prefabDesc = proto.prefabDesc;
|
||||||
|
/* Fix collision sizes, for GalacticScale old versions, should be of no use now.
|
||||||
|
FixExtValue(ref prefabDesc.buildCollider.ext.x);
|
||||||
|
FixExtValue(ref prefabDesc.buildCollider.ext.y);
|
||||||
|
FixExtValue(ref prefabDesc.buildCollider.ext.z);
|
||||||
|
if (prefabDesc.buildColliders != null)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < prefabDesc.buildColliders.Length; i++)
|
||||||
|
{
|
||||||
|
FixExtValue(ref prefabDesc.buildColliders[i].ext.x);
|
||||||
|
FixExtValue(ref prefabDesc.buildColliders[i].ext.y);
|
||||||
|
FixExtValue(ref prefabDesc.buildColliders[i].ext.z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (prefabDesc.isInserter)
|
if (prefabDesc.isInserter)
|
||||||
{
|
{
|
||||||
@@ -443,4 +472,16 @@ public class Patch : BaseUnityPlugin, IModCanSave
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
private static void FixExtValue(ref float v)
|
||||||
|
{
|
||||||
|
if (v == 0f)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var b = Math.Abs(v);
|
||||||
|
v = (v - b) * 0.75f + b;
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
+108
-69
@@ -24,23 +24,23 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
foreach (var planet in GameMain.data.factories)
|
foreach (var planet in GameMain.data.factories)
|
||||||
{
|
{
|
||||||
if (planet == null) continue;
|
if (planet == null) continue;
|
||||||
if (OptimizePool((in EntityData n, int index) => n.id == index, () =>
|
if (OptimizePool((in EntityData n) => n.id, () =>
|
||||||
{
|
{
|
||||||
planet.entityCapacity = 0;
|
planet.entityCapacity = 0;
|
||||||
planet.SetEntityCapacity(1024);
|
planet.SetEntityCapacity(1024);
|
||||||
},
|
},
|
||||||
ref planet.entityPool, ref planet.entityCursor,
|
ref planet.entityPool, ref planet.entityCursor, ref planet.entityCapacity,
|
||||||
ref planet.entityRecycle, ref planet.entityRecycleCursor))
|
ref planet.entityRecycle, ref planet.entityRecycleCursor))
|
||||||
{
|
{
|
||||||
Logger.LogDebug($"Optimized `{nameof(planet.entityPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(planet.entityPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OptimizePool((in PrebuildData n, int index) => n.id == index, () =>
|
if (OptimizePool((in PrebuildData n) => n.id, () =>
|
||||||
{
|
{
|
||||||
planet.prebuildCapacity = 0;
|
planet.prebuildCapacity = 0;
|
||||||
planet.SetPrebuildCapacity(256);
|
planet.SetPrebuildCapacity(256);
|
||||||
},
|
},
|
||||||
ref planet.prebuildPool, ref planet.prebuildCursor,
|
ref planet.prebuildPool, ref planet.prebuildCursor, ref planet.prebuildCapacity,
|
||||||
ref planet.prebuildRecycle, ref planet.prebuildRecycleCursor))
|
ref planet.prebuildRecycle, ref planet.prebuildRecycleCursor))
|
||||||
{
|
{
|
||||||
Logger.LogDebug($"Optimized `{nameof(planet.prebuildPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(planet.prebuildPool)}` on Planet {planet.planetId}");
|
||||||
@@ -49,152 +49,152 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var cargoTraffic = planet.cargoTraffic;
|
var cargoTraffic = planet.cargoTraffic;
|
||||||
if (cargoTraffic != null)
|
if (cargoTraffic != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in BeltComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in BeltComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.beltCapacity = 0;
|
cargoTraffic.beltCapacity = 0;
|
||||||
cargoTraffic.SetBeltCapacity(16);
|
cargoTraffic.SetBeltCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.beltPool, ref cargoTraffic.beltCursor,
|
ref cargoTraffic.beltPool, ref cargoTraffic.beltCursor, ref cargoTraffic.beltCapacity,
|
||||||
ref cargoTraffic.beltRecycle, ref cargoTraffic.beltRecycleCursor))
|
ref cargoTraffic.beltRecycle, ref cargoTraffic.beltRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.beltPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.beltPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in CargoPath n, int index) => (n?.id ?? 0) == index, () =>
|
if (OptimizePool((in CargoPath n) => n?.id ?? 0, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.pathCapacity = 0;
|
cargoTraffic.pathCapacity = 0;
|
||||||
cargoTraffic.SetPathCapacity(16);
|
cargoTraffic.SetPathCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.pathPool, ref cargoTraffic.pathCursor,
|
ref cargoTraffic.pathPool, ref cargoTraffic.pathCursor, ref cargoTraffic.pathCapacity,
|
||||||
ref cargoTraffic.pathRecycle, ref cargoTraffic.pathRecycleCursor))
|
ref cargoTraffic.pathRecycle, ref cargoTraffic.pathRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pathPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pathPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in SplitterComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in SplitterComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.splitterCapacity = 0;
|
cargoTraffic.splitterCapacity = 0;
|
||||||
cargoTraffic.SetSplitterCapacity(16);
|
cargoTraffic.SetSplitterCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.splitterPool, ref cargoTraffic.splitterCursor,
|
ref cargoTraffic.splitterPool, ref cargoTraffic.splitterCursor, ref cargoTraffic.splitterCapacity,
|
||||||
ref cargoTraffic.splitterRecycle, ref cargoTraffic.splitterRecycleCursor))
|
ref cargoTraffic.splitterRecycle, ref cargoTraffic.splitterRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.splitterPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.splitterPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in MonitorComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in MonitorComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.monitorCapacity = 0;
|
cargoTraffic.monitorCapacity = 0;
|
||||||
cargoTraffic.SetMonitorCapacity(16);
|
cargoTraffic.SetMonitorCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.monitorPool, ref cargoTraffic.monitorCursor,
|
ref cargoTraffic.monitorPool, ref cargoTraffic.monitorCursor, ref cargoTraffic.monitorCapacity,
|
||||||
ref cargoTraffic.monitorRecycle, ref cargoTraffic.monitorRecycleCursor))
|
ref cargoTraffic.monitorRecycle, ref cargoTraffic.monitorRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.monitorPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.monitorPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in SpraycoaterComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in SpraycoaterComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.spraycoaterCapacity = 0;
|
cargoTraffic.spraycoaterCapacity = 0;
|
||||||
cargoTraffic.SetSpraycoaterCapacity(16);
|
cargoTraffic.SetSpraycoaterCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.spraycoaterPool, ref cargoTraffic.spraycoaterCursor,
|
ref cargoTraffic.spraycoaterPool, ref cargoTraffic.spraycoaterCursor, ref cargoTraffic.spraycoaterCapacity,
|
||||||
ref cargoTraffic.spraycoaterRecycle, ref cargoTraffic.spraycoaterRecycleCursor))
|
ref cargoTraffic.spraycoaterRecycle, ref cargoTraffic.spraycoaterRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.spraycoaterPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.spraycoaterPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PilerComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in PilerComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
cargoTraffic.pilerCapacity = 0;
|
cargoTraffic.pilerCapacity = 0;
|
||||||
cargoTraffic.SetPilerCapacity(16);
|
cargoTraffic.SetPilerCapacity(16);
|
||||||
},
|
},
|
||||||
ref cargoTraffic.pilerPool, ref cargoTraffic.pilerCursor,
|
ref cargoTraffic.pilerPool, ref cargoTraffic.pilerCursor, ref cargoTraffic.pilerCapacity,
|
||||||
ref cargoTraffic.pilerRecycle, ref cargoTraffic.pilerRecycleCursor))
|
ref cargoTraffic.pilerRecycle, ref cargoTraffic.pilerRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pilerPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(cargoTraffic.pilerPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
var factoryStorage = planet.factoryStorage;
|
var factoryStorage = planet.factoryStorage;
|
||||||
if (factoryStorage != null)
|
if (factoryStorage != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in StorageComponent n, int index) => (n?.id ?? 0) == index, () =>
|
if (OptimizePool((in StorageComponent n) => n?.id ?? 0, () =>
|
||||||
{
|
{
|
||||||
factoryStorage.storageCapacity = 0;
|
factoryStorage.storageCapacity = 0;
|
||||||
factoryStorage.SetStorageCapacity(64);
|
factoryStorage.SetStorageCapacity(64);
|
||||||
},
|
},
|
||||||
ref factoryStorage.storagePool, ref factoryStorage.storageCursor,
|
ref factoryStorage.storagePool, ref factoryStorage.storageCursor, ref factoryStorage.storageCapacity,
|
||||||
ref factoryStorage.storageRecycle, ref factoryStorage.storageRecycleCursor))
|
ref factoryStorage.storageRecycle, ref factoryStorage.storageRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factoryStorage.storagePool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factoryStorage.storagePool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in TankComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in TankComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
factoryStorage.tankCapacity = 0;
|
factoryStorage.tankCapacity = 0;
|
||||||
factoryStorage.SetTankCapacity(256);
|
factoryStorage.SetTankCapacity(256);
|
||||||
},
|
},
|
||||||
ref factoryStorage.tankPool, ref factoryStorage.tankCursor,
|
ref factoryStorage.tankPool, ref factoryStorage.tankCursor, ref factoryStorage.tankCapacity,
|
||||||
ref factoryStorage.tankRecycle, ref factoryStorage.tankRecycleCursor))
|
ref factoryStorage.tankRecycle, ref factoryStorage.tankRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factoryStorage.tankPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factoryStorage.tankPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
var factorySystem = planet.factorySystem;
|
var factorySystem = planet.factorySystem;
|
||||||
if (factorySystem != null)
|
if (factorySystem != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in MinerComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in MinerComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
factorySystem.minerCapacity = 0;
|
factorySystem.minerCapacity = 0;
|
||||||
factorySystem.SetMinerCapacity(256);
|
factorySystem.SetMinerCapacity(256);
|
||||||
},
|
},
|
||||||
ref factorySystem.minerPool, ref factorySystem.minerCursor,
|
ref factorySystem.minerPool, ref factorySystem.minerCursor, ref factorySystem.minerCapacity,
|
||||||
ref factorySystem.minerRecycle, ref factorySystem.minerRecycleCursor))
|
ref factorySystem.minerRecycle, ref factorySystem.minerRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.minerPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.minerPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in InserterComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in InserterComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
factorySystem.inserterCapacity = 0;
|
factorySystem.inserterCapacity = 0;
|
||||||
factorySystem.SetInserterCapacity(256);
|
factorySystem.SetInserterCapacity(256);
|
||||||
},
|
},
|
||||||
ref factorySystem.inserterPool, ref factorySystem.inserterCursor,
|
ref factorySystem.inserterPool, ref factorySystem.inserterCursor, ref factorySystem.inserterCapacity,
|
||||||
ref factorySystem.inserterRecycle, ref factorySystem.inserterRecycleCursor))
|
ref factorySystem.inserterRecycle, ref factorySystem.inserterRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.inserterPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.inserterPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in AssemblerComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in AssemblerComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
factorySystem.assemblerCapacity = 0;
|
factorySystem.assemblerCapacity = 0;
|
||||||
factorySystem.SetAssemblerCapacity(256);
|
factorySystem.SetAssemblerCapacity(256);
|
||||||
},
|
},
|
||||||
ref factorySystem.assemblerPool, ref factorySystem.assemblerCursor,
|
ref factorySystem.assemblerPool, ref factorySystem.assemblerCursor, ref factorySystem.assemblerCapacity,
|
||||||
ref factorySystem.assemblerRecycle, ref factorySystem.assemblerRecycleCursor))
|
ref factorySystem.assemblerRecycle, ref factorySystem.assemblerRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.assemblerPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.assemblerPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in FractionatorComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in FractionatorComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
factorySystem.fractionatorCapacity = 0;
|
factorySystem.fractionatorCapacity = 0;
|
||||||
factorySystem.SetFractionatorCapacity(32);
|
factorySystem.SetFractionatorCapacity(32);
|
||||||
},
|
},
|
||||||
ref factorySystem.fractionatorPool, ref factorySystem.fractionatorCursor,
|
ref factorySystem.fractionatorPool, ref factorySystem.fractionatorCursor, ref factorySystem.fractionatorCapacity,
|
||||||
ref factorySystem.fractionatorRecycle, ref factorySystem.fractionatorRecycleCursor))
|
ref factorySystem.fractionatorRecycle, ref factorySystem.fractionatorRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.fractionatorPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.fractionatorPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in EjectorComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in EjectorComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
factorySystem.ejectorCapacity = 0;
|
factorySystem.ejectorCapacity = 0;
|
||||||
factorySystem.SetEjectorCapacity(32);
|
factorySystem.SetEjectorCapacity(32);
|
||||||
},
|
},
|
||||||
ref factorySystem.ejectorPool, ref factorySystem.ejectorCursor,
|
ref factorySystem.ejectorPool, ref factorySystem.ejectorCursor, ref factorySystem.ejectorCapacity,
|
||||||
ref factorySystem.ejectorRecycle, ref factorySystem.ejectorRecycleCursor))
|
ref factorySystem.ejectorRecycle, ref factorySystem.ejectorRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.ejectorPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.ejectorPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in SiloComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in SiloComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
factorySystem.siloCapacity = 0;
|
factorySystem.siloCapacity = 0;
|
||||||
factorySystem.SetSiloCapacity(32);
|
factorySystem.SetSiloCapacity(32);
|
||||||
},
|
},
|
||||||
ref factorySystem.siloPool, ref factorySystem.siloCursor,
|
ref factorySystem.siloPool, ref factorySystem.siloCursor, ref factorySystem.siloCapacity,
|
||||||
ref factorySystem.siloRecycle, ref factorySystem.siloRecycleCursor))
|
ref factorySystem.siloRecycle, ref factorySystem.siloRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.siloPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.siloPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in LabComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in LabComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
factorySystem.labCapacity = 0;
|
factorySystem.labCapacity = 0;
|
||||||
factorySystem.SetLabCapacity(256);
|
factorySystem.SetLabCapacity(256);
|
||||||
},
|
},
|
||||||
ref factorySystem.labPool, ref factorySystem.labCursor,
|
ref factorySystem.labPool, ref factorySystem.labCursor, ref factorySystem.labCapacity,
|
||||||
ref factorySystem.labRecycle, ref factorySystem.labRecycleCursor))
|
ref factorySystem.labRecycle, ref factorySystem.labRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(factorySystem.labPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(factorySystem.labPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
var transport = planet.transport;
|
var transport = planet.transport;
|
||||||
if (transport != null)
|
if (transport != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in StationComponent n, int index) => (n?.id ?? 0) == index, () =>
|
if (OptimizePool((in StationComponent n) => n?.id ?? 0, () =>
|
||||||
{
|
{
|
||||||
transport.stationCapacity = 0;
|
transport.stationCapacity = 0;
|
||||||
transport.SetStationCapacity(16);
|
transport.SetStationCapacity(16);
|
||||||
},
|
},
|
||||||
ref transport.stationPool, ref transport.stationCursor,
|
ref transport.stationPool, ref transport.stationCursor, ref transport.stationCapacity,
|
||||||
ref transport.stationRecycle, ref transport.stationRecycleCursor))
|
ref transport.stationRecycle, ref transport.stationRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(transport.stationPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(transport.stationPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in DispenserComponent n, int index) => (n?.id ?? 0) == index, () =>
|
if (OptimizePool((in DispenserComponent n) => n?.id ?? 0, () =>
|
||||||
{
|
{
|
||||||
transport.dispenserCapacity = 0;
|
transport.dispenserCapacity = 0;
|
||||||
transport.SetDispenserCapacity(8);
|
transport.SetDispenserCapacity(8);
|
||||||
},
|
},
|
||||||
ref transport.dispenserPool, ref transport.dispenserCursor,
|
ref transport.dispenserPool, ref transport.dispenserCursor, ref transport.dispenserCapacity,
|
||||||
ref transport.dispenserRecycle, ref transport.dispenserRecycleCursor))
|
ref transport.dispenserRecycle, ref transport.dispenserRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(transport.dispenserPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(transport.dispenserPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
@@ -202,54 +202,54 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var powerSystem = planet.powerSystem;
|
var powerSystem = planet.powerSystem;
|
||||||
if (powerSystem != null)
|
if (powerSystem != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in PowerGeneratorComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in PowerGeneratorComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
powerSystem.genCapacity = 0;
|
powerSystem.genCapacity = 0;
|
||||||
powerSystem.SetGeneratorCapacity(8);
|
powerSystem.SetGeneratorCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.genPool, ref powerSystem.genCursor,
|
ref powerSystem.genPool, ref powerSystem.genCursor, ref powerSystem.genCapacity,
|
||||||
ref powerSystem.genRecycle, ref powerSystem.genRecycleCursor))
|
ref powerSystem.genRecycle, ref powerSystem.genRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.genPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.genPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerNodeComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in PowerNodeComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
powerSystem.nodeCapacity = 0;
|
powerSystem.nodeCapacity = 0;
|
||||||
powerSystem.SetNodeCapacity(8);
|
powerSystem.SetNodeCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.nodePool, ref powerSystem.nodeCursor,
|
ref powerSystem.nodePool, ref powerSystem.nodeCursor, ref powerSystem.nodeCapacity,
|
||||||
ref powerSystem.nodeRecycle, ref powerSystem.nodeRecycleCursor))
|
ref powerSystem.nodeRecycle, ref powerSystem.nodeRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.nodePool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.nodePool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerConsumerComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in PowerConsumerComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
powerSystem.consumerCapacity = 0;
|
powerSystem.consumerCapacity = 0;
|
||||||
powerSystem.SetConsumerCapacity(8);
|
powerSystem.SetConsumerCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.consumerPool, ref powerSystem.consumerCursor,
|
ref powerSystem.consumerPool, ref powerSystem.consumerCursor, ref powerSystem.consumerCapacity,
|
||||||
ref powerSystem.consumerRecycle, ref powerSystem.consumerRecycleCursor))
|
ref powerSystem.consumerRecycle, ref powerSystem.consumerRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.consumerPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.consumerPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerAccumulatorComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in PowerAccumulatorComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
powerSystem.accCapacity = 0;
|
powerSystem.accCapacity = 0;
|
||||||
powerSystem.SetAccumulatorCapacity(8);
|
powerSystem.SetAccumulatorCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.accPool, ref powerSystem.accCursor,
|
ref powerSystem.accPool, ref powerSystem.accCursor, ref powerSystem.accCapacity,
|
||||||
ref powerSystem.accRecycle, ref powerSystem.accRecycleCursor))
|
ref powerSystem.accRecycle, ref powerSystem.accRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.accPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.accPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerExchangerComponent n, int index) => n.id == index, () =>
|
if (OptimizePool((in PowerExchangerComponent n) => n.id, () =>
|
||||||
{
|
{
|
||||||
powerSystem.excCapacity = 0;
|
powerSystem.excCapacity = 0;
|
||||||
powerSystem.SetExchangerCapacity(8);
|
powerSystem.SetExchangerCapacity(8);
|
||||||
},
|
},
|
||||||
ref powerSystem.excPool, ref powerSystem.excCursor,
|
ref powerSystem.excPool, ref powerSystem.excCursor, ref powerSystem.excCapacity,
|
||||||
ref powerSystem.excRecycle, ref powerSystem.excRecycleCursor))
|
ref powerSystem.excRecycle, ref powerSystem.excRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.excPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.excPool)}` on Planet {planet.planetId}");
|
||||||
if (OptimizePool((in PowerNetwork n, int index) => (n?.id ?? 0) == index, () =>
|
if (OptimizePool((in PowerNetwork n) => n?.id ?? 0, () =>
|
||||||
{
|
{
|
||||||
powerSystem.netCapacity = 0;
|
powerSystem.netCapacity = 0;
|
||||||
powerSystem.SetNetworkCapacity(8);
|
powerSystem.SetNetworkCapacity(8);
|
||||||
powerSystem.netPool[0] = new PowerNetwork();
|
powerSystem.netPool[0] = new PowerNetwork();
|
||||||
powerSystem.netPool[0].Reset(0);
|
powerSystem.netPool[0].Reset(0);
|
||||||
},
|
},
|
||||||
ref powerSystem.netPool, ref powerSystem.netCursor,
|
ref powerSystem.netPool, ref powerSystem.netCursor, ref powerSystem.netCapacity,
|
||||||
ref powerSystem.netRecycle, ref powerSystem.netRecycleCursor))
|
ref powerSystem.netRecycle, ref powerSystem.netRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(powerSystem.netPool)}` on Planet {planet.planetId}");
|
Logger.LogDebug($"Optimized `{nameof(powerSystem.netPool)}` on Planet {planet.planetId}");
|
||||||
}
|
}
|
||||||
@@ -257,12 +257,12 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var trashContainer = GameMain.data.trashSystem?.container;
|
var trashContainer = GameMain.data.trashSystem?.container;
|
||||||
if (trashContainer != null)
|
if (trashContainer != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in TrashObject n, int index) => n.item != 0, () =>
|
if (OptimizePool((in TrashObject n) => n.item == 0, () =>
|
||||||
{
|
{
|
||||||
trashContainer.trashCapacity = 0;
|
trashContainer.trashCapacity = 0;
|
||||||
trashContainer.SetTrashCapacity(16);
|
trashContainer.SetTrashCapacity(16);
|
||||||
},
|
},
|
||||||
ref trashContainer.trashObjPool, ref trashContainer.trashCursor,
|
ref trashContainer.trashObjPool, ref trashContainer.trashCursor, ref trashContainer.trashCapacity,
|
||||||
ref trashContainer.trashRecycle, ref trashContainer.trashRecycleCursor))
|
ref trashContainer.trashRecycle, ref trashContainer.trashRecycleCursor))
|
||||||
{
|
{
|
||||||
Logger.LogDebug($"Optimized `{nameof(trashContainer.trashObjPool)}`");
|
Logger.LogDebug($"Optimized `{nameof(trashContainer.trashObjPool)}`");
|
||||||
@@ -271,12 +271,12 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var warningSystem = GameMain.data.warningSystem;
|
var warningSystem = GameMain.data.warningSystem;
|
||||||
if (warningSystem != null)
|
if (warningSystem != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in WarningData n, int index) => n.id == index, () =>
|
if (OptimizePool((in WarningData n) => n.id, () =>
|
||||||
{
|
{
|
||||||
warningSystem.warningCapacity = 0;
|
warningSystem.warningCapacity = 0;
|
||||||
warningSystem.SetWarningCapacity(32);
|
warningSystem.SetWarningCapacity(32);
|
||||||
},
|
},
|
||||||
ref warningSystem.warningPool, ref warningSystem.warningCursor,
|
ref warningSystem.warningPool, ref warningSystem.warningCursor, ref warningSystem.warningCapacity,
|
||||||
ref warningSystem.warningRecycle, ref warningSystem.warningRecycleCursor))
|
ref warningSystem.warningRecycle, ref warningSystem.warningRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(warningSystem.warningPool)}`");
|
Logger.LogDebug($"Optimized `{nameof(warningSystem.warningPool)}`");
|
||||||
}
|
}
|
||||||
@@ -286,48 +286,48 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
foreach (var dysonSphere in dysonSpheres)
|
foreach (var dysonSphere in dysonSpheres)
|
||||||
{
|
{
|
||||||
if (dysonSphere == null) continue;
|
if (dysonSphere == null) continue;
|
||||||
if (OptimizePool((in DysonRocket n, int index) => n.id == index, () =>
|
if (OptimizePool((in DysonRocket n) => n.id, () =>
|
||||||
{
|
{
|
||||||
dysonSphere.rocketCapacity = 0;
|
dysonSphere.rocketCapacity = 0;
|
||||||
dysonSphere.SetRocketCapacity(256);
|
dysonSphere.SetRocketCapacity(256);
|
||||||
},
|
},
|
||||||
ref dysonSphere.rocketPool, ref dysonSphere.rocketCursor,
|
ref dysonSphere.rocketPool, ref dysonSphere.rocketCursor, ref dysonSphere.rocketCapacity,
|
||||||
ref dysonSphere.rocketRecycle, ref dysonSphere.rocketRecycleCursor))
|
ref dysonSphere.rocketRecycle, ref dysonSphere.rocketRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(dysonSphere.rocketPool)}` on Star {dysonSphere.starData.id}");
|
Logger.LogDebug($"Optimized `{nameof(dysonSphere.rocketPool)}` on Star {dysonSphere.starData.id}");
|
||||||
if (OptimizePool((in DysonNodeRData n, int index) => n.id == index, () =>
|
if (OptimizePool((in DysonNodeRData n) => n.id, () =>
|
||||||
{
|
{
|
||||||
dysonSphere.nrdCapacity = 0;
|
dysonSphere.nrdCapacity = 0;
|
||||||
dysonSphere.SetNrdCapacity(128);
|
dysonSphere.SetNrdCapacity(128);
|
||||||
},
|
},
|
||||||
ref dysonSphere.nrdPool, ref dysonSphere.nrdCursor,
|
ref dysonSphere.nrdPool, ref dysonSphere.nrdCursor, ref dysonSphere.nrdCapacity,
|
||||||
ref dysonSphere.nrdRecycle, ref dysonSphere.nrdRecycleCursor))
|
ref dysonSphere.nrdRecycle, ref dysonSphere.nrdRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(dysonSphere.nrdPool)}` on Star {dysonSphere.starData.id}");
|
Logger.LogDebug($"Optimized `{nameof(dysonSphere.nrdPool)}` on Star {dysonSphere.starData.id}");
|
||||||
if (dysonSphere.layersIdBased == null) continue;
|
if (dysonSphere.layersIdBased == null) continue;
|
||||||
foreach (var layer in dysonSphere.layersSorted)
|
foreach (var layer in dysonSphere.layersSorted)
|
||||||
{
|
{
|
||||||
if (layer == null) continue;
|
if (layer == null) continue;
|
||||||
if (OptimizePool((in DysonNode n, int index) => (n?.id ?? 0) == index, () =>
|
if (OptimizePool((in DysonNode n) => n?.id ?? 0, () =>
|
||||||
{
|
{
|
||||||
layer.nodeCapacity = 64;
|
layer.nodeCapacity = 64;
|
||||||
layer.SetNodeCapacity(64);
|
layer.SetNodeCapacity(64);
|
||||||
},
|
},
|
||||||
ref layer.nodePool, ref layer.nodeCursor,
|
ref layer.nodePool, ref layer.nodeCursor, ref layer.nodeCapacity,
|
||||||
ref layer.nodeRecycle, ref layer.nodeRecycleCursor))
|
ref layer.nodeRecycle, ref layer.nodeRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(layer.nodePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
Logger.LogDebug($"Optimized `{nameof(layer.nodePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
||||||
if (OptimizePool((in DysonFrame n, int index) => (n?.id ?? 0) == index, () =>
|
if (OptimizePool((in DysonFrame n) => n?.id ?? 0, () =>
|
||||||
{
|
{
|
||||||
layer.frameCapacity = 64;
|
layer.frameCapacity = 64;
|
||||||
layer.SetFrameCapacity(64);
|
layer.SetFrameCapacity(64);
|
||||||
},
|
},
|
||||||
ref layer.framePool, ref layer.frameCursor,
|
ref layer.framePool, ref layer.frameCursor, ref layer.frameCapacity,
|
||||||
ref layer.frameRecycle, ref layer.frameRecycleCursor))
|
ref layer.frameRecycle, ref layer.frameRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(layer.framePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
Logger.LogDebug($"Optimized `{nameof(layer.framePool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
||||||
if (OptimizePool((in DysonShell n, int index) => (n?.id ?? 0) == index, () =>
|
if (OptimizePool((in DysonShell n) => n?.id ?? 0, () =>
|
||||||
{
|
{
|
||||||
layer.shellCapacity = 64;
|
layer.shellCapacity = 64;
|
||||||
layer.SetShellCapacity(64);
|
layer.SetShellCapacity(64);
|
||||||
},
|
},
|
||||||
ref layer.shellPool, ref layer.shellCursor,
|
ref layer.shellPool, ref layer.shellCursor, ref layer.shellCapacity,
|
||||||
ref layer.shellRecycle, ref layer.shellRecycleCursor))
|
ref layer.shellRecycle, ref layer.shellRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(layer.shellPool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
Logger.LogDebug($"Optimized `{nameof(layer.shellPool)}` on Star {dysonSphere.starData.id} layer {layer.id}");
|
||||||
}
|
}
|
||||||
@@ -335,12 +335,12 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var swarm = dysonSphere.swarm;
|
var swarm = dysonSphere.swarm;
|
||||||
if (swarm != null)
|
if (swarm != null)
|
||||||
{
|
{
|
||||||
if (OptimizePool((in SailBullet n, int index) => n.id == index, () =>
|
if (OptimizePool((in SailBullet n) => n.id, () =>
|
||||||
{
|
{
|
||||||
swarm.bulletCapacity = 0;
|
swarm.bulletCapacity = 0;
|
||||||
swarm.SetBulletCapacity(128);
|
swarm.SetBulletCapacity(128);
|
||||||
},
|
},
|
||||||
ref swarm.bulletPool, ref swarm.bulletCursor,
|
ref swarm.bulletPool, ref swarm.bulletCursor, ref swarm.bulletCapacity,
|
||||||
ref swarm.bulletRecycle, ref swarm.bulletRecycleCursor))
|
ref swarm.bulletRecycle, ref swarm.bulletRecycleCursor))
|
||||||
Logger.LogDebug($"Optimized `{nameof(swarm.bulletPool)}` on Star {dysonSphere.starData.id}");
|
Logger.LogDebug($"Optimized `{nameof(swarm.bulletPool)}` on Star {dysonSphere.starData.id}");
|
||||||
}
|
}
|
||||||
@@ -350,10 +350,12 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
GC.Collect();
|
GC.Collect();
|
||||||
}
|
}
|
||||||
|
|
||||||
private delegate bool IsOccupied<T>(in T s, int index);
|
private delegate int GetId<T>(in T s);
|
||||||
|
|
||||||
|
private delegate void SetToInitialCapacity();
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private static bool OptimizePool<T>(IsOccupied<T> isOccupied, Action initCapacity, ref T[] pool, ref int cursor, ref int[] recycle, ref int recycleCursor)
|
private static bool OptimizePool<T>(GetId<T> getter, SetToInitialCapacity initCapacity, ref T[] pool, ref int cursor, ref int capacity, ref int[] recycle, ref int recycleCursor)
|
||||||
{
|
{
|
||||||
if (cursor <= 1) return false;
|
if (cursor <= 1) return false;
|
||||||
if (recycleCursor == cursor - 1)
|
if (recycleCursor == cursor - 1)
|
||||||
@@ -367,7 +369,7 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
var pos = cursor - 1;
|
var pos = cursor - 1;
|
||||||
while (pos > 0)
|
while (pos > 0)
|
||||||
{
|
{
|
||||||
if (isOccupied(pool[pos], pos)) break;
|
if (getter(pool[pos]) == pos) break;
|
||||||
pos--;
|
pos--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,4 +391,41 @@ public class PoolOptPatch : BaseUnityPlugin
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private delegate bool IsEmpty<T>(in T s);
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
private static bool OptimizePool<T>(IsEmpty<T> checker, SetToInitialCapacity initCapacity, ref T[] pool, ref int cursor, ref int capacity, ref int[] recycle, ref int recycleCursor)
|
||||||
|
{
|
||||||
|
if (cursor <= 1) return false;
|
||||||
|
if (recycleCursor == cursor - 1)
|
||||||
|
{
|
||||||
|
cursor = 1;
|
||||||
|
recycleCursor = 0;
|
||||||
|
initCapacity();
|
||||||
|
Logger.LogDebug("Resetted pool to initial status");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var pos = cursor - 1;
|
||||||
|
while (pos > 0)
|
||||||
|
{
|
||||||
|
if (!checker(pool[pos])) break;
|
||||||
|
pos--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pos + 1 == cursor) return false;
|
||||||
|
if (pos == 0)
|
||||||
|
{
|
||||||
|
cursor = 1;
|
||||||
|
recycleCursor = 0;
|
||||||
|
initCapacity();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor = pos + 1;
|
||||||
|
Array.Sort(recycle, 0, recycleCursor);
|
||||||
|
var idx = Array.BinarySearch(recycle, 0, recycleCursor, pos + 1);
|
||||||
|
recycleCursor = idx < 0 ? ~idx : idx;
|
||||||
|
Logger.LogDebug($"Shrinked pool size to {cursor} and recycle size to {recycleCursor}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+8
-24
@@ -3,18 +3,10 @@
|
|||||||
|
|
||||||
## Changlog
|
## Changlog
|
||||||
|
|
||||||
* 1.6.4
|
* 1.6.3 - Unreleased
|
||||||
* `Hide battle-related techs in Peace mode`: Fix an array index error when opening the tech tree after switching from a Peace-mode save to a Combat-mode save in the same game process, including when disabling the option after loading another Peace-mode save.
|
* `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.
|
||||||
* 1.6.3
|
* `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. `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 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.
|
||||||
* `Quick build Mining Machines`:
|
* `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.
|
||||||
* Add a Factory-tab button to arrange ordinary Mining Machines densely around the nearest solid vein group. Each miner covers at least 3 nodes from that group, without including nearby groups. Layouts are not limited by stock; missing miners remain as ghosts awaiting materials. Placement respects construction range and does not include belts or power facilities. Click again to cancel a search.
|
|
||||||
* `Allow restoring/burying veins` is off by default, using only visible nodes without restoring or burying any. Enable it to restore unobstructed nodes away from Dark Fog Planetary Bases and allow unused nodes to be buried for better coverage. Nodes used by existing miners or miner ghosts are protected.
|
|
||||||
* `Blueprint descriptions`:
|
|
||||||
* Add an `Auto-fill` entry to the native description header in the blueprint browser, copy, and paste inspectors. It opens generation options without moving native fields or covering the file list. Generation replaces the main description with material flows per minute, separating shortages, surpluses, inputs, outputs, and research use, and adds factory and logistics power demand to a `Power` custom field.
|
|
||||||
* Choose `Final-product output` (the default on opening the inspector) to retain rated final outputs and show intermediate shortages and excess, or `Lowest intermediate throughput` to scale the final-product mix to the bottleneck using recipe ratios. Complete, balanceable chains have no internal shortages in the latter mode; unused intermediate capacity appears as excess. External inputs use the selected basis; power still covers every selected building at full load. If a balanced basis cannot be determined, the original description is kept.
|
|
||||||
* A `Proliferation` checkbox controls whether calculations include proliferation, defaulting to on when the blueprint contains a Spray Coater. Large rates use K/M/G where display precision is preserved, and numbers with four or more integer digits use comma thousands separators, including before suffixes; unknown values are marked separately. Other custom fields are preserved, and the blueprint still needs to be saved manually.
|
|
||||||
* `Sunlight at night`: Lighting now follows the camera, including planet view, and stays consistent across buildings, terrain, solar panels, and belts. Restore lighting correctly after switching planets, and return to native lighting when sailing, disabling the feature, or using white rendering mode.
|
|
||||||
* `Protect veins from exhaustion`: Fix the option failing to take effect in 1.6.2, restoring protection of configured vein reserves and minimum oil rates, along with the corresponding mining statistics.
|
|
||||||
* 1.6.2
|
* 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.
|
* `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.
|
* `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.
|
||||||
@@ -446,18 +438,10 @@
|
|||||||
|
|
||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
* 1.6.4
|
* 1.6.3 - Unreleased
|
||||||
* `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。
|
* `夜间日光灯`:按镜头和当前观察位置的地表方向计算光照,不再跟随机甲朝向,行星视图也适用。统一建筑、地表、太阳能板和传送带的光照方向,在光源或行星切换后恢复功能,并在航行、关闭功能或白模渲染时恢复原版光照。
|
||||||
* 1.6.3
|
* `快速铺设采矿机`:在「工厂」页增加按钮,按游戏实际碰撞体在最近的固体矿脉搜索密集布局,支持脚部交错、邻近矿机联动调整及结束前补入剩余可用位置。「允许恢复/掩埋矿物」默认关闭:仅使用可见矿点,跳过所有恢复和掩埋计算;开启后,恢复可恢复的掩埋矿点,并允许掩埋未被使用的矿点来提高覆盖数。以各台矿机覆盖矿点数之和为目标,要求每台在掩埋后仍覆盖至少 3 个矿点,不受库存限制地生成完整布局,缺少采矿机的位置保留待建造虚影。使用最多 4 个后台线程加速布局搜索,线程数不超过可用逻辑线程数的一半。功能调试期间输出可离线重放的 JSON 数据,完成提示保留约 8 秒。
|
||||||
* `快速铺设采矿机`:
|
* `蓝图说明`:在蓝图浏览、复制和粘贴界面的说明框上方增加「自动填写说明」按钮和「增产」复选框。点击按钮会用蓝图满负荷运行时每分钟的物料流量替换原说明,按需分行列出「缺少」「多余」「输入」「输出」「研究」,并将工厂与物流耗电写入「耗电」自定义字段。输入量以下游建筑实际能消耗的量为限;蓝图含研究模式研究站时,蓝图内产出的矩阵列入「研究」行,研究模式研究站均按满负荷计入耗电。蓝图含喷涂机时,复选框默认勾选。无法计算的数值会单独标注而不显示为零,其他自定义字段保持不变,也不会自动保存蓝图。
|
||||||
* 在「工厂」页增加按钮,自动在最近的固体矿脉周围密集铺设普通采矿机。每台至少覆盖选中矿脉的 3 个矿点,不混入附近其他矿脉。布局数量不受库存限制,采矿机不足的位置保留待建造虚影。遵守建造范围,不自动铺设传送带和电力设施。计算期间再次点击可取消。
|
|
||||||
* 「允许恢复/掩埋矿物」默认关闭,仅使用可见矿点,不恢复或掩埋矿点。开启后可恢复未被建筑阻挡、且远离黑雾行星基地的矿点,并允许掩埋未使用的矿点来提高覆盖数;已有矿机和待建造矿机使用的矿点会受到保护。
|
|
||||||
* `蓝图说明`:
|
|
||||||
* 在蓝图浏览、复制和粘贴检查面板的说明标题行增加「自动填写」入口,点击展开生成选项,不移动原生字段或遮挡文件列表。生成时用每分钟的物料流量替换原说明,分别列出「缺少」「多余」「输入」「输出」「研究」,并将工厂与物流耗电写入「耗电」自定义字段。
|
|
||||||
* 可选择「最终产物产量」(每次打开检查面板时的默认值),保留最终产物的额定产量并显示中间产物的缺口和余量;也可选择「最低产量中间产物」,按配方比例换算瓶颈,等比例缩放各最终产物。后一种模式下,数据完整且可平衡的生产链没有内部缺口,未使用的中间产能列为「多余」。外部输入采用所选基准,耗电仍按所选全部建筑满载估算。无法确定平衡基准时保留原说明。
|
|
||||||
* 可用「增产」复选框选择是否计入增产效果,蓝图含喷涂机时默认勾选。较大的流量在保留显示精度的前提下使用 K/M/G 单位;整数部分达到四位的数字用逗号每三位分隔,带单位时也适用。无法计算的数值单独标注。保留其他自定义字段,填写后仍需手动保存蓝图。
|
|
||||||
* `夜间日光灯`:光照改为随镜头变化,行星视图也适用;建筑、地表、太阳能板和传送带的光照方向保持一致。切换行星后正确恢复光照,航行、关闭功能或进入白模渲染时恢复原版光照。
|
|
||||||
* `保护矿脉不会枯竭`:修复 1.6.2 中开启后仍不生效的问题,恢复设定的矿脉剩余量、油井最低流速保护及相应开采统计。
|
|
||||||
* 1.6.2
|
* 1.6.2
|
||||||
* `提升物流塔和大型采矿机的最大功耗`:修复启用后调整大型采矿机开采速度时出现 0% 或异常速度的问题。
|
* `提升物流塔和大型采矿机的最大功耗`:修复启用后调整大型采矿机开采速度时出现 0% 或异常速度的问题。
|
||||||
* `调整建筑输入缓冲`:修复 DSP 0.10.35.29104 及后续版本中射线接收器透镜缓冲设置不生效的问题,并将显示的游戏原始值更正为 2。
|
* `调整建筑输入缓冲`:修复 DSP 0.10.35.29104 及后续版本中射线接收器透镜缓冲设置不生效的问题,并将显示的游戏原始值更正为 2。
|
||||||
|
|||||||
@@ -13,44 +13,49 @@ public static class ItemIds
|
|||||||
public const int SulfuricAcid = 1116;
|
public const int SulfuricAcid = 1116;
|
||||||
public const int Hydrogen = 1120;
|
public const int Hydrogen = 1120;
|
||||||
public const int Deuterium = 1121;
|
public const int Deuterium = 1121;
|
||||||
public const int CriticalPhoton = 1208;
|
public const int Photon = 1208;
|
||||||
|
|
||||||
/* Materials and components */
|
/* Materials used by recipes */
|
||||||
public const int TitaniumAlloy = 1107;
|
public const int OrganicCrystal = 1015;
|
||||||
public const int Prism = 1111;
|
public const int FireIce = 1012;
|
||||||
public const int FrameMaterial = 1125;
|
public const int CriticalPhoton = 1124;
|
||||||
public const int CasimirCrystal = 1126;
|
public const int CircuitBoard = 1112; // used in proliferator mk.III recipe
|
||||||
public const int MagneticCoil = 1202;
|
public const int Steel = 1107;
|
||||||
public const int ElectricMotor = 1203;
|
public const int TitaniumGlass = 1111;
|
||||||
public const int ElectromagneticTurbine = 1204;
|
public const int GravitonLens = 1125;
|
||||||
public const int SuperMagneticRing = 1205;
|
|
||||||
public const int GravitonLens = 1209;
|
|
||||||
public const int CircuitBoard = 1301;
|
|
||||||
public const int QuantumChip = 1305;
|
|
||||||
public const int PlasmaExciter = 1401;
|
|
||||||
public const int ParticleBroadband = 1402;
|
|
||||||
public const int AnnihilationConstraintSphere = 1403;
|
|
||||||
public const int Thruster = 1405;
|
|
||||||
public const int ReinforcedThruster = 1406;
|
|
||||||
|
|
||||||
/* Proliferators */
|
/* Proliferators */
|
||||||
public const int ProliferatorMkI = 1141;
|
public const int ProliferatorMkI = 1141;
|
||||||
public const int ProliferatorMkII = 1142;
|
public const int ProliferatorMkII = 1142;
|
||||||
public const int ProliferatorMkIII = 1143;
|
public const int ProliferatorMkIII = 1143;
|
||||||
|
|
||||||
/* Logistics */
|
/* Logistics carriers */
|
||||||
public const int SpaceWarper = 1210;
|
|
||||||
public const int LogisticsDrone = 5001;
|
public const int LogisticsDrone = 5001;
|
||||||
public const int LogisticsVessel = 5002;
|
public const int LogisticsVessel = 5002;
|
||||||
public const int LogisticsBot = 5003;
|
public const int LogisticsBot = 5003;
|
||||||
|
public const int SpaceWarper = 1126;
|
||||||
|
|
||||||
|
/* Matrices */
|
||||||
|
public const int ElectromagneticMatrix = 1202;
|
||||||
|
public const int EnergyMatrix = 1203;
|
||||||
|
public const int StructureMatrix = 1204;
|
||||||
|
public const int InformationMatrix = 1205;
|
||||||
|
public const int UniverseMatrix = 1209;
|
||||||
|
public const int Antimatter = 1210;
|
||||||
|
|
||||||
|
/* Components */
|
||||||
|
public const int PlasmaExciter = 1301;
|
||||||
|
public const int ParticleBroadband = 1305;
|
||||||
|
public const int Processor = 1401;
|
||||||
|
public const int QuantumChip = 1402;
|
||||||
|
public const int MicrocrystallineComponent = 1403;
|
||||||
|
public const int PlaneFilter = 1405;
|
||||||
|
public const int ParticleContainer = 1406;
|
||||||
|
|
||||||
/* Dyson sphere materials */
|
/* Dyson sphere materials */
|
||||||
public const int DysonSphereComponent = 1502;
|
public const int SolarSail = 1502;
|
||||||
public const int SmallCarrierRocket = 1503;
|
public const int FrameMaterial = 1503;
|
||||||
|
public const int DysonSphereComponent = 1802;
|
||||||
/* Fuel rods */
|
|
||||||
public const int DeuteronFuelRod = 1802;
|
|
||||||
public const int StrangeAnnihilationFuelRod = 1804;
|
|
||||||
|
|
||||||
/* Power nodes */
|
/* Power nodes */
|
||||||
public const int TeslaTower = 2201;
|
public const int TeslaTower = 2201;
|
||||||
@@ -62,49 +67,49 @@ public static class ItemIds
|
|||||||
public const int MiningMachine = 2301;
|
public const int MiningMachine = 2301;
|
||||||
|
|
||||||
/* Dark Fog items (combat expansion) */
|
/* Dark Fog items (combat expansion) */
|
||||||
public const int DarkFogMatrix = 5201;
|
public const int DarkFogMemoryUnit = 5201;
|
||||||
public const int DarkFogSiliconNeuron = 5202;
|
public const int DarkFogSiliconNeuron = 5202;
|
||||||
public const int DarkFogMatterRecombinator = 5203;
|
public const int DarkFogMatterReassembler = 5203;
|
||||||
public const int DarkFogNegentropySingularity = 5204;
|
public const int DarkFogNegentropySingularity = 5204;
|
||||||
public const int DarkFogCoreElement = 5205;
|
public const int DarkFogVirtualParticle = 5205;
|
||||||
public const int DarkFogEnergyShard = 5206;
|
public const int DarkFogEnergyFragment = 5206;
|
||||||
|
|
||||||
/* Matrices. Metadata types use the same IDs; the Universe Matrix's metadata is Metaverse. */
|
/* Fuel and advanced items */
|
||||||
public const int ElectromagneticMatrix = 6001;
|
public const int HydrogenFuelRod = 6001;
|
||||||
public const int EnergyMatrix = 6002;
|
public const int DeuteronFuelRod = 6002;
|
||||||
public const int StructureMatrix = 6003;
|
public const int AntimatterFuelRod = 6003;
|
||||||
public const int InformationMatrix = 6004;
|
public const int StrangeAnnihilationFuelRod = 1804;
|
||||||
public const int GravityMatrix = 6005;
|
public const int StrangeMatter = 6004;
|
||||||
public const int UniverseMatrix = 6006;
|
public const int Foundation = 6005;
|
||||||
|
public const int Metaverse = 6006; // also called property/meta-data item
|
||||||
|
|
||||||
/* Item groups used by belt signal recipe calculations. */
|
/* Item groups used by belt signal recipe calculations. */
|
||||||
public static readonly int[] ExtraOreItemIds =
|
public static readonly int[] ExtraOreItemIds =
|
||||||
[
|
[
|
||||||
Water, SulfuricAcid, Hydrogen, Deuterium, CriticalPhoton,
|
Water, SulfuricAcid, Hydrogen, Deuterium, Photon,
|
||||||
DarkFogMatrix, DarkFogSiliconNeuron, DarkFogMatterRecombinator,
|
DarkFogMemoryUnit, DarkFogSiliconNeuron, DarkFogMatterReassembler,
|
||||||
DarkFogNegentropySingularity, DarkFogCoreElement, DarkFogEnergyShard
|
DarkFogNegentropySingularity, DarkFogVirtualParticle, DarkFogEnergyFragment
|
||||||
];
|
];
|
||||||
|
|
||||||
// Listed in the same order as the belt signal option tips.
|
|
||||||
public static readonly HashSet<int> ExtraProliferationItemIds =
|
public static readonly HashSet<int> ExtraProliferationItemIds =
|
||||||
[
|
[
|
||||||
TitaniumAlloy, Prism, FrameMaterial, ProliferatorMkII, ProliferatorMkIII,
|
Steel, TitaniumGlass, GravitonLens, ProliferatorMkII, ProliferatorMkIII,
|
||||||
MagneticCoil, ElectricMotor, ElectromagneticTurbine, SuperMagneticRing,
|
ElectromagneticMatrix, EnergyMatrix, StructureMatrix, InformationMatrix,
|
||||||
CircuitBoard, Thruster, ReinforcedThruster, PlasmaExciter, ParticleBroadband,
|
UniverseMatrix, Antimatter, PlasmaExciter, ParticleBroadband,
|
||||||
GravitonLens, QuantumChip, AnnihilationConstraintSphere, DeuteronFuelRod, SpaceWarper,
|
Processor, QuantumChip, MicrocrystallineComponent, PlaneFilter, ParticleContainer,
|
||||||
DysonSphereComponent, SmallCarrierRocket, ElectromagneticMatrix, StructureMatrix,
|
SolarSail, FrameMaterial, DysonSphereComponent,
|
||||||
InformationMatrix, GravityMatrix, UniverseMatrix
|
HydrogenFuelRod, AntimatterFuelRod, StrangeMatter, Foundation, Metaverse
|
||||||
];
|
];
|
||||||
|
|
||||||
public static readonly HashSet<int> NoProliferationItemIds =
|
public static readonly HashSet<int> NoProliferationItemIds =
|
||||||
[
|
[
|
||||||
CasimirCrystal, EnergyMatrix
|
SpaceWarper, DeuteronFuelRod
|
||||||
];
|
];
|
||||||
|
|
||||||
/* Dark Fog materials used by production calculations. */
|
/* Dark Fog materials used by production calculations. */
|
||||||
public static readonly int[] DarkFogItemIds =
|
public static readonly int[] DarkFogItemIds =
|
||||||
[
|
[
|
||||||
DarkFogMatrix, DarkFogSiliconNeuron, DarkFogMatterRecombinator,
|
DarkFogMemoryUnit, DarkFogSiliconNeuron, DarkFogMatterReassembler,
|
||||||
DarkFogNegentropySingularity, DarkFogCoreElement, DarkFogEnergyShard
|
DarkFogNegentropySingularity, DarkFogVirtualParticle, DarkFogEnergyFragment
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -133,6 +133,21 @@ public static class I18N
|
|||||||
ApplyIndexers();
|
ApplyIndexers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the localized text for the given key in the currently active language,
|
||||||
|
/// falling back to the key itself when no entry is registered.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">The lookup key.</param>
|
||||||
|
/// <returns>The localized text, or <paramref name="key"/> if no entry exists.</returns>
|
||||||
|
internal static string Translate(string key)
|
||||||
|
{
|
||||||
|
if (!Entries.TryGetValue(key, out var loc)) return key;
|
||||||
|
var languageIndex = Localization.currentLanguageIndex;
|
||||||
|
if (languageIndex >= 0 && languageIndex < Localization.Languages.Length && Localization.Languages[languageIndex].lcId == 2052)
|
||||||
|
return loc.Zh;
|
||||||
|
return loc.En;
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(Localization), nameof(Localization.LoadSettings))]
|
[HarmonyPostfix, HarmonyPriority(Priority.Last), HarmonyPatch(typeof(Localization), nameof(Localization.LoadSettings))]
|
||||||
private static void Localization_LoadSettings_Postfix()
|
private static void Localization_LoadSettings_Postfix()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,14 +6,7 @@ public static class I18NKeys
|
|||||||
{
|
{
|
||||||
public const string Unknown = "Unknown";
|
public const string Unknown = "Unknown";
|
||||||
public const string BlueprintAutoFillDescription = "UXAssist Blueprint Auto-fill description";
|
public const string BlueprintAutoFillDescription = "UXAssist Blueprint Auto-fill description";
|
||||||
public const string BlueprintDescriptionOptions = "UXAssist Blueprint Description Options";
|
|
||||||
public const string BlueprintDescriptionOptionsTip = "UXAssist Blueprint Description Options Tip";
|
|
||||||
public const string BlueprintProliferation = "UXAssist Blueprint Proliferation";
|
public const string BlueprintProliferation = "UXAssist Blueprint Proliferation";
|
||||||
public const string BlueprintProductionBasis = "UXAssist Blueprint Production Basis";
|
|
||||||
public const string BlueprintFinalProducts = "UXAssist Blueprint Final Products";
|
|
||||||
public const string BlueprintBottleneckIntermediate = "UXAssist Blueprint Bottleneck Intermediate";
|
|
||||||
public const string BlueprintProductionBasisTip = "UXAssist Blueprint Production Basis Tip";
|
|
||||||
public const string BlueprintBasisUnavailable = "Cannot determine a balanced intermediate throughput. Check building settings and production-chain outputs, or use final-product output.";
|
|
||||||
public const string BlueprintPower = "UXAssist Blueprint Power";
|
public const string BlueprintPower = "UXAssist Blueprint Power";
|
||||||
public const string BlueprintPowerEnglish = "Power";
|
public const string BlueprintPowerEnglish = "Power";
|
||||||
public const string BlueprintPowerChinese = "耗电";
|
public const string BlueprintPowerChinese = "耗电";
|
||||||
@@ -212,10 +205,8 @@ public static class I18NKeys
|
|||||||
public const string QuickMinerFailed = "Miner placement stopped; check the log before retrying";
|
public const string QuickMinerFailed = "Miner placement stopped; check the log before retrying";
|
||||||
public const string QuickMinerVeinsChanged = "Veins changed during miner layout search";
|
public const string QuickMinerVeinsChanged = "Veins changed during miner layout search";
|
||||||
public const string QuickMinerResult = "Placed {0} Mining Machines, {1} total vein coverage, {2} buried nodes";
|
public const string QuickMinerResult = "Placed {0} Mining Machines, {1} total vein coverage, {2} buried nodes";
|
||||||
#if DEBUG
|
|
||||||
public const string QuickMinerDebugSaved = "Miner layout debug data: {0}";
|
public const string QuickMinerDebugSaved = "Miner layout debug data: {0}";
|
||||||
public const string QuickMinerDebugFailed = "Could not save miner layout debug data";
|
public const string QuickMinerDebugFailed = "Could not save miner layout debug data";
|
||||||
#endif
|
|
||||||
public const string MaximumCountToBuild = "Maximum count to build";
|
public const string MaximumCountToBuild = "Maximum count to build";
|
||||||
public const string Max = "max";
|
public const string Max = "max";
|
||||||
public const string StopEjectorsWhenAvailableNodesAreAllFilledUp = "Stop ejectors when available nodes are all filled up";
|
public const string StopEjectorsWhenAvailableNodesAreAllFilledUp = "Stop ejectors when available nodes are all filled up";
|
||||||
@@ -244,19 +235,7 @@ public static class I18NKeys
|
|||||||
{
|
{
|
||||||
I18N.Add(Unknown, "Unknown", "未知");
|
I18N.Add(Unknown, "Unknown", "未知");
|
||||||
I18N.Add(BlueprintAutoFillDescription, "Auto-fill description", "自动填写说明");
|
I18N.Add(BlueprintAutoFillDescription, "Auto-fill description", "自动填写说明");
|
||||||
I18N.Add(BlueprintDescriptionOptions, "Auto-fill…", "自动填写…");
|
|
||||||
I18N.Add(BlueprintDescriptionOptionsTip,
|
|
||||||
"Choose production basis and proliferation, then fill the blueprint description.",
|
|
||||||
"选择产量基准和增产后,自动填写蓝图说明。");
|
|
||||||
I18N.Add(BlueprintProliferation, "Proliferation", "增产");
|
I18N.Add(BlueprintProliferation, "Proliferation", "增产");
|
||||||
I18N.Add(BlueprintProductionBasis, "Production basis", "产量基准");
|
|
||||||
I18N.Add(BlueprintFinalProducts, "Final-product output", "最终产物产量");
|
|
||||||
I18N.Add(BlueprintBottleneckIntermediate, "Lowest intermediate throughput", "最低产量中间产物");
|
|
||||||
I18N.Add(BlueprintProductionBasisTip,
|
|
||||||
"Final-product output (default): keep rated final outputs and show intermediate shortages and excess.\nLowest intermediate throughput: convert capacities through recipe ratios and scale all final outputs together to the bottleneck; complete, balanceable chains have no internal shortages. Excess shows unused intermediate capacity. Power still sizes all selected buildings at full load.\nUnknown settings or an unresolved output prevent balanced generation; the existing description is kept.",
|
|
||||||
"最终产物产量(默认):保留最终产物的额定产量,显示中间产物的缺口和余量。\n最低产量中间产物:按配方比例换算产能,以瓶颈等比例缩放各最终产物;数据完整且可平衡时没有内部缺口,「多余」表示未使用的中间产能。耗电仍按所选全部建筑满载估算。\n缺少参数或无法确定输出时,不生成平衡说明,保留原说明。");
|
|
||||||
I18N.Add(BlueprintBasisUnavailable, BlueprintBasisUnavailable,
|
|
||||||
"无法确定可平衡的中间产物产量,原说明已保留。请检查建筑参数和生产链输出,或改用最终产物产量基准。");
|
|
||||||
I18N.Add(BlueprintPower, BlueprintPowerEnglish, BlueprintPowerChinese);
|
I18N.Add(BlueprintPower, BlueprintPowerEnglish, BlueprintPowerChinese);
|
||||||
I18N.Add(BlueprintInputLine, "Input: ", "输入:");
|
I18N.Add(BlueprintInputLine, "Input: ", "输入:");
|
||||||
I18N.Add(BlueprintOutputLine, "Output: ", "输出:");
|
I18N.Add(BlueprintOutputLine, "Output: ", "输出:");
|
||||||
@@ -522,10 +501,8 @@ You can set 2 shortcut keys in Settings panel:
|
|||||||
I18N.Add(QuickMinerFailed, "Miner placement stopped. Check the UXAssist log before retrying.", "采矿机铺设已停止,请查看 UXAssist 日志后重试。");
|
I18N.Add(QuickMinerFailed, "Miner placement stopped. Check the UXAssist log before retrying.", "采矿机铺设已停止,请查看 UXAssist 日志后重试。");
|
||||||
I18N.Add(QuickMinerVeinsChanged, "The veins changed during calculation. Click the button again to recalculate the layout.", "计算期间矿点状态已变化,请再次点击按钮重新计算布局。");
|
I18N.Add(QuickMinerVeinsChanged, "The veins changed during calculation. Click the button again to recalculate the layout.", "计算期间矿点状态已变化,请再次点击按钮重新计算布局。");
|
||||||
I18N.Add(QuickMinerResult, "Placed {0} Mining Machines; total vein coverage: {1} (shared nodes counted per miner); buried nodes: {2}.", "已铺设 {0} 台采矿机,总覆盖 {1} 个矿点(各台分别计数),掩埋 {2} 个矿点。");
|
I18N.Add(QuickMinerResult, "Placed {0} Mining Machines; total vein coverage: {1} (shared nodes counted per miner); buried nodes: {2}.", "已铺设 {0} 台采矿机,总覆盖 {1} 个矿点(各台分别计数),掩埋 {2} 个矿点。");
|
||||||
#if DEBUG
|
|
||||||
I18N.Add(QuickMinerDebugSaved, "Debug data: {0}", "调试数据:{0}");
|
I18N.Add(QuickMinerDebugSaved, "Debug data: {0}", "调试数据:{0}");
|
||||||
I18N.Add(QuickMinerDebugFailed, "Could not save debug data. Check the UXAssist log before retrying.", "调试数据保存失败,请查看 UXAssist 日志后重试。");
|
I18N.Add(QuickMinerDebugFailed, "Could not save debug data. Check the UXAssist log before retrying.", "调试数据保存失败,请查看 UXAssist 日志后重试。");
|
||||||
#endif
|
|
||||||
I18N.Add(MaximumCountToBuild, "Maximum count to build", "最大建造数量");
|
I18N.Add(MaximumCountToBuild, "Maximum count to build", "最大建造数量");
|
||||||
I18N.Add(Max, "max", "最大");
|
I18N.Add(Max, "max", "最大");
|
||||||
I18N.Add(StopEjectorsWhenAvailableNodesAreAllFilledUp, "Stop ejectors when available nodes are all filled up", "可用节点全部造完时停止弹射");
|
I18N.Add(StopEjectorsWhenAvailableNodesAreAllFilledUp, "Stop ejectors when available nodes are all filled up", "可用节点全部造完时停止弹射");
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ namespace UXAssist.Common;
|
|||||||
|
|
||||||
public enum KnownItemId : int
|
public enum KnownItemId : int
|
||||||
{
|
{
|
||||||
Drone = GameConstants.ItemIds.LogisticsDrone,
|
Drone = 5001,
|
||||||
Ship = GameConstants.ItemIds.LogisticsVessel,
|
Ship = 5002,
|
||||||
Bot = GameConstants.ItemIds.LogisticsBot,
|
Bot = 5003,
|
||||||
Warper = GameConstants.ItemIds.SpaceWarper,
|
Warper = 1210,
|
||||||
}
|
}
|
||||||
@@ -80,6 +80,12 @@ public static class WinApi
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Errors
|
||||||
|
|
||||||
|
private const int ERROR_INSUFFICIENT_BUFFER = 122;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Structs
|
#region Structs
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ internal static class MinerPlacementDebug
|
|||||||
internal sealed class Snapshot
|
internal sealed class Snapshot
|
||||||
{
|
{
|
||||||
public int schema = 4;
|
public int schema = 4;
|
||||||
public string algorithm = "parallel-repack-v5-pose-exploration-min3-unlimited-stock-target-group";
|
public string algorithm = "parallel-repack-v5-pose-exploration-min3-unlimited-stock";
|
||||||
public int minimumCoverage = MinerPlacementSolver.MinimumCoverage;
|
public int minimumCoverage = MinerPlacementSolver.MinimumCoverage;
|
||||||
public string version, gameVersion, startedUtc, outcome, error;
|
public string version, gameVersion, startedUtc, outcome, error;
|
||||||
public int planetId, veinType, veinGroup, initialStock, placedCount, totalCoverage, buriedCount;
|
public int planetId, veinType, veinGroup, initialStock, placedCount, totalCoverage, buriedCount;
|
||||||
|
|||||||
@@ -2,15 +2,11 @@ using System;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
#if DEBUG
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
#endif
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
#if DEBUG
|
|
||||||
using BepInEx;
|
using BepInEx;
|
||||||
#endif
|
|
||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
@@ -103,13 +99,12 @@ public static class QuickMinerBuild
|
|||||||
private static void Fail(Exception exception)
|
private static void Fail(Exception exception)
|
||||||
{
|
{
|
||||||
UXAssist.Logger.LogError($"Quick miner placement failed: {exception}");
|
UXAssist.Logger.LogError($"Quick miner placement failed: {exception}");
|
||||||
#if DEBUG
|
|
||||||
_job?.RecordFailure(exception);
|
_job?.RecordFailure(exception);
|
||||||
#endif
|
|
||||||
Stop();
|
Stop();
|
||||||
UIRealtimeTip.Popup(I18NKeys.QuickMinerFailed.Translate());
|
UIRealtimeTip.Popup(I18NKeys.QuickMinerFailed.Translate());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Completion, failure and cancellation all finish the job, which records its debug data.
|
||||||
private static void Stop()
|
private static void Stop()
|
||||||
{
|
{
|
||||||
var job = _job;
|
var job = _job;
|
||||||
@@ -125,9 +120,7 @@ public static class QuickMinerBuild
|
|||||||
|
|
||||||
private static void ShowResult(string message)
|
private static void ShowResult(string message)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
|
||||||
UXAssist.Logger.LogInfo($"Quick miner result: {message.Replace("\n", " | ")}");
|
UXAssist.Logger.LogInfo($"Quick miner result: {message.Replace("\n", " | ")}");
|
||||||
#endif
|
|
||||||
UIRealtimeTip.Popup(message);
|
UIRealtimeTip.Popup(message);
|
||||||
foreach (var tip in UIRoot.instance.uiGame.generalTips.realtimeTips)
|
foreach (var tip in UIRoot.instance.uiGame.generalTips.realtimeTips)
|
||||||
{
|
{
|
||||||
@@ -167,10 +160,7 @@ public static class QuickMinerBuild
|
|||||||
private sealed class Node
|
private sealed class Node
|
||||||
{
|
{
|
||||||
public int Id;
|
public int Id;
|
||||||
public Vector3 Position;
|
public Vector3 Position, OriginalPosition;
|
||||||
#if DEBUG
|
|
||||||
public Vector3 OriginalPosition;
|
|
||||||
#endif
|
|
||||||
public ColliderData Collider;
|
public ColliderData Collider;
|
||||||
public bool Target, Visible, CanBury;
|
public bool Target, Visible, CanBury;
|
||||||
public EVeinType Type;
|
public EVeinType Type;
|
||||||
@@ -197,12 +187,10 @@ public static class QuickMinerBuild
|
|||||||
private readonly ColliderData _body;
|
private readonly ColliderData _body;
|
||||||
private readonly float _footprintRadius, _halfDiagonal;
|
private readonly float _footprintRadius, _halfDiagonal;
|
||||||
private readonly bool _capsule, _allowVeinReform;
|
private readonly bool _capsule, _allowVeinReform;
|
||||||
#if DEBUG
|
|
||||||
private readonly MinerPlacementDebug.Snapshot _debug = new();
|
private readonly MinerPlacementDebug.Snapshot _debug = new();
|
||||||
private readonly List<MinerPlacementDebug.Phase> _phases = [];
|
private readonly List<MinerPlacementDebug.Phase> _phases = [];
|
||||||
private readonly List<MinerPlacementDebug.Placement> _placements = [];
|
private readonly List<MinerPlacementDebug.Placement> _placements = [];
|
||||||
private readonly Stopwatch _timer = Stopwatch.StartNew();
|
private readonly Stopwatch _timer = Stopwatch.StartNew();
|
||||||
#endif
|
|
||||||
private readonly CancellationTokenSource _cancellation = new();
|
private readonly CancellationTokenSource _cancellation = new();
|
||||||
private readonly int _workers = MinerPlacementSolver.WorkerCount;
|
private readonly int _workers = MinerPlacementSolver.WorkerCount;
|
||||||
private IEnumerator _work;
|
private IEnumerator _work;
|
||||||
@@ -212,7 +200,6 @@ public static class QuickMinerBuild
|
|||||||
private float _probeX = float.NaN, _probeZ = float.NaN;
|
private float _probeX = float.NaN, _probeZ = float.NaN;
|
||||||
private bool _probeRestricted;
|
private bool _probeRestricted;
|
||||||
private EVeinType _type;
|
private EVeinType _type;
|
||||||
private int _group;
|
|
||||||
private float _minX, _maxX, _minZ, _maxZ;
|
private float _minX, _maxX, _minZ, _maxZ;
|
||||||
|
|
||||||
public bool IsCurrent => GameMain.isRunning && GameMain.mainPlayer == _player &&
|
public bool IsCurrent => GameMain.isRunning && GameMain.mainPlayer == _player &&
|
||||||
@@ -244,7 +231,6 @@ public static class QuickMinerBuild
|
|||||||
// Native clearance checks measure from the encompassing build collider.
|
// Native clearance checks measure from the encompassing build collider.
|
||||||
_halfDiagonal = Mathf.Sqrt(desc.buildCollider.ext.x * desc.buildCollider.ext.x + desc.buildCollider.ext.z * desc.buildCollider.ext.z);
|
_halfDiagonal = Mathf.Sqrt(desc.buildCollider.ext.x * desc.buildCollider.ext.x + desc.buildCollider.ext.z * desc.buildCollider.ext.z);
|
||||||
_capsule = planet.id == planet.galaxy.birthPlanetId && GameMain.history.SpaceCapsuleExist();
|
_capsule = planet.id == planet.galaxy.birthPlanetId && GameMain.history.SpaceCapsuleExist();
|
||||||
#if DEBUG
|
|
||||||
_debug.version = PluginInfo.PLUGIN_VERSION;
|
_debug.version = PluginInfo.PLUGIN_VERSION;
|
||||||
_debug.gameVersion = GameConfig.gameVersion.ToString();
|
_debug.gameVersion = GameConfig.gameVersion.ToString();
|
||||||
_debug.startedUtc = DateTime.UtcNow.ToString("O");
|
_debug.startedUtc = DateTime.UtcNow.ToString("O");
|
||||||
@@ -261,18 +247,15 @@ public static class QuickMinerBuild
|
|||||||
_debug.buildColliders = desc.buildColliders.Select(MinerPlacementDebug.Collider.Capture).ToArray();
|
_debug.buildColliders = desc.buildColliders.Select(MinerPlacementDebug.Collider.Capture).ToArray();
|
||||||
_debug.minerColliders = _nativeObstacles.Select(MinerPlacementDebug.Collider.Capture).ToArray();
|
_debug.minerColliders = _nativeObstacles.Select(MinerPlacementDebug.Collider.Capture).ToArray();
|
||||||
_debug.outcome = "cancelled";
|
_debug.outcome = "cancelled";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Step() => (_work ??= Run()).MoveNext();
|
public bool Step() => (_work ??= Run()).MoveNext();
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
public void RecordFailure(Exception exception)
|
public void RecordFailure(Exception exception)
|
||||||
{
|
{
|
||||||
_debug.outcome = "failed";
|
_debug.outcome = "failed";
|
||||||
_debug.error = exception.ToString();
|
_debug.error = exception.ToString();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
public void Finish()
|
public void Finish()
|
||||||
{
|
{
|
||||||
@@ -288,20 +271,15 @@ public static class QuickMinerBuild
|
|||||||
_cancellation.Dispose();
|
_cancellation.Dispose();
|
||||||
}, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
|
}, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default);
|
||||||
(_work as IDisposable)?.Dispose();
|
(_work as IDisposable)?.Dispose();
|
||||||
#if DEBUG
|
|
||||||
var location = WriteDebug();
|
var location = WriteDebug();
|
||||||
if (_result != null) _result += "\n" + location;
|
if (_result != null) ShowResult(_result + "\n" + location);
|
||||||
#endif
|
|
||||||
if (_result != null) ShowResult(_result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator Run()
|
private IEnumerator Run()
|
||||||
{
|
{
|
||||||
if (!FindNodes())
|
if (!FindNodes())
|
||||||
{
|
{
|
||||||
#if DEBUG
|
|
||||||
_debug.outcome = "no-veins";
|
_debug.outcome = "no-veins";
|
||||||
#endif
|
|
||||||
_result = I18NKeys.QuickMinerNoVeins.Translate();
|
_result = I18NKeys.QuickMinerNoVeins.Translate();
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
@@ -321,43 +299,23 @@ public static class QuickMinerBuild
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var solver = new MinerPlacementSolver(_candidates, _nodes.Count, _allowVeinReform);
|
var solver = new MinerPlacementSolver(_candidates, _nodes.Count, _allowVeinReform);
|
||||||
#if DEBUG
|
var work = Search(solver, "coarse", 10);
|
||||||
var work = Search(solver, 10, "coarse");
|
|
||||||
#else
|
|
||||||
var work = Search(solver, 10);
|
|
||||||
#endif
|
|
||||||
while (work.MoveNext()) yield return null;
|
while (work.MoveNext()) yield return null;
|
||||||
work = Expand(solver.Best, 0.35f, 3f);
|
work = Expand(solver.Best, 0.35f, 3f);
|
||||||
while (work.MoveNext()) yield return null;
|
while (work.MoveNext()) yield return null;
|
||||||
#if DEBUG
|
work = Search(solver, "refine-position", 6);
|
||||||
work = Search(solver, 6, "refine-position");
|
|
||||||
#else
|
|
||||||
work = Search(solver, 6);
|
|
||||||
#endif
|
|
||||||
while (work.MoveNext()) yield return null;
|
while (work.MoveNext()) yield return null;
|
||||||
work = Expand(solver.Best, 0.12f, 1f);
|
work = Expand(solver.Best, 0.12f, 1f);
|
||||||
while (work.MoveNext()) yield return null;
|
while (work.MoveNext()) yield return null;
|
||||||
#if DEBUG
|
work = Search(solver, "refine-angle", 4);
|
||||||
work = Search(solver, 4, "refine-angle");
|
|
||||||
#else
|
|
||||||
work = Search(solver, 4);
|
|
||||||
#endif
|
|
||||||
while (work.MoveNext()) yield return null;
|
while (work.MoveNext()) yield return null;
|
||||||
#if DEBUG
|
|
||||||
_debug.outcome = "completed";
|
_debug.outcome = "completed";
|
||||||
#endif
|
|
||||||
Commit(solver.Best);
|
Commit(solver.Best);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
private IEnumerator Search(MinerPlacementSolver solver, string phase, int passes)
|
||||||
private IEnumerator Search(MinerPlacementSolver solver, int passes, string phase)
|
|
||||||
#else
|
|
||||||
private IEnumerator Search(MinerPlacementSolver solver, int passes)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#if DEBUG
|
|
||||||
var timer = Stopwatch.StartNew();
|
var timer = Stopwatch.StartNew();
|
||||||
#endif
|
|
||||||
if (_workers > 0)
|
if (_workers > 0)
|
||||||
{
|
{
|
||||||
_search = solver.SearchAsync(passes, _cancellation.Token, _workers);
|
_search = solver.SearchAsync(passes, _cancellation.Token, _workers);
|
||||||
@@ -370,17 +328,14 @@ public static class QuickMinerBuild
|
|||||||
var work = solver.Search(passes);
|
var work = solver.Search(passes);
|
||||||
while (work.MoveNext()) yield return null;
|
while (work.MoveNext()) yield return null;
|
||||||
}
|
}
|
||||||
#if DEBUG
|
|
||||||
_phases.Add(new MinerPlacementDebug.Phase
|
_phases.Add(new MinerPlacementDebug.Phase
|
||||||
{
|
{
|
||||||
name = phase, candidateCount = _candidates.Count, passes = passes, score = solver.BestScore,
|
name = phase, candidateCount = _candidates.Count, passes = passes, score = solver.BestScore,
|
||||||
searchMilliseconds = timer.ElapsedMilliseconds, elapsedMilliseconds = _timer.ElapsedMilliseconds,
|
searchMilliseconds = timer.ElapsedMilliseconds, elapsedMilliseconds = _timer.ElapsedMilliseconds,
|
||||||
selected = solver.Best.Select(candidate => _candidates.IndexOf(candidate)).ToArray()
|
selected = solver.Best.Select(candidate => _candidates.IndexOf(candidate)).ToArray()
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
private string WriteDebug()
|
private string WriteDebug()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -414,7 +369,6 @@ public static class QuickMinerBuild
|
|||||||
return I18NKeys.QuickMinerDebugFailed.Translate();
|
return I18NKeys.QuickMinerDebugFailed.Translate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
private bool FindNodes()
|
private bool FindNodes()
|
||||||
{
|
{
|
||||||
@@ -432,10 +386,7 @@ public static class QuickMinerBuild
|
|||||||
_type = vein.type;
|
_type = vein.type;
|
||||||
}
|
}
|
||||||
if (group == 0) return false;
|
if (group == 0) return false;
|
||||||
_group = group;
|
|
||||||
#if DEBUG
|
|
||||||
_debug.veinGroup = group;
|
_debug.veinGroup = group;
|
||||||
#endif
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
for (var i = 1; i < _factory.veinCursor; i++)
|
for (var i = 1; i < _factory.veinCursor; i++)
|
||||||
{
|
{
|
||||||
@@ -487,15 +438,11 @@ public static class QuickMinerBuild
|
|||||||
_nodes.Add(new Node
|
_nodes.Add(new Node
|
||||||
{
|
{
|
||||||
Id = i, Target = vein.groupIndex == group, Type = vein.type,
|
Id = i, Target = vein.groupIndex == group, Type = vein.type,
|
||||||
Position = vein.pos, Collider = _physics.GetColliderData(vein.colliderId),
|
Position = vein.pos, OriginalPosition = vein.pos, Collider = _physics.GetColliderData(vein.colliderId),
|
||||||
#if DEBUG
|
|
||||||
OriginalPosition = vein.pos,
|
|
||||||
#endif
|
|
||||||
Visible = vein.pos.magnitude >= _planet.realRadius - 40f,
|
Visible = vein.pos.magnitude >= _planet.realRadius - 40f,
|
||||||
CanBury = _allowVeinReform && vein.groupIndex == group && vein.minerCount == 0 && !reserved.Contains(i)
|
CanBury = _allowVeinReform && vein.groupIndex == group && vein.minerCount == 0 && !reserved.Contains(i)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#if DEBUG
|
|
||||||
var existing = new List<MinerPlacementDebug.ExistingMiner>();
|
var existing = new List<MinerPlacementDebug.ExistingMiner>();
|
||||||
for (var i = 1; i < _factory.entityCursor; i++)
|
for (var i = 1; i < _factory.entityCursor; i++)
|
||||||
{
|
{
|
||||||
@@ -521,7 +468,6 @@ public static class QuickMinerBuild
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
_debug.existingMiners = existing.ToArray();
|
_debug.existingMiners = existing.ToArray();
|
||||||
#endif
|
|
||||||
return _nodes.Count > 0;
|
return _nodes.Count > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,26 +593,13 @@ public static class QuickMinerBuild
|
|||||||
|
|
||||||
private void TryCandidate(float x, float z, float yaw)
|
private void TryCandidate(float x, float z, float yaw)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
|
||||||
_debug.rejections.attempted++;
|
_debug.rejections.attempted++;
|
||||||
#endif
|
|
||||||
if (x != _probeX || z != _probeZ) Probe(x, z);
|
if (x != _probeX || z != _probeZ) Probe(x, z);
|
||||||
var pos = _probe;
|
var pos = _probe;
|
||||||
if (!FactoryPatch.RemoveBuildRangeLimitEnabled.Value &&
|
if (!FactoryPatch.RemoveBuildRangeLimitEnabled.Value &&
|
||||||
(pos - _player.position).sqrMagnitude > _player.mecha.buildArea * _player.mecha.buildArea)
|
(pos - _player.position).sqrMagnitude > _player.mecha.buildArea * _player.mecha.buildArea)
|
||||||
{
|
{ _debug.rejections.range++; return; }
|
||||||
#if DEBUG
|
if (_probeRestricted) { _debug.rejections.clearance++; return; }
|
||||||
_debug.rejections.range++;
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_probeRestricted)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
_debug.rejections.clearance++;
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var rotation = Maths.SphericalRotation(pos, yaw);
|
var rotation = Maths.SphericalRotation(pos, yaw);
|
||||||
var pose = new Pose(pos, rotation);
|
var pose = new Pose(pos, rotation);
|
||||||
_covered.Clear();
|
_covered.Clear();
|
||||||
@@ -674,22 +607,10 @@ public static class QuickMinerBuild
|
|||||||
{
|
{
|
||||||
var node = _nodes[i];
|
var node = _nodes[i];
|
||||||
if (!MinerComponent.IsTargetVeinInRange(node.Position, pose, _item.prefabDesc)) continue;
|
if (!MinerComponent.IsTargetVeinInRange(node.Position, pose, _item.prefabDesc)) continue;
|
||||||
if (node.Type != _type)
|
if (node.Type != _type) { _debug.rejections.mixedType++; return; }
|
||||||
{
|
_covered.Add(i);
|
||||||
#if DEBUG
|
|
||||||
_debug.rejections.mixedType++;
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (node.Target) _covered.Add(i);
|
|
||||||
}
|
|
||||||
if (_covered.Count < MinerPlacementSolver.MinimumCoverage)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
_debug.rejections.noCoverage++;
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
if (_covered.Count < MinerPlacementSolver.MinimumCoverage) { _debug.rejections.noCoverage++; return; }
|
||||||
for (var i = 0; i < _buildBoxes.Length; i++)
|
for (var i = 0; i < _buildBoxes.Length; i++)
|
||||||
_buildBoxes[i] = new Box(_item.prefabDesc.buildColliders[i].BindToObject(0, 0, EObjectType.None, pos, rotation));
|
_buildBoxes[i] = new Box(_item.prefabDesc.buildColliders[i].BindToObject(0, 0, EObjectType.None, pos, rotation));
|
||||||
_buried?.Clear();
|
_buried?.Clear();
|
||||||
@@ -697,41 +618,17 @@ public static class QuickMinerBuild
|
|||||||
{
|
{
|
||||||
var node = _nodes[i];
|
var node = _nodes[i];
|
||||||
if (!Hits(node.Collider)) continue;
|
if (!Hits(node.Collider)) continue;
|
||||||
if (!node.CanBury)
|
if (!node.CanBury) { _debug.rejections.veinCollision++; return; }
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
_debug.rejections.veinCollision++;
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_buried.Add(i);
|
_buried.Add(i);
|
||||||
}
|
}
|
||||||
if (_allowVeinReform)
|
if (_allowVeinReform)
|
||||||
{
|
{
|
||||||
foreach (var index in _buried) _covered.Remove(index);
|
foreach (var index in _buried) _covered.Remove(index);
|
||||||
if (_covered.Count < MinerPlacementSolver.MinimumCoverage)
|
if (_covered.Count < MinerPlacementSolver.MinimumCoverage) { _debug.rejections.noCoverage++; return; }
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
_debug.rejections.noCoverage++;
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
foreach (var obstacle in _nearObstacles)
|
foreach (var obstacle in _nearObstacles)
|
||||||
{
|
if (Hits(obstacle)) { _debug.rejections.buildingCollision++; return; }
|
||||||
if (!Hits(obstacle)) continue;
|
if (!HasGround(pos, rotation)) { _debug.rejections.ground++; return; }
|
||||||
#if DEBUG
|
|
||||||
_debug.rejections.buildingCollision++;
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!HasGround(pos, rotation))
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
_debug.rejections.ground++;
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (var i = 0; i < _nativeObstacles.Length; i++)
|
for (var i = 0; i < _nativeObstacles.Length; i++)
|
||||||
_obstacleBoxes[i] = new Box(_nativeObstacles[i].BindToObject(0, 0, EObjectType.None, pos, rotation));
|
_obstacleBoxes[i] = new Box(_nativeObstacles[i].BindToObject(0, 0, EObjectType.None, pos, rotation));
|
||||||
_candidates.Add(new Candidate
|
_candidates.Add(new Candidate
|
||||||
@@ -818,25 +715,17 @@ public static class QuickMinerBuild
|
|||||||
{
|
{
|
||||||
if (layout.Count == 0)
|
if (layout.Count == 0)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
|
||||||
_debug.outcome = "no-placement";
|
_debug.outcome = "no-placement";
|
||||||
#endif
|
|
||||||
_result = I18NKeys.QuickMinerNoPlacement.Translate();
|
_result = I18NKeys.QuickMinerNoPlacement.Translate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!NodesUnchanged(layout))
|
if (!NodesUnchanged(layout))
|
||||||
{
|
{
|
||||||
#if DEBUG
|
|
||||||
_debug.outcome = "veins-changed";
|
_debug.outcome = "veins-changed";
|
||||||
#endif
|
|
||||||
_result = I18NKeys.QuickMinerVeinsChanged.Translate();
|
_result = I18NKeys.QuickMinerVeinsChanged.Translate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#if DEBUG
|
|
||||||
var placed = new List<(Candidate Candidate, int Prebuild, MinerPlacementDebug.Placement Debug)>();
|
var placed = new List<(Candidate Candidate, int Prebuild, MinerPlacementDebug.Placement Debug)>();
|
||||||
#else
|
|
||||||
var placed = new List<(Candidate Candidate, int Prebuild)>();
|
|
||||||
#endif
|
|
||||||
var plannedBurial = _allowVeinReform
|
var plannedBurial = _allowVeinReform
|
||||||
? layout.SelectMany(candidate => candidate.Buried).Select(index => _nodes[index].Id).ToHashSet() : null;
|
? layout.SelectMany(candidate => candidate.Buried).Select(index => _nodes[index].Id).ToHashSet() : null;
|
||||||
var hidden = _allowVeinReform ? new Dictionary<int, Vector3>() : null;
|
var hidden = _allowVeinReform ? new Dictionary<int, Vector3>() : null;
|
||||||
@@ -855,13 +744,11 @@ public static class QuickMinerBuild
|
|||||||
validator.buildPreviews.Add(preview);
|
validator.buildPreviews.Add(preview);
|
||||||
foreach (var candidate in layout)
|
foreach (var candidate in layout)
|
||||||
{
|
{
|
||||||
#if DEBUG
|
|
||||||
var debug = new MinerPlacementDebug.Placement
|
var debug = new MinerPlacementDebug.Placement
|
||||||
{
|
{
|
||||||
candidate = _candidates.IndexOf(candidate), outcome = "pending", nativeCondition = "not-checked", nativeVeins = [], plannedVeins = [], finalVeins = []
|
candidate = _candidates.IndexOf(candidate), outcome = "pending", nativeCondition = "not-checked", nativeVeins = [], plannedVeins = [], finalVeins = []
|
||||||
};
|
};
|
||||||
_placements.Add(debug);
|
_placements.Add(debug);
|
||||||
#endif
|
|
||||||
// No yield between burial, native validation, item consumption, and creation.
|
// No yield between burial, native validation, item consumption, and creation.
|
||||||
if (_allowVeinReform)
|
if (_allowVeinReform)
|
||||||
{
|
{
|
||||||
@@ -876,11 +763,7 @@ public static class QuickMinerBuild
|
|||||||
}
|
}
|
||||||
// Validation needs current Unity colliders; GPU buffers are synced once at the end.
|
// Validation needs current Unity colliders; GPU buffers are synced once at the end.
|
||||||
_physics.RefreshColliders();
|
_physics.RefreshColliders();
|
||||||
#if DEBUG
|
if (!Validate(validator, preview, candidate, plannedBurial, debug)) continue;
|
||||||
if (!Validate(validator, preview, candidate, plannedBurial, out var plannedVeins, debug)) continue;
|
|
||||||
#else
|
|
||||||
if (!Validate(validator, preview, candidate, plannedBurial, out var plannedVeins)) continue;
|
|
||||||
#endif
|
|
||||||
var itemId = ItemIds.MiningMachine;
|
var itemId = ItemIds.MiningMachine;
|
||||||
var count = 1;
|
var count = 1;
|
||||||
if (_player.inhandItemId == itemId && _player.inhandItemCount > 0) _player.UseHandItems(1, out _);
|
if (_player.inhandItemId == itemId && _player.inhandItemCount > 0) _player.UseHandItems(1, out _);
|
||||||
@@ -893,20 +776,14 @@ public static class QuickMinerBuild
|
|||||||
itemRequired = count == 1 ? 0 : 1,
|
itemRequired = count == 1 ? 0 : 1,
|
||||||
filterId = _factory.veinPool[_nodes[candidate.Covered[0]].Id].productId
|
filterId = _factory.veinPool[_nodes[candidate.Covered[0]].Id].productId
|
||||||
};
|
};
|
||||||
prebuild.InitParametersArray(plannedVeins.Length);
|
prebuild.InitParametersArray(debug.plannedVeins.Length);
|
||||||
Array.Copy(plannedVeins, prebuild.parameters, plannedVeins.Length);
|
Array.Copy(debug.plannedVeins, prebuild.parameters, debug.plannedVeins.Length);
|
||||||
var id = _factory.AddPrebuildDataWithComponents(prebuild);
|
var id = _factory.AddPrebuildDataWithComponents(prebuild);
|
||||||
#if DEBUG
|
|
||||||
debug.prebuildId = id;
|
debug.prebuildId = id;
|
||||||
debug.itemRequired = prebuild.itemRequired;
|
debug.itemRequired = prebuild.itemRequired;
|
||||||
debug.outcome = id > 0 ? "placed" : "prebuild-failed";
|
debug.outcome = id > 0 ? "placed" : "prebuild-failed";
|
||||||
#endif
|
|
||||||
if (id == 0 && count == 1) _player.TryAddItemToPackage(ItemIds.MiningMachine, 1, 0, true);
|
if (id == 0 && count == 1) _player.TryAddItemToPackage(ItemIds.MiningMachine, 1, 0, true);
|
||||||
#if DEBUG
|
|
||||||
if (id > 0) placed.Add((candidate, id, debug));
|
if (id > 0) placed.Add((candidate, id, debug));
|
||||||
#else
|
|
||||||
if (id > 0) placed.Add((candidate, id));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -929,25 +806,21 @@ public static class QuickMinerBuild
|
|||||||
foreach (var node in _nodes)
|
foreach (var node in _nodes)
|
||||||
{
|
{
|
||||||
ref var vein = ref _factory.veinPool[node.Id];
|
ref var vein = ref _factory.veinPool[node.Id];
|
||||||
if (node.Target && vein.id == node.Id && vein.amount > 0 && vein.type == _type && vein.pos.magnitude >= _planet.realRadius - 40f &&
|
if (vein.id == node.Id && vein.amount > 0 && vein.type == _type && vein.pos.magnitude >= _planet.realRadius - 40f &&
|
||||||
MinerComponent.IsTargetVeinInRange(vein.pos, pose, _item.prefabDesc)) ids.Add(node.Id);
|
MinerComponent.IsTargetVeinInRange(vein.pos, pose, _item.prefabDesc)) ids.Add(node.Id);
|
||||||
}
|
}
|
||||||
ref var prebuild = ref _factory.prebuildPool[entry.Prebuild];
|
ref var prebuild = ref _factory.prebuildPool[entry.Prebuild];
|
||||||
prebuild.InitParametersArray(ids.Count);
|
prebuild.InitParametersArray(ids.Count);
|
||||||
if (ids.Count > 0) ids.CopyTo(prebuild.parameters);
|
if (ids.Count > 0) ids.CopyTo(prebuild.parameters);
|
||||||
#if DEBUG
|
|
||||||
entry.Debug.finalVeins = ids.ToArray();
|
entry.Debug.finalVeins = ids.ToArray();
|
||||||
#endif
|
|
||||||
coverage += ids.Count;
|
coverage += ids.Count;
|
||||||
}
|
}
|
||||||
if (_allowVeinReform) RefreshVeins(buriedCount > 0 ? 1 : 0);
|
if (_allowVeinReform) RefreshVeins(buriedCount > 0 ? 1 : 0);
|
||||||
}
|
}
|
||||||
#if DEBUG
|
|
||||||
_debug.placedCount = placed.Count;
|
_debug.placedCount = placed.Count;
|
||||||
_debug.totalCoverage = coverage;
|
_debug.totalCoverage = coverage;
|
||||||
_debug.buriedCount = buriedCount;
|
_debug.buriedCount = buriedCount;
|
||||||
if (placed.Count == 0) _debug.outcome = "no-placement";
|
if (placed.Count == 0) _debug.outcome = "no-placement";
|
||||||
#endif
|
|
||||||
_result = placed.Count == 0 ? I18NKeys.QuickMinerNoPlacement.Translate() :
|
_result = placed.Count == 0 ? I18NKeys.QuickMinerNoPlacement.Translate() :
|
||||||
string.Format(I18NKeys.QuickMinerResult.Translate(), placed.Count, coverage, buriedCount);
|
string.Format(I18NKeys.QuickMinerResult.Translate(), placed.Count, coverage, buriedCount);
|
||||||
}
|
}
|
||||||
@@ -973,16 +846,9 @@ public static class QuickMinerBuild
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CheckBuildConditions repeats the search's land-point tests, so ground needs no separate check.
|
// CheckBuildConditions repeats the search's land-point tests, so ground needs no separate check.
|
||||||
#if DEBUG
|
private bool Validate(BuildTool_Click validator, BuildPreview preview, Candidate candidate, HashSet<int> plannedBurial, MinerPlacementDebug.Placement debug)
|
||||||
private bool Validate(BuildTool_Click validator, BuildPreview preview, Candidate candidate, HashSet<int> plannedBurial, out int[] plannedVeins, MinerPlacementDebug.Placement debug)
|
|
||||||
#else
|
|
||||||
private bool Validate(BuildTool_Click validator, BuildPreview preview, Candidate candidate, HashSet<int> plannedBurial, out int[] plannedVeins)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
plannedVeins = [];
|
|
||||||
#if DEBUG
|
|
||||||
debug.outcome = "native-rejected";
|
debug.outcome = "native-rejected";
|
||||||
#endif
|
|
||||||
preview.ResetAll();
|
preview.ResetAll();
|
||||||
preview.item = _item;
|
preview.item = _item;
|
||||||
preview.desc = _item.prefabDesc;
|
preview.desc = _item.prefabDesc;
|
||||||
@@ -1017,26 +883,16 @@ public static class QuickMinerBuild
|
|||||||
}
|
}
|
||||||
Physics.SyncTransforms();
|
Physics.SyncTransforms();
|
||||||
var valid = validator.CheckBuildConditions();
|
var valid = validator.CheckBuildConditions();
|
||||||
#if DEBUG
|
|
||||||
debug.nativeCondition = preview.condition.ToString();
|
debug.nativeCondition = preview.condition.ToString();
|
||||||
debug.coverObjectId = preview.coverObjId;
|
debug.coverObjectId = preview.coverObjId;
|
||||||
debug.nativeVeins = preview.parameters?.Take(preview.paramCount).ToArray() ?? [];
|
debug.nativeVeins = preview.parameters?.Take(preview.paramCount).ToArray() ?? [];
|
||||||
#endif
|
|
||||||
if (!valid || preview.condition != EBuildCondition.Ok || preview.coverObjId != 0) return false;
|
if (!valid || preview.condition != EBuildCondition.Ok || preview.coverObjId != 0) return false;
|
||||||
// Native selection includes nearby groups of the same type. Keep only this
|
// Include every planned burial now, so a later miner cannot reduce this one
|
||||||
// group and exclude all planned burials before enforcing the minimum.
|
// below the minimum after its item has already been consumed.
|
||||||
plannedVeins = preview.parameters?.Take(preview.paramCount).Where(id => _factory.veinPool[id].groupIndex == _group &&
|
debug.plannedVeins = _allowVeinReform
|
||||||
(!_allowVeinReform || !plannedBurial.Contains(id))).ToArray() ?? [];
|
? debug.nativeVeins.Where(id => !plannedBurial.Contains(id)).ToArray() : debug.nativeVeins;
|
||||||
#if DEBUG
|
if (debug.plannedVeins.Length < MinerPlacementSolver.MinimumCoverage)
|
||||||
debug.plannedVeins = plannedVeins;
|
{ debug.outcome = "below-minimum-coverage"; return false; }
|
||||||
#endif
|
|
||||||
if (plannedVeins.Length < MinerPlacementSolver.MinimumCoverage)
|
|
||||||
{
|
|
||||||
#if DEBUG
|
|
||||||
debug.outcome = "below-minimum-coverage";
|
|
||||||
#endif
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (var i = 0; i < preview.paramCount; i++)
|
for (var i = 0; i < preview.paramCount; i++)
|
||||||
{
|
{
|
||||||
ref var vein = ref _factory.veinPool[preview.parameters[i]];
|
ref var vein = ref _factory.veinPool[preview.parameters[i]];
|
||||||
|
|||||||
@@ -27,6 +27,14 @@ internal static class MenuButtonUI
|
|||||||
I18N.OnInitialized += RecreateConfigWindow;
|
I18N.OnInitialized += RecreateConfigWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Uninit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static void OnInputUpdate()
|
public static void OnInputUpdate()
|
||||||
{
|
{
|
||||||
if (_toggleKey.keyValue)
|
if (_toggleKey.keyValue)
|
||||||
@@ -35,6 +43,10 @@ internal static class MenuButtonUI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void OnUpdate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static void ToggleConfigWindow()
|
public static void ToggleConfigWindow()
|
||||||
{
|
{
|
||||||
if (!_configWinInitialized)
|
if (!_configWinInitialized)
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ internal static class MilkyWayUI
|
|||||||
GameLogicProc.OnGameEnd += ResetState;
|
GameLogicProc.OnGameEnd += ResetState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static void Uninit()
|
public static void Uninit()
|
||||||
{
|
{
|
||||||
GameLogicProc.OnGameEnd -= ResetState;
|
GameLogicProc.OnGameEnd -= ResetState;
|
||||||
@@ -46,6 +50,14 @@ internal static class MilkyWayUI
|
|||||||
_topTenPlayerData = null;
|
_topTenPlayerData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void OnInputUpdate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OnUpdate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static void AddClusterUploadResult(int result, float requestTime)
|
public static void AddClusterUploadResult(int result, float requestTime)
|
||||||
{
|
{
|
||||||
lock (_clusterUploadResultsLock)
|
lock (_clusterUploadResultsLock)
|
||||||
|
|||||||
@@ -58,6 +58,26 @@ internal static class StarmapFilterUI
|
|||||||
{1000, 23},
|
{1000, 23},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public static void Init()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Start()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Uninit()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OnInputUpdate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OnUpdate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public static void InitStarmapButtons()
|
public static void InitStarmapButtons()
|
||||||
{
|
{
|
||||||
var uiRoot = UIRoot.instance;
|
var uiRoot = UIRoot.instance;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ public static class UIFunctions
|
|||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
MenuButtonUI.Init();
|
MenuButtonUI.Init();
|
||||||
|
StarmapFilterUI.Init();
|
||||||
MilkyWayUI.Init();
|
MilkyWayUI.Init();
|
||||||
|
|
||||||
UXAssist.RegisterExporter(ExportClusterUploadResults);
|
UXAssist.RegisterExporter(ExportClusterUploadResults);
|
||||||
@@ -18,22 +19,32 @@ public static class UIFunctions
|
|||||||
|
|
||||||
public static void Start()
|
public static void Start()
|
||||||
{
|
{
|
||||||
|
MenuButtonUI.Start();
|
||||||
|
StarmapFilterUI.Start();
|
||||||
|
MilkyWayUI.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Uninit()
|
public static void Uninit()
|
||||||
{
|
{
|
||||||
|
MenuButtonUI.Uninit();
|
||||||
|
StarmapFilterUI.Uninit();
|
||||||
MilkyWayUI.Uninit();
|
MilkyWayUI.Uninit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnInputUpdate()
|
public static void OnInputUpdate()
|
||||||
{
|
{
|
||||||
MenuButtonUI.OnInputUpdate();
|
MenuButtonUI.OnInputUpdate();
|
||||||
|
StarmapFilterUI.OnInputUpdate();
|
||||||
|
MilkyWayUI.OnInputUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void OnUpdate()
|
public static void OnUpdate()
|
||||||
{
|
{
|
||||||
|
MenuButtonUI.OnUpdate();
|
||||||
AutoCruiseUI.OnUpdate();
|
AutoCruiseUI.OnUpdate();
|
||||||
AutoConstructUI.OnUpdate();
|
AutoConstructUI.OnUpdate();
|
||||||
|
StarmapFilterUI.OnUpdate();
|
||||||
|
MilkyWayUI.OnUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void InitMenuButtons()
|
public static void InitMenuButtons()
|
||||||
|
|||||||
@@ -46,6 +46,19 @@ public static class WindowFunctions
|
|||||||
process.PriorityClass = (ProcessPriorityClass)ProrityFlags[ProcessPriority.Value];
|
process.PriorityClass = (ProcessPriorityClass)ProrityFlags[ProcessPriority.Value];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetPriorityName(int priority)
|
||||||
|
{
|
||||||
|
return priority switch
|
||||||
|
{
|
||||||
|
WinApi.HIGH_PRIORITY_CLASS => I18NKeys.High.Translate(),
|
||||||
|
WinApi.ABOVE_NORMAL_PRIORITY_CLASS => I18NKeys.AboveNormal.Translate(),
|
||||||
|
WinApi.NORMAL_PRIORITY_CLASS => I18NKeys.Normal.Translate(),
|
||||||
|
WinApi.BELOW_NORMAL_PRIORITY_CLASS => I18NKeys.BelowNormal.Translate(),
|
||||||
|
WinApi.IDLE_PRIORITY_CLASS => I18NKeys.Idle.Translate(),
|
||||||
|
_ => I18NKeys.Unknown.Translate()
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static void SetWindowTitle()
|
public static void SetWindowTitle()
|
||||||
{
|
{
|
||||||
// Get profile name from command line arguments, and set window title accordingly
|
// Get profile name from command line arguments, and set window title accordingly
|
||||||
|
|||||||
@@ -102,81 +102,38 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
|||||||
|
|
||||||
private sealed class InspectorControls
|
private sealed class InspectorControls
|
||||||
{
|
{
|
||||||
private const float Left = 12f;
|
private const float Left = 22f;
|
||||||
private const float ControlsGap = 12f;
|
private const float ControlsGap = 12f;
|
||||||
|
|
||||||
private readonly UIBlueprintInspector _inspector;
|
private readonly UIBlueprintInspector _inspector;
|
||||||
private RectTransform _panel;
|
private readonly float _controlsHeight;
|
||||||
private UIButton _entry;
|
|
||||||
private Text _entryText;
|
|
||||||
private UIButton _button;
|
private UIButton _button;
|
||||||
private Text _buttonText;
|
private Text _buttonText;
|
||||||
private UIButton _cancelButton;
|
|
||||||
private Text _cancelText;
|
|
||||||
private MyCheckBox _checkbox;
|
private MyCheckBox _checkbox;
|
||||||
private MyCornerComboBox _basisCombo;
|
|
||||||
private Text _basisLabel;
|
|
||||||
private UIButton _basisHelp;
|
|
||||||
private BlueprintData _currentBlueprint;
|
private BlueprintData _currentBlueprint;
|
||||||
private bool _manualProliferation;
|
private bool _manualProliferation;
|
||||||
|
private bool _layoutApplied;
|
||||||
|
|
||||||
public InspectorControls(UIBlueprintInspector inspector)
|
public InspectorControls(UIBlueprintInspector inspector)
|
||||||
{
|
{
|
||||||
_inspector = inspector;
|
_inspector = inspector;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// The native description has a 22px title row above its editable text.
|
_button = LayoutHelper.AddButton(Left, 0, inspector.group1,
|
||||||
_entry = LayoutHelper.AddButton(0, 0, inspector.descGroupTrans,
|
|
||||||
I18NKeys.BlueprintDescriptionOptions, 13, "blueprint-description-options", ToggleOptions);
|
|
||||||
_entryText = _entry.transform.Find("button-text").GetComponent<Text>();
|
|
||||||
_entry.tips = inspector.tipButton2.tips;
|
|
||||||
_entry.tips.topLevel = true;
|
|
||||||
Util.NormalizeRectWithTopRight(_entry, 0, 0, inspector.descGroupTrans);
|
|
||||||
|
|
||||||
// Reuse the native background, including its blur material, only while options are open.
|
|
||||||
var source = UIRoot.instance.uiGame.inserterWindow.transform.Find("panel-bg").GetComponent<Image>();
|
|
||||||
_panel = UnityEngine.Object.Instantiate(source, inspector.rectTrans).rectTransform;
|
|
||||||
_panel.gameObject.name = "uxassist-blueprint-description-options";
|
|
||||||
for (var i = _panel.childCount - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
var child = _panel.GetChild(i).gameObject;
|
|
||||||
child.SetActive(false);
|
|
||||||
UnityEngine.Object.Destroy(child);
|
|
||||||
}
|
|
||||||
_panel.anchorMin = new Vector2(0, 1);
|
|
||||||
_panel.anchorMax = Vector2.one;
|
|
||||||
_panel.pivot = new Vector2(0, 1);
|
|
||||||
_panel.anchoredPosition = new Vector2(Left, -Left);
|
|
||||||
_panel.sizeDelta = new Vector2(-Left * 2, 152);
|
|
||||||
_button = LayoutHelper.AddButton(Left, 12, _panel,
|
|
||||||
I18NKeys.BlueprintAutoFillDescription, 15, "blueprint-auto-fill-description", Generate);
|
I18NKeys.BlueprintAutoFillDescription, 15, "blueprint-auto-fill-description", Generate);
|
||||||
_buttonText = _button.transform.Find("button-text").GetComponent<Text>();
|
_buttonText = _button.transform.Find("button-text").GetComponent<Text>();
|
||||||
_cancelButton = LayoutHelper.AddButton(0, 0, _panel,
|
_checkbox = MyCheckBox.CreateCheckBox(Left, 0, inspector.group1, false,
|
||||||
I18NKeys.Cancel, 14, "blueprint-description-cancel", CloseOptions);
|
|
||||||
_cancelText = _cancelButton.transform.Find("button-text").GetComponent<Text>();
|
|
||||||
Util.NormalizeRectWithTopRight(_cancelButton, Left, 14, _panel);
|
|
||||||
_checkbox = MyCheckBox.CreateCheckBox(Left, 52, _panel, false,
|
|
||||||
I18NKeys.BlueprintProliferation.Translate(), 15).WithSmallerBox(22f);
|
I18NKeys.BlueprintProliferation.Translate(), 15).WithSmallerBox(22f);
|
||||||
_checkbox.gameObject.name = "blueprint-proliferation";
|
_checkbox.gameObject.name = "blueprint-proliferation";
|
||||||
_checkbox.OnChecked += OnProliferationChecked;
|
_checkbox.OnChecked += OnProliferationChecked;
|
||||||
_basisLabel = LayoutHelper.AddText(Left, 80, _panel, I18NKeys.BlueprintProductionBasis, 14);
|
|
||||||
_basisCombo = MyCornerComboBox.CreateComboBox(Left, 108, _panel).WithFontSize(14)
|
|
||||||
.WithItems(I18NKeys.BlueprintFinalProducts, I18NKeys.BlueprintBottleneckIntermediate)
|
|
||||||
.WithIndex(0);
|
|
||||||
var combo = _basisCombo.GetComponent<UIComboBox>();
|
|
||||||
combo.CanInput = false;
|
|
||||||
combo.autoWidth = false;
|
|
||||||
var comboRect = (RectTransform)_basisCombo.transform;
|
|
||||||
comboRect.anchorMax = Vector2.one;
|
|
||||||
comboRect.sizeDelta = new Vector2(-Left * 2, 28);
|
|
||||||
_basisHelp = LayoutHelper.AddTipsButton(Left, 80, _panel,
|
|
||||||
I18NKeys.BlueprintProductionBasis.Translate(), I18NKeys.BlueprintProductionBasisTip.Translate(), "");
|
|
||||||
UpdateLabels();
|
UpdateLabels();
|
||||||
_panel.gameObject.SetActive(false);
|
_controlsHeight = Math.Max(_button.transform.GetComponent<RectTransform>().rect.height,
|
||||||
|
_checkbox.rectTrans.rect.height) + 10f;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
Destroy();
|
if (_button) UnityEngine.Object.Destroy(_button.gameObject);
|
||||||
|
if (_checkbox) UnityEngine.Object.Destroy(_checkbox.gameObject);
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,72 +142,65 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
|||||||
{
|
{
|
||||||
_currentBlueprint = null;
|
_currentBlueprint = null;
|
||||||
_manualProliferation = false;
|
_manualProliferation = false;
|
||||||
_basisCombo.SetIndex(0);
|
|
||||||
if (_inspector.blueprint != null) SyncDefault();
|
if (_inspector.blueprint != null) SyncDefault();
|
||||||
else _checkbox.Checked = false;
|
else _checkbox.Checked = false;
|
||||||
CloseOptions();
|
|
||||||
_entry.gameObject.SetActive(_inspector.blueprint != null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Refresh()
|
public void Refresh()
|
||||||
{
|
{
|
||||||
SyncDefault();
|
SyncDefault();
|
||||||
_entry.gameObject.SetActive(_inspector.blueprint != null);
|
if (!_layoutApplied)
|
||||||
|
_inspector.group1.anchoredPosition += new Vector2(0, -_controlsHeight);
|
||||||
|
PositionControls();
|
||||||
|
_inspector.group2.anchoredPosition += new Vector2(0, -_controlsHeight);
|
||||||
|
_inspector.group3.anchoredPosition += new Vector2(0, -_controlsHeight);
|
||||||
|
_inspector.group4.anchoredPosition += new Vector2(0, -_controlsHeight);
|
||||||
|
_inspector.contentTrans.sizeDelta += new Vector2(0, _controlsHeight);
|
||||||
|
_layoutApplied = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleOptions()
|
|
||||||
{
|
|
||||||
_panel.SetAsLastSibling();
|
|
||||||
_panel.gameObject.SetActive(!_panel.gameObject.activeSelf);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CloseOptions() => _panel.gameObject.SetActive(false);
|
|
||||||
|
|
||||||
public void UpdateLabels()
|
public void UpdateLabels()
|
||||||
{
|
{
|
||||||
_entryText.text = I18NKeys.BlueprintDescriptionOptions.Translate();
|
|
||||||
((RectTransform)_entry.transform).sizeDelta =
|
|
||||||
new Vector2(Util.GetPreferredWidth(_entryText) + 16, 20);
|
|
||||||
_entry.tips.tipTitle = I18NKeys.BlueprintAutoFillDescription.Translate();
|
|
||||||
_entry.tips.tipText = I18NKeys.BlueprintDescriptionOptionsTip.Translate();
|
|
||||||
_entry.UpdateTip();
|
|
||||||
_buttonText.text = I18NKeys.BlueprintAutoFillDescription.Translate();
|
_buttonText.text = I18NKeys.BlueprintAutoFillDescription.Translate();
|
||||||
_cancelText.text = I18NKeys.Cancel.Translate();
|
|
||||||
((RectTransform)_cancelButton.transform).sizeDelta =
|
|
||||||
new Vector2(Util.GetPreferredWidth(_cancelText) + 20, 24);
|
|
||||||
_checkbox.SetLabelText(I18NKeys.BlueprintProliferation.Translate());
|
_checkbox.SetLabelText(I18NKeys.BlueprintProliferation.Translate());
|
||||||
_basisLabel.text = I18NKeys.BlueprintProductionBasis.Translate();
|
|
||||||
var combo = _basisCombo.GetComponent<UIComboBox>();
|
|
||||||
var index = combo.itemIndex;
|
|
||||||
_basisCombo.SetItems(I18NKeys.BlueprintFinalProducts, I18NKeys.BlueprintBottleneckIntermediate);
|
|
||||||
_basisCombo.SetIndex(index);
|
|
||||||
_basisHelp.tips.tipTitle = I18NKeys.BlueprintProductionBasis.Translate();
|
|
||||||
_basisHelp.tips.tipText = I18NKeys.BlueprintProductionBasisTip.Translate();
|
|
||||||
_basisHelp.UpdateTip();
|
|
||||||
var width = Math.Max(160f, Util.GetPreferredWidth(_buttonText) + 26f);
|
var width = Math.Max(160f, Util.GetPreferredWidth(_buttonText) + 26f);
|
||||||
_button.transform.GetComponent<RectTransform>().sizeDelta =
|
_button.transform.GetComponent<RectTransform>().sizeDelta =
|
||||||
new Vector2(width, _button.transform.GetComponent<RectTransform>().sizeDelta.y);
|
new Vector2(width, _button.transform.GetComponent<RectTransform>().sizeDelta.y);
|
||||||
var labelWidth = Util.GetPreferredWidth(_basisLabel);
|
if (_layoutApplied) PositionControls();
|
||||||
_basisLabel.rectTransform.sizeDelta = new Vector2(labelWidth, _basisLabel.rectTransform.sizeDelta.y);
|
|
||||||
Util.NormalizeRectWithTopLeft(_basisHelp, Left + labelWidth + ControlsGap, 80, _panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Destroy()
|
public void Destroy()
|
||||||
{
|
{
|
||||||
if (_entry)
|
if (_layoutApplied && _inspector)
|
||||||
{
|
{
|
||||||
_entry.button.onClick.RemoveListener(ToggleOptions);
|
_inspector.group1.anchoredPosition += new Vector2(0, _controlsHeight);
|
||||||
UnityEngine.Object.Destroy(_entry.gameObject);
|
_inspector.group2.anchoredPosition += new Vector2(0, _controlsHeight);
|
||||||
|
_inspector.group3.anchoredPosition += new Vector2(0, _controlsHeight);
|
||||||
|
_inspector.group4.anchoredPosition += new Vector2(0, _controlsHeight);
|
||||||
|
_inspector.contentTrans.sizeDelta += new Vector2(0, -_controlsHeight);
|
||||||
|
_layoutApplied = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_button)
|
if (_button)
|
||||||
|
{
|
||||||
_button.button.onClick.RemoveListener(Generate);
|
_button.button.onClick.RemoveListener(Generate);
|
||||||
if (_cancelButton)
|
UnityEngine.Object.Destroy(_button.gameObject);
|
||||||
_cancelButton.button.onClick.RemoveListener(CloseOptions);
|
}
|
||||||
|
|
||||||
if (_checkbox)
|
if (_checkbox)
|
||||||
|
{
|
||||||
_checkbox.OnChecked -= OnProliferationChecked;
|
_checkbox.OnChecked -= OnProliferationChecked;
|
||||||
if (!_panel) return;
|
UnityEngine.Object.Destroy(_checkbox.gameObject);
|
||||||
_panel.gameObject.SetActive(false);
|
}
|
||||||
UnityEngine.Object.Destroy(_panel.gameObject);
|
}
|
||||||
|
|
||||||
|
private void PositionControls()
|
||||||
|
{
|
||||||
|
var buttonRect = _button.transform.GetComponent<RectTransform>();
|
||||||
|
var top = 4f - _controlsHeight;
|
||||||
|
Util.NormalizeRectWithTopLeft(_button, Left, top, _inspector.group1);
|
||||||
|
Util.NormalizeRectWithTopLeft(_checkbox, Left + buttonRect.rect.width + ControlsGap,
|
||||||
|
top + (buttonRect.rect.height - _checkbox.rectTrans.rect.height) / 2f, _inspector.group1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SyncDefault()
|
private void SyncDefault()
|
||||||
@@ -258,7 +208,6 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
|||||||
var blueprint = _inspector.blueprint;
|
var blueprint = _inspector.blueprint;
|
||||||
if (!ReferenceEquals(blueprint, _currentBlueprint))
|
if (!ReferenceEquals(blueprint, _currentBlueprint))
|
||||||
{
|
{
|
||||||
CloseOptions();
|
|
||||||
_currentBlueprint = blueprint;
|
_currentBlueprint = blueprint;
|
||||||
_manualProliferation = false;
|
_manualProliferation = false;
|
||||||
}
|
}
|
||||||
@@ -317,14 +266,7 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var request = capture.CreateRequest(_checkbox.Checked);
|
var report = new FactoryBlackBoxAnalyzer(catalog).Analyze(capture.CreateRequest(_checkbox.Checked));
|
||||||
request.ProductionBasis = (BlueprintProductionBasis)_basisCombo.GetComponent<UIComboBox>().itemIndex;
|
|
||||||
var report = new FactoryBlackBoxAnalyzer(catalog).Analyze(request);
|
|
||||||
if (report.Diagnostics.Any(diagnostic => diagnostic.Code == ProductionDiagnosticCode.BlueprintBasisUnavailable))
|
|
||||||
{
|
|
||||||
UIRealtimeTip.Popup(I18NKeys.BlueprintBasisUnavailable.Translate());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (report.Status == ProductionStatus.Failed || report.Status == ProductionStatus.DataNotReady)
|
if (report.Status == ProductionStatus.Failed || report.Status == ProductionStatus.DataNotReady)
|
||||||
{
|
{
|
||||||
UIRealtimeTip.Popup((report.Status == ProductionStatus.DataNotReady
|
UIRealtimeTip.Popup((report.Status == ProductionStatus.DataNotReady
|
||||||
@@ -378,7 +320,6 @@ public class BlueprintDescriptionPatch : PatchImpl<BlueprintDescriptionPatch>
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseOptions();
|
|
||||||
if (!report.MaterialComplete || !report.PowerBreakdown.FactoryComplete ||
|
if (!report.MaterialComplete || !report.PowerBreakdown.FactoryComplete ||
|
||||||
!report.PowerBreakdown.LogisticsComplete)
|
!report.PowerBreakdown.LogisticsComplete)
|
||||||
UIRealtimeTip.Popup(I18NKeys.BlueprintPartial.Translate());
|
UIRealtimeTip.Popup(I18NKeys.BlueprintPartial.Translate());
|
||||||
|
|||||||
@@ -10,6 +10,15 @@ namespace UXAssist.Patches.Factory;
|
|||||||
|
|
||||||
internal static class ArchitectModePatch
|
internal static class ArchitectModePatch
|
||||||
{
|
{
|
||||||
|
public static void Enable(bool enable)
|
||||||
|
{
|
||||||
|
UnlimitInteractive.Enable(enable);
|
||||||
|
RemoveSomeConditionBuild.Enable(enable);
|
||||||
|
RemoveBuildRangeLimit.Enable(enable);
|
||||||
|
LargerAreaForUpgradeAndDismantle.Enable(enable);
|
||||||
|
LargerAreaForTerraform.Enable(enable);
|
||||||
|
}
|
||||||
|
|
||||||
internal class UnlimitInteractive : PatchImpl<UnlimitInteractive>
|
internal class UnlimitInteractive : PatchImpl<UnlimitInteractive>
|
||||||
{
|
{
|
||||||
// Harmony transpiler: PlayerAction_Inspect_GetObjectSelectDistance_Transpiler
|
// Harmony transpiler: PlayerAction_Inspect_GetObjectSelectDistance_Transpiler
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UXAssist.Common;
|
using UXAssist.Common;
|
||||||
@@ -13,6 +14,11 @@ namespace UXAssist.Patches.Factory;
|
|||||||
[ModFeature("BeltSignalsForBuyOut")]
|
[ModFeature("BeltSignalsForBuyOut")]
|
||||||
internal static class BeltSignalPatch
|
internal static class BeltSignalPatch
|
||||||
{
|
{
|
||||||
|
public static void Enable(bool enable)
|
||||||
|
{
|
||||||
|
BeltSignalsForBuyOut.Enable(enable);
|
||||||
|
}
|
||||||
|
|
||||||
public static void InitPersist()
|
public static void InitPersist()
|
||||||
{
|
{
|
||||||
BeltSignalsForBuyOut.InitPersist();
|
BeltSignalsForBuyOut.InitPersist();
|
||||||
@@ -57,12 +63,12 @@ internal static class BeltSignalPatch
|
|||||||
// A belt selects one material, so its equivalent single-material rate is 30.
|
// A belt selects one material, so its equivalent single-material rate is 30.
|
||||||
private static readonly (int ItemId, int ExchangeRate, string NameKey, string IconPath)[] DarkFogBuyOutDefinitions =
|
private static readonly (int ItemId, int ExchangeRate, string NameKey, string IconPath)[] DarkFogBuyOutDefinitions =
|
||||||
[
|
[
|
||||||
(ItemIds.DarkFogMatrix, 20, I18NKeys.MemoryUnit, "assets/signal/dark-fog-matrix.png"),
|
(ItemIds.DarkFogMemoryUnit, 20, I18NKeys.MemoryUnit, "assets/signal/dark-fog-matrix.png"),
|
||||||
(ItemIds.DarkFogEnergyShard, 60, I18NKeys.EnergyFragment, "assets/signal/energy-shard.png"),
|
(ItemIds.DarkFogEnergyFragment, 60, I18NKeys.EnergyFragment, "assets/signal/energy-shard.png"),
|
||||||
(ItemIds.DarkFogSiliconNeuron, 30, I18NKeys.SiliconNeuron, "assets/signal/silicon-based-neuron.png"),
|
(ItemIds.DarkFogSiliconNeuron, 30, I18NKeys.SiliconNeuron, "assets/signal/silicon-based-neuron.png"),
|
||||||
(ItemIds.DarkFogNegentropySingularity, 30, I18NKeys.NegentropySingularity, "assets/signal/negentropy-singularity.png"),
|
(ItemIds.DarkFogNegentropySingularity, 30, I18NKeys.NegentropySingularity, "assets/signal/negentropy-singularity.png"),
|
||||||
(ItemIds.DarkFogMatterRecombinator, 30, I18NKeys.MatterReassembler, "assets/signal/matter-recombinator.png"),
|
(ItemIds.DarkFogMatterReassembler, 30, I18NKeys.MatterReassembler, "assets/signal/matter-recombinator.png"),
|
||||||
(ItemIds.DarkFogCoreElement, 10, I18NKeys.VirtualParticle, "assets/signal/core-element.png")
|
(ItemIds.DarkFogVirtualParticle, 10, I18NKeys.VirtualParticle, "assets/signal/core-element.png")
|
||||||
];
|
];
|
||||||
public static readonly int[] DarkFogItemsInVoid = [0, 0, 0, 0, 0, 0];
|
public static readonly int[] DarkFogItemsInVoid = [0, 0, 0, 0, 0, 0];
|
||||||
private static Dictionary<int, uint>[] _signalBelts = new Dictionary<int, uint>[64];
|
private static Dictionary<int, uint>[] _signalBelts = new Dictionary<int, uint>[64];
|
||||||
@@ -119,6 +125,23 @@ internal static class BeltSignalPatch
|
|||||||
_loaded = true;
|
_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void RemoveBeltSignalProtos()
|
||||||
|
{
|
||||||
|
if (!_initialized || !_loaded) return;
|
||||||
|
var signals = LDB._signals;
|
||||||
|
if (signals.dataIndices.TryGetValue(301, out var index))
|
||||||
|
{
|
||||||
|
signals.dataArray = [.. signals.dataArray.Take(index), .. signals.dataArray.Skip(index + 6)];
|
||||||
|
for (var id = 301; id <= 306; id++)
|
||||||
|
signals.dataIndices.Remove(id);
|
||||||
|
var len = signals.dataArray.Length;
|
||||||
|
for (; index < len; index++)
|
||||||
|
signals.dataIndices[signals.dataArray[index].ID] = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
_loaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
private static void InitSignalBelts()
|
private static void InitSignalBelts()
|
||||||
{
|
{
|
||||||
if (!GameMain.isRunning) return;
|
if (!GameMain.isRunning) return;
|
||||||
@@ -304,14 +327,13 @@ internal static class BeltSignalPatch
|
|||||||
var consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
|
var consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
|
||||||
if (consume < 4)
|
if (consume < 4)
|
||||||
{
|
{
|
||||||
// Metaverse is the metadata of the Universe Matrix.
|
var metaverseLong = propertySystem.GetItemAvaliableProperty(_clusterSeedKey, ItemIds.Metaverse);
|
||||||
var metaverseLong = propertySystem.GetItemAvaliableProperty(_clusterSeedKey, ItemIds.UniverseMatrix);
|
|
||||||
if (metaverseLong > 0L)
|
if (metaverseLong > 0L)
|
||||||
{
|
{
|
||||||
var metaverse = metaverseLong > 10 ? 10 : (int)metaverseLong;
|
var metaverse = metaverseLong > 10 ? 10 : (int)metaverseLong;
|
||||||
propertySystem.AddItemConsumption(_clusterSeedKey, ItemIds.UniverseMatrix, metaverse);
|
propertySystem.AddItemConsumption(_clusterSeedKey, ItemIds.Metaverse, metaverse);
|
||||||
var mainPlayer = GameMain.mainPlayer;
|
var mainPlayer = GameMain.mainPlayer;
|
||||||
GameMain.history.AddPropertyItemConsumption(ItemIds.UniverseMatrix, metaverse, true);
|
GameMain.history.AddPropertyItemConsumption(ItemIds.Metaverse, metaverse, true);
|
||||||
var count = definition.ExchangeRate * metaverse;
|
var count = definition.ExchangeRate * metaverse;
|
||||||
DarkFogItemsInVoid[itemIdx] += count;
|
DarkFogItemsInVoid[itemIdx] += count;
|
||||||
consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
|
consume = (byte)Math.Min(DarkFogItemsInVoid[itemIdx], 4);
|
||||||
|
|||||||
@@ -79,6 +79,8 @@ internal static class BuildToolPatch
|
|||||||
|
|
||||||
internal class OffGridBuilding : PatchImpl<OffGridBuilding>
|
internal class OffGridBuilding : PatchImpl<OffGridBuilding>
|
||||||
{
|
{
|
||||||
|
// private const float SteppedRotationDegrees = 15f;
|
||||||
|
|
||||||
private static bool _initialized;
|
private static bool _initialized;
|
||||||
|
|
||||||
private static void SetupRichTextSupport()
|
private static void SetupRichTextSupport()
|
||||||
@@ -290,6 +292,62 @@ internal static class BuildToolPatch
|
|||||||
return matcher.InstructionEnumeration();
|
return matcher.InstructionEnumeration();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public static IEnumerable<CodeInstruction> PatchToPerformSteppedRotate(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
|
{
|
||||||
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
|
||||||
|
MatchIgnoreGridAndCheckIfRotatable(matcher, out var ifBlockEntryLabel, out var elseBlockEntryLabel);
|
||||||
|
|
||||||
|
if (matcher.IsInvalid)
|
||||||
|
return instructions;
|
||||||
|
|
||||||
|
while (!matcher.Labels.Contains(elseBlockEntryLabel.Value))
|
||||||
|
matcher.Advance(1);
|
||||||
|
|
||||||
|
Label? ifBlockExitLabel = null;
|
||||||
|
|
||||||
|
matcher.MatchBack(false, new CodeMatch(ci => ci.Branches(out ifBlockExitLabel)));
|
||||||
|
|
||||||
|
if (matcher.IsInvalid)
|
||||||
|
return instructions;
|
||||||
|
|
||||||
|
while (!matcher.Labels.Contains(ifBlockEntryLabel.Value))
|
||||||
|
matcher.Advance(-1);
|
||||||
|
|
||||||
|
var instructionToClone = matcher.Instruction.Clone();
|
||||||
|
var overwriteWith = CodeInstruction.LoadField(typeof(VFInput), nameof(VFInput.control));
|
||||||
|
|
||||||
|
matcher.SetAndAdvance(overwriteWith.opcode, overwriteWith.operand);
|
||||||
|
matcher.Insert(instructionToClone);
|
||||||
|
matcher.CreateLabel(out var existingEntryLabel);
|
||||||
|
matcher.InsertAndAdvance(
|
||||||
|
new CodeInstruction(OpCodes.Brfalse, existingEntryLabel),
|
||||||
|
new CodeInstruction(OpCodes.Ldarg_0),
|
||||||
|
CodeInstruction.Call(typeof(OffGridBuilding), nameof(RotateStepped)),
|
||||||
|
new CodeInstruction(OpCodes.Br, ifBlockExitLabel)
|
||||||
|
);
|
||||||
|
|
||||||
|
return matcher.InstructionEnumeration();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RotateStepped(BuildTool_Click instance)
|
||||||
|
{
|
||||||
|
if (VFInput._rotate.onDown)
|
||||||
|
{
|
||||||
|
instance.yaw += SteppedRotationDegrees;
|
||||||
|
instance.yaw = Mathf.Repeat(instance.yaw, 360f);
|
||||||
|
instance.yaw = Mathf.Round(instance.yaw / SteppedRotationDegrees) * SteppedRotationDegrees;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (VFInput._counterRotate.onDown)
|
||||||
|
{
|
||||||
|
instance.yaw -= SteppedRotationDegrees;
|
||||||
|
instance.yaw = Mathf.Repeat(instance.yaw, 360f);
|
||||||
|
instance.yaw = Mathf.Round(instance.yaw / SteppedRotationDegrees) * SteppedRotationDegrees;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class TreatStackingAsSingle : PatchImpl<TreatStackingAsSingle>
|
internal class TreatStackingAsSingle : PatchImpl<TreatStackingAsSingle>
|
||||||
|
|||||||
@@ -8,6 +8,11 @@ namespace UXAssist.Patches.Factory;
|
|||||||
|
|
||||||
internal static class BuildingBufferPatch
|
internal static class BuildingBufferPatch
|
||||||
{
|
{
|
||||||
|
public static void Enable(bool enable)
|
||||||
|
{
|
||||||
|
TweakBuildingBuffer.Enable(enable);
|
||||||
|
}
|
||||||
|
|
||||||
internal class TweakBuildingBuffer : PatchImpl<TweakBuildingBuffer>
|
internal class TweakBuildingBuffer : PatchImpl<TweakBuildingBuffer>
|
||||||
{
|
{
|
||||||
public static void RefreshAssemblerBufferMultipliers()
|
public static void RefreshAssemblerBufferMultipliers()
|
||||||
|
|||||||
@@ -10,6 +10,11 @@ namespace UXAssist.Patches.Factory;
|
|||||||
[ModFeature("VeinProtection")]
|
[ModFeature("VeinProtection")]
|
||||||
internal static partial class VeinProtectionPatch
|
internal static partial class VeinProtectionPatch
|
||||||
{
|
{
|
||||||
|
public static void Enable(bool enable)
|
||||||
|
{
|
||||||
|
ProtectVeinsFromExhaustion.Enable(enable);
|
||||||
|
}
|
||||||
|
|
||||||
public static void InitConfig()
|
public static void InitConfig()
|
||||||
{
|
{
|
||||||
ProtectVeinsFromExhaustion.InitConfig();
|
ProtectVeinsFromExhaustion.InitConfig();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
public static ConfigEntry<bool> EnableWindowResizeEnabled;
|
public static ConfigEntry<bool> EnableWindowResizeEnabled;
|
||||||
public static ConfigEntry<bool> LoadLastWindowRectEnabled;
|
public static ConfigEntry<bool> LoadLastWindowRectEnabled;
|
||||||
|
|
||||||
|
// public static ConfigEntry<bool> AutoSaveOptEnabled;
|
||||||
public static ConfigEntry<bool> ConvertSavesFromPeaceEnabled;
|
public static ConfigEntry<bool> ConvertSavesFromPeaceEnabled;
|
||||||
public static ConfigEntry<Vector4> LastWindowRect;
|
public static ConfigEntry<Vector4> LastWindowRect;
|
||||||
public static ConfigEntry<bool> ProfileBasedSaveFolderEnabled;
|
public static ConfigEntry<bool> ProfileBasedSaveFolderEnabled;
|
||||||
@@ -80,6 +81,7 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
FixLastWindowRect();
|
FixLastWindowRect();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
// AutoSaveOptEnabled.SettingChanged += (_, _) => AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
|
||||||
ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
ConvertSavesFromPeaceEnabled.SettingChanged += (_, _) => ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
||||||
ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath();
|
ProfileBasedSaveFolderEnabled.SettingChanged += (_, _) => RefreshSavePath();
|
||||||
ProfileBasedOptionEnabled.SettingChanged += (_, _) => ProfileBasedOption.Enable(ProfileBasedOptionEnabled.Value);
|
ProfileBasedOptionEnabled.SettingChanged += (_, _) => ProfileBasedOption.Enable(ProfileBasedOptionEnabled.Value);
|
||||||
@@ -110,6 +112,7 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
EnableWindowResize.Enable(EnableWindowResizeEnabled.Value);
|
||||||
|
// AutoSaveOpt.Enable(AutoSaveOptEnabled.Value);
|
||||||
ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
ConvertSavesFromPeace.Enable(ConvertSavesFromPeaceEnabled.Value);
|
||||||
Enable(true);
|
Enable(true);
|
||||||
|
|
||||||
@@ -120,6 +123,7 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
{
|
{
|
||||||
Enable(false);
|
Enable(false);
|
||||||
EnableWindowResize.Enable(false);
|
EnableWindowResize.Enable(false);
|
||||||
|
// AutoSaveOpt.Enable(false);
|
||||||
ConvertSavesFromPeace.Enable(false);
|
ConvertSavesFromPeace.Enable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,6 +311,145 @@ public class GamePatch : PatchImpl<GamePatch>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
private class AutoSaveOpt: PatchImpl<AutoSaveOpt>
|
||||||
|
{
|
||||||
|
protected override void OnEnable()
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(GameConfig.gameSaveFolder + "AutoSaves/");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPrefix]
|
||||||
|
[HarmonyPatch(typeof(GameSave), nameof(GameSave.AutoSave))]
|
||||||
|
private static bool GameSave_AutoSave_Prefix(ref bool __result)
|
||||||
|
{
|
||||||
|
if (!GameSave.SaveCurrentGame(GameSave.AutoSaveTmp))
|
||||||
|
{
|
||||||
|
GlobalObject.SaveOpCounter();
|
||||||
|
__result = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var tmpFilename = GameConfig.gameSaveFolder + GameSave.AutoSaveTmp + GameSave.saveExt;
|
||||||
|
var targetFilename = $"{GameConfig.gameSaveFolder}AutoSaves/[{GameMain.data.gameDesc.clusterString}] {DateTime.Now:yyyy-MM-dd_hh-mm-ss}{GameSave.saveExt}";
|
||||||
|
File.Move(tmpFilename, targetFilename);
|
||||||
|
__result = true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.RefreshList))]
|
||||||
|
public static void UILoadGameWindow_RefreshList_Postfix(UILoadGameWindow __instance)
|
||||||
|
{
|
||||||
|
var baseDir = GameConfig.gameSaveFolder + "AutoSaves/";
|
||||||
|
var files = Directory.GetFiles(baseDir, "*" + GameSave.saveExt, SearchOption.TopDirectoryOnly);
|
||||||
|
var entries = __instance.entries;
|
||||||
|
var entries2 = new List<UIGameSaveEntry>();
|
||||||
|
var entryPrefab = __instance.entryPrefab;
|
||||||
|
var entryPrefabParent = entryPrefab.transform.parent;
|
||||||
|
foreach (var f in files)
|
||||||
|
{
|
||||||
|
var fileInfo = new FileInfo(f);
|
||||||
|
var entry = Object.Instantiate(entryPrefab, entryPrefabParent);
|
||||||
|
entry.fileInfo = fileInfo;
|
||||||
|
entries2.Add(entry);
|
||||||
|
}
|
||||||
|
entries2.Sort((x, y) => -x.fileDate.CompareTo(y.fileDate));
|
||||||
|
if (entries2.Count > 10)
|
||||||
|
entries2.RemoveRange(10, entries2.Count - 10);
|
||||||
|
var autoSaveText = ">> " + I18NKeys.AutoSaveEntry.Translate();
|
||||||
|
foreach (var entry in entries2)
|
||||||
|
{
|
||||||
|
entry.indexText.text = "";
|
||||||
|
var saveName = entry.saveName;
|
||||||
|
entry._saveName = $"AutoSaves/{saveName}";
|
||||||
|
var quoteIndex = saveName.IndexOf('[');
|
||||||
|
if (quoteIndex >= 0)
|
||||||
|
{
|
||||||
|
var quoteIndex2 = saveName.IndexOf(']', quoteIndex + 1);
|
||||||
|
if (quoteIndex2 > 0) saveName = saveName.Substring(quoteIndex, quoteIndex2 + 1 - quoteIndex);
|
||||||
|
}
|
||||||
|
entry.nameText.text = $"{autoSaveText} {saveName}";
|
||||||
|
entry.nameText.fontStyle = FontStyle.Italic;
|
||||||
|
entry.nameText.color = new Color(1f, 1f, 1f, 0.7f);
|
||||||
|
entry.timeText.text = $"{entry.fileDate:yyyy-MM-dd HH:mm:ss}";
|
||||||
|
GameSave.ReadModes(entry.fileInfo.FullName, out var isSandbox, out var isPeace);
|
||||||
|
if (entry.sandboxIcon != null)
|
||||||
|
{
|
||||||
|
entry.sandboxIcon.gameObject.SetActive(isSandbox);
|
||||||
|
}
|
||||||
|
if (entry.combatIcon != null)
|
||||||
|
{
|
||||||
|
entry.combatIcon.gameObject.SetActive(!isPeace);
|
||||||
|
}
|
||||||
|
entry.selected = false;
|
||||||
|
entry.gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
entries.AddRange(entries2);
|
||||||
|
entries.Sort((x, y) => -x.fileDate.CompareTo(y.fileDate));
|
||||||
|
var displayIndex = 1;
|
||||||
|
for (var i = 0; i < entries.Count; i++)
|
||||||
|
{
|
||||||
|
var entry = entries[i];
|
||||||
|
entry.index = i + 1;
|
||||||
|
entry.rectTrans.anchoredPosition = new Vector2(entry.rectTrans.anchoredPosition.x, -40 * i);
|
||||||
|
if (string.IsNullOrEmpty(entry.indexText.text)) continue;
|
||||||
|
entry.indexText.text = displayIndex.ToString();
|
||||||
|
displayIndex++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HarmonyPostfix]
|
||||||
|
[HarmonyPatch(typeof(UISaveGameWindow), nameof(UISaveGameWindow.RefreshList))]
|
||||||
|
public static void UISaveGameWindow_RefreshList_Postfix(UISaveGameWindow __instance)
|
||||||
|
{
|
||||||
|
var entries = __instance.entries;
|
||||||
|
entries.Sort((x, y) => -x.fileDate.CompareTo(y.fileDate));
|
||||||
|
for (var i = 0; i < entries.Count; i++)
|
||||||
|
{
|
||||||
|
var entry = entries[i];
|
||||||
|
entry.index = i + 1;
|
||||||
|
entry.rectTrans.anchoredPosition = new Vector2(entry.rectTrans.anchoredPosition.x, -40 * i);
|
||||||
|
entry.indexText.text = (i + 1).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Harmony transpiler: UILoadGameWindow_ReplaceSaveName_Transpiler
|
||||||
|
// Target: UILoadGameWindow.DoLoadSelectedGame, UILoadGameWindow.OnSelectedChange
|
||||||
|
// Fallback: None — patch will fail loudly if the target method body changes.
|
||||||
|
[HarmonyTranspiler]
|
||||||
|
[HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.DoLoadSelectedGame))]
|
||||||
|
[HarmonyPatch(typeof(UILoadGameWindow), nameof(UILoadGameWindow.OnSelectedChange))]
|
||||||
|
private static IEnumerable<CodeInstruction> UILoadGameWindow_ReplaceSaveName_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
|
{
|
||||||
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
matcher.Start().MatchForward(false,
|
||||||
|
new CodeMatch(OpCodes.Callvirt, AccessTools.PropertyGetter(typeof(UIGameSaveEntry), nameof(UIGameSaveEntry.saveName)))
|
||||||
|
);
|
||||||
|
matcher.Repeat(m => m.SetAndAdvance(OpCodes.Ldfld, AccessTools.Field(typeof(UIGameSaveEntry), nameof(UIGameSaveEntry._saveName))));
|
||||||
|
return matcher.InstructionEnumeration();
|
||||||
|
}
|
||||||
|
// Harmony transpiler: GameSave_RemoveValidateOnLoad_Transpiler
|
||||||
|
// Target: GameSave.LoadCurrentGame, GameSave.LoadGameDesc, GameSave.ReadHeader, GameSave.ReadHeaderAndDescAndProperty, GameSave.SaveExist, GameSave.SavePath
|
||||||
|
// Fallback: Checks CodeMatcher.IsInvalid/IsValid and returns original instructions on mismatch.
|
||||||
|
[HarmonyTranspiler]
|
||||||
|
[HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadCurrentGame))]
|
||||||
|
[HarmonyPatch(typeof(GameSave), nameof(GameSave.LoadGameDesc))]
|
||||||
|
[HarmonyPatch(typeof(GameSave), nameof(GameSave.ReadHeader))]
|
||||||
|
[HarmonyPatch(typeof(GameSave), nameof(GameSave.ReadHeaderAndDescAndProperty))]
|
||||||
|
[HarmonyPatch(typeof(GameSave), nameof(GameSave.SaveExist))]
|
||||||
|
[HarmonyPatch(typeof(GameSave), nameof(GameSave.SavePath))]
|
||||||
|
private static IEnumerable<CodeInstruction> GameSave_RemoveValidateOnLoad_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
|
{
|
||||||
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
matcher.Start().MatchForward(false,
|
||||||
|
new CodeMatch(OpCodes.Call, AccessTools.Method(typeof(CommonUtils), nameof(CommonUtils.ValidFileName)))
|
||||||
|
);
|
||||||
|
matcher.RemoveInstruction();
|
||||||
|
return matcher.InstructionEnumeration();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private class ConvertSavesFromPeace : PatchImpl<ConvertSavesFromPeace>
|
private class ConvertSavesFromPeace : PatchImpl<ConvertSavesFromPeace>
|
||||||
{
|
{
|
||||||
private static bool _needConvert;
|
private static bool _needConvert;
|
||||||
|
|||||||
@@ -639,7 +639,7 @@ internal static class RealtimeLogisticsInfoPanel
|
|||||||
|| rectPoint.x is < -4096f or > 4096f
|
|| rectPoint.x is < -4096f or > 4096f
|
||||||
|| rectPoint.y is < -4096f or > 4096f
|
|| rectPoint.y is < -4096f or > 4096f
|
||||||
|| Phys.RayCastSphere(localPosition, vec / magnitude, magnitude, Vector3.zero, realRadius, out _)
|
|| Phys.RayCastSphere(localPosition, vec / magnitude, magnitude, Vector3.zero, realRadius, out _)
|
||||||
|| storageArray.All(storage => storage.itemId == 0))
|
|| storageArray.Select(x => x.itemId).All(x => x == 0))
|
||||||
{
|
{
|
||||||
stationTip.gameObject.SetActive(false);
|
stationTip.gameObject.SetActive(false);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -204,6 +204,110 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
{
|
{
|
||||||
ShowAllStarsNameStatus = 0;
|
ShowAllStarsNameStatus = 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
// Harmony transpiler: UIStarmapPlanet__OnLateUpdate_Transpiler
|
||||||
|
// Target: UIStarmapPlanet._OnLateUpdate
|
||||||
|
// Fallback: None — patch will fail loudly if the target method body changes.
|
||||||
|
[HarmonyTranspiler]
|
||||||
|
[HarmonyPatch(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet._OnLateUpdate))]
|
||||||
|
private static IEnumerable<CodeInstruction> UIStarmapPlanet__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
|
{
|
||||||
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
matcher.MatchForward(false,
|
||||||
|
new CodeMatch(OpCodes.Ldarg_0),
|
||||||
|
new CodeMatch(OpCodes.Ldloc_3),
|
||||||
|
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet.projected)))
|
||||||
|
);
|
||||||
|
matcher.Advance(3);
|
||||||
|
matcher.CreateLabel(out var jumpPos1);
|
||||||
|
matcher.InsertAndAdvance(
|
||||||
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))),
|
||||||
|
new CodeInstruction(OpCodes.Ldc_I4_2),
|
||||||
|
new CodeInstruction(OpCodes.Ceq),
|
||||||
|
new CodeInstruction(OpCodes.Brfalse, jumpPos1),
|
||||||
|
new CodeInstruction(OpCodes.Ldc_I4_0),
|
||||||
|
new CodeInstruction(OpCodes.Stloc_3)
|
||||||
|
);
|
||||||
|
matcher.MatchForward(false,
|
||||||
|
new CodeMatch(OpCodes.Ldarg_0),
|
||||||
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet.gameHistory))),
|
||||||
|
new CodeMatch(OpCodes.Ldarg_0),
|
||||||
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapPlanet), nameof(UIStarmapPlanet.planet))),
|
||||||
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(PlanetData), nameof(PlanetData.id))),
|
||||||
|
new CodeMatch(OpCodes.Callvirt, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.GetPlanetPin))),
|
||||||
|
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||||
|
new CodeMatch(ci => ci.Branches(out _)),
|
||||||
|
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||||
|
new CodeMatch(ci => ci.IsStloc()),
|
||||||
|
new CodeMatch(ci => ci.Branches(out _))
|
||||||
|
);
|
||||||
|
matcher.CreateLabelAt(matcher.Pos + 8, out var jumpPos);
|
||||||
|
var labels = matcher.Labels;
|
||||||
|
matcher.Labels = [];
|
||||||
|
matcher.InsertAndAdvance(
|
||||||
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))).WithLabels(labels),
|
||||||
|
new CodeInstruction(OpCodes.Ldc_I4_1),
|
||||||
|
new CodeInstruction(OpCodes.Ceq),
|
||||||
|
new CodeInstruction(OpCodes.Brtrue, jumpPos),
|
||||||
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(PlayerPatch), nameof(_showAllStarsNameKey))),
|
||||||
|
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(KeyBindings), nameof(KeyBindings.IsKeyPressing))),
|
||||||
|
new CodeInstruction(OpCodes.Brtrue, jumpPos)
|
||||||
|
);
|
||||||
|
return matcher.InstructionEnumeration();
|
||||||
|
}
|
||||||
|
// Harmony transpiler: UIStarmapDFHive__OnLateUpdate_Transpiler
|
||||||
|
// Target: UIStarmapDFHive._OnLateUpdate
|
||||||
|
// Fallback: None — patch will fail loudly if the target method body changes.
|
||||||
|
[HarmonyTranspiler]
|
||||||
|
[HarmonyPatch(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive._OnLateUpdate))]
|
||||||
|
private static IEnumerable<CodeInstruction> UIStarmapDFHive__OnLateUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
|
{
|
||||||
|
var matcher = new CodeMatcher(instructions, generator);
|
||||||
|
matcher.MatchForward(false,
|
||||||
|
new CodeMatch(OpCodes.Ldarg_0),
|
||||||
|
new CodeMatch(ci => ci.IsLdloc()),
|
||||||
|
new CodeMatch(OpCodes.Stfld, AccessTools.Field(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive.projected)))
|
||||||
|
);
|
||||||
|
matcher.Advance(3);
|
||||||
|
matcher.CreateLabel(out var jumpPos1);
|
||||||
|
matcher.InsertAndAdvance(
|
||||||
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))),
|
||||||
|
new CodeInstruction(OpCodes.Ldc_I4_2),
|
||||||
|
new CodeInstruction(OpCodes.Ceq),
|
||||||
|
new CodeInstruction(OpCodes.Brfalse, jumpPos1),
|
||||||
|
new CodeInstruction(OpCodes.Ldc_I4_0),
|
||||||
|
new CodeInstruction(OpCodes.Stloc_S, 4)
|
||||||
|
);
|
||||||
|
matcher.MatchForward(false,
|
||||||
|
new CodeMatch(OpCodes.Ldarg_0),
|
||||||
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive.gameHistory))),
|
||||||
|
new CodeMatch(OpCodes.Ldarg_0),
|
||||||
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(UIStarmapDFHive), nameof(UIStarmapDFHive.hive))),
|
||||||
|
new CodeMatch(OpCodes.Ldfld, AccessTools.Field(typeof(EnemyDFHiveSystem), nameof(EnemyDFHiveSystem.hiveStarId))),
|
||||||
|
new CodeMatch(OpCodes.Ldc_I4, 1000000),
|
||||||
|
new CodeMatch(OpCodes.Sub),
|
||||||
|
new CodeMatch(OpCodes.Callvirt, AccessTools.Field(typeof(GameHistoryData), nameof(GameHistoryData.GetHivePin))),
|
||||||
|
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||||
|
new CodeMatch(ci => ci.Branches(out _)),
|
||||||
|
new CodeMatch(OpCodes.Ldc_I4_1),
|
||||||
|
new CodeMatch(ci => ci.IsStloc()),
|
||||||
|
new CodeMatch(ci => ci.Branches(out _))
|
||||||
|
);
|
||||||
|
matcher.CreateLabelAt(matcher.Pos + 10, out var jumpPos);
|
||||||
|
var labels = matcher.Labels;
|
||||||
|
matcher.Labels = [];
|
||||||
|
matcher.InsertAndAdvance(
|
||||||
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(ShortcutKeysForStarsName), nameof(_showAllStarsNameStatus))).WithLabels(labels),
|
||||||
|
new CodeInstruction(OpCodes.Ldc_I4_1),
|
||||||
|
new CodeInstruction(OpCodes.Ceq),
|
||||||
|
new CodeInstruction(OpCodes.Brtrue, jumpPos),
|
||||||
|
new CodeInstruction(OpCodes.Ldsfld, AccessTools.Field(typeof(PlayerPatch), nameof(_showAllStarsNameKey))),
|
||||||
|
new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(KeyBindings), nameof(KeyBindings.IsKeyPressing))),
|
||||||
|
new CodeInstruction(OpCodes.Brtrue, jumpPos)
|
||||||
|
);
|
||||||
|
return matcher.InstructionEnumeration();
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -222,22 +222,11 @@ public static class TechPatch
|
|||||||
foreach (var item in nodes)
|
foreach (var item in nodes)
|
||||||
{
|
{
|
||||||
var node = item.Value;
|
var node = item.Value;
|
||||||
var postTechArray = node.techProto.postTechArray;
|
|
||||||
// A new session can initialize nodes while the peace-mode graph is still filtered.
|
|
||||||
var arrowCount = node.arrows.Length;
|
|
||||||
if (arrowCount < postTechArray.Length)
|
|
||||||
{
|
|
||||||
System.Array.Resize(ref node.arrows, postTechArray.Length);
|
|
||||||
for (var i = arrowCount; i < postTechArray.Length; i++)
|
|
||||||
{
|
|
||||||
node.arrows[i] = UnityEngine.Object.Instantiate(node.arrowPrefab, node.arrowPrefab.parent);
|
|
||||||
node.arrows[i].SetAsFirstSibling();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (var arrow in node.arrows)
|
foreach (var arrow in node.arrows)
|
||||||
{
|
{
|
||||||
arrow.gameObject.SetActive(false);
|
arrow.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
var postTechArray = node.techProto.postTechArray;
|
||||||
var active = postTechArray.Length > 0;
|
var active = postTechArray.Length > 0;
|
||||||
node.connGroup.gameObject.SetActive(active);
|
node.connGroup.gameObject.SetActive(active);
|
||||||
node.connImages = active ? node.connGroup.GetComponentsInChildren<Image>(true) : [];
|
node.connImages = active ? node.connGroup.GetComponentsInChildren<Image>(true) : [];
|
||||||
|
|||||||
@@ -106,6 +106,11 @@ public class UIPatch : PatchImpl<UIPatch>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Vector2 GetAdjustedSizeDelta(Vector2 origSizeDelta)
|
||||||
|
{
|
||||||
|
return new Vector2(origSizeDelta.x + 40f, origSizeDelta.y);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnDisable()
|
protected override void OnDisable()
|
||||||
{
|
{
|
||||||
if (planetVeinCount != null)
|
if (planetVeinCount != null)
|
||||||
|
|||||||
@@ -1,148 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading;
|
|
||||||
using static UXAssist.Production.ProductionMath;
|
|
||||||
|
|
||||||
namespace UXAssist.Production;
|
|
||||||
|
|
||||||
internal static class BlueprintBottleneckBalance
|
|
||||||
{
|
|
||||||
private const double Tolerance = 1e-7;
|
|
||||||
|
|
||||||
internal static bool TryCalculate(IReadOnlyList<BlackBoxProcessGroup> processes,
|
|
||||||
IReadOnlyDictionary<int, double> production, IReadOnlyDictionary<int, double> consumption,
|
|
||||||
ISet<int> researchMatrixSinks,
|
|
||||||
out SortedDictionary<int, double> balancedProduction, out SortedDictionary<int, double> balancedConsumption,
|
|
||||||
out IReadOnlyDictionary<int, BlackBoxItemClassification> balancedClassifications,
|
|
||||||
out IReadOnlyDictionary<int, double> balancedNet)
|
|
||||||
{
|
|
||||||
balancedProduction = null;
|
|
||||||
balancedConsumption = null;
|
|
||||||
balancedClassifications = null;
|
|
||||||
balancedNet = null;
|
|
||||||
if (production.Count == 0 && consumption.Count == 0)
|
|
||||||
{
|
|
||||||
balancedProduction = new SortedDictionary<int, double>();
|
|
||||||
balancedConsumption = new SortedDictionary<int, double>();
|
|
||||||
balancedClassifications = new Dictionary<int, BlackBoxItemClassification>();
|
|
||||||
balancedNet = new Dictionary<int, double>();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var groups = processes.GroupBy(process => process.StableKey, StringComparer.Ordinal)
|
|
||||||
.OrderBy(group => group.Key, StringComparer.Ordinal)
|
|
||||||
.Select(group => (source: group.First(), count: group.Sum(process => process.Count))).ToArray();
|
|
||||||
var produced = new HashSet<int>(groups.SelectMany(group => group.source.NetPerBuilding)
|
|
||||||
.Where(flow => flow.Value > BlackBoxMaterialClassifier.Tolerance).Select(flow => flow.Key));
|
|
||||||
var consumed = new HashSet<int>(groups.SelectMany(group => group.source.NetPerBuilding)
|
|
||||||
.Where(flow => flow.Value < -BlackBoxMaterialClassifier.Tolerance).Select(flow => flow.Key));
|
|
||||||
var items = produced.OrderBy(itemId => itemId).ToArray();
|
|
||||||
// Normalize only the scale variable; the solver still resolves shared demand, recipe ratios, and cycles together.
|
|
||||||
var commonScale = items.Where(consumed.Contains).Select(itemId => production[itemId] / consumption[itemId])
|
|
||||||
.Aggregate(1.0, Math.Min);
|
|
||||||
var targets = items.Where(itemId => !consumed.Contains(itemId) || researchMatrixSinks.Contains(itemId))
|
|
||||||
.ToDictionary(itemId => itemId, itemId => Math.Max(0, production[itemId] -
|
|
||||||
(consumption.TryGetValue(itemId, out var amount) ? amount : 0)));
|
|
||||||
// Launchers, generators, and precise research can terminate a chain without an item output.
|
|
||||||
var sinks = Enumerable.Range(0, groups.Length).Where(index =>
|
|
||||||
groups[index].source.NetPerBuilding.Values.Any(value => value < -BlackBoxMaterialClassifier.Tolerance) &&
|
|
||||||
!groups[index].source.NetPerBuilding.Values.Any(value => value > BlackBoxMaterialClassifier.Tolerance))
|
|
||||||
.ToArray();
|
|
||||||
if (!targets.Values.Any(FinitePositive) && sinks.Length == 0) return false;
|
|
||||||
|
|
||||||
var scaleColumn = groups.Length;
|
|
||||||
var surplusStart = scaleColumn + 1;
|
|
||||||
var capacitySlackStart = surplusStart + items.Length;
|
|
||||||
var columnCount = capacitySlackStart + groups.Length + 1;
|
|
||||||
var matrix = new double[items.Length + groups.Length + 1 + sinks.Length, columnCount];
|
|
||||||
var rhs = new double[matrix.GetLength(0)];
|
|
||||||
var maximizeOutput = new double[columnCount];
|
|
||||||
var minimizeUse = new double[columnCount];
|
|
||||||
var minimizeSurplus = new double[columnCount];
|
|
||||||
maximizeOutput[scaleColumn] = -1;
|
|
||||||
for (var row = 0; row < items.Length; row++)
|
|
||||||
{
|
|
||||||
var itemId = items[row];
|
|
||||||
var rowScale = Math.Max(production[itemId], consumption.TryGetValue(itemId, out var amount) ? amount : 0);
|
|
||||||
for (var index = 0; index < groups.Length; index++)
|
|
||||||
if (groups[index].source.NetPerBuilding.TryGetValue(itemId, out var net))
|
|
||||||
matrix[row, index] = net * groups[index].count / rowScale;
|
|
||||||
if (targets.TryGetValue(itemId, out var target)) matrix[row, scaleColumn] = -target / rowScale * commonScale;
|
|
||||||
matrix[row, surplusStart + row] = -1;
|
|
||||||
minimizeSurplus[surplusStart + row] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var index = 0; index <= groups.Length; index++)
|
|
||||||
{
|
|
||||||
var row = items.Length + index;
|
|
||||||
matrix[row, index] = index < groups.Length ? 1 : commonScale;
|
|
||||||
matrix[row, capacitySlackStart + index] = 1;
|
|
||||||
rhs[row] = 1;
|
|
||||||
if (index < groups.Length) minimizeUse[index] = groups[index].count;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var index = 0; index < sinks.Length; index++)
|
|
||||||
{
|
|
||||||
var row = items.Length + groups.Length + 1 + index;
|
|
||||||
matrix[row, sinks[index]] = 1;
|
|
||||||
matrix[row, scaleColumn] = -commonScale;
|
|
||||||
}
|
|
||||||
|
|
||||||
var solution = TwoPhaseSimplex.Solve(matrix, rhs,
|
|
||||||
new[] { maximizeOutput, minimizeUse, minimizeSurplus }, 20000, CancellationToken.None);
|
|
||||||
if (solution.Status != LinearSolveStatus.Optimal || !FinitePositive(solution.Values[scaleColumn])) return false;
|
|
||||||
for (var row = 0; row < rhs.Length; row++)
|
|
||||||
{
|
|
||||||
var residual = -rhs[row];
|
|
||||||
for (var column = 0; column < columnCount; column++) residual += matrix[row, column] * solution.Values[column];
|
|
||||||
if (Math.Abs(residual) > Tolerance) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
balancedProduction = new SortedDictionary<int, double>(production.ToDictionary(flow => flow.Key, _ => 0.0));
|
|
||||||
balancedConsumption = new SortedDictionary<int, double>(consumption.ToDictionary(flow => flow.Key, _ => 0.0));
|
|
||||||
var unusedProduction = new Dictionary<int, double>();
|
|
||||||
for (var index = 0; index < groups.Length; index++)
|
|
||||||
{
|
|
||||||
var group = groups[index];
|
|
||||||
var utilized = Math.Min(1, solution.Values[index]) * group.count;
|
|
||||||
var executions = group.source.Process.CyclesPerBuildingPerMinute * utilized;
|
|
||||||
foreach (var flow in group.source.Process.OutputsPerCycle)
|
|
||||||
AddFlow(balancedProduction, flow.Key, flow.Value * executions);
|
|
||||||
foreach (var flow in group.source.Process.InputsPerCycle)
|
|
||||||
AddFlow(balancedConsumption, flow.Key, flow.Value * executions);
|
|
||||||
foreach (var flow in group.source.NetPerBuilding)
|
|
||||||
if (flow.Value > 0) AddFlow(unusedProduction, flow.Key, flow.Value * (group.count - utilized));
|
|
||||||
}
|
|
||||||
|
|
||||||
var netFlows = new Dictionary<int, double>();
|
|
||||||
var result = new Dictionary<int, BlackBoxItemClassification>();
|
|
||||||
var allItems = new SortedSet<int>(production.Keys);
|
|
||||||
allItems.UnionWith(consumption.Keys);
|
|
||||||
foreach (var itemId in allItems)
|
|
||||||
{
|
|
||||||
var grossProduced = balancedProduction.TryGetValue(itemId, out var p) ? p : 0;
|
|
||||||
var grossConsumed = balancedConsumption.TryGetValue(itemId, out var c) ? c : 0;
|
|
||||||
var net = grossProduced - grossConsumed;
|
|
||||||
if (targets.TryGetValue(itemId, out var target))
|
|
||||||
{
|
|
||||||
var required = target * solution.Values[scaleColumn] * commonScale;
|
|
||||||
if (net < required - Tolerance * Math.Max(1, required)) return false;
|
|
||||||
}
|
|
||||||
if (Math.Abs(net) <= Tolerance * Math.Max(1, Math.Max(grossProduced, grossConsumed))) net = 0;
|
|
||||||
netFlows[itemId] = net;
|
|
||||||
var intermediate = produced.Contains(itemId) && consumed.Contains(itemId);
|
|
||||||
if (intermediate && net < 0) return false;
|
|
||||||
var research = researchMatrixSinks.Contains(itemId);
|
|
||||||
var researchProduct = research && net > 0;
|
|
||||||
result[itemId] = new BlackBoxItemClassification(produced.Contains(itemId) && !consumed.Contains(itemId) || researchProduct,
|
|
||||||
researchProduct, 0,
|
|
||||||
intermediate && !research && unusedProduction.TryGetValue(itemId, out var unused) ? unused : 0,
|
|
||||||
intermediate && !research ? Math.Max(0, net) : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
balancedClassifications = result;
|
|
||||||
balancedNet = netFlows;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -64,7 +64,6 @@ public sealed class BlueprintDescriptionText
|
|||||||
public static class BlueprintDescriptionFormatter
|
public static class BlueprintDescriptionFormatter
|
||||||
{
|
{
|
||||||
private const double Tolerance = 1e-9;
|
private const double Tolerance = 1e-9;
|
||||||
private static readonly string[] RateUnits = { "K", "M", "G" };
|
|
||||||
private static readonly string[] PowerUnits = { "W", "kW", "MW", "GW", "TW" };
|
private static readonly string[] PowerUnits = { "W", "kW", "MW", "GW", "TW" };
|
||||||
|
|
||||||
public static BlueprintDescriptionText Format(ProductionReport report, Func<int, string> itemTag,
|
public static BlueprintDescriptionText Format(ProductionReport report, Func<int, string> itemTag,
|
||||||
@@ -88,8 +87,7 @@ public static class BlueprintDescriptionFormatter
|
|||||||
var input = new List<string>();
|
var input = new List<string>();
|
||||||
var output = new SortedDictionary<int, double>();
|
var output = new SortedDictionary<int, double>();
|
||||||
var research = new SortedDictionary<int, double>();
|
var research = new SortedDictionary<int, double>();
|
||||||
var orderedFlows = report.ItemFlows.Values.OrderBy(flow => flow.ItemId).ToArray();
|
foreach (var flow in report.ItemFlows.Values.OrderBy(flow => flow.ItemId))
|
||||||
foreach (var flow in orderedFlows)
|
|
||||||
{
|
{
|
||||||
var shortage = Math.Min(flow.IntermediateShortage,
|
var shortage = Math.Min(flow.IntermediateShortage,
|
||||||
flow.SteadyStateExternalSupply ?? flow.RequiredExternalSupply);
|
flow.SteadyStateExternalSupply ?? flow.RequiredExternalSupply);
|
||||||
@@ -99,14 +97,14 @@ public static class BlueprintDescriptionFormatter
|
|||||||
|
|
||||||
if (report.MaterialComplete)
|
if (report.MaterialComplete)
|
||||||
{
|
{
|
||||||
foreach (var flow in orderedFlows)
|
foreach (var flow in report.ItemFlows.Values.OrderBy(flow => flow.ItemId))
|
||||||
{
|
{
|
||||||
if (flow.OverbuildSurplus.GetValueOrDefault() > Tolerance)
|
if (flow.OverbuildSurplus.GetValueOrDefault() > Tolerance)
|
||||||
excess.Add(FormatItem(flow.ItemId, flow.OverbuildSurplus.Value, itemTag));
|
excess.Add(FormatItem(flow.ItemId, flow.OverbuildSurplus.Value, itemTag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var flow in orderedFlows)
|
foreach (var flow in report.ItemFlows.Values.OrderBy(flow => flow.ItemId))
|
||||||
{
|
{
|
||||||
var requiredSupply = flow.SteadyStateExternalSupply ?? flow.RequiredExternalSupply;
|
var requiredSupply = flow.SteadyStateExternalSupply ?? flow.RequiredExternalSupply;
|
||||||
if (requiredSupply > Tolerance && flow.IntermediateShortage <= Tolerance)
|
if (requiredSupply > Tolerance && flow.IntermediateShortage <= Tolerance)
|
||||||
@@ -149,21 +147,7 @@ public static class BlueprintDescriptionFormatter
|
|||||||
var tag = itemTag(itemId);
|
var tag = itemTag(itemId);
|
||||||
if (string.IsNullOrEmpty(tag))
|
if (string.IsNullOrEmpty(tag))
|
||||||
throw new InvalidOperationException("An item in the blueprint report has no native icon tag.");
|
throw new InvalidOperationException("An item in the blueprint report has no native icon tag.");
|
||||||
return tag + " x" + FormatRate(rate);
|
return tag + " x" + FormatNumber(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)
|
private static string FormatPower(double? watts, BlueprintDescriptionLabels labels)
|
||||||
@@ -192,7 +176,7 @@ public static class BlueprintDescriptionFormatter
|
|||||||
throw new InvalidOperationException("A blueprint report contains an invalid rate or power value.");
|
throw new InvalidOperationException("A blueprint report contains an invalid rate or power value.");
|
||||||
var rounded = RoundForDisplay(value);
|
var rounded = RoundForDisplay(value);
|
||||||
if (rounded > 0 || value == 0)
|
if (rounded > 0 || value == 0)
|
||||||
return rounded.ToString(value < 1 ? "0.###" : "#,##0.##", CultureInfo.InvariantCulture);
|
return rounded.ToString(value < 1 ? "0.###" : "0.##", CultureInfo.InvariantCulture);
|
||||||
var precise = value.ToString("0.######", CultureInfo.InvariantCulture);
|
var precise = value.ToString("0.######", CultureInfo.InvariantCulture);
|
||||||
return precise != "0" ? precise : value.ToString("0.###E+0", CultureInfo.InvariantCulture);
|
return precise != "0" ? precise : value.ToString("0.###E+0", CultureInfo.InvariantCulture);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,18 +31,11 @@ public sealed class ProductionBuildingSnapshot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum BlueprintProductionBasis
|
|
||||||
{
|
|
||||||
FinalProducts,
|
|
||||||
BottleneckIntermediate
|
|
||||||
}
|
|
||||||
|
|
||||||
public sealed class FactoryBlackBoxRequest
|
public sealed class FactoryBlackBoxRequest
|
||||||
{
|
{
|
||||||
public List<ProductionBuildingSnapshot> Buildings { get; } = new List<ProductionBuildingSnapshot>();
|
public List<ProductionBuildingSnapshot> Buildings { get; } = new List<ProductionBuildingSnapshot>();
|
||||||
public List<ProductionDiagnostic> CaptureDiagnostics { get; } = new List<ProductionDiagnostic>();
|
public List<ProductionDiagnostic> CaptureDiagnostics { get; } = new List<ProductionDiagnostic>();
|
||||||
public bool ProliferationEnabled { get; set; }
|
public bool ProliferationEnabled { get; set; }
|
||||||
public BlueprintProductionBasis ProductionBasis { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class FactoryBlackBoxAnalyzer
|
public sealed class FactoryBlackBoxAnalyzer
|
||||||
@@ -257,27 +250,8 @@ public sealed class FactoryBlackBoxAnalyzer
|
|||||||
|
|
||||||
var matrixSinkItems = hasResearchMatrixSink
|
var matrixSinkItems = hasResearchMatrixSink
|
||||||
? new HashSet<int>(_catalog.ResearchMatrixItemIds) : new HashSet<int>();
|
? new HashSet<int>(_catalog.ResearchMatrixItemIds) : new HashSet<int>();
|
||||||
IReadOnlyDictionary<int, BlackBoxItemClassification> classifications = null;
|
var classifications = BlackBoxMaterialClassifier.Classify(processGroups, grossProduction, grossConsumption,
|
||||||
IReadOnlyDictionary<int, double> steadyStateBalance = null;
|
materialComplete, uncertainDemandItems, unknownDemand, matrixSinkItems, out var steadyStateBalance);
|
||||||
if (request.ProductionBasis == BlueprintProductionBasis.BottleneckIntermediate)
|
|
||||||
{
|
|
||||||
if (!materialComplete || !BlueprintBottleneckBalance.TryCalculate(processGroups,
|
|
||||||
grossProduction, grossConsumption, matrixSinkItems,
|
|
||||||
out var balancedProduction, out var balancedConsumption, out var balancedClassifications,
|
|
||||||
out var balancedNet))
|
|
||||||
diagnostics.Add(new ProductionDiagnostic(ProductionDiagnosticCode.BlueprintBasisUnavailable,
|
|
||||||
"A complete material selection with a feasible final output is required for the bottleneck basis."));
|
|
||||||
else
|
|
||||||
{
|
|
||||||
grossProduction = balancedProduction;
|
|
||||||
grossConsumption = balancedConsumption;
|
|
||||||
classifications = balancedClassifications;
|
|
||||||
steadyStateBalance = balancedNet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (classifications == null)
|
|
||||||
classifications = BlackBoxMaterialClassifier.Classify(processGroups, grossProduction, grossConsumption,
|
|
||||||
materialComplete, uncertainDemandItems, unknownDemand, matrixSinkItems, out steadyStateBalance);
|
|
||||||
var flows = new List<ProductionItemFlow>();
|
var flows = new List<ProductionItemFlow>();
|
||||||
var allItems = new SortedSet<int>(grossProduction.Keys);
|
var allItems = new SortedSet<int>(grossProduction.Keys);
|
||||||
allItems.UnionWith(grossConsumption.Keys);
|
allItems.UnionWith(grossConsumption.Keys);
|
||||||
|
|||||||
@@ -119,7 +119,8 @@ public static class ProductionCatalogReader
|
|||||||
}
|
}
|
||||||
|
|
||||||
return new ProductionCatalog(items, recipes, buildings,
|
return new ProductionCatalog(items, recipes, buildings,
|
||||||
Cargo.accTableMilli, Cargo.incTableMilli, Cargo.powerTableRatio, technologies, matrixIds);
|
(double[])Cargo.accTableMilli.Clone(), (double[])Cargo.incTableMilli.Clone(),
|
||||||
|
(double[])Cargo.powerTableRatio.Clone(), technologies, matrixIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddSpecialRecipes(IEnumerable<ItemProto> itemProtos,
|
private static void AddSpecialRecipes(IEnumerable<ItemProto> itemProtos,
|
||||||
|
|||||||
@@ -116,8 +116,7 @@ public enum ProductionDiagnosticCode
|
|||||||
Unbounded,
|
Unbounded,
|
||||||
IterationLimit,
|
IterationLimit,
|
||||||
Cancelled,
|
Cancelled,
|
||||||
ConservationFailure,
|
ConservationFailure
|
||||||
BlueprintBasisUnavailable
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class ProductionDiagnostic
|
public sealed class ProductionDiagnostic
|
||||||
|
|||||||
+6
-16
@@ -17,11 +17,7 @@
|
|||||||
* Strict hotkey dectection for build menu, thus building hotkeys(0~9, F1~F10, X, U) are not triggered while holding Ctrl/Alt/Shift.
|
* Strict hotkey dectection for build menu, thus building hotkeys(0~9, F1~F10, X, U) are not triggered while holding Ctrl/Alt/Shift.
|
||||||
* Fix a bug that warning popup on `Veins Utilization` upgraded to level 8000+
|
* 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
|
* Sort blueprint structures before saving, to reduce generated blueprint data size a little
|
||||||
* Add an `Auto-fill` entry to the description header in the blueprint browser, copy, and paste inspectors. Click it to open generation options without moving or resizing native fields or covering the file list
|
* 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
|
||||||
* `Production basis` defaults to `Final-product output` each time the inspector opens, retaining rated final outputs and showing intermediate shortages and excess. Choose `Lowest intermediate throughput` to scale the final-product mix together to the bottleneck, using recipe ratios and shared intermediate demand. Complete, balanceable chains then have no internal shortages; unused intermediate capacity appears as excess. External inputs and final outputs use the same basis.
|
|
||||||
* `Proliferation` defaults to on when the blueprint contains a Spray Coater; it can be changed manually. Power demand still estimates all selected buildings at full load in either production basis.
|
|
||||||
* Replaces the main description with material flows per minute and writes power demand to a `Power` custom field, preserving other custom fields. If the bottleneck basis cannot be determined, the existing description is kept; check missing building settings and chain outputs, or select `Final-product output`. Save the blueprint manually to keep generated changes.
|
|
||||||
* 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. Numbers with four or more integer digits use comma thousands separators, including before suffixes (for example, `12,345` and `1,234.5K`).
|
|
||||||
* Increase maximum count of Metadata Instantiations to 20000 (from 2000)
|
* Increase maximum count of Metadata Instantiations to 20000 (from 2000)
|
||||||
* Increase capacity of player order queue to 128 (from 16)
|
* 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
|
* Enable `Hide UI` (`F11` by default) in Star Map view, hiding UI and other scene elements
|
||||||
@@ -89,13 +85,13 @@
|
|||||||
* Quick build Orbital Collectors
|
* Quick build Orbital Collectors
|
||||||
* Set a maximum number to build per operation; 0 builds as many as possible
|
* Set a maximum number to build per operation; 0 builds as many as possible
|
||||||
* Quick build Mining Machines
|
* Quick build Mining Machines
|
||||||
* Use the button on the Factory tab near Quick build Orbital Collectors. Places the full ordinary Mining Machine layout at the nearest solid vein group regardless of carried stock. Mines only the selected group, even when another group of the same resource is nearby. Uses available miners from the inventory and hand; missing miners remain as ghosts awaiting materials. Every placed miner must retain at least 3 covered nodes in the selected group after all planned burials; miners below that minimum are invalid.
|
* Use the button on the Factory tab near Quick build Orbital Collectors. Places the full ordinary Mining Machine layout at the nearest solid vein group regardless of carried stock. Uses available miners from the inventory and hand; missing miners remain as ghosts awaiting materials. Every placed miner must retain at least 3 covered nodes after all planned burials; miners below that minimum are invalid.
|
||||||
* `Allow restoring/burying veins` is off by default. When disabled, uses only visible nodes and skips all restoration and burial calculations. Enable it to restore buried nodes unless obstructed by buildings or near Dark Fog Planetary Bases. Changes apply to the next calculation. Searches individual native collision shapes so the miner's feet can interleave where the game permits.
|
* `Allow restoring/burying veins` is off by default. When disabled, uses only visible nodes and skips all restoration and burial calculations. Enable it to restore buried nodes unless obstructed by buildings or near Dark Fog Planetary Bases. Changes apply to the next calculation. Searches individual native collision shapes so the miner's feet can interleave where the game permits.
|
||||||
* Uses multiple packing orders, exploration keyed by placement pose as well as candidate index, local position/rotation refinement, body-width neighbor candidates, and coordinated repacking of up to three nearby miners to seek a high sum of vein counts across all placed miners. A final pass fills remaining compatible candidates when they increase total coverage while preserving the three-node minimum. Shared nodes count once per miner; this bounded search does not guarantee a global optimum.
|
* Uses multiple packing orders, exploration keyed by placement pose as well as candidate index, local position/rotation refinement, body-width neighbor candidates, and coordinated repacking of up to three nearby miners to seek a high sum of vein counts across all placed miners. A final pass fills remaining compatible candidates when they increase total coverage while preserving the three-node minimum. Shared nodes count once per miner; this bounded search does not guarantee a global optimum.
|
||||||
* Reuses collision checks and runs independent layout searches on up to 4 background workers, capped at half the available logical processors. Systems with one logical processor keep the search on the main thread with a frame budget. Native terrain checks and placement stay on the main thread; worker scheduling preserves the same layout as sequential search.
|
* Reuses collision checks and runs independent layout searches on up to 4 background workers, capped at half the available logical processors. Systems with one logical processor keep the search on the main thread with a frame budget. Native terrain checks and placement stay on the main thread; worker scheduling preserves the same layout as sequential search.
|
||||||
* With `Allow restoring/burying veins` enabled, may bury unused nodes when that improves total coverage. Nodes already assigned to miners or miner prebuilds are protected. Ground, water, existing buildings, construction range, and the game's other placement clearances still apply.
|
* With `Allow restoring/burying veins` enabled, may bury unused nodes when that improves total coverage. Nodes already assigned to miners or miner prebuilds are protected. Ground, water, existing buildings, construction range, and the game's other placement clearances still apply.
|
||||||
* Click again during calculation to cancel. Changing planets or leaving the game cancels automatically. Construction drones finish the prebuilds; belts and power supply are not placed.
|
* Click again during calculation to cancel. Changing planets or leaving the game cancels automatically. Construction drones finish the prebuilds; belts and power supply are not placed.
|
||||||
* Debug builds capture a timestamped JSON snapshot for each calculation and export it to `BepInEx/debug/UXAssist/QuickMiner/` in the active game profile, including the restoration/burial option, nodes, native colliders, accepted candidates, search phases and their search times, logical processor and worker counts, existing miners, and native placement results. Only Debug builds log the result summary and full file path; Release builds exclude this debug functionality. The completion tip stays visible for about 8 seconds in both builds. Replay and compare sequential/parallel results without loading a save using `powershell -File tools/tests/Test-QuickMinerPlacement.ps1 -Snapshot <file.json>` from the repository root. Replay fails if total coverage falls below the recorded result; add `-MinimumTotalCoverage <count>` to require a higher total.
|
* While tuning this feature, each calculation writes a timestamped JSON snapshot to `BepInEx/debug/UXAssist/QuickMiner/` in the active game profile, including the restoration/burial option, nodes, native colliders, accepted candidates, search phases and their search times, logical processor and worker counts, existing miners, and native placement results. The completion tip stays visible for about 8 seconds; the log also records the result summary and full file path. Replay and compare sequential/parallel results without loading a save using `powershell -File tools/tests/Test-QuickMinerPlacement.ps1 -Snapshot <file.json>` from the repository root. Replay fails if total coverage falls below the recorded result; add `-MinimumTotalCoverage <count>` to require a higher total.
|
||||||
* Belt signals for buy out dark fog items automatically
|
* Belt signals for buy out dark fog items automatically
|
||||||
* 6 belt signals are added to the signal panel, which can be used to buy out dark fog items automatically.
|
* 6 belt signals are added to the signal panel, which can be used to buy out dark fog items automatically.
|
||||||
* Generated items are stacked in 4 items.
|
* Generated items are stacked in 4 items.
|
||||||
@@ -171,7 +167,6 @@
|
|||||||
* Buy out techs with their prerequisites
|
* Buy out techs with their prerequisites
|
||||||
* This enables batch buying out techs with their prerequisites. Buy-out buttons are shown for locked techs/upgrades.
|
* This enables batch buying out techs with their prerequisites. Buy-out buttons are shown for locked techs/upgrades.
|
||||||
* Hide battle-related techs in Peace mode
|
* Hide battle-related techs in Peace mode
|
||||||
* Battle-related techs and their connections return when disabling the option or loading a Combat-mode save; switching saves does not require restarting the game.
|
|
||||||
* Unlock all techs with metadata
|
* Unlock all techs with metadata
|
||||||
* Use the config-panel button to confirm the metadata cost and buy out eligible techs in a batch; unlimited upgrade chains are excluded.
|
* Use the config-panel button to confirm the metadata cost and buy out eligible techs in a batch; unlimited upgrade chains are excluded.
|
||||||
* Combat
|
* Combat
|
||||||
@@ -225,11 +220,7 @@
|
|||||||
* 更严格的建造菜单热键检测,因此在按住Ctrl/Alt/Shift时不再会触发建造热键(0~9, F1~F10, X, U)
|
* 更严格的建造菜单热键检测,因此在按住Ctrl/Alt/Shift时不再会触发建造热键(0~9, F1~F10, X, U)
|
||||||
* 修复了`矿物利用`升级到8000级以上时弹出警告的bug
|
* 修复了`矿物利用`升级到8000级以上时弹出警告的bug
|
||||||
* 保存蓝图前对建筑进行排序,以减少生成的蓝图数据大小
|
* 保存蓝图前对建筑进行排序,以减少生成的蓝图数据大小
|
||||||
* 在蓝图浏览、复制和粘贴检查面板的说明标题行增加「自动填写」入口,点击展开生成选项,不移动或缩放原生字段,也不遮挡文件列表
|
* 在蓝图浏览、复制和粘贴界面增加「自动填写说明」按钮和「增产」复选框,用蓝图每分钟的物料流量和耗电自动填写说明
|
||||||
* 每次打开检查面板时,「产量基准」默认为「最终产物产量」,保留最终产物的额定产量,并显示中间产物的缺口和余量。选择「最低产量中间产物」后,按配方比例和共享中间物料的需求换算瓶颈,等比例缩放各最终产物。数据完整且可平衡的生产链没有内部缺口,未使用的中间产能列为「多余」;外部输入和最终输出采用同一基准。
|
|
||||||
* 蓝图含喷涂机时默认勾选「增产」,也可手动修改。两种产量基准均按所选全部建筑满载估算耗电。
|
|
||||||
* 用每分钟的物料流量替换原说明,将耗电写入「耗电」自定义字段,保留其他自定义字段。无法确定瓶颈基准时保留原说明;可检查缺失的建筑参数和生产链输出,或改选「最终产物产量」。填写后需手动保存蓝图。
|
|
||||||
* 较大的物料流量使用能精确表示的最大 `K`/`M`/`G` 单位,小数最多一位;无法在保留显示精度的前提下缩写时,保留普通数字格式。整数部分达到四位的数字用逗号每三位分隔,带单位时也适用,例如 `12,345` 和 `1,234.5K`。
|
|
||||||
* 将元数据提取的最大数量增加到20000(原来为2000)
|
* 将元数据提取的最大数量增加到20000(原来为2000)
|
||||||
* 将玩家指令队列的容量增加到128(原来为16)
|
* 将玩家指令队列的容量增加到128(原来为16)
|
||||||
* 在星图视图中启用 `隐藏 UI` 功能(默认按键为 `F11`),同时隐藏 UI 和场景中的其他元素
|
* 在星图视图中启用 `隐藏 UI` 功能(默认按键为 `F11`),同时隐藏 UI 和场景中的其他元素
|
||||||
@@ -297,13 +288,13 @@
|
|||||||
* 快速建造轨道采集器
|
* 快速建造轨道采集器
|
||||||
* 可设置单次建造数量上限;设为 0 时尽可能多地建造
|
* 可设置单次建造数量上限;设为 0 时尽可能多地建造
|
||||||
* 快速铺设采矿机
|
* 快速铺设采矿机
|
||||||
* 点击「工厂」页中轨道采集器按钮附近的按钮,在最近的固体矿脉生成完整的普通采矿机布局,数量不受库存限制。仅开采选中的矿脉,即使附近有同种资源的其他矿脉也不会混入。有采矿机时正常消耗背包和手持物品,不足的位置保留待建造虚影,等待补充材料。所有计划掩埋完成后,每台矿机仍须覆盖选中矿脉的至少 3 个矿点;少于 3 个的视为无效,不予铺设。
|
* 点击「工厂」页中轨道采集器按钮附近的按钮,在最近的固体矿脉生成完整的普通采矿机布局,数量不受库存限制。有采矿机时正常消耗背包和手持物品,不足的位置保留待建造虚影,等待补充材料。所有计划掩埋完成后,每台矿机仍须覆盖至少 3 个矿点;少于 3 个的视为无效,不予铺设。
|
||||||
* 「允许恢复/掩埋矿物」默认关闭。关闭时仅使用可见矿点,跳过所有恢复和掩埋计算;开启后,先恢复未被建筑阻挡且不在黑雾行星基地附近的掩埋矿点。选项变更从下次计算生效。按原版独立碰撞体搜索布局,保留游戏允许的矿机脚部交叉空间。
|
* 「允许恢复/掩埋矿物」默认关闭。关闭时仅使用可见矿点,跳过所有恢复和掩埋计算;开启后,先恢复未被建筑阻挡且不在黑雾行星基地附近的掩埋矿点。选项变更从下次计算生效。按原版独立碰撞体搜索布局,保留游戏允许的矿机脚部交叉空间。
|
||||||
* 比较多种铺设顺序,同时按候选序号及位置朝向探索不同布局,细调位置和朝向,按机身宽度补充紧邻候选,并允许邻近的两三台矿机一起重新布局,尽量提高各台矿机覆盖矿点数之和。结束前再扫描全部候选,继续补入能提高总覆盖数、且不破坏每台至少覆盖 3 点要求的矿机。同一矿点被多台矿机覆盖时重复计数。计算有界,不保证全局最优。
|
* 比较多种铺设顺序,同时按候选序号及位置朝向探索不同布局,细调位置和朝向,按机身宽度补充紧邻候选,并允许邻近的两三台矿机一起重新布局,尽量提高各台矿机覆盖矿点数之和。结束前再扫描全部候选,继续补入能提高总覆盖数、且不破坏每台至少覆盖 3 点要求的矿机。同一矿点被多台矿机覆盖时重复计数。计算有界,不保证全局最优。
|
||||||
* 复用碰撞检查结果,使用最多 4 个后台线程并行搜索独立布局,线程数不超过可用逻辑线程数的一半。单逻辑线程系统继续在主线程按每帧预算计算。原生地形检查和实际铺设保留在主线程;并行调度与顺序搜索生成相同布局。
|
* 复用碰撞检查结果,使用最多 4 个后台线程并行搜索独立布局,线程数不超过可用逻辑线程数的一半。单逻辑线程系统继续在主线程按每帧预算计算。原生地形检查和实际铺设保留在主线程;并行调度与顺序搜索生成相同布局。
|
||||||
* 开启「允许恢复/掩埋矿物」后,允许掩埋未被使用的矿点来提高总覆盖数;保护已有矿机及待建造矿机使用的矿点。仍需满足地面、水面、现有建筑、建造范围及游戏的其他放置间距要求。
|
* 开启「允许恢复/掩埋矿物」后,允许掩埋未被使用的矿点来提高总覆盖数;保护已有矿机及待建造矿机使用的矿点。仍需满足地面、水面、现有建筑、建造范围及游戏的其他放置间距要求。
|
||||||
* 计算期间再次点击可取消,切换行星或退出游戏自动取消。待建造对象由建设机器人完成,不自动铺设传送带和电力设施。
|
* 计算期间再次点击可取消,切换行星或退出游戏自动取消。待建造对象由建设机器人完成,不自动铺设传送带和电力设施。
|
||||||
* 仅 Debug 版本会为每次计算采集带时间戳的 JSON 快照,并导出到当前游戏配置目录的 `BepInEx/debug/UXAssist/QuickMiner/`,记录恢复/掩埋选项、矿点、原生碰撞体、有效候选、搜索阶段及其搜索耗时、逻辑线程数和工作线程数、现有矿机和原生铺设校验结果。结果摘要和文件完整路径的日志也仅在 Debug 版本中输出;Release 版本不编译这些调试功能。两个版本的完成提示均保留约 8 秒。在仓库根目录运行 `powershell -File tools/tests/Test-QuickMinerPlacement.ps1 -Snapshot <file.json>`,即可离线重放并比较顺序与并行搜索结果,无需读取存档。总覆盖数低于记录结果时,重放检查会失败;可追加 `-MinimumTotalCoverage <数量>`,要求达到更高的总覆盖数。
|
* 功能调试期间,每次计算都会在当前游戏配置目录的 `BepInEx/debug/UXAssist/QuickMiner/` 下写入带时间戳的 JSON 文件,记录恢复/掩埋选项、矿点、原生碰撞体、有效候选、搜索阶段及其搜索耗时、逻辑线程数和工作线程数、现有矿机和原生铺设校验结果。完成提示保留约 8 秒,日志也会记录结果摘要和文件的完整路径。在仓库根目录运行 `powershell -File tools/tests/Test-QuickMinerPlacement.ps1 -Snapshot <file.json>`,即可离线重放并比较顺序与并行搜索结果,无需读取存档。总覆盖数低于记录结果时,重放检查会失败;可追加 `-MinimumTotalCoverage <数量>`,要求达到更高的总覆盖数。
|
||||||
* 用于自动购买黑雾物品的传送带信号
|
* 用于自动购买黑雾物品的传送带信号
|
||||||
* 在信号面板上添加了6个传送带信号,可以用于自动购买黑雾道具。
|
* 在信号面板上添加了6个传送带信号,可以用于自动购买黑雾道具。
|
||||||
* 生成的物品堆叠数为4。
|
* 生成的物品堆叠数为4。
|
||||||
@@ -379,7 +370,6 @@
|
|||||||
* 买断科技也同时买断所有前置科技
|
* 买断科技也同时买断所有前置科技
|
||||||
* 可批量买断科技及其前置科技,未解锁的科技和升级会显示买断按钮。
|
* 可批量买断科技及其前置科技,未解锁的科技和升级会显示买断按钮。
|
||||||
* 在和平模式下隐藏战斗相关科技
|
* 在和平模式下隐藏战斗相关科技
|
||||||
* 关闭选项或加载战斗模式存档后恢复相关科技及连线,切换存档无需重启游戏。
|
|
||||||
* 使用元数据解锁所有科技
|
* 使用元数据解锁所有科技
|
||||||
* 在配置面板点击按钮并确认元数据消耗,批量买断符合条件的科技;不包含无限升级科技链。
|
* 在配置面板点击按钮并确认元数据消耗,批量买断符合条件的科技;不包含无限升级科技链。
|
||||||
* 战斗
|
* 战斗
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ public class MyKeyBinder : MonoBehaviour
|
|||||||
|
|
||||||
[SerializeField] public UIButton setNoneKeyUIButton;
|
[SerializeField] public UIButton setNoneKeyUIButton;
|
||||||
|
|
||||||
|
private bool _nextNotOn;
|
||||||
|
|
||||||
protected void OnDestroy()
|
protected void OnDestroy()
|
||||||
{
|
{
|
||||||
OnFree?.Invoke();
|
OnFree?.Invoke();
|
||||||
@@ -221,6 +223,11 @@ public class MyKeyBinder : MonoBehaviour
|
|||||||
{
|
{
|
||||||
inputUIButton.highlighted = true;
|
inputUIButton.highlighted = true;
|
||||||
|
|
||||||
|
if (!_nextNotOn) return;
|
||||||
|
_nextNotOn = false;
|
||||||
|
inputUIButton.highlighted = false;
|
||||||
|
setTheKeyToggle.isOn = false;
|
||||||
|
waitingText.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnSetDefaultKeyClick(int data)
|
public void OnSetDefaultKeyClick(int data)
|
||||||
|
|||||||
@@ -559,6 +559,15 @@ public abstract class MyWindowManager
|
|||||||
win._Destroy();
|
win._Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public static void SetRect(ManualBehaviour win, RectTransform rect)
|
||||||
|
{
|
||||||
|
var rectTransform = win.GetComponent<RectTransform>();
|
||||||
|
//rectTransform.position =
|
||||||
|
//rectTransform.sizeDelta = rect;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public class Patch : PatchImpl<Patch>
|
public class Patch : PatchImpl<Patch>
|
||||||
{
|
{
|
||||||
protected override void OnEnable()
|
protected override void OnEnable()
|
||||||
@@ -577,6 +586,14 @@ public abstract class MyWindowManager
|
|||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
//_Create -> _Init
|
||||||
|
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnCreate))]
|
||||||
|
public static void UIGame__OnCreate_Postfix()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnDestroy))]
|
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnDestroy))]
|
||||||
public static void UIRoot__OnDestroy_Postfix()
|
public static void UIRoot__OnDestroy_Postfix()
|
||||||
{
|
{
|
||||||
@@ -595,6 +612,17 @@ public abstract class MyWindowManager
|
|||||||
InitAllWindows();
|
InitAllWindows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
[HarmonyPostfix, HarmonyPatch(typeof(UIGame), nameof(UIGame._OnFree))]
|
||||||
|
public static void UIGame__OnFree_Postfix()
|
||||||
|
{
|
||||||
|
foreach (var win in Windows)
|
||||||
|
{
|
||||||
|
win._Free();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnUpdate))]
|
[HarmonyPostfix, HarmonyPatch(typeof(UIRoot), nameof(UIRoot._OnUpdate))]
|
||||||
public static void UIRoot__OnUpdate_Postfix()
|
public static void UIRoot__OnUpdate_Postfix()
|
||||||
{
|
{
|
||||||
|
|||||||
+36
-12
@@ -96,19 +96,37 @@ public static class UIConfigWindow
|
|||||||
|
|
||||||
private class AutoConfigDispenserChargePowerMapper() : MyWindow.RangeValueMapper<int>(3, 30)
|
private class AutoConfigDispenserChargePowerMapper() : MyWindow.RangeValueMapper<int>(3, 30)
|
||||||
{
|
{
|
||||||
public override string FormatValue(string format, int value) => FormatPower(value * 300000L);
|
public override string FormatValue(string format, int value)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder(" ");
|
||||||
|
StringBuilderUtility.WriteKMG(sb, 8, value * 300000L, false);
|
||||||
|
sb.Append('W');
|
||||||
|
return sb.ToString().Trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AutoConfigBattleBaseChargePowerMapper() : MyWindow.RangeValueMapper<int>(4, 40)
|
private class AutoConfigBattleBaseChargePowerMapper() : MyWindow.RangeValueMapper<int>(4, 40)
|
||||||
{
|
{
|
||||||
|
|
||||||
public override string FormatValue(string format, int value) => FormatPower(value * 300000L);
|
public override string FormatValue(string format, int value)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder(" ");
|
||||||
|
StringBuilderUtility.WriteKMG(sb, 8, value * 300000L, false);
|
||||||
|
sb.Append('W');
|
||||||
|
return sb.ToString().Trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AutoConfigPLSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
private class AutoConfigPLSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
||||||
{
|
{
|
||||||
|
|
||||||
public override string FormatValue(string format, int value) => FormatPower(value * 3000000L);
|
public override string FormatValue(string format, int value)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder(" ");
|
||||||
|
StringBuilderUtility.WriteKMG(sb, 8, value * 3000000L, false);
|
||||||
|
sb.Append('W');
|
||||||
|
return sb.ToString().Trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AutoConfigCarrierMinDeliverMapper() : MyWindow.RangeValueMapper<int>(0, 10)
|
private class AutoConfigCarrierMinDeliverMapper() : MyWindow.RangeValueMapper<int>(0, 10)
|
||||||
@@ -129,7 +147,13 @@ public static class UIConfigWindow
|
|||||||
|
|
||||||
private class AutoConfigILSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
private class AutoConfigILSChargePowerMapper() : MyWindow.RangeValueMapper<int>(2, 20)
|
||||||
{
|
{
|
||||||
public override string FormatValue(string format, int value) => FormatPower(value * 15000000L);
|
public override string FormatValue(string format, int value)
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder(" ");
|
||||||
|
StringBuilderUtility.WriteKMG(sb, 8, value * 15000000L, false);
|
||||||
|
sb.Append('W');
|
||||||
|
return sb.ToString().Trim();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AutoConfigILSMaxTripShipMapper() : MyWindow.RangeValueMapper<int>(1, 41)
|
private class AutoConfigILSMaxTripShipMapper() : MyWindow.RangeValueMapper<int>(1, 41)
|
||||||
@@ -168,14 +192,6 @@ public static class UIConfigWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string FormatPower(long watts)
|
|
||||||
{
|
|
||||||
var sb = new StringBuilder(" ");
|
|
||||||
StringBuilderUtility.WriteKMG(sb, 8, watts, false);
|
|
||||||
sb.Append('W');
|
|
||||||
return sb.ToString().Trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||||
{
|
{
|
||||||
UnityEngine.UI.Text txt;
|
UnityEngine.UI.Text txt;
|
||||||
@@ -187,6 +203,14 @@ public static class UIConfigWindow
|
|||||||
wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, I18NKeys.EnableGameWindowResize);
|
wnd.AddCheckBox(x, y, tab1, GamePatch.EnableWindowResizeEnabled, I18NKeys.EnableGameWindowResize);
|
||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, I18NKeys.RemeberWindowPositionAndSizeOnLastExit);
|
wnd.AddCheckBox(x, y, tab1, GamePatch.LoadLastWindowRectEnabled, I18NKeys.RemeberWindowPositionAndSizeOnLastExit);
|
||||||
|
/*
|
||||||
|
y += 30f;
|
||||||
|
wnd.AddCheckBox(x, y, tab1, GamePatch.AutoSaveOptEnabled, "Better auto-save mechanism");
|
||||||
|
x = 200f;
|
||||||
|
y += 6f;
|
||||||
|
wnd.AddTipsButton2(x, y, tab1, "Better auto-save mechanism", "Better auto-save mechanism tips", "auto-save-opt-tips");
|
||||||
|
x = 0f;
|
||||||
|
*/
|
||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab1, GamePatch.ConvertSavesFromPeaceEnabled, I18NKeys.ConvertOldSavesToCombatModeOnLoading);
|
wnd.AddCheckBox(x, y, tab1, GamePatch.ConvertSavesFromPeaceEnabled, I18NKeys.ConvertOldSavesToCombatModeOnLoading);
|
||||||
MyCheckBox checkBoxForMeasureTextWidth;
|
MyCheckBox checkBoxForMeasureTextWidth;
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
|||||||
"Profile-based option");
|
"Profile-based option");
|
||||||
GamePatch.DefaultProfileName = Config.Bind("Game", "DefaultProfileName", "Default",
|
GamePatch.DefaultProfileName = Config.Bind("Game", "DefaultProfileName", "Default",
|
||||||
"Default profile name, used when profile-based save folder is enabled. Use original game save folder if matched");
|
"Default profile name, used when profile-based save folder is enabled. Use original game save folder if matched");
|
||||||
|
/*
|
||||||
|
GamePatch.AutoSaveOptEnabled = Config.Bind("Game", "AutoSaveOpt", false,
|
||||||
|
"Better auto-save mechanism");
|
||||||
|
*/
|
||||||
GamePatch.ConvertSavesFromPeaceEnabled = Config.Bind("Game", "ConvertSavesFromPeace", false,
|
GamePatch.ConvertSavesFromPeaceEnabled = Config.Bind("Game", "ConvertSavesFromPeace", false,
|
||||||
"Convert saves from Peace mode to Combat mode on save loading");
|
"Convert saves from Peace mode to Combat mode on save loading");
|
||||||
GamePatch.GameUpsFactor = _dummyConfig.Bind("Game", "GameUpsFactor", 1.0,
|
GamePatch.GameUpsFactor = _dummyConfig.Bind("Game", "GameUpsFactor", 1.0,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||||
<Description>DSP MOD - UXAssist</Description>
|
<Description>DSP MOD - UXAssist</Description>
|
||||||
<Version>1.6.4</Version>
|
<Version>1.6.3</Version>
|
||||||
<PackageId>UXAssist</PackageId>
|
<PackageId>UXAssist</PackageId>
|
||||||
<RootNamespace>UXAssist</RootNamespace>
|
<RootNamespace>UXAssist</RootNamespace>
|
||||||
<PackHasChangelog>true</PackHasChangelog>
|
<PackHasChangelog>true</PackHasChangelog>
|
||||||
@@ -11,8 +11,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="tools/**/*.cs" />
|
<Compile Remove="tools/**/*.cs" />
|
||||||
<Compile Remove="Functions/Factory/MinerPlacementDebug.cs" Condition="'$(Configuration)' != 'Debug'" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
<Reference Include="System.Runtime.Serialization" Condition="'$(Configuration)' == 'Debug'" />
|
|
||||||
<PackageReference Include="DysonSphereProgram.Modding.CommonAPI" Version="1.*" />
|
<PackageReference Include="DysonSphereProgram.Modding.CommonAPI" Version="1.*" />
|
||||||
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
|
<PackageReference Include="DysonSphereProgram.Modding.DSPModSave" Version="1.*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
# Blueprint Description Validation
|
|
||||||
|
|
||||||
This document records the native layout evidence for the UXAssist description-header entry and the checks needed for in-game acceptance. Compilation and managed production checks do not establish compatibility with other blueprint mods.
|
|
||||||
|
|
||||||
## Native evidence
|
|
||||||
|
|
||||||
Inspected on 2026-11-01 after discovering Steam through `HKCU`'s Steam path and `steamapps/libraryfolders.vdf`:
|
|
||||||
|
|
||||||
- Original assembly: `D:/Steam/steamapps/common/Dyson Sphere Program/DSPGAME_Data/Managed/Assembly-CSharp.dll`, SHA-256 `EF314425DADE51F529F184F07BE136CD3C2660A6A81515603C7226FBE7AB1D8C`.
|
|
||||||
- Native UI assets: `DSPGAME_Data/level0`, SHA-256 `04655A46BBEB113113688BCDC0E0EA8EC5F128B348E32194FC9743ADB48C8E91`.
|
|
||||||
- The installed version history ends at `0.10.35.29151`; the Steam manifest reports build ID `25955035`. Assembly file version `0.0.0.0` alone does not identify this game build.
|
|
||||||
|
|
||||||
The original `UIBlueprintInspector.Refresh` sizes the description and native groups, places groups 2 through 4, and updates the scroll content height. It does not restore group 1's position. The previous UXAssist layout shifted group 1 and repeatedly offset the later groups and content height, making both the native refresh and other layout patches share ownership of those transforms.
|
|
||||||
|
|
||||||
The relevant original methods can be reproduced by decompiling the following types from the original assembly:
|
|
||||||
|
|
||||||
| Native method | Observed behavior |
|
|
||||||
| --- | --- |
|
|
||||||
| `UIBlueprintInspector.Refresh(bool forModify, bool refreshComponent, bool refreshCode, bool loadExistHead = false)` | Controls native group sizes, later group positions, and content height; reloads the main description input only when `forModify` is false. |
|
|
||||||
| `UIBlueprintInspector._OnOpen()` and `_OnClose()` | Refresh and open native settings for the relevant mode; clear the blueprint on close. |
|
|
||||||
| `ManualBehaviour._Close()` | Deactivates the inspector GameObject, hiding children. |
|
|
||||||
| `UIBlueprintInspector.OnCustomFieldEndEdit(string str)` and `CollectExternalFields(int excludeTargetId = -1)` | Collect, escape, and validate pending custom-field edits through the native path. |
|
|
||||||
| `UIBlueprintInspector.OnCopyClick()`, `OnSaveChangesClick()`, and `OnSaveClick()` | Serialize or save the current blueprint with the game's native workflow. |
|
|
||||||
|
|
||||||
The native `descGroupTrans` in all three inspectors contains a description label at the top and an input beginning 22 pixels below it. The compact UXAssist entry occupies the right side of this existing title row; it does not move the title, input, groups, or scroll content. Options appear only on request inside the inspector and close after successful generation or inspector closure. The browser's file grid remains outside the UXAssist controls. Following the separate native settings panel is unnecessary, and no per-frame positioning patch is used.
|
|
||||||
|
|
||||||
`UIBlueprintInspector.Refresh(forModify: true)` does not reload `descTextInput`. Successful generation must assign both the blueprint description and its input before using the native modification refresh. Pending custom fields must first pass through the native field collection and escaping rules. Native copy and save handlers serialize the current blueprint, so they remain the actions used to share or persist a generated description.
|
|
||||||
|
|
||||||
Decompiled methods and extracted rectangle data are development artifacts under `UXAssist/obj/native-inspector/`. Reinspect the installed original assembly and assets after a game update; the publicized compile-time references omit method bodies.
|
|
||||||
|
|
||||||
## Managed production checks
|
|
||||||
|
|
||||||
Run the production checks and normal UXAssist build from the repository root:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
dotnet run --project UXAssist/tools/ProductionCheck/ProductionCheck.csproj -c Release
|
|
||||||
dotnet build UXAssist/UXAssist.csproj -c Release --no-restore
|
|
||||||
git diff --check
|
|
||||||
```
|
|
||||||
|
|
||||||
The production-basis cases check an undersupplied chain, recipe-ratio conversion, shared intermediate demand, joint products, a cycle with an output, research-matrix outlets, no internal intermediate, power-only selections, very different capacity scales, and unavailable material settings or final output. A successful bottleneck report must conserve material, normalize inputs and outputs to the same throughput, preserve rated group capacity and power, and avoid internal shortages. Existing default-mode expectations must continue to pass.
|
|
||||||
|
|
||||||
## Manual acceptance
|
|
||||||
|
|
||||||
No in-game, Unity event-loop, or third-party mod integration test has been performed for this change. Repeat these checks at the target profile's resolutions and UI scales, with each installed blueprint UI mod. The header entry avoids native layout writes but another mod may use the same extension space.
|
|
||||||
|
|
||||||
1. Open all three inspectors in English and Simplified Chinese. Confirm the header entry is readable without covering the title or editable description. Open and close its options, generate, and close the inspector. The options must not remain over the file grid or survive an inspector close.
|
|
||||||
2. Scroll the native description and custom fields and expand native foundation, fill-only, and reform settings. All native fields must retain their positions and sizes, and scrolling must reach every field.
|
|
||||||
3. Reopen each inspector and repeatedly refresh or change the blueprint selection. Confirm there is one entry, options are initially closed, the production basis resets to final-product output on opening, Spray Coaters set the automatic proliferation default, and a manual checkbox choice survives content refreshes in the current session.
|
|
||||||
4. Generate both production bases for an unbalanced chain. Final-product output should retain rated final capacity and show the missing intermediate; lowest intermediate throughput should reduce the common final-output mix, use correspondingly reduced external inputs, and show no internal shortage when the chain is complete and balanceable. Power should remain the same full-load estimate. Check necessary coproduct output separately from unused intermediate capacity.
|
|
||||||
5. Edit the description and unrelated custom fields before generating. Generate twice, including with 20 custom fields and with existing English or Chinese power fields. Confirm unrelated edits survive, duplicate power fields are consolidated, and failed generation leaves the prior description and fields intact. Include missing building settings, an unavailable bottleneck basis, and the native description length limit.
|
|
||||||
6. Save, copy the share code, and reopen or paste the blueprint through the native buttons. Confirm the generated main description, power field, and unrelated fields persist correctly. With a research-mode lab, confirm net produced matrices appear under Research without fabricated matrix imports or research speed.
|
|
||||||
7. Restart the test profile without UXAssist, then restore it and restart again. Confirm the entry and options are absent without UXAssist, native fields keep their normal layout in both cases, and repeated opening and generation work with the installed blueprint mods. `OnDisable` and inspector-destruction cleanup are code-review checks unless a development harness exercises them; a supported user-facing hot-disable workflow is not assumed.
|
|
||||||
@@ -40,16 +40,12 @@ When proliferation is enabled, ordinary recipes default to their native extra-pr
|
|||||||
|
|
||||||
## Fixed-building analysis
|
## Fixed-building analysis
|
||||||
|
|
||||||
By default, the black box evaluates each selected building at full load, even if another selected building cannot provide all its inputs. It does not simulate belt layouts, startup storage, or logistics throughput. Missing inputs appear as `RequiredExternalSupply`; byproducts and internal deficits retain producer and consumer group attribution. `GrossProduction` and `GrossConsumption` remain separate even when a recipe returns some of its own input. Material classification uses each process's net per-item flow, so that return cannot become a false external requirement or coproduct. The optional blueprint production basis below changes material ledgers only when explicitly requested.
|
The black box evaluates each selected building at full load, even if another selected building cannot provide all its inputs. It does not simulate belt layouts, startup storage, or logistics throughput. Missing inputs appear as `RequiredExternalSupply`; byproducts and internal deficits retain producer and consumer group attribution. `GrossProduction` and `GrossConsumption` remain separate even when a recipe returns some of its own input. Material classification uses each process's net per-item flow, so that return cannot become a false external requirement or coproduct.
|
||||||
|
|
||||||
`IntermediateShortage` records the missing externally supplied portion of an item produced and consumed within the selection. `OverbuildSurplus` and `CoproductSurplus` are independent nullable amounts; both can be positive for the same item. Equivalent buildings are grouped by recipe, building, proliferation mode, speed, and operating settings in stable order. Whole-building reductions are tested against every item's shared balance: no final-product capacity may decrease and no internal shortage may increase. The reduction identifies redundancy only; gross flows, original full-load inputs, outputs, and power never change. Coproduct supply counts only retained whole buildings required by a process's other products, and internal net consumption is credited before exposing the remainder. Headroom from a single-output producer or a joint process's limiting product remains ordinary balance, not a coproduct. When materials are incomplete, overbuild and coproduct amounts are unknown rather than fabricated from a partial layout.
|
`IntermediateShortage` records the missing externally supplied portion of an item produced and consumed within the selection. `OverbuildSurplus` and `CoproductSurplus` are independent nullable amounts; both can be positive for the same item. Equivalent buildings are grouped by recipe, building, proliferation mode, speed, and operating settings in stable order. Whole-building reductions are tested against every item's shared balance: no final-product capacity may decrease and no internal shortage may increase. The reduction identifies redundancy only; gross flows, original full-load inputs, outputs, and power never change. Coproduct supply counts only retained whole buildings required by a process's other products, and internal net consumption is credited before exposing the remainder. Headroom from a single-output producer or a joint process's limiting product remains ordinary balance, not a coproduct. When materials are incomplete, overbuild and coproduct amounts are unknown rather than fabricated from a partial layout.
|
||||||
|
|
||||||
`SteadyStateExternalSupply` is a separate input estimate from the known processes. After whole-building classification for complete selections, a fractional reduction of surplus intermediate producers propagates downstream limits through upstream processes. The reduction stops after a bounded number of passes, because a lossless cycle such as charging and discharging accumulators can otherwise pass a tiny leftover around indefinitely; stopping early only keeps the input estimate conservative. Every reduction applies to the entire process, keeps rated final-product capacity, and never worsens an existing intermediate shortage; deterministic grouping and ordering keep results independent of blueprint building order. For partial selections, skip whole-building classification but still cap independently known upstream inputs against known demand. Protect any known inputs of an unresolved downstream process, or all known products if its possible inputs are unknown, instead of treating its demand as zero. Only the blueprint description uses this estimate, marked as a known portion when incomplete. Gross ledgers, `RequiredExternalSupply`, uncertain overbuild and coproduct classification, independently known rated outputs, and power retain their original meaning.
|
`SteadyStateExternalSupply` is a separate input estimate from the known processes. After whole-building classification for complete selections, a fractional reduction of surplus intermediate producers propagates downstream limits through upstream processes. The reduction stops after a bounded number of passes, because a lossless cycle such as charging and discharging accumulators can otherwise pass a tiny leftover around indefinitely; stopping early only keeps the input estimate conservative. Every reduction applies to the entire process, keeps rated final-product capacity, and never worsens an existing intermediate shortage; deterministic grouping and ordering keep results independent of blueprint building order. For partial selections, skip whole-building classification but still cap independently known upstream inputs against known demand. Protect any known inputs of an unresolved downstream process, or all known products if its possible inputs are unknown, instead of treating its demand as zero. Only the blueprint description uses this estimate, marked as a known portion when incomplete. Gross ledgers, `RequiredExternalSupply`, uncertain overbuild and coproduct classification, independently known rated outputs, and power retain their original meaning.
|
||||||
|
|
||||||
`FactoryBlackBoxRequest.ProductionBasis` defaults to `BlueprintProductionBasis.FinalProducts`, preserving these existing full-load semantics for all callers. The blueprint inspector can explicitly select `BottleneckIntermediate`. This mode reuses `TwoPhaseSimplex` to maximize one common fraction, no greater than 1, of the selected final-product mix, bounded by each selected process's capacity. Terminal consumers without item outputs, such as launchers, fuel generators, or precisely configured research, operate at that same fraction. Every internally produced material must balance without external imports; only materials with no selected producer can enter from outside. Capacities are converted through recipe ratios and shared consumption, rather than comparing different items' absolute per-minute rates. Joint products and selected cycles participate in the same balance; no unselected recipe is introduced. After maximizing the common fraction, the solver minimizes used building capacity, then remaining normalized surplus.
|
|
||||||
|
|
||||||
On a successful bottleneck calculation, all material ledgers, external inputs, final outputs, and research-matrix outlets use the normalized process rates. Unused positive intermediate capacity, including fractional building capacity, is reported as excess. This measures spare rated capacity rather than actual surplus stock or extra throughput; that capacity may not be simultaneously attainable from the normalized upstream flow. Surplus necessarily produced alongside required joint products remains coproduct output. A complete, balanceable chain therefore has no internal shortage within numerical tolerance. `Groups` and power retain the full selected building capacities, so normalized material rates must not be used to infer reduced power demand. Unknown material data, an unidentified final outlet, zero feasible throughput, or a failed or limited solve produces `BlueprintBasisUnavailable`; the inspector then preserves the existing description and fields. A pure cycle without a final outlet cannot establish this basis. A selection with no internal intermediate can retain its rated final output; a known selection with no material flows can still generate its power field without a material solve. Independently unknown power does not become known through balancing.
|
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
var capture = BlueprintSelectionReader.Capture(factory, selectedObjectIds);
|
var capture = BlueprintSelectionReader.Capture(factory, selectedObjectIds);
|
||||||
var selection = capture.CreateRequest(proliferationEnabled: true);
|
var selection = capture.CreateRequest(proliferationEnabled: true);
|
||||||
@@ -70,13 +66,11 @@ Native research uses the current lab technology's matrix point requirements, wit
|
|||||||
|
|
||||||
## Blueprint descriptions
|
## Blueprint descriptions
|
||||||
|
|
||||||
The shared `UIBlueprintInspector` in browser, copy, and paste modes adds a compact `Auto-fill` entry to the existing description header. Its options open on demand within the inspector, rather than occupying the browser file grid. Only UXAssist-owned transforms are positioned: native fields, groups, anchors, and scroll height remain owned by the game. No per-frame layout patch or native-settings tracking is needed. Disable and destruction remove only the UXAssist controls.
|
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.
|
||||||
|
|
||||||
The options contain `Auto-fill description`, `Proliferation`, and a `Production basis` selector with a localized help tip. Each inspector open resets the basis to `Final-product output`, retaining existing calculation behavior; selecting `Lowest intermediate throughput` opts into `BottleneckIntermediate` for generation. 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. Generation captures only `blueprint.buildings` with `BlueprintSelectionReader.FromBlueprint` on the game thread, then runs `FactoryBlackBoxAnalyzer` against the captured catalog. A successful bottleneck solve supplies classification and steady-state balances directly; the original classifier runs only in final-product mode or after an unavailable bottleneck result. 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 excess classified by the selected production basis; `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 1,234K); if no suffix preserves that display precision, keep the ordinary number. Numbers with four or more integer digits use comma thousands separators, including coefficients before material or power units. 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.
|
||||||
|
|
||||||
`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 or bottleneck basis, 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` owns the groups' positions and scroll height. `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. See [blueprint description validation](BlueprintDescriptionValidation.md) for native layout evidence and manual compatibility checks.
|
|
||||||
|
|
||||||
## Special-process settings
|
## Special-process settings
|
||||||
|
|
||||||
@@ -129,8 +123,7 @@ Use a test game for the following manual checks. Compare full-load rates only wi
|
|||||||
- Select miners at different machine speeds, including one with a backed-up output, a gas collector, and renewable generators. Check native miner power scaling, full-load miner output regardless of the output backlog, per-minute gas output without added grid demand, and ideal rated renewable power rather than local conditions.
|
- Select miners at different machine speeds, including one with a backed-up output, a gas collector, and renewable generators. Check native miner power scaling, full-load miner output regardless of the output backlog, per-minute gas output without added grid demand, and ideal rated renewable power rather than local conditions.
|
||||||
- Select ray receivers in both modes, fuel generators, ejectors, and silos. Toggle proliferation and compare working power, generation, accumulator exchange, and Dyson demand as separate quantities. In a sandbox game, capture boosted artificial stars and launchers, and confirm that blueprint analysis of boosted buildings requires `BoostEnabled`.
|
- Select ray receivers in both modes, fuel generators, ejectors, and silos. Toggle proliferation and compare working power, generation, accumulator exchange, and Dyson demand as separate quantities. In a sandbox game, capture boosted artificial stars and launchers, and confirm that blueprint analysis of boosted buildings requires `BoostEnabled`.
|
||||||
- Remove an upstream producer from a mixed production selection. Confirm that downstream capacity is unchanged and the missing material appears as required external supply. Add one producer more than downstream demand needs, and confirm that only that whole building's output is reported as excess.
|
- Remove an upstream producer from a mixed production selection. Confirm that downstream capacity is unchanged and the missing material appears as required external supply. Add one producer more than downstream demand needs, and confirm that only that whole building's output is reported as excess.
|
||||||
- In browser, copy, and paste inspectors, check the localized description-header entry and options, Spray Coater defaults and manual overrides, and native item tags in the generated description and `Power` field. Confirm options close after successful generation or inspector closure, the file grid stays usable, and native settings and description fields retain their positions. Generate twice and at the 20-field limit; verify that pending manual edits, unrelated fields, save/copy behavior, and ordinary blueprint sharing remain intact.
|
- In browser, copy, and paste inspectors, check localized control placement, Spray Coater defaults and manual overrides, and native item tags in the generated description and `Power` field. Generate twice and at the 20-field limit; verify that pending manual edits, unrelated fields, save/copy behavior, and ordinary blueprint sharing remain intact. Compare joint-production overbuild with necessary coproduct output without replacing original full-load rates or power.
|
||||||
- Compare both production bases on an undersupplied chain, uneven recipe ratios, shared intermediate branches, and a joint-product chain. Final-product mode must retain rated final outputs and expose intermediate shortages. Bottleneck mode must scale final outputs together, update raw inputs to the same throughput, and leave no internal shortage for a complete, balanceable chain. Confirm unused intermediate capacity and necessary coproduct output remain distinct, and that power stays at the same full-load estimate. Test a chain without internal intermediates, missing building settings, and a cycle without a final outlet; an unavailable bottleneck basis must preserve existing description and fields.
|
|
||||||
- Place one research-mode lab alongside one or all six matrix production chains. Confirm the matrices' positive net production appears only in the Research line, other final products stay in Output, and known in-blueprint matrix consumption reduces the Research rate. Do not fabricate lab matrix imports, excess, or an estimated lab consumption rate; change current technology, add more labs, and toggle proliferation to check matrix routing stays independent while full working power updates. Without the lab, normal matrix output and overbuild rules resume.
|
- Place one research-mode lab alongside one or all six matrix production chains. Confirm the matrices' positive net production appears only in the Research line, other final products stay in Output, and known in-blueprint matrix consumption reduces the Research rate. Do not fabricate lab matrix imports, excess, or an estimated lab consumption rate; change current technology, add more labs, and toggle proliferation to check matrix routing stays independent while full working power updates. Without the lab, normal matrix output and overbuild rules resume.
|
||||||
- Combine planner targets with shared coproducts, explicit raw-material boundaries, and alternate selected recipes. Confirm material conservation, shared surplus reuse, and no introduction of unselected recipes.
|
- Combine planner targets with shared coproducts, explicit raw-material boundaries, and alternate selected recipes. Confirm material conservation, shared surplus reuse, and no introduction of unselected recipes.
|
||||||
- Toggle belt-signal proliferation and reload a game. Confirm that existing belts use the new catalog, item generation continues, and fractional production and consumption statistics remain independent.
|
- Toggle belt-signal proliferation and reload a game. Confirm that existing belts use the new catalog, item generation continues, and fractional production and consumption statistics remain independent.
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "UXAssist",
|
"name": "UXAssist",
|
||||||
"version_number": "1.6.4",
|
"version_number": "1.6.3",
|
||||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ internal static class Program
|
|||||||
BlueprintMixedProducersAndCycles();
|
BlueprintMixedProducersAndCycles();
|
||||||
SteadyStateLosslessCycle();
|
SteadyStateLosslessCycle();
|
||||||
BlueprintProliferationAndCompleteness();
|
BlueprintProliferationAndCompleteness();
|
||||||
BlueprintProductionBases();
|
|
||||||
BlueprintDescriptionFormattingAndFields();
|
BlueprintDescriptionFormattingAndFields();
|
||||||
LogisticsChargingPower();
|
LogisticsChargingPower();
|
||||||
FractionationFlow();
|
FractionationFlow();
|
||||||
@@ -1038,35 +1037,35 @@ internal static class Program
|
|||||||
{
|
{
|
||||||
new ProductionItem(ItemIds.Water, 0, true, false, 0, 0),
|
new ProductionItem(ItemIds.Water, 0, true, false, 0, 0),
|
||||||
new ProductionItem(ItemIds.ProliferatorMkIII, 201, false, false, 4, 75),
|
new ProductionItem(ItemIds.ProliferatorMkIII, 201, false, false, 4, 75),
|
||||||
new ProductionItem(ItemIds.TitaniumAlloy, 202, false, false, 0, 0),
|
new ProductionItem(ItemIds.Steel, 202, false, false, 0, 0),
|
||||||
new ProductionItem(ItemIds.CasimirCrystal, 203, false, false, 0, 0),
|
new ProductionItem(ItemIds.SpaceWarper, 203, false, false, 0, 0),
|
||||||
new ProductionItem(ItemIds.Prism, 204, false, false, 0, 0)
|
new ProductionItem(ItemIds.TitaniumGlass, 204, false, false, 0, 0)
|
||||||
};
|
};
|
||||||
var recipes = new[]
|
var recipes = new[]
|
||||||
{
|
{
|
||||||
Recipe(201, new[] { (ItemIds.Water, 1.0) },
|
Recipe(201, new[] { (ItemIds.Water, 1.0) },
|
||||||
new[] { (ItemIds.ProliferatorMkIII, 1.0) }),
|
new[] { (ItemIds.ProliferatorMkIII, 1.0) }),
|
||||||
Recipe(202, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.TitaniumAlloy, 1.0) }),
|
Recipe(202, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.Steel, 1.0) }),
|
||||||
Recipe(203, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.CasimirCrystal, 1.0) }),
|
Recipe(203, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.SpaceWarper, 1.0) }),
|
||||||
Recipe(204, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.Prism, 1.0) },
|
Recipe(204, new[] { (ItemIds.Water, 1.0) }, new[] { (ItemIds.TitaniumGlass, 1.0) },
|
||||||
productive: false)
|
productive: false)
|
||||||
};
|
};
|
||||||
var catalog = new ProductionCatalog(items, recipes, Array.Empty<ProductionBuilding>(),
|
var catalog = new ProductionCatalog(items, recipes, Array.Empty<ProductionBuilding>(),
|
||||||
new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 });
|
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 });
|
||||||
var request = BeltSignalSourcePreset.Create(catalog, ItemIds.TitaniumAlloy, true, true);
|
var request = BeltSignalSourcePreset.Create(catalog, ItemIds.Steel, true, true);
|
||||||
Check(request.ExternalMaterials.SetEquals(new[] { ItemIds.Water }),
|
Check(request.ExternalMaterials.SetEquals(new[] { ItemIds.Water }),
|
||||||
"only known natural belt source IDs become external materials");
|
"only known natural belt source IDs become external materials");
|
||||||
Equal(ItemIds.ProliferatorMkIII, request.ProliferatorItemId,
|
Equal(ItemIds.ProliferatorMkIII, request.ProliferatorItemId,
|
||||||
"belt policy uses the available proliferator item");
|
"belt policy uses the available proliferator item");
|
||||||
Check(request.SelfSprayProliferator && request.SprayDeliveredItems.Contains(ItemIds.TitaniumAlloy),
|
Check(request.SelfSprayProliferator && request.SprayDeliveredItems.Contains(ItemIds.Steel),
|
||||||
"self-spray and delivered-item spraying are request settings");
|
"self-spray and delivered-item spraying are request settings");
|
||||||
Check(request.ProliferationModeByItem[ItemIds.TitaniumAlloy] == ProliferationMode.ExtraProducts,
|
Check(request.ProliferationModeByItem[ItemIds.Steel] == ProliferationMode.ExtraProducts,
|
||||||
"productive legacy extra-products choice maps to a native mode");
|
"productive legacy extra-products choice maps to a native mode");
|
||||||
Check(request.ProliferationModeByItem[ItemIds.CasimirCrystal] == ProliferationMode.None,
|
Check(request.ProliferationModeByItem[ItemIds.SpaceWarper] == ProliferationMode.None,
|
||||||
"legacy disabled item keeps its no-proliferation preset");
|
"legacy disabled item keeps its no-proliferation preset");
|
||||||
Check(request.ProliferationModeByItem[ItemIds.Prism] == ProliferationMode.Speedup,
|
Check(request.ProliferationModeByItem[ItemIds.TitaniumGlass] == ProliferationMode.Speedup,
|
||||||
"unsupported extra-products choice falls back to native speedup");
|
"unsupported extra-products choice falls back to native speedup");
|
||||||
var report = new ProductionPlanner(catalog).Calculate(request);
|
var report = new ProductionPlanner(catalog).Calculate(request);
|
||||||
Check(report.MaterialComplete, "belt preset resolves the proliferator's recipe and raw materials");
|
Check(report.MaterialComplete, "belt preset resolves the proliferator's recipe and raw materials");
|
||||||
@@ -1085,7 +1084,7 @@ internal static class Program
|
|||||||
Array.Empty<ProductionBuilding>(), new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
Array.Empty<ProductionBuilding>(), new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 });
|
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 });
|
||||||
var updated = BeltSignalSourcePreset.Create(updatedCatalog, ItemIds.TitaniumAlloy, true, false);
|
var updated = BeltSignalSourcePreset.Create(updatedCatalog, ItemIds.Steel, true, false);
|
||||||
Equal(9999, updated.ProliferatorItemId, "updated game data selects a valid proliferator instead of a stale ID");
|
Equal(9999, updated.ProliferatorItemId, "updated game data selects a valid proliferator instead of a stale ID");
|
||||||
|
|
||||||
var alternativeCatalog = new ProductionCatalog(new[]
|
var alternativeCatalog = new ProductionCatalog(new[]
|
||||||
@@ -2021,206 +2020,6 @@ internal static class Program
|
|||||||
"an unresolved but known downstream input prevents underestimating its upstream supply");
|
"an unresolved but known downstream input prevents underestimating its upstream supply");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void BlueprintProductionBases()
|
|
||||||
{
|
|
||||||
var analyzer = new FactoryBlackBoxAnalyzer(BlueprintCatalog());
|
|
||||||
var request = BlueprintRequest(1);
|
|
||||||
var rated = analyzer.Analyze(request);
|
|
||||||
Equal(60, rated.ItemFlows[2].IntermediateShortage,
|
|
||||||
"default final-product basis retains the selected downstream shortage");
|
|
||||||
request.ProductionBasis = BlueprintProductionBasis.BottleneckIntermediate;
|
|
||||||
var balanced = analyzer.Analyze(request);
|
|
||||||
Check(balanced.MaterialComplete && !balanced.Diagnostics.Any(), "bottleneck coproduct chain is complete");
|
|
||||||
Equal(0.5, balanced.ItemFlows[4].NetFlow, "limiting A capacity halves final output");
|
|
||||||
Equal(1, balanced.ItemFlows[1].SteadyStateExternalSupply.Value, "raw input uses the same feasible basis");
|
|
||||||
Equal(45, balanced.ItemFlows[3].CoproductSurplus.Value, "joint output retains its unavoidable B45 surplus");
|
|
||||||
Equal(0, balanced.ItemFlows[2].IntermediateShortage, "bottleneck mode solves rather than hides missing A");
|
|
||||||
Equal(60, balanced.ItemFlows[2].GrossConsumption, "downstream consumption is actually reduced");
|
|
||||||
Equal(rated.Power.ConsumptionWatts, balanced.Power.ConsumptionWatts,
|
|
||||||
"power still sizes all selected facilities at rated load");
|
|
||||||
Equal(rated.Groups[1].ExecutionsPerMinute, balanced.Groups[1].ExecutionsPerMinute,
|
|
||||||
"selected group capacities stay available separately from basis material flows");
|
|
||||||
var labels = new BlueprintDescriptionLabels("Factory power", "Logistics power", "Missing: ",
|
|
||||||
"Excess: ", "Unknown", "(known portion)", "Input: ", "Output: ", "Research: ");
|
|
||||||
var balancedText = BlueprintDescriptionFormatter.Format(balanced, TestItemTag, labels);
|
|
||||||
Check(!balancedText.Warnings.Contains("Missing:"), "a solved bottleneck does not format an internal shortage");
|
|
||||||
Check(balancedText.Input == TestItemTag(1) + " x1", "formatted input uses normalized raw demand");
|
|
||||||
Check(balancedText.Output == TestItemTag(3) + " x45, " + TestItemTag(4) + " x0.5",
|
|
||||||
"formatted output uses the same normalized final and coproduct rates");
|
|
||||||
|
|
||||||
var ratioCatalog = BasisCatalog(new[]
|
|
||||||
{
|
|
||||||
Recipe(801, new[] { (1, 1.0) }, new[] { (2, 0.5) }),
|
|
||||||
Recipe(802, new[] { (1, 1.0) }, new[] { (3, 100.0) }),
|
|
||||||
Recipe(803, new[] { (2, 1.0), (3, 100.0) }, new[] { (4, 10.0) })
|
|
||||||
});
|
|
||||||
var ratioRequest = BasisRequest(801, 802, 803);
|
|
||||||
var ratio = new FactoryBlackBoxAnalyzer(ratioCatalog).Analyze(ratioRequest);
|
|
||||||
Equal(5, ratio.ItemFlows[4].NetFlow, "different intermediate units are converted through recipe ratios");
|
|
||||||
Equal(50, ratio.ItemFlows[3].GrossConsumption, "large-count ingredient uses normalized demand");
|
|
||||||
Equal(50, ratio.ItemFlows[3].OverbuildSurplus.Value, "unused intermediate capacity is excess");
|
|
||||||
Equal(1.5, ratio.ItemFlows[1].SteadyStateExternalSupply.Value, "external inputs share the selected basis");
|
|
||||||
Check(ratio.ItemFlows.Values.All(flow => flow.IntermediateShortage == 0),
|
|
||||||
"ratio-scaled complete chain has no internal missing material");
|
|
||||||
var ratioReverse = BasisRequest(803, 802, 801);
|
|
||||||
var reversed = new FactoryBlackBoxAnalyzer(ratioCatalog).Analyze(ratioReverse);
|
|
||||||
foreach (var flow in ratio.ItemFlows.Values)
|
|
||||||
{
|
|
||||||
Equal(flow.GrossProduction, reversed.ItemFlows[flow.ItemId].GrossProduction,
|
|
||||||
"bottleneck production is independent of selection order");
|
|
||||||
Equal(flow.GrossConsumption, reversed.ItemFlows[flow.ItemId].GrossConsumption,
|
|
||||||
"bottleneck consumption is independent of selection order");
|
|
||||||
}
|
|
||||||
var unevenCatalog = BasisCatalog(new[]
|
|
||||||
{
|
|
||||||
Recipe(804, new[] { (1, 1.0) }, new[] { (2, 0.5) }),
|
|
||||||
Recipe(805, new[] { (2, 1e8) }, new[] { (4, 1e8) })
|
|
||||||
});
|
|
||||||
var uneven = new FactoryBlackBoxAnalyzer(unevenCatalog).Analyze(BasisRequest(804, 805));
|
|
||||||
Check(!uneven.Diagnostics.Any(), "a small common fraction can still represent meaningful known throughput");
|
|
||||||
Equal(0.5, uneven.ItemFlows[4].NetFlow, "large capacity ratios do not become a false zero-throughput failure");
|
|
||||||
|
|
||||||
var sharedCatalog = BasisCatalog(new[]
|
|
||||||
{
|
|
||||||
Recipe(811, new[] { (1, 1.0) }, new[] { (2, 3.0) }),
|
|
||||||
Recipe(812, new[] { (2, 2.0) }, new[] { (3, 3.0) }),
|
|
||||||
Recipe(813, new[] { (2, 3.0) }, new[] { (4, 4.0) })
|
|
||||||
});
|
|
||||||
var shared = new FactoryBlackBoxAnalyzer(sharedCatalog).Analyze(BasisRequest(811, 812, 813));
|
|
||||||
Equal(1.8, shared.ItemFlows[3].NetFlow, "shared material scales the first final branch by 3/5");
|
|
||||||
Equal(2.4, shared.ItemFlows[4].NetFlow, "shared material scales the second final branch by 3/5");
|
|
||||||
Equal(3, shared.ItemFlows[2].GrossConsumption, "shared demand sums both branches");
|
|
||||||
Equal(1, shared.ItemFlows[1].RequiredExternalSupply, "shared branches use one common raw-input ledger");
|
|
||||||
Equal(1, shared.ItemFlows[1].SteadyStateExternalSupply.Value,
|
|
||||||
"steady-state supply matches the normalized shared-branch ledger");
|
|
||||||
foreach (var report in new[] { balanced, ratio, shared })
|
|
||||||
foreach (var flow in report.ItemFlows.Values.Where(flow => flow.ProducerGroups.Count > 0 &&
|
|
||||||
flow.ConsumerGroups.Count > 0))
|
|
||||||
Check(flow.NetFlow >= -1e-7 * Math.Max(1, Math.Max(flow.GrossProduction, flow.GrossConsumption)),
|
|
||||||
"normalized gross ledgers conserve internal material within relative tolerance");
|
|
||||||
|
|
||||||
var knownMaterialsRequest = BlueprintRequest(1);
|
|
||||||
knownMaterialsRequest.ProductionBasis = BlueprintProductionBasis.BottleneckIntermediate;
|
|
||||||
knownMaterialsRequest.Buildings.Add(new ProductionBuildingSnapshot(3, 30, 0, 1, ProliferationMode.None));
|
|
||||||
var unknownPower = analyzer.Analyze(knownMaterialsRequest);
|
|
||||||
Check(unknownPower.MaterialComplete && !unknownPower.PowerComplete && !unknownPower.Diagnostics.Any(
|
|
||||||
diagnostic => diagnostic.Code == ProductionDiagnosticCode.BlueprintBasisUnavailable),
|
|
||||||
"unknown logistics power does not discard independently known bottleneck materials");
|
|
||||||
Equal(0.5, unknownPower.ItemFlows[4].NetFlow, "known material throughput survives unknown power");
|
|
||||||
var powerOnlyRequest = new FactoryBlackBoxRequest
|
|
||||||
{ ProductionBasis = BlueprintProductionBasis.BottleneckIntermediate };
|
|
||||||
powerOnlyRequest.Buildings.Add(new ProductionBuildingSnapshot(1, 31, 0, 1, ProliferationMode.None));
|
|
||||||
powerOnlyRequest.Buildings.Add(new ProductionBuildingSnapshot(2, 30, 0, 1, ProliferationMode.None,
|
|
||||||
operatingParameters: new Dictionary<string, double> { ["ChargePowerWatts"] = 500 }));
|
|
||||||
var powerOnly = analyzer.Analyze(powerOnlyRequest);
|
|
||||||
Check(powerOnly.MaterialComplete && powerOnly.PowerComplete && !powerOnly.Diagnostics.Any(),
|
|
||||||
"known power-only blueprints have an empty material ledger that needs no basis reduction");
|
|
||||||
Check(powerOnly.ItemFlows.Count == 0, "power-only blueprints do not fabricate material rates");
|
|
||||||
var powerOnlyText = BlueprintDescriptionFormatter.Format(powerOnly, TestItemTag, labels);
|
|
||||||
Check(powerOnlyText.Description.Length == 0 && powerOnlyText.Power == "Factory power 900W | Logistics power 500W",
|
|
||||||
"power-only generation keeps its useful power field under the bottleneck option");
|
|
||||||
powerOnlyRequest.ProductionBasis = BlueprintProductionBasis.FinalProducts;
|
|
||||||
Equal(analyzer.Analyze(powerOnlyRequest).Power.ConsumptionWatts, powerOnly.Power.ConsumptionWatts,
|
|
||||||
"power-only layouts have the same selected capacity under either material basis");
|
|
||||||
|
|
||||||
var cycleCatalog = BasisCatalog(new[]
|
|
||||||
{
|
|
||||||
Recipe(821, new[] { (1, 1.0) }, new[] { (2, 0.5) }),
|
|
||||||
Recipe(822, new[] { (2, 2.0) }, new[] { (3, 1.0) }),
|
|
||||||
Recipe(823, new[] { (3, 1.0) }, new[] { (2, 1.0), (4, 1.0) })
|
|
||||||
});
|
|
||||||
var cycle = new FactoryBlackBoxAnalyzer(cycleCatalog).Analyze(BasisRequest(821, 822, 823));
|
|
||||||
Equal(0.5, cycle.ItemFlows[4].NetFlow, "returned intermediate participates in the bottleneck solve");
|
|
||||||
Equal(0, cycle.ItemFlows[2].NetFlow, "cyclic first material conserves at normalized throughput");
|
|
||||||
Equal(0, cycle.ItemFlows[3].NetFlow, "cyclic second material conserves at normalized throughput");
|
|
||||||
Check(cycle.ItemFlows.Values.All(flow => flow.IntermediateShortage == 0),
|
|
||||||
"a feasible cycle has no internal missing material");
|
|
||||||
|
|
||||||
var single = new FactoryBlackBoxAnalyzer(ratioCatalog).Analyze(BasisRequest(801));
|
|
||||||
Equal(0.5, single.ItemFlows[2].NetFlow, "no-intermediate selection keeps final capacity");
|
|
||||||
Equal(1, single.ItemFlows[1].SteadyStateExternalSupply.Value, "no-intermediate raw input remains known");
|
|
||||||
var subset = new FactoryBlackBoxAnalyzer(ratioCatalog).Analyze(BasisRequest(803));
|
|
||||||
Equal(10, subset.ItemFlows[4].NetFlow, "a blueprint subset treats absent upstream stages as external");
|
|
||||||
Equal(100, subset.ItemFlows[3].SteadyStateExternalSupply.Value,
|
|
||||||
"an absent producer remains a real external input");
|
|
||||||
var unknownRequest = BasisRequest(801, 803, 9999);
|
|
||||||
var unknown = new FactoryBlackBoxAnalyzer(ratioCatalog).Analyze(unknownRequest);
|
|
||||||
Check(!unknown.MaterialComplete && unknown.Diagnostics.Any(diagnostic =>
|
|
||||||
diagnostic.Code == ProductionDiagnosticCode.BlueprintBasisUnavailable),
|
|
||||||
"unknown production prevents claiming a complete bottleneck balance");
|
|
||||||
Equal(0.5, unknown.ItemFlows[2].IntermediateShortage,
|
|
||||||
"unavailable basis preserves the original known shortage");
|
|
||||||
var closed = new FactoryBlackBoxAnalyzer(BlueprintCatalog()).Analyze(BasisRequest(621, 622));
|
|
||||||
Check(closed.Diagnostics.Any(diagnostic => diagnostic.Code == ProductionDiagnosticCode.BlueprintBasisUnavailable),
|
|
||||||
"a pure closed loop has no final output from which to choose a common basis");
|
|
||||||
var infeasibleCatalog = BasisCatalog(new[]
|
|
||||||
{
|
|
||||||
Recipe(831, new[] { (2, 1.0) }, new[] { (3, 1.0), (4, 1.0) }),
|
|
||||||
Recipe(832, new[] { (3, 1.0) }, new[] { (2, 0.5) })
|
|
||||||
});
|
|
||||||
var infeasible = new FactoryBlackBoxAnalyzer(infeasibleCatalog).Analyze(BasisRequest(831, 832));
|
|
||||||
Check(infeasible.Diagnostics.Any(diagnostic =>
|
|
||||||
diagnostic.Code == ProductionDiagnosticCode.BlueprintBasisUnavailable),
|
|
||||||
"zero feasible final throughput cannot masquerade as a balanced zero-output description");
|
|
||||||
Equal(1, infeasible.ItemFlows[4].NetFlow, "infeasible basis keeps the original known final rate");
|
|
||||||
|
|
||||||
var sinkCatalog = BasisCatalog(new[]
|
|
||||||
{
|
|
||||||
Recipe(841, new[] { (1, 1.0) }, new[] { (2, 0.5) }),
|
|
||||||
Recipe(842, new[] { (2, 1.0) }, Array.Empty<(int, double)>())
|
|
||||||
});
|
|
||||||
var sink = new FactoryBlackBoxAnalyzer(sinkCatalog).Analyze(BasisRequest(841, 842));
|
|
||||||
Check(!sink.Diagnostics.Any(), "a consuming terminal process supplies a non-item final target");
|
|
||||||
Equal(0.5, sink.ItemFlows[2].GrossConsumption,
|
|
||||||
"a non-item terminal consumer follows the bottleneck instead of silently idling");
|
|
||||||
|
|
||||||
var researchCatalog = new ProductionCatalog(ratioCatalog.Items.Values, ratioCatalog.Recipes.Values,
|
|
||||||
ratioCatalog.Buildings.Values, new[] { 0.0 }, new[] { 0.0 }, new[] { 1.0 },
|
|
||||||
researchMatrixItemIds: new[] { 2 });
|
|
||||||
var researchRequest = BasisRequest(801, 803);
|
|
||||||
researchRequest.Buildings.Add(new ProductionBuildingSnapshot(9, 11, 0, 1, ProliferationMode.None,
|
|
||||||
operatingParameters: new Dictionary<string, double>
|
|
||||||
{ ["ResearchMode"] = 1, ["ResearchMatrixSink"] = 1 }));
|
|
||||||
var research = new FactoryBlackBoxAnalyzer(researchCatalog).Analyze(researchRequest);
|
|
||||||
Equal(5, research.ItemFlows[4].NetFlow, "known matrix consumption still constrains the final product");
|
|
||||||
Equal(0, research.ItemFlows[2].NetFlow, "matrix outlet does not fabricate extra matrix consumption");
|
|
||||||
Check(!research.ItemFlows[2].IsResearchProduct, "no positive matrix net means no research output");
|
|
||||||
var matrixOnlyRequest = BasisRequest(801);
|
|
||||||
matrixOnlyRequest.Buildings.Add(researchRequest.Buildings.Last());
|
|
||||||
var matrixOnly = new FactoryBlackBoxAnalyzer(researchCatalog).Analyze(matrixOnlyRequest);
|
|
||||||
Equal(0.5, matrixOnly.ItemFlows[2].NetFlow, "research outlet preserves produced matrices as a final target");
|
|
||||||
Check(matrixOnly.ItemFlows[2].IsResearchProduct, "positive matrix net remains a research product");
|
|
||||||
var researchConsumedRequest = BasisRequest(801, 803);
|
|
||||||
researchConsumedRequest.Buildings[0] = new ProductionBuildingSnapshot(1, 10, 801, 3,
|
|
||||||
ProliferationMode.None);
|
|
||||||
researchConsumedRequest.Buildings.Add(researchRequest.Buildings.Last());
|
|
||||||
var researchConsumed = new FactoryBlackBoxAnalyzer(researchCatalog).Analyze(researchConsumedRequest);
|
|
||||||
Equal(0.5, researchConsumed.ItemFlows[2].NetFlow,
|
|
||||||
"positive research matrix output subtracts real downstream matrix use");
|
|
||||||
Check(researchConsumed.ItemFlows[2].IsResearchProduct,
|
|
||||||
"matrix outlets preserve the positive net target alongside an ordinary final product");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ProductionCatalog BasisCatalog(IEnumerable<ProductionRecipe> recipes)
|
|
||||||
{
|
|
||||||
return new ProductionCatalog(Enumerable.Range(1, 4)
|
|
||||||
.Select(id => new ProductionItem(id, 0, id == 1, false, 0, 0)), recipes,
|
|
||||||
new[]
|
|
||||||
{
|
|
||||||
new ProductionBuilding(10, ProductionRecipeCategory.Assemble, 1, 1000, 100),
|
|
||||||
new ProductionBuilding(11, ProductionRecipeCategory.Research, 1, 2000, 200)
|
|
||||||
}, new[] { 0.0 }, new[] { 0.0 }, new[] { 1.0 });
|
|
||||||
}
|
|
||||||
|
|
||||||
private static FactoryBlackBoxRequest BasisRequest(params int[] recipes)
|
|
||||||
{
|
|
||||||
var request = new FactoryBlackBoxRequest { ProductionBasis = BlueprintProductionBasis.BottleneckIntermediate };
|
|
||||||
for (var index = 0; index < recipes.Length; index++)
|
|
||||||
request.Buildings.Add(new ProductionBuildingSnapshot(index + 1, 10, recipes[index], 1,
|
|
||||||
ProliferationMode.None));
|
|
||||||
return request;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void BlueprintDescriptionFormattingAndFields()
|
private static void BlueprintDescriptionFormattingAndFields()
|
||||||
{
|
{
|
||||||
var labels = new BlueprintDescriptionLabels("工厂耗电", "物流耗电", "缺少:", "多余:", "未知",
|
var labels = new BlueprintDescriptionLabels("工厂耗电", "物流耗电", "缺少:", "多余:", "未知",
|
||||||
@@ -2275,11 +2074,7 @@ internal static class Program
|
|||||||
"gigawatt and megawatt display matches the native Chinese field example");
|
"gigawatt and megawatt display matches the native Chinese field example");
|
||||||
Check(large.Input == "" && large.Output == "" && large.Description == "",
|
Check(large.Input == "" && large.Output == "" && large.Description == "",
|
||||||
"empty material categories add no description lines");
|
"empty material categories add no description lines");
|
||||||
foreach (var (watts, expected) in new[]
|
foreach (var (watts, expected) in new[] { (999.999, "1kW"), (999999.0, "1MW"), (999.994, "999.99W") })
|
||||||
{
|
|
||||||
(999.999, "1kW"), (999999.0, "1MW"), (999.994, "999.99W"),
|
|
||||||
(1234567890000000.0, "1,234.57TW")
|
|
||||||
})
|
|
||||||
{
|
{
|
||||||
var boundary = new ProductionReport(ProductionStatus.Complete, true, true,
|
var boundary = new ProductionReport(ProductionStatus.Complete, true, true,
|
||||||
Array.Empty<ProductionItemFlow>(), Array.Empty<ProductionGroupFlow>(),
|
Array.Empty<ProductionItemFlow>(), Array.Empty<ProductionGroupFlow>(),
|
||||||
@@ -2362,44 +2157,6 @@ internal static class Program
|
|||||||
rounded.Description == "输出:" + rounded.Output,
|
rounded.Description == "输出:" + rounded.Output,
|
||||||
"no consumers means no power field and an output-only report has one line");
|
"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, "1,234K"), (1234500.0, "1,234.5K"), (1230000000.0, "1,230M"),
|
|
||||||
(12345.0, "12,345"), (1200.01, "1,200.01"),
|
|
||||||
(999.99, "999.99"), (1000.01, "1,000.01"),
|
|
||||||
(999999.0, "999,999"), (999999.99, "999,999.99"),
|
|
||||||
(1234567890123.0, "1,234,567,890,123"), (1234000000000.0, "1,234G"),
|
|
||||||
(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,
|
var inputOnlyReport = new ProductionReport(ProductionStatus.Complete, true, true,
|
||||||
new[] { new ProductionItemFlow(51, 0, 3, 0, 0, 0, 0, 3,
|
new[] { new ProductionItemFlow(51, 0, 3, 0, 0, 0, 0, 3,
|
||||||
false, Array.Empty<int>(), Array.Empty<int>()) },
|
false, Array.Empty<int>(), Array.Empty<int>()) },
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
|
using UXAssist.Common.ModFeatures;
|
||||||
|
|
||||||
namespace UniverseGenTweaks;
|
namespace UniverseGenTweaks;
|
||||||
|
|
||||||
|
[ModFeature("UniverseGenSave", Order = 13)]
|
||||||
public static class GalaxyGenSave
|
public static class GalaxyGenSave
|
||||||
{
|
{
|
||||||
public static void Export(BinaryWriter w)
|
public static void Export(BinaryWriter w)
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ namespace UniverseGenTweaks;
|
|||||||
[ModFeature("UniverseGenGalaxySelectUI", Order = 10)]
|
[ModFeature("UniverseGenGalaxySelectUI", Order = 10)]
|
||||||
public static class GalaxySelectUIPatch
|
public static class GalaxySelectUIPatch
|
||||||
{
|
{
|
||||||
|
private static Text _minDistTitle;
|
||||||
|
private static Text _minStepTitle;
|
||||||
|
private static Text _maxStepTitle;
|
||||||
|
private static Text _flattenTitle;
|
||||||
private static Slider _minDistSlider;
|
private static Slider _minDistSlider;
|
||||||
private static Slider _minStepSlider;
|
private static Slider _minStepSlider;
|
||||||
private static Slider _maxStepSlider;
|
private static Slider _maxStepSlider;
|
||||||
@@ -58,28 +62,28 @@ public static class GalaxySelectUIPatch
|
|||||||
{
|
{
|
||||||
__instance.starCountSlider.maxValue = MoreSettings.MaxStarCount.Value;
|
__instance.starCountSlider.maxValue = MoreSettings.MaxStarCount.Value;
|
||||||
|
|
||||||
CreateSliderWithText(__instance.starCountSlider, out var minDistTitle, out _minDistSlider, out _minDistText, out var minDistLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out _minDistTitle, out _minDistSlider, out _minDistText, out var minDistLocalizer);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out var minStepTitle, out _minStepSlider, out _minStepText, out var minStepLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out _minStepTitle, out _minStepSlider, out _minStepText, out var minStepLocalizer);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out var maxStepTitle, out _maxStepSlider, out _maxStepText, out var maxStepLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out _maxStepTitle, out _maxStepSlider, out _maxStepText, out var maxStepLocalizer);
|
||||||
CreateSliderWithText(__instance.starCountSlider, out var flattenTitle, out _flattenSlider, out _flattenText, out var flattenLocalizer);
|
CreateSliderWithText(__instance.starCountSlider, out _flattenTitle, out _flattenSlider, out _flattenText, out var flattenLocalizer);
|
||||||
minDistLocalizer.stringKey = Localization.StarDistanceMin;
|
minDistLocalizer.stringKey = Localization.StarDistanceMin;
|
||||||
minDistTitle.text = Localization.StarDistanceMin.Translate();
|
_minDistTitle.text = Localization.StarDistanceMin.Translate();
|
||||||
minStepLocalizer.stringKey = Localization.StepDistanceMin;
|
minStepLocalizer.stringKey = Localization.StepDistanceMin;
|
||||||
minStepTitle.text = Localization.StepDistanceMin.Translate();
|
_minStepTitle.text = Localization.StepDistanceMin.Translate();
|
||||||
maxStepLocalizer.stringKey = Localization.StepDistanceMax;
|
maxStepLocalizer.stringKey = Localization.StepDistanceMax;
|
||||||
maxStepTitle.text = Localization.StepDistanceMax.Translate();
|
_maxStepTitle.text = Localization.StepDistanceMax.Translate();
|
||||||
flattenLocalizer.stringKey = Localization.Flatness;
|
flattenLocalizer.stringKey = Localization.Flatness;
|
||||||
flattenTitle.text = Localization.Flatness.Translate();
|
_flattenTitle.text = Localization.Flatness.Translate();
|
||||||
|
|
||||||
minDistTitle.name = "min-dist";
|
_minDistTitle.name = "min-dist";
|
||||||
minStepTitle.name = "min-step";
|
_minStepTitle.name = "min-step";
|
||||||
maxStepTitle.name = "max-step";
|
_maxStepTitle.name = "max-step";
|
||||||
flattenTitle.name = "flatten";
|
_flattenTitle.name = "flatten";
|
||||||
|
|
||||||
TransformDeltaY(minDistTitle.transform, UniverseGenConstants.SliderRowSpacing);
|
TransformDeltaY(_minDistTitle.transform, UniverseGenConstants.SliderRowSpacing);
|
||||||
TransformDeltaY(minStepTitle.transform, UniverseGenConstants.SliderRowSpacing * 2);
|
TransformDeltaY(_minStepTitle.transform, UniverseGenConstants.SliderRowSpacing * 2);
|
||||||
TransformDeltaY(maxStepTitle.transform, UniverseGenConstants.SliderRowSpacing * 3);
|
TransformDeltaY(_maxStepTitle.transform, UniverseGenConstants.SliderRowSpacing * 3);
|
||||||
TransformDeltaY(flattenTitle.transform, UniverseGenConstants.SliderRowSpacing * 4);
|
TransformDeltaY(_flattenTitle.transform, UniverseGenConstants.SliderRowSpacing * 4);
|
||||||
TransformDeltaY(__instance.darkFogToggle.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
TransformDeltaY(__instance.darkFogToggle.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
||||||
TransformDeltaY(__instance.resourceMultiplierSlider.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
TransformDeltaY(__instance.resourceMultiplierSlider.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
||||||
TransformDeltaY(__instance.sandboxToggle.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
TransformDeltaY(__instance.sandboxToggle.transform.parent, UniverseGenConstants.SliderRowSpacing * 4);
|
||||||
@@ -109,7 +113,10 @@ public static class GalaxySelectUIPatch
|
|||||||
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnUnregEvent))]
|
[HarmonyPatch(typeof(UIGalaxySelect), nameof(UIGalaxySelect._OnUnregEvent))]
|
||||||
private static void UIGalaxySelect__OnUnregEvent_Postfix()
|
private static void UIGalaxySelect__OnUnregEvent_Postfix()
|
||||||
{
|
{
|
||||||
RemoveAllListeners();
|
_minDistSlider.onValueChanged.RemoveAllListeners();
|
||||||
|
_minStepSlider.onValueChanged.RemoveAllListeners();
|
||||||
|
_maxStepSlider.onValueChanged.RemoveAllListeners();
|
||||||
|
_flattenSlider.onValueChanged.RemoveAllListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ namespace UniverseGenTweaks;
|
|||||||
|
|
||||||
public static class UIConfigWindow
|
public static class UIConfigWindow
|
||||||
{
|
{
|
||||||
|
private static RectTransform _windowTrans;
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
MyConfigWindow.OnUICreated += CreateUI;
|
MyConfigWindow.OnUICreated += CreateUI;
|
||||||
@@ -14,12 +16,13 @@ public static class UIConfigWindow
|
|||||||
|
|
||||||
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
|
||||||
{
|
{
|
||||||
|
_windowTrans = trans;
|
||||||
// General tab
|
// General tab
|
||||||
var x = 0f;
|
var x = 0f;
|
||||||
var y = 10f;
|
var y = 10f;
|
||||||
wnd.AddSplitter(trans, 10f);
|
wnd.AddSplitter(trans, 10f);
|
||||||
wnd.AddTabGroup(trans, Localization.UniverseGen, "tab-group-galaxygen");
|
wnd.AddTabGroup(trans, Localization.UniverseGen, "tab-group-galaxygen");
|
||||||
var tab1 = wnd.AddTab(trans, "General");
|
var tab1 = wnd.AddTab(_windowTrans, "General");
|
||||||
MyCheckBox.CreateCheckBox(x, y, tab1, MoreSettings.Enabled, Localization.EnableMoreSettingsOnUniverseGen);
|
MyCheckBox.CreateCheckBox(x, y, tab1, MoreSettings.Enabled, Localization.EnableMoreSettingsOnUniverseGen);
|
||||||
x += 20f;
|
x += 20f;
|
||||||
y += 26f;
|
y += 26f;
|
||||||
@@ -67,7 +70,7 @@ public static class UIConfigWindow
|
|||||||
EpicDifficulty.OilMultiplier.Value = val;
|
EpicDifficulty.OilMultiplier.Value = val;
|
||||||
sl2.SetLabelText(val.ToString(sl2.labelFormat));
|
sl2.SetLabelText(val.ToString(sl2.labelFormat));
|
||||||
};
|
};
|
||||||
var tab2 = wnd.AddTab(trans, Localization.BirthStar);
|
var tab2 = wnd.AddTab(_windowTrans, Localization.BirthStar);
|
||||||
x = 0f;
|
x = 0f;
|
||||||
y = 10f;
|
y = 10f;
|
||||||
MyCheckBox.CreateCheckBox(x, y, tab2, BirthPlanetPatch.SitiVeinsOnBirthPlanet, Localization.SiliconTitaniumOnBirthPlanet);
|
MyCheckBox.CreateCheckBox(x, y, tab2, BirthPlanetPatch.SitiVeinsOnBirthPlanet, Localization.SiliconTitaniumOnBirthPlanet);
|
||||||
|
|||||||
@@ -381,15 +381,6 @@ internal static class QuickMinerPlacementTests
|
|||||||
Check(snapshot.schema is 1 or 2 or 3 or 4, "Unsupported debug snapshot schema.");
|
Check(snapshot.schema is 1 or 2 or 3 or 4, "Unsupported debug snapshot schema.");
|
||||||
Check(snapshot.nodes != null && snapshot.candidates != null && snapshot.buildColliders != null && snapshot.minerColliders != null && snapshot.phases != null,
|
Check(snapshot.nodes != null && snapshot.candidates != null && snapshot.buildColliders != null && snapshot.minerColliders != null && snapshot.phases != null,
|
||||||
"This snapshot contains summary data only and cannot be replayed. Run quick miner placement again with the updated build.");
|
"This snapshot contains summary data only and cannot be replayed. Run quick miner placement again with the updated build.");
|
||||||
if (snapshot.algorithm?.EndsWith("-target-group", StringComparison.Ordinal) == true)
|
|
||||||
{
|
|
||||||
var targetIds = snapshot.nodes.Where(node => node.target).Select(node => node.id).ToHashSet();
|
|
||||||
Check(snapshot.candidates.All(candidate => candidate.covered.All(index => snapshot.nodes[index].target)),
|
|
||||||
"Candidate coverage must exclude neighboring vein groups, including those of the same type.");
|
|
||||||
Check((snapshot.placements ?? []).All(placement =>
|
|
||||||
(placement.plannedVeins ?? []).Concat(placement.finalVeins ?? []).All(targetIds.Contains)),
|
|
||||||
"Planned and final miner parameters must contain only nodes from the selected vein group.");
|
|
||||||
}
|
|
||||||
Console.WriteLine($"Snapshot: outcome={snapshot.outcome}, nodes={snapshot.nodes.Length}, candidates={snapshot.candidates.Length}, placed={snapshot.placedCount}, actual coverage={snapshot.totalCoverage}");
|
Console.WriteLine($"Snapshot: outcome={snapshot.outcome}, nodes={snapshot.nodes.Length}, candidates={snapshot.candidates.Length}, placed={snapshot.placedCount}, actual coverage={snapshot.totalCoverage}");
|
||||||
foreach (var failure in (snapshot.placements ?? []).Where(p => p.outcome != "placed").GroupBy(p => (p.outcome, p.nativeCondition)))
|
foreach (var failure in (snapshot.placements ?? []).Where(p => p.outcome != "placed").GroupBy(p => (p.outcome, p.nativeCondition)))
|
||||||
Console.WriteLine($"Placement {failure.Key.outcome}: native={failure.Key.nativeCondition}, count={failure.Count()}");
|
Console.WriteLine($"Placement {failure.Key.outcome}: native={failure.Key.nativeCondition}, count={failure.Count()}");
|
||||||
|
|||||||
Reference in new issue
Block a user