mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-03-22 11:53:25 +08:00
UXAssist 1.5.4
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
* `Auto-contruct`:
|
* `Auto-contruct`:
|
||||||
* Add a UI option to hide it completely.
|
* Add a UI option to hide it completely.
|
||||||
* Fix an issue that may cause circling.
|
* Fix an issue that may cause circling.
|
||||||
|
* `Auto-cruise`: Fix some user experience related logics.
|
||||||
* 1.5.3
|
* 1.5.3
|
||||||
* New feature: `Auto-contruct`
|
* New feature: `Auto-contruct`
|
||||||
* Fly to buildings to be contructed automatically.
|
* Fly to buildings to be contructed automatically.
|
||||||
@@ -385,6 +386,7 @@
|
|||||||
* `自动建造`:
|
* `自动建造`:
|
||||||
* 增加了一个 UI 选项,可完全隐藏该功能。
|
* 增加了一个 UI 选项,可完全隐藏该功能。
|
||||||
* 修复了可能导致盘旋的问题。
|
* 修复了可能导致盘旋的问题。
|
||||||
|
* `自动巡航`:修复了一些用户体验相关的逻辑问题。
|
||||||
* 1.5.3
|
* 1.5.3
|
||||||
* 新功能:`自动建造`
|
* 新功能:`自动建造`
|
||||||
* 自动飞行到待建造的建筑处进行建造。
|
* 自动飞行到待建造的建筑处进行建造。
|
||||||
|
|||||||
@@ -337,9 +337,19 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
private static int _indicatorAstroId;
|
private static int _indicatorAstroId;
|
||||||
private static bool _speedUp;
|
private static bool _speedUp;
|
||||||
private static Vector3 _direction;
|
private static Vector3 _direction;
|
||||||
|
private static EMovementState _movementState = EMovementState.Walk;
|
||||||
|
|
||||||
public static int IndicatorAstroId => _indicatorAstroId;
|
public static int IndicatorAstroId => _indicatorAstroId;
|
||||||
|
|
||||||
|
protected override void OnEnable()
|
||||||
|
{
|
||||||
|
_canUseWarper = false;
|
||||||
|
_indicatorAstroId = 0;
|
||||||
|
_speedUp = false;
|
||||||
|
_direction = Vector3.zero;
|
||||||
|
_movementState = EMovementState.Walk;
|
||||||
|
}
|
||||||
|
|
||||||
public static void ToggleAutoCruise()
|
public static void ToggleAutoCruise()
|
||||||
{
|
{
|
||||||
AutoCruiseEnabled.Value = !AutoCruiseEnabled.Value;
|
AutoCruiseEnabled.Value = !AutoCruiseEnabled.Value;
|
||||||
@@ -349,6 +359,16 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool UpdateMovementState(PlayerController controller)
|
||||||
|
{
|
||||||
|
var movementStateChanged = controller.movementStateInFrame != _movementState;
|
||||||
|
if (movementStateChanged)
|
||||||
|
{
|
||||||
|
_movementState = controller.movementStateInFrame;
|
||||||
|
}
|
||||||
|
return movementStateChanged;
|
||||||
|
}
|
||||||
|
|
||||||
[HarmonyTranspiler]
|
[HarmonyTranspiler]
|
||||||
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GameTick))]
|
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GameTick))]
|
||||||
private static IEnumerable<CodeInstruction> PlayerController_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
private static IEnumerable<CodeInstruction> PlayerController_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
|
||||||
@@ -365,7 +385,8 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
var player = controller.player;
|
var player = controller.player;
|
||||||
if (player.mecha.thrusterLevel < 2) return;
|
if (player.mecha.thrusterLevel < 2) return;
|
||||||
var navi = player.navigation;
|
var navi = player.navigation;
|
||||||
if (navi.indicatorAstroId != _indicatorAstroId)
|
var astroChanged = navi.indicatorAstroId != _indicatorAstroId;
|
||||||
|
if (astroChanged)
|
||||||
{
|
{
|
||||||
_indicatorAstroId = navi.indicatorAstroId;
|
_indicatorAstroId = navi.indicatorAstroId;
|
||||||
Functions.UIFunctions.UpdateToggleAutoCruiseCheckButtonVisiblility();
|
Functions.UIFunctions.UpdateToggleAutoCruiseCheckButtonVisiblility();
|
||||||
@@ -377,25 +398,33 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
case EMovementState.Drift:
|
case EMovementState.Drift:
|
||||||
if (!AutoCruiseEnabled.Value) return;
|
if (!AutoCruiseEnabled.Value) return;
|
||||||
if (GameMain.localStar?.astroId == _indicatorAstroId) return;
|
if (GameMain.localStar?.astroId == _indicatorAstroId) return;
|
||||||
|
UpdateMovementState(controller);
|
||||||
/* Press jump key to fly */
|
/* Press jump key to fly */
|
||||||
controller.input0.z = 1f;
|
controller.input0.z = 1f;
|
||||||
break;
|
break;
|
||||||
case EMovementState.Fly:
|
case EMovementState.Fly:
|
||||||
if (!AutoCruiseEnabled.Value) return;
|
if (!AutoCruiseEnabled.Value) return;
|
||||||
if (GameMain.localStar?.astroId == _indicatorAstroId) return;
|
if (GameMain.localStar?.astroId == _indicatorAstroId) return;
|
||||||
|
UpdateMovementState(controller);
|
||||||
/* Keep pressing jump and pullup key to sail */
|
/* Keep pressing jump and pullup key to sail */
|
||||||
controller.input0.y = 1f;
|
controller.input0.y = -1f;
|
||||||
controller.input1.y = 1f;
|
controller.input1.y = 1f;
|
||||||
break;
|
break;
|
||||||
case EMovementState.Sail:
|
case EMovementState.Sail:
|
||||||
if (VFInput._pullUp.pressing || VFInput._pushDown.pressing || VFInput._moveLeft.pressing || VFInput._moveRight.pressing ||
|
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)))
|
(!player.warping && UIRoot.instance.uiGame.disableLockCursor && (VFInput._moveForward.pressing || VFInput._moveBackward.pressing)))
|
||||||
return;
|
return;
|
||||||
|
var movementStateChanged = UpdateMovementState(controller);
|
||||||
var playerPos = player.uPosition;
|
var playerPos = player.uPosition;
|
||||||
var isHive = _indicatorAstroId > 1000000;
|
var isHive = _indicatorAstroId > 1000000;
|
||||||
ref var astro = ref isHive ? ref GameMain.spaceSector.astros[_indicatorAstroId - 1000000] : ref GameMain.galaxy.astrosData[_indicatorAstroId];
|
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;
|
||||||
|
astroVec = astroVec.normalized;
|
||||||
|
if (astroChanged || movementStateChanged)
|
||||||
|
{
|
||||||
|
controller.actionSail.sailPoser.targetURotWanted = Quaternion.LookRotation(astroVec);
|
||||||
|
}
|
||||||
if (distance < astro.type switch
|
if (distance < astro.type switch
|
||||||
{
|
{
|
||||||
EAstroType.Planet => 800.0 + astro.uRadius,
|
EAstroType.Planet => 800.0 + astro.uRadius,
|
||||||
@@ -413,7 +442,7 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
var autoCruise = AutoCruiseEnabled.Value;
|
var autoCruise = AutoCruiseEnabled.Value;
|
||||||
if (GameMain.instance.timei % 6 == 0 || _direction == Vector3.zero)
|
if (GameMain.instance.timei % 6 == 0 || _direction == Vector3.zero)
|
||||||
{
|
{
|
||||||
_direction = astroVec.normalized;
|
_direction = astroVec;
|
||||||
|
|
||||||
/* Check nearest astroes, try to bypass them */
|
/* Check nearest astroes, try to bypass them */
|
||||||
var localStar = GameMain.localStar;
|
var localStar = GameMain.localStar;
|
||||||
@@ -477,11 +506,11 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
var speed = uVel.magnitude;
|
var speed = uVel.magnitude;
|
||||||
if (player.warping)
|
if (player.warping)
|
||||||
{
|
{
|
||||||
_speedUp = false;
|
|
||||||
if (autoCruise)
|
if (autoCruise)
|
||||||
{
|
{
|
||||||
/* Speed down if too close */
|
|
||||||
var actionSail = controller.actionSail;
|
var actionSail = controller.actionSail;
|
||||||
|
_speedUp = actionSail.currentWarpSpeed < actionSail.maxWarpSpeed;
|
||||||
|
/* Speed down if too close */
|
||||||
if (distance < GalaxyData.LY * 1.5)
|
if (distance < GalaxyData.LY * 1.5)
|
||||||
{
|
{
|
||||||
if (distance < actionSail.currentWarpSpeed * distance switch
|
if (distance < actionSail.currentWarpSpeed * distance switch
|
||||||
@@ -493,9 +522,14 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
})
|
})
|
||||||
{
|
{
|
||||||
controller.input0.y = -1f;
|
controller.input0.y = -1f;
|
||||||
|
_speedUp = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_speedUp = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -505,6 +539,7 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
|||||||
{
|
{
|
||||||
player.warpCommand = true;
|
player.warpCommand = true;
|
||||||
VFAudio.Create("warp-begin", player.transform, Vector3.zero, true);
|
VFAudio.Create("warp-begin", player.transform, Vector3.zero, true);
|
||||||
|
controller.actionSail.sailPoser.targetURotWanted = Quaternion.LookRotation(astroVec);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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.5.3</Version>
|
<Version>1.5.4</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<PackageId>UXAssist</PackageId>
|
<PackageId>UXAssist</PackageId>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "UXAssist",
|
"name": "UXAssist",
|
||||||
"version_number": "1.5.3",
|
"version_number": "1.5.4",
|
||||||
"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": [
|
||||||
|
|||||||
Reference in New Issue
Block a user