mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-22 18:19:02 +08:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
74baa2428e | ||
|
|
9fb75f70b8 | ||
|
|
4c0ad9c27f | ||
|
|
5e6cfe7fa5 | ||
|
|
a1ba5266bb | ||
|
|
ba2648a3e3 | ||
|
|
325536fc79 | ||
|
|
ec00212669 |
No files matched your search
@@ -25,6 +25,7 @@
|
|||||||
- Keep temporary verification projects under the mod's excluded root `obj/` directory. Remove abandoned generated outputs when their source project is gone so the SDK source glob cannot compile them into the mod.
|
- Keep temporary verification projects under the mod's excluded root `obj/` directory. Remove abandoned generated outputs when their source project is gone so the SDK source glob cannot compile them into the mod.
|
||||||
- Refresh game references explicitly with `dotnet build UpdateGameDlls/UpdateGameDlls.csproj`; the script publicizes installed DLLs in staging and compares generated content hashes so checkout timestamps cannot hide game updates. Missing DSP or the publicizer is a warning, not a build failure. If `assembly-publicizer` requires an unavailable .NET runtime, retry with process-local `DOTNET_ROLL_FORWARD=Major` rather than changing global runtime settings. Verify discovery warnings against the actual configured library directories and original managed DLLs; absence from the VDF `apps` list alone does not establish that DSP is uninstalled.
|
- Refresh game references explicitly with `dotnet build UpdateGameDlls/UpdateGameDlls.csproj`; the script publicizes installed DLLs in staging and compares generated content hashes so checkout timestamps cannot hide game updates. Missing DSP or the publicizer is a warning, not a build failure. If `assembly-publicizer` requires an unavailable .NET runtime, retry with process-local `DOTNET_ROLL_FORWARD=Major` rather than changing global runtime settings. Verify discovery warnings against the actual configured library directories and original managed DLLs; absence from the VDF `apps` list alone does not establish that DSP is uninstalled.
|
||||||
- Package main mods with `dotnet build -t:ZipMod -c Release`; package preloaders with `dotnet build -t:CopyToParentPackage -c Release`. The mod `.csproj` `<Version>` is the single version source and packaging synchronizes `package/manifest.json`. Keep the latest English and Chinese changelog headings and notes aligned with `<Version>`; preserve existing unreleased notes and historical entries. Describe relevant triggers when documenting fixes to previously released behavior.
|
- Package main mods with `dotnet build -t:ZipMod -c Release`; package preloaders with `dotnet build -t:CopyToParentPackage -c Release`. The mod `.csproj` `<Version>` is the single version source and packaging synchronizes `package/manifest.json`. Keep the latest English and Chinese changelog headings and notes aligned with `<Version>`; preserve existing unreleased notes and historical entries. Describe relevant triggers when documenting fixes to previously released behavior.
|
||||||
|
- When delivering UXAssist changes for local use in r2modman (R2), run `ZipMod`, verify that the zip contains the current DLL, manifest, icon, README, and changelog, and report the zip's full Windows path.
|
||||||
- Treat warnings as errors except the intentional obsolete API warning `0618`; do not weaken this policy to hide new warnings.
|
- Treat warnings as errors except the intentional obsolete API warning `0618`; do not weaken this policy to hide new warnings.
|
||||||
- Export Thunderstore package icons as 256x256 PNG files and verify their format and dimensions. For circular exports, apply an antialiased alpha mask to the approved artwork instead of regenerating it; preserve RGB pixels and make the exterior fully transparent. Convey the mod's function through familiar, conventionally oriented symbols rather than lettering. Preserve DSP motifs and consistent materials across related mod icons. During localized edits, preserve all unrequested geometry, placement and styling from the chosen reference; do not redesign surrounding structures to produce an overlap. Use clear foreground occlusion for intersecting forms without losing the main symbol's silhouette, and check contrast in 64x64 and 32x32 side-by-side previews. Keep unselected icon candidates under `artifacts/`, outside release package directories.
|
- Export Thunderstore package icons as 256x256 PNG files and verify their format and dimensions. For circular exports, apply an antialiased alpha mask to the approved artwork instead of regenerating it; preserve RGB pixels and make the exterior fully transparent. Convey the mod's function through familiar, conventionally oriented symbols rather than lettering. Preserve DSP motifs and consistent materials across related mod icons. During localized edits, preserve all unrequested geometry, placement and styling from the chosen reference; do not redesign surrounding structures to produce an overlap. Use clear foreground occlusion for intersecting forms without losing the main symbol's silhouette, and check contrast in 64x64 and 32x32 side-by-side previews. Keep unselected icon candidates under `artifacts/`, outside release package directories.
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
## Changlog
|
## Changlog
|
||||||
|
|
||||||
* 2.4.8
|
* 2.4.8
|
||||||
|
* Require UXAssist 1.6.3 or later for the shared production API. Older versions are rejected before initialization instead of failing while loading belt-signal features.
|
||||||
* `Mecha and Drones/Fleets invincible`: Fix mecha HP and energy shield protection failing when enabled after taking damage, and restore protection for space fleets.
|
* `Mecha and Drones/Fleets invincible`: Fix mecha HP and energy shield protection failing when enabled after taking damage, and restore protection for space fleets.
|
||||||
* `Finish build immediately`: Fix possible errors when starting a new game. Construction begins after the opening cutscene ends or is skipped.
|
* `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`:
|
* `Belt signal item generation`:
|
||||||
@@ -208,6 +209,7 @@
|
|||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
* 2.4.8
|
* 2.4.8
|
||||||
|
* 需要 UXAssist 1.6.3 或更高版本提供共享生产计算 API。旧版本会在初始化前被拒绝加载,避免加载传送带信号功能时出错。
|
||||||
* `机甲和战斗无人机无敌`:修复受伤后启用时机甲耐久度和能量护盾保护可能失效的问题,并恢复太空编队的无敌保护。
|
* `机甲和战斗无人机无敌`:修复受伤后启用时机甲耐久度和能量护盾保护可能失效的问题,并恢复太空编队的无敌保护。
|
||||||
* `建造秒完成`:修复开始新游戏时可能报错的问题。建造会在开场动画播放结束或跳过后开始。
|
* `建造秒完成`:修复开始新游戏时可能报错的问题。建造会在开场动画播放结束或跳过后开始。
|
||||||
* `传送带信号物品生成`:
|
* `传送带信号物品生成`:
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using UXAssist.Common.ModFeatures;
|
|||||||
namespace CheatEnabler;
|
namespace CheatEnabler;
|
||||||
|
|
||||||
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
|
||||||
[BepInDependency(UXAssist.PluginInfo.PLUGIN_GUID)]
|
[BepInDependency(UXAssist.PluginInfo.PLUGIN_GUID, "1.6.3")]
|
||||||
public class CheatEnabler : BaseUnityPlugin
|
public class CheatEnabler : BaseUnityPlugin
|
||||||
{
|
{
|
||||||
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
public new static readonly BepInEx.Logging.ManualLogSource Logger =
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ The item icon selects the output; no hotkey is needed.
|
|||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
|
* Requires UXAssist 1.6.3 or later. When upgrading manually, replace the old UXAssist DLL and remove duplicate copies from the BepInEx plugins folder.
|
||||||
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
|
* Please upgrade `BepInEx` 5.4.21 or later if using with [BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/) to avoid possible conflicts.
|
||||||
* You can download [BepInEx here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
|
* You can download [BepInEx here](https://github.com/bepinex/bepinex/releases/latest)(choose x64 edition).
|
||||||
* If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
|
* If using with r2modman, you can upgrade `BepInEx` by clicking `Settings` -> `Browse profile folder`, then extract downloaded zip to the folder and overwrite existing files.
|
||||||
@@ -198,6 +199,7 @@ The item icon selects the output; no hotkey is needed.
|
|||||||
|
|
||||||
## 注意事项
|
## 注意事项
|
||||||
|
|
||||||
|
* 需要 UXAssist 1.6.3 或更高版本。手动升级时,请替换旧的 UXAssist DLL,并删除 BepInEx 插件目录中的重复副本。
|
||||||
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突
|
* 如果和[BlueprintTweaks](https://dsp.thunderstore.io/package/kremnev8/BlueprintTweaks/)一起使用,请升级`BepInEx`到5.4.21或更高版本,以避免可能的冲突
|
||||||
* 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)(选择x64版本)下载`BepInEx`
|
* 你可以在[这里](https://github.com/bepinex/bepinex/releases/latest)(选择x64版本)下载`BepInEx`
|
||||||
* 如果使用r2modman,你可以点击`Settings` -> `Browse profile folder`,然后将下载的zip解压到该文件夹并覆盖现有文件
|
* 如果使用r2modman,你可以点击`Settings` -> `Browse profile folder`,然后将下载的zip解压到该文件夹并覆盖现有文件
|
||||||
|
|||||||
@@ -5,6 +5,6 @@
|
|||||||
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"xiaoye97-BepInEx-5.4.17",
|
"xiaoye97-BepInEx-5.4.17",
|
||||||
"soarqin-UXAssist-1.4.0"
|
"soarqin-UXAssist-1.6.3"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
## Changelog
|
## Changelog
|
||||||
|
|
||||||
* 1.5.0
|
* 1.5.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. Move the checkbox to the title bar to prevent overlap with the English automation input label.
|
||||||
* `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.
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
* 1.5.0
|
* 1.5.0
|
||||||
* `储物仓垃圾桶`:销毁四向分流器送入上方储物仓的物品,包括堆叠和喷涂增产剂的物品;启用垃圾桶时清除已满状态缓存。
|
* `储物仓垃圾桶`:销毁四向分流器送入上方储物仓的物品,包括堆叠和喷涂增产剂的物品;启用垃圾桶时清除已满状态缓存。将复选框移至标题栏,避免与英文自动化输入说明重叠。
|
||||||
* `储液罐垃圾桶`:修复单层储液罐装入第一批液体后停止输入的问题,普通储存和垃圾桶模式均可正常工作。
|
* `储液罐垃圾桶`:修复单层储液罐装入第一批液体后停止输入的问题,普通储存和垃圾桶模式均可正常工作。
|
||||||
* `传送带信号垃圾桶`:适配当前游戏的模拟循环,修复 DSP 0.10.33/0.10.34 更新后的启动报错和物品无法销毁问题。
|
* `传送带信号垃圾桶`:适配当前游戏的模拟循环,修复 DSP 0.10.33/0.10.34 更新后的启动报错和物品无法销毁问题。
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.IO;
|
|||||||
using System.Reflection.Emit;
|
using System.Reflection.Emit;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using NebulaAPI;
|
using NebulaAPI;
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Dustbin;
|
namespace Dustbin;
|
||||||
|
|
||||||
@@ -106,7 +105,7 @@ public static class StoragePatch
|
|||||||
[HarmonyPatch(typeof(UIStorageWindow), nameof(UIStorageWindow._OnCreate))]
|
[HarmonyPatch(typeof(UIStorageWindow), nameof(UIStorageWindow._OnCreate))]
|
||||||
private static void UIStorageWindow__OnCreate_Postfix(UIStorageWindow __instance)
|
private static void UIStorageWindow__OnCreate_Postfix(UIStorageWindow __instance)
|
||||||
{
|
{
|
||||||
_storageDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 50f, 50f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin");
|
_storageDustbinCheckBox = UI.MyCheckBox.CreateCheckBox(false, __instance.transform, 220f, 26f, Localization.CurrentLanguageLCID == Localization.LCID_ZHCN ? "垃圾桶" : "Dustbin");
|
||||||
var window = __instance;
|
var window = __instance;
|
||||||
_storageDustbinCheckBox.OnChecked += () =>
|
_storageDustbinCheckBox.OnChecked += () =>
|
||||||
{
|
{
|
||||||
@@ -134,10 +133,6 @@ public static class StoragePatch
|
|||||||
var storagePool = __instance.factoryStorage.storagePool;
|
var storagePool = __instance.factoryStorage.storagePool;
|
||||||
if (storagePool[storageId].id != storageId) return;
|
if (storagePool[storageId].id != storageId) return;
|
||||||
_storageDustbinCheckBox.Checked = storagePool[storageId].IsDustbin;
|
_storageDustbinCheckBox.Checked = storagePool[storageId].IsDustbin;
|
||||||
if (__instance.transform is RectTransform rectTrans)
|
|
||||||
{
|
|
||||||
_storageDustbinCheckBox.rectTrans.anchoredPosition3D = new Vector3(190, 57 - rectTrans.sizeDelta.y, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adopt fix from starfi5h's NebulaCompatiblilityAssist */
|
/* Adopt fix from starfi5h's NebulaCompatiblilityAssist */
|
||||||
@@ -145,8 +140,8 @@ public static class StoragePatch
|
|||||||
[HarmonyPatch(typeof(UIStorageGrid), nameof(UIStorageGrid.OnStorageSizeChanged))]
|
[HarmonyPatch(typeof(UIStorageGrid), nameof(UIStorageGrid.OnStorageSizeChanged))]
|
||||||
private static void UIStorageGrid_OnStorageSizeChanged_Postfix()
|
private static void UIStorageGrid_OnStorageSizeChanged_Postfix()
|
||||||
{
|
{
|
||||||
// Due to storage window is empty when open in client, the size will change after receiving data from host
|
// Storage data arrives asynchronously on multiplayer clients.
|
||||||
_lastStorageId = 0; // Refresh UI to reposition button on client side
|
_lastStorageId = 0; // Refresh checkbox state on the client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,9 @@
|
|||||||
## Changlog
|
## Changlog
|
||||||
|
|
||||||
* 1.6.4
|
* 1.6.4
|
||||||
|
* `Reverse conveyor belt`: Enable it on the Factory tab and press `Alt+R` over a built belt to reverse it without opening its panel. The shortcut can be changed in the system options.
|
||||||
* `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.
|
* `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.
|
||||||
|
* `Auto-cruise`: Fix the mecha diving back into the ground right after taking off from a moon that is close to its gas giant.
|
||||||
* 1.6.3
|
* 1.6.3
|
||||||
* `Quick build Mining Machines`:
|
* `Quick build Mining Machines`:
|
||||||
* 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.
|
* 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.
|
||||||
@@ -447,7 +449,9 @@
|
|||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
* 1.6.4
|
* 1.6.4
|
||||||
|
* `反转传送带`:在「工厂」页启用后,将鼠标移到已建成的传送带上,按 `Alt+R` 直接反转,无需打开面板;可在系统选项中修改快捷键。
|
||||||
* `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。
|
* `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。
|
||||||
|
* `自动巡航`:修复从紧邻气态巨星的卫星上起飞后,机甲又扎回地面的问题。
|
||||||
* 1.6.3
|
* 1.6.3
|
||||||
* `快速铺设采矿机`:
|
* `快速铺设采矿机`:
|
||||||
* 在「工厂」页增加按钮,自动在最近的固体矿脉周围密集铺设普通采矿机。每台至少覆盖选中矿脉的 3 个矿点,不混入附近其他矿脉。布局数量不受库存限制,采矿机不足的位置保留待建造虚影。遵守建造范围,不自动铺设传送带和电力设施。计算期间再次点击可取消。
|
* 在「工厂」页增加按钮,自动在最近的固体矿脉周围密集铺设普通采矿机。每台至少覆盖选中矿脉的 3 个矿点,不混入附近其他矿脉。布局数量不受库存限制,采矿机不足的位置保留待建造虚影。遵守建造范围,不自动铺设传送带和电力设施。计算期间再次点击可取消。
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public static class FactoryConfigProvider
|
|||||||
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled => FactoryPatch.TankFastFillInAndTakeOutEnabled;
|
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled => FactoryPatch.TankFastFillInAndTakeOutEnabled;
|
||||||
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier => FactoryPatch.TankFastFillInAndTakeOutMultiplier;
|
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier => FactoryPatch.TankFastFillInAndTakeOutMultiplier;
|
||||||
public static ConfigEntry<bool> CutConveyorBeltEnabled => FactoryPatch.CutConveyorBeltEnabled;
|
public static ConfigEntry<bool> CutConveyorBeltEnabled => FactoryPatch.CutConveyorBeltEnabled;
|
||||||
|
public static ConfigEntry<bool> ReverseConveyorBeltEnabled => FactoryPatch.ReverseConveyorBeltEnabled;
|
||||||
public static ConfigEntry<bool> TweakBuildingBufferEnabled => FactoryPatch.TweakBuildingBufferEnabled;
|
public static ConfigEntry<bool> TweakBuildingBufferEnabled => FactoryPatch.TweakBuildingBufferEnabled;
|
||||||
public static ConfigEntry<int> AssemblerBufferTimeMultiplier => FactoryPatch.AssemblerBufferTimeMultiplier;
|
public static ConfigEntry<int> AssemblerBufferTimeMultiplier => FactoryPatch.AssemblerBufferTimeMultiplier;
|
||||||
public static ConfigEntry<int> AssemblerBufferMininumMultiplier => FactoryPatch.AssemblerBufferMininumMultiplier;
|
public static ConfigEntry<int> AssemblerBufferMininumMultiplier => FactoryPatch.AssemblerBufferMininumMultiplier;
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ public static class I18NKeys
|
|||||||
public const string KEYToggleDoNotRenderEntities = "KEYToggleDoNotRenderEntities";
|
public const string KEYToggleDoNotRenderEntities = "KEYToggleDoNotRenderEntities";
|
||||||
public const string KEYOffgridForPaths = "KEYOffgridForPaths";
|
public const string KEYOffgridForPaths = "KEYOffgridForPaths";
|
||||||
public const string KEYCutConveyorBelt = "KEYCutConveyorBelt";
|
public const string KEYCutConveyorBelt = "KEYCutConveyorBelt";
|
||||||
|
public const string KEYReverseConveyorBelt = "KEYReverseConveyorBelt";
|
||||||
public const string KEYDismantleBlueprintSelection = "KEYDismantleBlueprintSelection";
|
public const string KEYDismantleBlueprintSelection = "KEYDismantleBlueprintSelection";
|
||||||
public const string KEYSelectAllBuildingsInBlueprintCopy = "KEYSelectAllBuildingsInBlueprintCopy";
|
public const string KEYSelectAllBuildingsInBlueprintCopy = "KEYSelectAllBuildingsInBlueprintCopy";
|
||||||
public const string KEYUPSSpeedDown = "KEYUPSSpeedDown";
|
public const string KEYUPSSpeedDown = "KEYUPSSpeedDown";
|
||||||
@@ -111,6 +112,7 @@ public static class I18NKeys
|
|||||||
public const string FastFillInToAndTakeOutFromTanks = "Fast fill in to and take out from tanks";
|
public const string FastFillInToAndTakeOutFromTanks = "Fast fill in to and take out from tanks";
|
||||||
public const string SpeedRatio = "Speed Ratio";
|
public const string SpeedRatio = "Speed Ratio";
|
||||||
public const string CutConveyorBeltWithShortcutKey = "Cut conveyor belt (with shortcut key)";
|
public const string CutConveyorBeltWithShortcutKey = "Cut conveyor belt (with shortcut key)";
|
||||||
|
public const string ReverseConveyorBeltWithShortcutKey = "Reverse conveyor belt (with shortcut key)";
|
||||||
public const string ProtectVeinsFromExhaustion = "Protect veins from exhaustion";
|
public const string ProtectVeinsFromExhaustion = "Protect veins from exhaustion";
|
||||||
public const string ProtectVeinsFromExhaustionTips = "Protect veins from exhaustion tips";
|
public const string ProtectVeinsFromExhaustionTips = "Protect veins from exhaustion tips";
|
||||||
public const string DoNotRenderFactoryEntities = "Do not render factory entities";
|
public const string DoNotRenderFactoryEntities = "Do not render factory entities";
|
||||||
@@ -301,6 +303,7 @@ public static class I18NKeys
|
|||||||
I18N.Add(KEYToggleDoNotRenderEntities, "[UXA] Toggle Do Not Render Factory Entities", "[UXA] 切换不渲染工厂建筑实体");
|
I18N.Add(KEYToggleDoNotRenderEntities, "[UXA] Toggle Do Not Render Factory Entities", "[UXA] 切换不渲染工厂建筑实体");
|
||||||
I18N.Add(KEYOffgridForPaths, "[UXA] Build belts offgrid", "[UXA] 脱离网格建造传送带");
|
I18N.Add(KEYOffgridForPaths, "[UXA] Build belts offgrid", "[UXA] 脱离网格建造传送带");
|
||||||
I18N.Add(KEYCutConveyorBelt, "[UXA] Cut conveyor belt", "[UXA] 切割传送带");
|
I18N.Add(KEYCutConveyorBelt, "[UXA] Cut conveyor belt", "[UXA] 切割传送带");
|
||||||
|
I18N.Add(KEYReverseConveyorBelt, "[UXA] Reverse conveyor belt", "[UXA] 反转传送带");
|
||||||
I18N.Add(KEYDismantleBlueprintSelection, "[UXA] Dismantle blueprint selected buildings", "[UXA] 拆除蓝图选中的建筑");
|
I18N.Add(KEYDismantleBlueprintSelection, "[UXA] Dismantle blueprint selected buildings", "[UXA] 拆除蓝图选中的建筑");
|
||||||
I18N.Add(KEYSelectAllBuildingsInBlueprintCopy, "[UXA] Select all buildings in Blueprint Copy Mode", "[UXA] 蓝图复制时选择所有建筑");
|
I18N.Add(KEYSelectAllBuildingsInBlueprintCopy, "[UXA] Select all buildings in Blueprint Copy Mode", "[UXA] 蓝图复制时选择所有建筑");
|
||||||
I18N.Add(KEYUPSSpeedDown, "[UXA] Decrease logical frame rate", "[UXA] 降低逻辑帧率");
|
I18N.Add(KEYUPSSpeedDown, "[UXA] Decrease logical frame rate", "[UXA] 降低逻辑帧率");
|
||||||
@@ -370,6 +373,7 @@ Hold Ctrl/Shift/Alt to change the count rapidly.
|
|||||||
I18N.Add(FastFillInToAndTakeOutFromTanks, "Fast fill in to and take out from tanks", "储液罐快速注入和抽取液体");
|
I18N.Add(FastFillInToAndTakeOutFromTanks, "Fast fill in to and take out from tanks", "储液罐快速注入和抽取液体");
|
||||||
I18N.Add(SpeedRatio, "Speed Ratio", "速度倍率");
|
I18N.Add(SpeedRatio, "Speed Ratio", "速度倍率");
|
||||||
I18N.Add(CutConveyorBeltWithShortcutKey, "Cut conveyor belt (with shortcut key)", "切割传送带(使用快捷键)");
|
I18N.Add(CutConveyorBeltWithShortcutKey, "Cut conveyor belt (with shortcut key)", "切割传送带(使用快捷键)");
|
||||||
|
I18N.Add(ReverseConveyorBeltWithShortcutKey, "Reverse conveyor belt (with shortcut key)", "反转传送带(使用快捷键)");
|
||||||
I18N.Add(ProtectVeinsFromExhaustion, "Protect veins from exhaustion", "保护矿脉不会耗尽");
|
I18N.Add(ProtectVeinsFromExhaustion, "Protect veins from exhaustion", "保护矿脉不会耗尽");
|
||||||
I18N.Add(ProtectVeinsFromExhaustionTips, """
|
I18N.Add(ProtectVeinsFromExhaustionTips, """
|
||||||
By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.
|
By default, the vein amount is protected at 100, and oil speed is protected at 1.0/s, you can set them yourself in config file.
|
||||||
|
|||||||
@@ -24,6 +24,43 @@ public static class FactoryFunctions
|
|||||||
cargoTraffic.AlterBeltConnections(beltId, 0, i0, i1, i2);
|
cargoTraffic.AlterBeltConnections(beltId, 0, i0, i1, i2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ReverseConveyorBelt(PlanetFactory factory, int beltId)
|
||||||
|
{
|
||||||
|
var traffic = factory?.cargoTraffic;
|
||||||
|
var player = GameMain.mainPlayer;
|
||||||
|
var window = UIRoot.instance?.uiGame?.beltWindow;
|
||||||
|
if (traffic == null || player == null || window == null || beltId <= 0 || beltId >= traffic.beltPool.Length) return;
|
||||||
|
|
||||||
|
ref var belt = ref traffic.beltPool[beltId];
|
||||||
|
if (belt.id != beltId) return;
|
||||||
|
var path = traffic.GetCargoPath(belt.segPathId);
|
||||||
|
// Match the native reverse button's limit of 2 to 1023 belts in one path.
|
||||||
|
const int maxBeltCount = 1023;
|
||||||
|
if (path == null || path.belts.Count < 2 || path.belts.Count > maxBeltCount) return;
|
||||||
|
|
||||||
|
var oldFactory = window.factory;
|
||||||
|
var oldTraffic = window.traffic;
|
||||||
|
var oldPlayer = window.player;
|
||||||
|
var oldBeltId = window._beltId;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
window.factory = factory;
|
||||||
|
window.traffic = traffic;
|
||||||
|
window.player = player;
|
||||||
|
// The beltId setter refreshes the visible inspector, so bind the backing field directly.
|
||||||
|
window._beltId = beltId;
|
||||||
|
// Nebula intercepts this native entry point to synchronize reversals.
|
||||||
|
window.OnReverseButtonClick(0);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
window._beltId = oldBeltId;
|
||||||
|
window.factory = oldFactory;
|
||||||
|
window.traffic = oldTraffic;
|
||||||
|
window.player = oldPlayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static bool ObjectIsBeltOrInserter(PlanetFactory factory, int objId)
|
public static bool ObjectIsBeltOrInserter(PlanetFactory factory, int objId)
|
||||||
{
|
{
|
||||||
if (objId == 0) return false;
|
if (objId == 0) return false;
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public static class FactoryPatch
|
|||||||
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled;
|
public static ConfigEntry<bool> TankFastFillInAndTakeOutEnabled;
|
||||||
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier;
|
public static ConfigEntry<int> TankFastFillInAndTakeOutMultiplier;
|
||||||
public static ConfigEntry<bool> CutConveyorBeltEnabled;
|
public static ConfigEntry<bool> CutConveyorBeltEnabled;
|
||||||
|
public static ConfigEntry<bool> ReverseConveyorBeltEnabled;
|
||||||
public static ConfigEntry<bool> TweakBuildingBufferEnabled;
|
public static ConfigEntry<bool> TweakBuildingBufferEnabled;
|
||||||
public static ConfigEntry<int> AssemblerBufferTimeMultiplier;
|
public static ConfigEntry<int> AssemblerBufferTimeMultiplier;
|
||||||
public static ConfigEntry<int> AssemblerBufferMininumMultiplier;
|
public static ConfigEntry<int> AssemblerBufferMininumMultiplier;
|
||||||
@@ -56,6 +57,7 @@ public static class FactoryPatch
|
|||||||
internal static PressKeyBind _doNotRenderEntitiesKey;
|
internal static PressKeyBind _doNotRenderEntitiesKey;
|
||||||
internal static PressKeyBind _offgridfForPathsKey;
|
internal static PressKeyBind _offgridfForPathsKey;
|
||||||
internal static PressKeyBind _cutConveyorBeltKey;
|
internal static PressKeyBind _cutConveyorBeltKey;
|
||||||
|
internal static PressKeyBind _reverseConveyorBeltKey;
|
||||||
internal static PressKeyBind _dismantleBlueprintSelectionKey;
|
internal static PressKeyBind _dismantleBlueprintSelectionKey;
|
||||||
internal static PressKeyBind _selectAllBuildingsInBlueprintCopyKey;
|
internal static PressKeyBind _selectAllBuildingsInBlueprintCopyKey;
|
||||||
|
|
||||||
@@ -86,6 +88,14 @@ public static class FactoryPatch
|
|||||||
name = "CutConveyorBelt",
|
name = "CutConveyorBelt",
|
||||||
canOverride = true
|
canOverride = true
|
||||||
}
|
}
|
||||||
|
);
|
||||||
|
_reverseConveyorBeltKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||||
|
{
|
||||||
|
key = new CombineKey((int)KeyCode.R, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
|
||||||
|
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
|
||||||
|
name = "ReverseConveyorBelt",
|
||||||
|
canOverride = true
|
||||||
|
}
|
||||||
);
|
);
|
||||||
_dismantleBlueprintSelectionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
_dismantleBlueprintSelectionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
|
||||||
{
|
{
|
||||||
@@ -215,6 +225,13 @@ public static class FactoryPatch
|
|||||||
Functions.FactoryFunctions.CutConveyorBelt(cargoTraffic, beltId);
|
Functions.FactoryFunctions.CutConveyorBelt(cargoTraffic, beltId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ReverseConveyorBeltEnabled.Value && _reverseConveyorBeltKey.keyValue
|
||||||
|
&& GameMain.isRunning && !GameMain.isPaused && !VFInput.onGUI)
|
||||||
|
{
|
||||||
|
var raycast = GameMain.mainPlayer?.controller?.cmd.raycast;
|
||||||
|
if (raycast != null && raycast.castEntity.id > 0 && raycast.castEntity.beltId > 0)
|
||||||
|
Functions.FactoryFunctions.ReverseConveyorBelt(raycast.planet?.factory, raycast.castEntity.beltId);
|
||||||
|
}
|
||||||
if (ShortcutKeysForBlueprintCopyEnabled.Value)
|
if (ShortcutKeysForBlueprintCopyEnabled.Value)
|
||||||
{
|
{
|
||||||
if (_dismantleBlueprintSelectionKey.keyValue)
|
if (_dismantleBlueprintSelectionKey.keyValue)
|
||||||
|
|||||||
@@ -654,6 +654,19 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
return default;
|
return default;
|
||||||
|
|
||||||
VectorLF3 baseDir = toTarget.normalized;
|
VectorLF3 baseDir = toTarget.normalized;
|
||||||
|
|
||||||
|
// The mecha can be inside several path radii at once. Stars and planets keep priority over
|
||||||
|
// hives: a hive's range is wide enough to cover a whole planet, and leaving the hive first
|
||||||
|
// can steer a mecha that has just taken off back into the ground.
|
||||||
|
// Among stars and planets, a moon close to its gas giant puts a mecha on the moon inside both
|
||||||
|
// ranges, and the giant comes first in the list. Leaving only the giant sends a mecha that
|
||||||
|
// takes off from the moon's giant-facing side back into the ground, because "away from the
|
||||||
|
// giant" points down there. Leave all of them together, each weighted by how deep the mecha
|
||||||
|
// is inside its range: their safety margins are equal, so the nearest surface dominates.
|
||||||
|
VectorLF3 bodiesInward = default;
|
||||||
|
VectorLF3 hiveInward = default;
|
||||||
|
bool insideBody = false;
|
||||||
|
bool insideHive = false;
|
||||||
foreach (Obstacle obstacle in obstacles)
|
foreach (Obstacle obstacle in obstacles)
|
||||||
{
|
{
|
||||||
double pathRadius = GetReachablePathRadius(obstacle);
|
double pathRadius = GetReachablePathRadius(obstacle);
|
||||||
@@ -662,10 +675,34 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
|
|
||||||
VectorLF3 toObstacle = obstacle.Position - playerPos;
|
VectorLF3 toObstacle = obstacle.Position - playerPos;
|
||||||
double obstacleDistance = toObstacle.magnitude;
|
double obstacleDistance = toObstacle.magnitude;
|
||||||
if (obstacleDistance < pathRadius)
|
if (obstacleDistance >= pathRadius)
|
||||||
return ComputeEscapeDirection(currentDirection, toObstacle, baseDir);
|
continue;
|
||||||
|
|
||||||
|
if (obstacle.HasSurface)
|
||||||
|
{
|
||||||
|
bodiesInward += SafeNorm(toObstacle, baseDir) * (pathRadius - obstacleDistance);
|
||||||
|
insideBody = true;
|
||||||
|
}
|
||||||
|
else if (!insideHive)
|
||||||
|
{
|
||||||
|
hiveInward = toObstacle;
|
||||||
|
insideHive = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insideBody)
|
||||||
|
return ComputeEscapeDirection(currentDirection, bodiesInward, baseDir);
|
||||||
|
if (insideHive)
|
||||||
|
return ComputeEscapeDirection(currentDirection, hiveInward, baseDir);
|
||||||
|
|
||||||
|
foreach (Obstacle obstacle in obstacles)
|
||||||
|
{
|
||||||
|
double pathRadius = GetReachablePathRadius(obstacle);
|
||||||
|
if (pathRadius <= 0.0)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (IsSegmentBlocked(playerPos, _targetUniversePosition, obstacle.Position, pathRadius))
|
if (IsSegmentBlocked(playerPos, _targetUniversePosition, obstacle.Position, pathRadius))
|
||||||
return ComputeTangentDirection(currentDirection, toObstacle, pathRadius, baseDir);
|
return ComputeTangentDirection(currentDirection, obstacle.Position - playerPos, pathRadius, baseDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return baseDir;
|
return baseDir;
|
||||||
@@ -1125,6 +1162,7 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
{
|
{
|
||||||
public VectorLF3 Position { get; } = position;
|
public VectorLF3 Position { get; } = position;
|
||||||
public double PathRadius { get; } = radius + safetyMargin;
|
public double PathRadius { get; } = radius + safetyMargin;
|
||||||
|
public bool HasSurface { get; } = radius > 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -60,6 +60,9 @@
|
|||||||
* Cut conveyor belt
|
* Cut conveyor belt
|
||||||
* Press shortcut key to cut conveyor belt under cursor.
|
* Press shortcut key to cut conveyor belt under cursor.
|
||||||
* The default shortcut key is Alt+X, you can set it in system options panel.
|
* The default shortcut key is Alt+X, you can set it in system options panel.
|
||||||
|
* Reverse conveyor belt
|
||||||
|
* Enable it on the Factory tab, hover over a built belt, and press `Alt+R` to reverse it without opening its panel.
|
||||||
|
* Change the shortcut in the system options. Reversal follows the native button's scope and limits.
|
||||||
* Treat stack items as single in monitor components
|
* Treat stack items as single in monitor components
|
||||||
* Quick build and dismantle stacking labs/storages/tanks
|
* Quick build and dismantle stacking labs/storages/tanks
|
||||||
* Fast fill in to and take out from tanks
|
* Fast fill in to and take out from tanks
|
||||||
@@ -268,6 +271,9 @@
|
|||||||
* 切割传送带
|
* 切割传送带
|
||||||
* 按快捷键切割光标位置的传送带
|
* 按快捷键切割光标位置的传送带
|
||||||
* 默认快捷键是Alt+X,可以在系统选项面板中设置
|
* 默认快捷键是Alt+X,可以在系统选项面板中设置
|
||||||
|
* 反转传送带
|
||||||
|
* 在「工厂」页启用后,将鼠标移到已建成的传送带上,按 `Alt+R` 直接反转,无需打开面板。
|
||||||
|
* 可在系统选项中修改快捷键,反转范围和限制与原版按钮一致。
|
||||||
* 在流速计中将堆叠物品视为单个物品
|
* 在流速计中将堆叠物品视为单个物品
|
||||||
* 快速建造和拆除堆叠研究站/储物仓/储液罐
|
* 快速建造和拆除堆叠研究站/储物仓/储液罐
|
||||||
* 储液罐快速注入和抽取液体
|
* 储液罐快速注入和抽取液体
|
||||||
|
|||||||
@@ -245,6 +245,8 @@ public static class UIConfigWindow
|
|||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.CutConveyorBeltEnabled, I18NKeys.CutConveyorBeltWithShortcutKey);
|
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.CutConveyorBeltEnabled, I18NKeys.CutConveyorBeltWithShortcutKey);
|
||||||
y += 36f;
|
y += 36f;
|
||||||
|
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.ReverseConveyorBeltEnabled, I18NKeys.ReverseConveyorBeltWithShortcutKey);
|
||||||
|
y += 36f;
|
||||||
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.TreatStackingAsSingleEnabled, I18NKeys.TreatStackItemsAsSingleInMonitorComponents);
|
checkBoxForMeasureTextWidth = wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.TreatStackingAsSingleEnabled, I18NKeys.TreatStackItemsAsSingleInMonitorComponents);
|
||||||
y += 36f;
|
y += 36f;
|
||||||
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.QuickBuildAndDismantleLabsEnabled, I18NKeys.QuickBuildAndDismantleStackingLabs);
|
wnd.AddCheckBox(x, y, tab2, FactoryConfigProvider.QuickBuildAndDismantleLabsEnabled, I18NKeys.QuickBuildAndDismantleStackingLabs);
|
||||||
|
|||||||
@@ -149,6 +149,8 @@ public class UXAssist : BaseUnityPlugin, IModCanSave
|
|||||||
FactoryPatch.TankFastFillInAndTakeOutMultiplier = Config.Bind("Factory", "TankFastFillInAndTakeOutMultiplier", 1000, "Speed multiplier for fast filling in to and takeing out from tanks");
|
FactoryPatch.TankFastFillInAndTakeOutMultiplier = Config.Bind("Factory", "TankFastFillInAndTakeOutMultiplier", 1000, "Speed multiplier for fast filling in to and takeing out from tanks");
|
||||||
FactoryPatch.CutConveyorBeltEnabled = Config.Bind("Factory", "CutConveyorBeltShortcut", false,
|
FactoryPatch.CutConveyorBeltEnabled = Config.Bind("Factory", "CutConveyorBeltShortcut", false,
|
||||||
"Cut conveyor belt (with shortcut key)");
|
"Cut conveyor belt (with shortcut key)");
|
||||||
|
FactoryPatch.ReverseConveyorBeltEnabled = Config.Bind("Factory", "ReverseConveyorBeltShortcut", false,
|
||||||
|
"Reverse conveyor belt (with shortcut key)");
|
||||||
FactoryPatch.TweakBuildingBufferEnabled = Config.Bind("Factory", "TweakBuildingBuffer", false,
|
FactoryPatch.TweakBuildingBufferEnabled = Config.Bind("Factory", "TweakBuildingBuffer", false,
|
||||||
"Tweak buffer count for assemblers and power generators");
|
"Tweak buffer count for assemblers and power generators");
|
||||||
FactoryPatch.AssemblerBufferTimeMultiplier = Config.Bind("Factory", "AssemblerBufferTimeMultiplier", 4, new ConfigDescription("Assembler buffer time multiplier in seconds", new AcceptableValueRange<int>(2, 10)));
|
FactoryPatch.AssemblerBufferTimeMultiplier = Config.Bind("Factory", "AssemblerBufferTimeMultiplier", 4, new ConfigDescription("Assembler buffer time multiplier in seconds", new AcceptableValueRange<int>(2, 10)));
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
// Checks the auto-cruise obstacle avoidance of a built UXAssist.dll without Unity. The avoidance math and
|
||||||
|
// its inputs are private to PlayerPatch.AutoNavigation, so they are reached through reflection.
|
||||||
|
internal static class AutoCruiseAvoidanceTests
|
||||||
|
{
|
||||||
|
private const BindingFlags Members =
|
||||||
|
BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
|
||||||
|
|
||||||
|
private const double PlanetRadius = 200.0;
|
||||||
|
private const double GasGiantRadius = 800.0;
|
||||||
|
private const double TakeoffAltitude = 49.0;
|
||||||
|
|
||||||
|
private static readonly VectorLF3 Up = new(0.0, 1.0, 0.0);
|
||||||
|
private static readonly VectorLF3 East = new(1.0, 0.0, 0.0);
|
||||||
|
private static readonly VectorLF3 North = new(0.0, 0.0, 1.0);
|
||||||
|
|
||||||
|
// A mecha that has just left a planet centred on the origin, still moving along the ground, with a
|
||||||
|
// destination far away in a direction that no obstacle of these checks blocks.
|
||||||
|
private static readonly VectorLF3 Mecha = Up * (PlanetRadius + TakeoffAltitude);
|
||||||
|
private static readonly VectorLF3 Target = North * (100.0 * GalaxyData.AU);
|
||||||
|
|
||||||
|
private static Type _navigation;
|
||||||
|
private static Type _obstacle;
|
||||||
|
private static int _checks;
|
||||||
|
private static int _failures;
|
||||||
|
|
||||||
|
private static void Check(bool condition, string message)
|
||||||
|
{
|
||||||
|
_checks++;
|
||||||
|
if (condition) return;
|
||||||
|
_failures++;
|
||||||
|
Console.WriteLine("FAIL " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static MemberInfo Member(string name)
|
||||||
|
{
|
||||||
|
MemberInfo[] members = _navigation.GetMember(name, Members);
|
||||||
|
if (members.Length != 1)
|
||||||
|
throw new MissingMemberException($"PlayerPatch.AutoNavigation.{name} was not found; update this check to match the renamed member.");
|
||||||
|
return members[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double Constant(string name) => (double)((FieldInfo)Member(name)).GetRawConstantValue();
|
||||||
|
|
||||||
|
private static object Obstacle(VectorLF3 position, double radius, double safetyMargin) =>
|
||||||
|
Activator.CreateInstance(_obstacle, Members, null, [position, radius, safetyMargin], null);
|
||||||
|
|
||||||
|
private static VectorLF3 Direction(VectorLF3 heading, params object[] obstacles)
|
||||||
|
{
|
||||||
|
((FieldInfo)Member("_targetUniversePosition")).SetValue(null, Target);
|
||||||
|
((FieldInfo)Member("_targetUniverseVelocity")).SetValue(null, default(VectorLF3));
|
||||||
|
((FieldInfo)Member("_targetArriveThresholdRadius")).SetValue(null, 4000.0);
|
||||||
|
var list = (IList)Activator.CreateInstance(typeof(List<>).MakeGenericType(_obstacle));
|
||||||
|
foreach (object obstacle in obstacles) list.Add(obstacle);
|
||||||
|
return (VectorLF3)((MethodInfo)Member("ComputeDirection")).Invoke(null, [Mecha, heading, list]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int Main(string[] args)
|
||||||
|
{
|
||||||
|
if (args.Length != 1) throw new ArgumentException("Usage: AutoCruiseAvoidanceTests <UXAssist.dll>");
|
||||||
|
Assembly mod = Assembly.LoadFrom(args[0]);
|
||||||
|
_navigation = mod.GetType("UXAssist.Patches.PlayerPatch+AutoNavigation", true);
|
||||||
|
_obstacle = mod.GetType("UXAssist.Patches.PlayerPatch+Obstacle", true);
|
||||||
|
double planetMargin = Constant("PlanetSafeRadius");
|
||||||
|
double hiveMargin = Constant("HiveSafeRadius");
|
||||||
|
|
||||||
|
object planet = Obstacle(default, PlanetRadius, planetMargin);
|
||||||
|
|
||||||
|
Check(VectorLF3.Dot(Direction(East), North) > 0.999,
|
||||||
|
"With nothing in the way the mecha must head straight for the target.");
|
||||||
|
|
||||||
|
VectorLF3 takeoff = Direction(East, planet);
|
||||||
|
Check(VectorLF3.Dot(takeoff, Up) > 0.85,
|
||||||
|
$"Taking off from a planet must climb away from it (heading vs. local up {VectorLF3.Dot(takeoff, Up):0.000}).");
|
||||||
|
|
||||||
|
// A hive's range is wide enough to cover a planet next to its orbit. Here the hive is straight
|
||||||
|
// overhead, so "away from the hive" points into the ground.
|
||||||
|
object hive = Obstacle(Mecha + Up * 8000.0, 0.0, hiveMargin);
|
||||||
|
VectorLF3 underHive = Direction(East, planet, hive);
|
||||||
|
Check((underHive - takeoff).magnitude < 1e-9,
|
||||||
|
$"A hive range that overlaps the planet must not change the take-off heading (heading vs. local up {VectorLF3.Dot(underHive, Up):0.000}).");
|
||||||
|
|
||||||
|
// A moon close to its gas giant: on the ground of the moon's giant-facing side the mecha is inside
|
||||||
|
// the giant's range too, and "away from the giant" points into the ground. The giant is listed
|
||||||
|
// first, as the planets are in orbit order.
|
||||||
|
VectorLF3 toGiant = (Up * 0.5 + East * Math.Sqrt(0.75)) * 2520.0;
|
||||||
|
object giant = Obstacle(Mecha + toGiant, GasGiantRadius, planetMargin);
|
||||||
|
foreach (VectorLF3 heading in new[] { East, -East, North })
|
||||||
|
{
|
||||||
|
VectorLF3 fromMoon = Direction(heading, giant, planet);
|
||||||
|
Check(VectorLF3.Dot(fromMoon, Up) > 0.75,
|
||||||
|
$"Taking off from a moon inside its gas giant's range must climb away from the moon (heading vs. local up {VectorLF3.Dot(fromMoon, Up):0.000}).");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Away from any surface a hive is still left behind.
|
||||||
|
object nearbyHive = Obstacle(Mecha + East * 8000.0, 0.0, hiveMargin);
|
||||||
|
VectorLF3 fromHive = Direction(North, nearbyHive);
|
||||||
|
Check(VectorLF3.Dot(fromHive, -East) > 0.85,
|
||||||
|
$"Inside a hive's range alone the mecha must fly away from the hive (heading vs. away {VectorLF3.Dot(fromHive, -East):0.000}).");
|
||||||
|
|
||||||
|
Console.WriteLine(_failures == 0
|
||||||
|
? $"Auto-cruise avoidance checks passed ({_checks} checks)."
|
||||||
|
: $"Auto-cruise avoidance checks: {_failures} of {_checks} failed.");
|
||||||
|
return _failures == 0 ? 0 : 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
#requires -Version 5.1
|
||||||
|
# Runs the auto-cruise obstacle avoidance of a built UXAssist.dll against the original game assemblies, without Unity.
|
||||||
|
[CmdletBinding()]
|
||||||
|
param([string]$GameRoot, [string]$UXAssistDll)
|
||||||
|
|
||||||
|
Set-StrictMode -Version Latest
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$repoRoot = [IO.Path]::GetFullPath((Join-Path $PSScriptRoot '..\..'))
|
||||||
|
if (-not $GameRoot) {
|
||||||
|
$steamRoot = (Get-ItemProperty -LiteralPath 'HKCU:\Software\Valve\Steam' -Name SteamPath).SteamPath
|
||||||
|
$vdf = Get-Content -LiteralPath (Join-Path $steamRoot 'steamapps\libraryfolders.vdf') -Raw
|
||||||
|
foreach ($entry in [regex]::Matches($vdf, '"path"\s+"([^"]+)"')) {
|
||||||
|
$library = $entry.Groups[1].Value.Replace('\\', '\')
|
||||||
|
$candidate = Join-Path $library 'steamapps\common\Dyson Sphere Program'
|
||||||
|
if (Test-Path -LiteralPath (Join-Path $candidate 'DSPGAME_Data\Managed\Assembly-CSharp.dll')) {
|
||||||
|
$GameRoot = $candidate
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-not $GameRoot) { throw 'DSP installation not found. Pass -GameRoot with the installed game directory.' }
|
||||||
|
$managed = Join-Path ([IO.Path]::GetFullPath($GameRoot)) 'DSPGAME_Data\Managed'
|
||||||
|
foreach ($name in @('Assembly-CSharp.dll', 'UnityEngine.CoreModule.dll')) {
|
||||||
|
if (-not (Test-Path -LiteralPath (Join-Path $managed $name))) { throw "Missing original game assembly: $name" }
|
||||||
|
}
|
||||||
|
if (-not $UXAssistDll) {
|
||||||
|
& dotnet build (Join-Path $repoRoot 'UXAssist\UXAssist.csproj') -c Release --no-restore -v quiet -nologo
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "UXAssist build failed (exit $LASTEXITCODE)." }
|
||||||
|
$UXAssistDll = Join-Path $repoRoot 'UXAssist\bin\Release\net472\UXAssist.dll'
|
||||||
|
}
|
||||||
|
$modDll = (Resolve-Path -LiteralPath $UXAssistDll).Path
|
||||||
|
$testRoot = Join-Path $repoRoot 'UXAssist\obj\auto-cruise-tests'
|
||||||
|
$null = [IO.Directory]::CreateDirectory($testRoot)
|
||||||
|
# Isolate the temporary console project from the mod's SDK props, packages, and packaging targets.
|
||||||
|
Set-Content -LiteralPath (Join-Path $testRoot 'Directory.Build.props') -Value '<Project />' -Encoding UTF8
|
||||||
|
Set-Content -LiteralPath (Join-Path $testRoot 'Directory.Build.targets') -Value '<Project />' -Encoding UTF8
|
||||||
|
$tests = [Security.SecurityElement]::Escape((Join-Path $PSScriptRoot 'AutoCruiseAvoidanceTests.cs'))
|
||||||
|
$originalDll = [Security.SecurityElement]::Escape((Join-Path $managed 'Assembly-CSharp.dll'))
|
||||||
|
$unityDll = [Security.SecurityElement]::Escape((Join-Path $managed 'UnityEngine.CoreModule.dll'))
|
||||||
|
$project = Join-Path $testRoot 'AutoCruiseTests.csproj'
|
||||||
|
Set-Content -LiteralPath $project -Encoding UTF8 -Value @"
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
|
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||||
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="$tests" />
|
||||||
|
<Reference Include="Assembly-CSharp" HintPath="$originalDll" />
|
||||||
|
<Reference Include="UnityEngine.CoreModule" HintPath="$unityDll" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
|
"@
|
||||||
|
& dotnet run --project $project -c Release -- $modDll
|
||||||
|
if ($LASTEXITCODE -ne 0) { throw "Auto-cruise avoidance checks failed (exit $LASTEXITCODE)." }
|
||||||
Reference in new issue
Block a user