1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 03:33:29 +08:00

CheatEnabler and UXAssist new versions

This commit is contained in:
2024-03-25 02:41:24 +08:00
parent 3a52175041
commit cff09505b9
13 changed files with 297 additions and 70 deletions

View File

@@ -5,7 +5,7 @@
<TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.cheatenabler</BepInExPluginGuid>
<Description>DSP MOD - CheatEnabler</Description>
<Version>2.3.11</Version>
<Version>2.3.13</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<PackageId>CheatEnabler</PackageId>

View File

@@ -26,6 +26,7 @@ public static class FactoryPatch
private static Harmony _factoryPatch;
private static PressKeyBind _noConditionKey;
private static PressKeyBind _noCollisionKey;
public static void Init()
{
@@ -33,12 +34,25 @@ public static class FactoryPatch
_noConditionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{
key = new CombineKey((int)KeyCode.Q, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
conflictGroup = KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "ToggleNoCondition",
canOverride = true
}
);
_noCollisionKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{
key = new CombineKey((int)KeyCode.W, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "ToggleNoCollision",
canOverride = true
}
);
I18N.Add("KEYToggleNoCondition", "Toggle No Condition Build", "切换无条件建造");
I18N.Add("KEYToggleNoCollision", "Toggle No Collision", "切换无碰撞");
I18N.Add("NoConditionOn", "No condition build is enabled!", "无条件建造已启用");
I18N.Add("NoConditionOff", "No condition build is disabled!", "无条件建造已禁用");
I18N.Add("NoCollisionOn", "No collision is enabled!", "无碰撞已启用");
I18N.Add("NoCollisionOff", "No collision is disabled!", "无碰撞已禁用");
ImmediateEnabled.SettingChanged += (_, _) => ImmediateBuild.Enable(ImmediateEnabled.Value);
ArchitectModeEnabled.SettingChanged += (_, _) => ArchitectMode.Enable(ArchitectModeEnabled.Value);
NoConditionEnabled.SettingChanged += (_, _) => NoConditionBuild.Enable(NoConditionEnabled.Value);
@@ -68,6 +82,18 @@ public static class FactoryPatch
if (_noConditionKey.keyValue)
{
NoConditionEnabled.Value = !NoConditionEnabled.Value;
if (!DSPGame.IsMenuDemo && GameMain.isRunning)
{
UIRoot.instance.uiGame.generalTips.InvokeRealtimeTipAhead((NoConditionEnabled.Value ? "NoConditionOn" : "NoConditionOff").Translate());
}
}
if (_noCollisionKey.keyValue)
{
NoCollisionEnabled.Value = !NoCollisionEnabled.Value;
if (!DSPGame.IsMenuDemo && GameMain.isRunning)
{
UIRoot.instance.uiGame.generalTips.InvokeRealtimeTipAhead((NoCollisionEnabled.Value ? "NoCollisionOn" : "NoCollisionOff").Translate());
}
}
}

View File

