1
0
mirror of https://github.com/soarqin/DSP_Mods.git synced 2025-12-09 16:13:31 +08:00

UXAssist 1.0.18

This commit is contained in:
2024-03-25 03:35:37 +08:00
parent cff09505b9
commit 11746a0bb4
4 changed files with 43 additions and 21 deletions

View File

@@ -219,14 +219,24 @@ public static class PlayerPatch
(!player.warping && UIRoot.instance.uiGame.disableLockCursor && (VFInput._moveForward.pressing || VFInput._moveBackward.pressing))) (!player.warping && UIRoot.instance.uiGame.disableLockCursor && (VFInput._moveForward.pressing || VFInput._moveBackward.pressing)))
return; return;
var playerPos = player.uPosition; var playerPos = player.uPosition;
ref var astro = ref GameMain.galaxy.astrosData[_indicatorAstroId]; var isHive = _indicatorAstroId > 1000000;
ref var astro = ref isHive ? ref GameMain.spaceSector.astros[_indicatorAstroId - 1000000] : ref GameMain.galaxy.astrosData[_indicatorAstroId];
var astroVec = astro.uPos - playerPos; var astroVec = astro.uPos - playerPos;
var distance = astroVec.magnitude; var distance = astroVec.magnitude;
if (distance - astro.uRadius < astro.type switch { if (distance < astro.type switch
EAstroType.Planet => 800.0, {
EAstroType.Star => 4000.0, EAstroType.Planet => 800.0 + astro.uRadius,
_ => 2000.0 EAstroType.Star => 4000.0 + astro.uRadius,
}) return; EAstroType.EnemyHive => 400.0,
_ => 2000.0 + astro.uRadius
})
{
if (isHive)
{
player.uVelocity = Vector3.zero;
}
return;
}
if (GameMain.instance.timei % 6 == 0) if (GameMain.instance.timei % 6 == 0)
{ {
_direction = astroVec.normalized; _direction = astroVec.normalized;
@@ -248,23 +258,29 @@ public static class PlayerPatch
nearestAstroId = p.astroId; nearestAstroId = p.astroId;
} }
/* If targeting hives, do not bypass them */
if (!isHive)
{
var hiveSys = GameMain.spaceSector.dfHives[localStar.index]; var hiveSys = GameMain.spaceSector.dfHives[localStar.index];
while (hiveSys != null) while (hiveSys != null)
{ {
if (hiveSys.realized) if (hiveSys.realized && hiveSys.hiveAstroId > 1000000)
{ {
ref var hiveAstro = ref GameMain.galaxy.astrosData[hiveSys.hiveAstroId]; ref var hiveAstro = ref GameMain.spaceSector.astros[hiveSys.hiveAstroId - 1000000];
/* Divide by 4, so that the real range is 2 times of the calculated range, /* Divide by 4, so that the real range is 2 times of the calculated range,
which means the minimal range allowed is 4000 */ which means the minimal range allowed is 4000 */
var range = (playerPos - hiveAstro.uPos).sqrMagnitude / 4.0; var range = (playerPos - hiveAstro.uPos).sqrMagnitude / 4.0;
if (range >= nearestRange) continue; if (range < nearestRange)
{
nearestRange = range; nearestRange = range;
nearestPos = hiveAstro.uPos; nearestPos = hiveAstro.uPos;
nearestAstroId = hiveSys.hiveAstroId; nearestAstroId = hiveSys.hiveAstroId;
} }
}
hiveSys = hiveSys.nextSibling; hiveSys = hiveSys.nextSibling;
} }
}
if (nearestAstroId != _indicatorAstroId && nearestRange < 2000.0 * 2000.0) if (nearestAstroId != _indicatorAstroId && nearestRange < 2000.0 * 2000.0)
{ {

View File

@@ -4,6 +4,9 @@
#### 一些提升用户体验的功能和补丁 #### 一些提升用户体验的功能和补丁
## Changlog ## Changlog
* 1.0.18
+ Fix crash while coursing to a dark-fog hive.
+ Auto-cruise does not bypass dark-fog hives if they are targeted.
* 1.0.17 * 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/) + 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 keeps Icarus on course to the target planet
@@ -132,6 +135,9 @@
* [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 * [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.18
+ 修复了以黑雾巢穴为目标时导致崩溃的问题
+ 当黑雾巢穴是目标时,自动导航不会绕过它
* 1.0.17 * 1.0.17
+ 新功能:`航行时自动导航`,想法来自[CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/)及其扩展[AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/) + 新功能:`航行时自动导航`,想法来自[CruiseAssist](https://dsp.thunderstore.io/package/tanu/CruiseAssist/)及其扩展[AutoPilot](https://dsp.thunderstore.io/package/tanu/AutoPilot/)
- 它会保持伊卡洛斯飞向目标星球 - 它会保持伊卡洛斯飞向目标星球

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"name": "UXAssist", "name": "UXAssist",
"version_number": "1.0.17", "version_number": "1.0.18",
"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": [