@@ -4,8 +4,13 @@
#### 添加一些作弊功能,同时屏蔽异常检测
## Changlog
* 2.3.13
+ Fix a bug that shortcuts are not working and have display issue on settings window.
* 2.3.12
+ Add a shortcut to toggle `No collision`(Alt+W by default), you can modify the shortcut on system settings window.
+ Add realtime tips when toggling `No condition build` and `No collision` with shortcuts.
* 2.3.11
+ Add a shortcut to toggle `No condition build`, you can modify the shortcut on system settings window. This depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 1.0.15 or later.
+ Add a shortcut to toggle `No condition build`(Alt+Q by default), you can modify the shortcut on system settings window. This depends on [UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 1.0.15 or later.
* 2.3.10
+ Fix following functions not working in new game updates:
- `Pump Anywhere`
@@ -126,6 +131,11 @@
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
## 更新日志
* 2.3.13
+ 修复了快捷键无效和设置窗口上的按键显示问题
* 2.3.12
+ 添加了一个快捷键来切换`无碰撞`,你可以在系统设置面板中修改快捷键。
+ 在使用快捷键切换`无条件建造``无碰撞`时添加了实时提示信息。
* 2.3.11
+ 添加了一个快捷键来切换`无条件建造`,你可以在系统设置面板中修改快捷键。这依赖于[UXAssist](https://dsp.thunderstore.io/package/soarqin/UXAssist) 1.0.15或更高版本
* 2.3.10

View File

@@ -1,6 +1,6 @@
{
"name": "CheatEnabler",
"version_number": "2.3.11",
"version_number": "2.3.13",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/CheatEnabler",
"description": "Add various cheat functions while disabling abnormal determinants / 添加一些作弊功能,同时屏蔽异常检测",
"dependencies": [

View File

@@ -205,8 +205,9 @@ public static class DysonSpherePatch
[HarmonyPatch(typeof(DysonSphere), nameof(DysonSphere.ResetNew))]
private static void DysonSphere_ResetNew_Prefix(DysonSphere __instance)
{
if (_nodeForAbsorb == null) return;
var starIndex = __instance.starData.index;
if (_nodeForAbsorb[starIndex] == null) return;
if (starIndex >= _nodeForAbsorb.Length || _nodeForAbsorb[starIndex] == null) return;
_nodeForAbsorb[starIndex].Clear();
_nodeForAbsorb[starIndex] = null;
}

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
@@ -597,7 +596,9 @@ public static class FactoryPatch
CalculateGridOffset(__instance.planet, preview.lpos, out var x, out var y, out var z);
_lastPlanet = planet;
_lastPos = preview.lpos;
_lastOffsetText = $"<color=#ffbfbfff>{FormatOffsetFloat(x)}</color>,<color=#bfffbfff>{FormatOffsetFloat(y)}</color>,<color=#bfbfffff>{FormatOffsetFloat(z)}</color>";
_lastOffsetText = z is < 0.001f and > -0.001f
? $"<color=#ffbfbfff>{FormatOffsetFloat(x)}</color>,<color=#bfffbfff>{FormatOffsetFloat(y)}</color>"
: $"<color=#ffbfbfff>{FormatOffsetFloat(x)}</color>,<color=#bfffbfff>{FormatOffsetFloat(y)}</color>,<color=#bfbfffff>{FormatOffsetFloat(z)}</color>";
}
__instance.actionBuild.model.cursorText = $"({_lastOffsetText})\n" + __instance.actionBuild.model.cursorText;
}

View File

@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection.Emit;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UXAssist.Common;
using Object = UnityEngine.Object;
namespace UXAssist;

View File

@@ -1,9 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Reflection.Emit;
using BepInEx.Configuration;
using CommonAPI.Systems;
using HarmonyLib;
using UnityEngine;
using UXAssist.Common;
namespace UXAssist;
@@ -12,6 +13,9 @@ public static class PlayerPatch
public static ConfigEntry<bool> EnhancedMechaForgeCountControlEnabled;
public static ConfigEntry<bool> HideTipsForSandsChangesEnabled;
public static ConfigEntry<bool> AutoNavigationEnabled;
public static ConfigEntry<bool> AutoCruiseEnabled;
public static ConfigEntry<double> DistanceToWarp;
private static PressKeyBind _autoDriveKey;
public static void Init()
{
@@ -21,6 +25,23 @@ public static class PlayerPatch
EnhancedMechaForgeCountControl.Enable(EnhancedMechaForgeCountControlEnabled.Value);
HideTipsForSandsChanges.Enable(HideTipsForSandsChangesEnabled.Value);
AutoNavigation.Enable(AutoNavigationEnabled.Value);
_autoDriveKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{
key = new CombineKey((int)KeyCode.A, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "ToggleAutoCruise",
canOverride = true
});
I18N.Add("AutoCruiseOn", "Auto-cruise enabled", "已启用自动巡航");
I18N.Add("AutoCruiseOff", "Auto-cruise disabled", "已禁用自动巡航");
}
public static void OnUpdate()
{
if (_autoDriveKey.keyValue)
{
AutoNavigation.ToggleAutoCruise();
}
}
public static void Uninit()
@@ -125,15 +146,14 @@ public static class PlayerPatch
}
}
private static class AutoNavigation
public static class AutoNavigation
{
private static Harmony _patch;
private static bool _canUseWarper;
private static int _indicatorAstroId;
private static bool _speedUp;
/*
private static bool _aimingEnabled;
*/
private static Vector3 _direction;
public static void Enable(bool on)
{
@@ -147,70 +167,175 @@ public static class PlayerPatch
_patch = null;
}
}
public static void ToggleAutoCruise()
{
AutoCruiseEnabled.Value = !AutoCruiseEnabled.Value;
if (!DSPGame.IsMenuDemo && GameMain.isRunning)
{
UIRoot.instance.uiGame.generalTips.InvokeRealtimeTipAhead((AutoCruiseEnabled.Value ? "AutoCruiseOn" : "AutoCruiseOff").Translate());
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GameTick))]
private static IEnumerable<CodeInstruction> PlayerController_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
var matcher = new CodeMatcher(instructions, generator);
matcher.MatchForward(false,
new CodeMatch(OpCodes.Callvirt, AccessTools.Method(typeof(BuildModel), nameof(BuildModel.LateGameTickIgnoreActive)))
);
var labels = matcher.Labels;
matcher.Labels = null;
matcher.InsertAndAdvance(
new CodeInstruction(OpCodes.Ldarg_0).WithLabels(labels),
new CodeMatch(OpCodes.Callvirt, AccessTools.Method(typeof(BuildModel), nameof(BuildModel.EarlyGameTickIgnoreActive)))
).Advance(1).InsertAndAdvance(
new CodeInstruction(OpCodes.Ldarg_0),
Transpilers.EmitDelegate((PlayerController controller) =>
{
/* Update target astro if changed */
_speedUp = false;
if (controller.movementStateInFrame != EMovementState.Sail) return;
var navi = controller.player.navigation;
var player = controller.player;
var navi = player.navigation;
if (navi.indicatorAstroId != _indicatorAstroId)
{
_indicatorAstroId = navi.indicatorAstroId;
if (_indicatorAstroId == 0) return;
}
else if (_indicatorAstroId == 0) return;
var player = controller.player;
var playerPos = player.uPosition;
ref var astro = ref GameMain.galaxy.astrosData[_indicatorAstroId];
var vec = astro.uPos - playerPos;
if (vec.magnitude - astro.uRadius < 800.0) return;
var direction = vec.normalized;
var localStar = GameMain.localStar;
if (localStar != null)
switch (controller.movementStateInFrame)
{
var nearestRange = (playerPos - localStar.uPosition).sqrMagnitude;
var nearestPos = localStar.uPosition;
var nearestAstroId = localStar.id;
foreach (var p in localStar.planets)
{
var range = (playerPos - p.uPosition).sqrMagnitude;
if (range >= nearestRange) continue;
nearestRange = range;
nearestPos = p.uPosition;
nearestAstroId = p.id;
}
if (nearestAstroId != _indicatorAstroId && nearestRange < 2000.0 * 2000.0)
{
var vec2 = (playerPos - nearestPos).normalized;
var dot = Vector3.Dot(vec2, direction);
if (dot >= 0)
case EMovementState.Walk:
case EMovementState.Drift:
if (!AutoCruiseEnabled.Value) return;
if (GameMain.localStar?.astroId == _indicatorAstroId) return;
/* Press jump key to fly */
controller.input0.z = 1f;
break;
case EMovementState.Fly:
if (!AutoCruiseEnabled.Value) return;
if (GameMain.localStar?.astroId == _indicatorAstroId) return;
/* Keep pressing jump and pullup key to sail */
controller.input0.y = 1f;
controller.input1.y = 1f;
break;
case EMovementState.Sail:
if (VFInput._pullUp.pressing || VFInput._pushDown.pressing || VFInput._moveLeft.pressing || VFInput._moveRight.pressing ||
(!player.warping && UIRoot.instance.uiGame.disableLockCursor && (VFInput._moveForward.pressing || VFInput._moveBackward.pressing)))
return;
var playerPos = player.uPosition;
ref var astro = ref GameMain.galaxy.astrosData[_indicatorAstroId];
var astroVec = astro.uPos - playerPos;
var distance = astroVec.magnitude;
if (distance - astro.uRadius < astro.type switch {
EAstroType.Planet => 800.0,
EAstroType.Star => 4000.0,
_ => 2000.0
}) return;
if (GameMain.instance.timei % 6 == 0)
{
direction = vec2;
_direction = astroVec.normalized;
/* Check nearest astroes, try to bypass them */
var localStar = GameMain.localStar;
_canUseWarper = AutoCruiseEnabled.Value && !player.warping && player.mecha.warpStorage.GetItemCount(1210) > 0;
if (localStar != null)
{
var nearestRange = (playerPos - localStar.uPosition).sqrMagnitude;
var nearestPos = localStar.uPosition;
var nearestAstroId = localStar.astroId;
foreach (var p in localStar.planets)
{
var range = (playerPos - p.uPosition).sqrMagnitude;
if (range >= nearestRange) continue;
nearestRange = range;
nearestPos = p.uPosition;
nearestAstroId = p.astroId;
}
var hiveSys = GameMain.spaceSector.dfHives[localStar.index];
while (hiveSys != null)
{
if (hiveSys.realized)
{
ref var hiveAstro = ref GameMain.galaxy.astrosData[hiveSys.hiveAstroId];
/* Divide by 4, so that the real range is 2 times of the calculated range,
which means the minimal range allowed is 4000 */
var range = (playerPos - hiveAstro.uPos).sqrMagnitude / 4.0;
if (range >= nearestRange) continue;
nearestRange = range;
nearestPos = hiveAstro.uPos;
nearestAstroId = hiveSys.hiveAstroId;
}
hiveSys = hiveSys.nextSibling;
}
if (nearestAstroId != _indicatorAstroId && nearestRange < 2000.0 * 2000.0)
{
Vector3 leavingDirection = (playerPos - nearestPos).normalized;
var dot = Vector3.Dot(leavingDirection, _direction);
if (dot < 0)
{
var cross = Vector3.Cross(_direction, leavingDirection);
_direction = Vector3.Cross(leavingDirection, cross).normalized;
}
else
{
_direction = leavingDirection;
}
}
}
}
Vector3 uVel = player.uVelocity;
var speed = uVel.magnitude;
if (player.warping)
{
_speedUp = false;
if (AutoCruiseEnabled.Value)
{
/* Speed down if too close */
var actionSail = controller.actionSail;
if (distance < GalaxyData.LY * 1.5)
{
if (distance < actionSail.currentWarpSpeed * distance switch
{
> GalaxyData.LY * 0.6 => 0.33,
> GalaxyData.LY * 0.3 => 0.5,
> GalaxyData.LY * 0.1 => 0.66,
_ => 1.0
})
{
controller.input0.y = -1f;
}
}
}
}
else
{
var cross = Vector3.Cross(direction, vec2);
direction = -Vector3.Cross(cross, vec2).normalized;
if (_canUseWarper && GameMain.localPlanet == null && distance > GalaxyData.AU * DistanceToWarp.Value && player.mecha.UseWarper())
{
player.warpCommand = true;
VFAudio.Create("warp-begin", player.transform, Vector3.zero, true);
}
else
{
/* Speed up if needed */
_speedUp = speed + 0.2f < player.mecha.maxSailSpeed;
}
}
}
/* Update direction, gracefully rotate for 2 degrees for each frame */
var angle = Vector3.Angle(uVel, _direction);
if (angle < 2f)
{
player.uVelocity = _direction * speed;
}
else
{
player.uVelocity = Vector3.Slerp(uVel, _direction * speed, 2f / angle);
}
break;
default:
_speedUp = false;
break;
}
var uVel = player.uVelocity;
var speed = uVel.magnitude;
_speedUp = !player.warping && speed < 2000.0 - 0.1;
player.uVelocity = direction * speed;
})
);
return matcher.InstructionEnumeration();
@@ -231,7 +356,7 @@ public static class PlayerPatch
return matcher.InstructionEnumeration();
}
/*
/* Disable Lock Cursor Mode on entering sail panel
[HarmonyPrefix]
[HarmonyPatch(typeof(UISailPanel), nameof(UISailPanel._OnOpen))]
public static void OnOpen_Prefix()

View File

@@ -4,6 +4,16 @@
#### 一些提升用户体验的功能和补丁
## Changlog
* 1.0.17
+ New function: `Auto navigation on sailings`, which is inspired by [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/)
- It keeps Icarus on course to the target planet
- It will try to bypass any obstacles(planets, stars or dark-fog hives) on the way
- Furthermore, there is also a shortcut key(Alt+A by default) which can be set in the system options window, which is used to toggle `Auto-cruise` that enables flying to targeted planets fully automatically.
- Auto-cruise will start when you target a planet on star map
- It will use warper to fly to the target planet if the planet is too far away, the range can be configured.
- It will speed down when approaching the target planet, to avoid overshooting
+ Fix a crash caused by `Stop ejectors when available nodes are all filled up` in latest game update
+ `Off-grid building and stepped rotation`: Hide Z coordinate from display if it is zero
* 1.0.16
+ Add CommonAPI to package manifest dependencies(missing in last version)
+ New function: `Hide tips for soil piles changes`
@@ -89,6 +99,13 @@
- Enable player actions in globe view
- Treat stack items as single in monitor components
- Hide tips for soil piles changes
- Auto navigation on sailings
- It keeps Icarus on course to the target planet
- It will try to bypass any obstacles(planets, stars or dark-fog hives) on the way
- Furthermore, there is also a shortcut key(Alt+A by default) which can be set in the system options window, which is used to toggle `Auto-cruise` that enables flying to targeted planets fully automatically.
- Auto-cruise will start when you select a planet as target
- It will use warper to fly to the target planet if the planet is too far away, the range can be configured.
- It will speed down when approaching the target planet, to avoid overshooting
- Enhanced control for logistic storage limits
- Logistic storage limits are not scaled on upgrading `Logistics Carrier Capacity`, if they are not set to maximum capacity.
- You can use arrow keys to adjust logistic storage limits gracefully.
@@ -112,8 +129,19 @@
* [Multifunction_mod](https://github.com/blacksnipebiu/Multifunction_mod): Some cheat functions
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI implementations
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): Off-grid building & stepped rotation implementations
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/) and its extension [AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `Auto navigation on sailings` and `Auto-cruise` implementations
## 更新日志
* 1.0.17
+ 新功能:`航行时自动导航`,想法来自[CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/)及其扩展[AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/)
- 它会保持伊卡洛斯飞向目标星球
- 它会尝试绕过途中的任何障碍物(行星、恒星或黑雾巢穴)
- 此外,还有一个快捷键(默认为Alt+A)可以在系统选项窗口中设置,用于切换`自动巡航`,实现完全自动化的飞行至目标星球。
- 当你选择目标星球后,自动巡航就会开始
- 如果目标星球距离过远会自动使用曲速(超过5AU),你可以在面板上更改这个值。
- 它会在接近目标星球时减速,以避免发生越过目标的情况
+ 修复了最新游戏更新后`当可用节点全部造完时停止弹射`引起崩溃问题
+ `脱离网格建造和小角度旋转`如果Z坐标为零则从显示中隐藏
* 1.0.16
+ 添加了对CommonAPI的包依赖(上个版本忘记加了)
+ 新功能:`隐藏沙土数量变动的提示`
@@ -201,6 +229,13 @@
- 在行星视图中允许玩家操作
- 在流速计中将堆叠物品视为单个物品
- 隐藏沙土数量变动的提示
- 航行时自动导航
- 它会保持伊卡洛斯飞向目标星球
- 它会尝试绕过途中的任何障碍物(行星、恒星或黑雾巢穴)
- 此外,还有一个快捷键(默认为Alt+A)可以在系统选项窗口中设置,用于切换`自动巡航`,实现完全自动化的飞行至目标星球。
- 当你选择目标星球后,自动巡航就会开始
- 如果目标星球距离过远会自动使用曲速(超过5AU),你可以在面板上更改这个值。
- 它会在接近目标星球时减速,以避免发生越过目标的情况
- 物流塔存储数量限制控制改进
- 当升级`运输机舱扩容`时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。
- 你可以使用方向键微调物流塔存储限制
@@ -224,3 +259,4 @@
* [BepInEx](https://bepinex.dev/): 基础模组框架
* [LSTM](https://github.com/hetima/DSP_LSTM) & [PlanetFinder](https://github.com/hetima/DSP_PlanetFinder): UI实现
* [OffGridConstruction](https://github.com/Velociraptor115-DSPModding/OffGridConstruction): 脱离网格建造以及小角度旋转的实现
* [CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/)及其扩展[AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/): `航行时自动导航``自动巡航`的实现

View File

@@ -1,4 +1,5 @@
using UnityEngine;
using System;
using UnityEngine;
using UXAssist.UI;
using UXAssist.Common;
@@ -36,6 +37,9 @@ public static class UIConfigWindow
I18N.Add("Enhance control for logistic storage limits tips", "Logistic storage limits are not scaled on upgrading 'Logistics Carrier Capacity', if they are not set to maximum capacity.\nUse arrow keys to adjust logistic storage limits:\n \u2190/\u2192: -/+10 \u2193\u2191: -/+100", "当升级'运输机舱扩容'时,不会对各种物流塔的存储限制按比例提升,除非设置为最大允许容量。\n你可以使用方向键微调物流塔存储限制\n \u2190\u2192: -/+10 \u2193\u2191: -/+100");
I18N.Add("Enhanced count control for hand-make", "Enhanced count control for hand-make", "手动制造物品的数量控制改进");
I18N.Add("Enhanced count control for hand-make tips", "Maximum count is increased to 1000.\nHold Ctrl/Shift/Alt to change the count rapidly.", "最大数量提升至1000\n按住Ctrl/Shift/Alt可快速改变数量");
I18N.Add("Auto navigation on sailings", "Auto navigation on sailings", "宇宙航行时自动导航");
I18N.Add("Enable auto-cruise", "Enable auto-cruise", "启用自动巡航");
I18N.Add("Distance to use warp", "Distance to use warp (AU)", "使用曲速的距离(AU)");
I18N.Add("Treat stack items as single in monitor components", "Treat stack items as single in monitor components", "在流速计中将堆叠物品视为单个物品");
I18N.Add("Initialize This Planet", "Initialize this planet", "初始化本行星");
I18N.Add("Initialize This Planet Confirm", "This operation will destroy all buildings and revert terrains on this planet, are you sure?", "此操作将会摧毁本行星上的所有建筑并恢复地形,确定吗?");
@@ -109,6 +113,26 @@ public static class UIConfigWindow
x = 270f;
y += 6f;
MyWindow.AddTipsButton(x, y, tab2, "Enhanced count control for hand-make", "Enhanced count control for hand-make tips", "enhanced-count-control-tips");
x = 350f;
y -= 108f;
MyCheckBox.CreateCheckBox(x, y, tab2, PlayerPatch.AutoNavigationEnabled, "Auto navigation on sailings");
x += 20f;
y += 36f;
MyCheckBox.CreateCheckBox(x, y, tab2, PlayerPatch.AutoCruiseEnabled, "Enable auto-cruise", 14);
x -= 20f;
y += 36f;
MyWindow.AddText(x, y, tab2, "Distance to use warp", 15, "text-distance-to-warp");
y += 24f;
var distanceToWarp = MySlider.CreateSlider(x, y, tab2, (float)Math.Round(PlayerPatch.DistanceToWarp.Value * 2.0), 1f, 40f, "0.0", 200f);
if (PlanetFunctions.OrbitalCollectorMaxBuildCount.Value == 0)
{
distanceToWarp.SetLabelText(PlayerPatch.DistanceToWarp.Value.ToString("0.0"));
}
distanceToWarp.OnValueChanged += () =>
{
PlayerPatch.DistanceToWarp.Value = Math.Round(distanceToWarp.Value) * 0.5;
distanceToWarp.SetLabelText(PlayerPatch.DistanceToWarp.Value.ToString("0.0"));
};
x = 400f;
y = 10f;
wnd.AddButton(x, y, tab2, "Initialize This Planet", 16, "button-init-planet", () =>
@@ -128,19 +152,19 @@ public static class UIConfigWindow
wnd.AddButton(x, y, 200, tab2, "Quick build Orbital Collectors", 16, "button-init-planet", PlanetFunctions.BuildOrbitalCollectors);
x += 10f;
y += 30f;
MyWindow.AddText(x, y, tab2, "Maximum count to build", 16, "text-oc-build-count");
y += 26f;
var sl0 = MySlider.CreateSlider(x, y, tab2, PlanetFunctions.OrbitalCollectorMaxBuildCount.Value, 0f, 40f, "G", 200f);
MyWindow.AddText(x, y, tab2, "Maximum count to build", 15, "text-oc-build-count");
y += 24f;
var ocBuildSlider = MySlider.CreateSlider(x, y, tab2, PlanetFunctions.OrbitalCollectorMaxBuildCount.Value, 0f, 40f, "G", 200f);
if (PlanetFunctions.OrbitalCollectorMaxBuildCount.Value == 0)
{
sl0.SetLabelText("max".Translate());
ocBuildSlider.SetLabelText("max".Translate());
}
sl0.OnValueChanged += () =>
ocBuildSlider.OnValueChanged += () =>
{
PlanetFunctions.OrbitalCollectorMaxBuildCount.Value = Mathf.RoundToInt(sl0.Value);
PlanetFunctions.OrbitalCollectorMaxBuildCount.Value = Mathf.RoundToInt(ocBuildSlider.Value);
if (PlanetFunctions.OrbitalCollectorMaxBuildCount.Value == 0)
{
sl0.SetLabelText("max".Translate());
ocBuildSlider.SetLabelText("max".Translate());
}
};

View File

@@ -31,7 +31,7 @@ public class UXAssist : BaseUnityPlugin
_toggleKey = KeyBindings.RegisterKeyBinding(new BuiltinKey
{
key = new CombineKey((int)KeyCode.BackQuote, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
conflictGroup = KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
conflictGroup = KeyBindConflict.MOVEMENT | KeyBindConflict.FLYING | KeyBindConflict.SAILING | KeyBindConflict.BUILD_MODE_1 | KeyBindConflict.KEYBOARD_KEYBIND,
name = "OpenUXAssistConfigWindow",
canOverride = true
});
@@ -74,6 +74,9 @@ public class UXAssist : BaseUnityPlugin
"Enhanced count control for hand-make, increases maximum of count to 1000, and you can hold Ctrl/Shift/Alt to change the count rapidly");
PlayerPatch.AutoNavigationEnabled = Config.Bind("Player", "AutoNavigation", false,
"Auto navigation");
PlayerPatch.AutoCruiseEnabled = Config.Bind("Player", "AutoCruise", false,
"Auto-cruise enabled");
PlayerPatch.DistanceToWarp = Config.Bind("Player", "DistanceToWarp", 5.0, "Distance to warp (in AU)");
DysonSpherePatch.StopEjectOnNodeCompleteEnabled = Config.Bind("DysonSphere", "StopEjectOnNodeComplete", false,
"Stop ejectors when available nodes are all filled up");
DysonSpherePatch.OnlyConstructNodesEnabled = Config.Bind("DysonSphere", "OnlyConstructNodes", false,
@@ -82,7 +85,7 @@ public class UXAssist : BaseUnityPlugin
I18N.Init();
I18N.Add("UXAssist Config", "UXAssist Config", "UX助手设置");
I18N.Add("KEYOpenUXAssistConfigWindow", "Open UXAssist Config Window", "打开UX助手设置面板");
I18N.Apply();
I18N.Add("KEYToggleAutoCruise", "Toggle auto-cruise", "切换自动巡航");
// UI Patch
_patch ??= Harmony.CreateAndPatchAll(typeof(UXAssist));
@@ -94,6 +97,8 @@ public class UXAssist : BaseUnityPlugin
PlanetPatch.Init();
PlayerPatch.Init();
DysonSpherePatch.Init();
I18N.Apply();
}
private void OnDestroy()
@@ -120,6 +125,7 @@ public class UXAssist : BaseUnityPlugin
{
ToggleConfigWindow();
}
PlayerPatch.OnUpdate();
}
private void LateUpdate()

View File

@@ -4,7 +4,7 @@
<TargetFramework>net472</TargetFramework>
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
<Description>DSP MOD - UXAssist</Description>
<Version>1.0.16</Version>
<Version>1.0.17</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<PackageId>UXAssist</PackageId>

View File

@@ -1,6 +1,6 @@
{
"name": "UXAssist",
"version_number": "1.0.16",
"version_number": "1.0.17",
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
"dependencies": [