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`:
|
||||
* Add a UI option to hide it completely.
|
||||
* Fix an issue that may cause circling.
|
||||
* `Auto-cruise`: Fix some user experience related logics.
|
||||
* 1.5.3
|
||||
* New feature: `Auto-contruct`
|
||||
* Fly to buildings to be contructed automatically.
|
||||
@@ -385,6 +386,7 @@
|
||||
* `自动建造`:
|
||||
* 增加了一个 UI 选项,可完全隐藏该功能。
|
||||
* 修复了可能导致盘旋的问题。
|
||||
* `自动巡航`:修复了一些用户体验相关的逻辑问题。
|
||||
* 1.5.3
|
||||
* 新功能:`自动建造`
|
||||
* 自动飞行到待建造的建筑处进行建造。
|
||||
|
||||
@@ -337,9 +337,19 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
private static int _indicatorAstroId;
|
||||
private static bool _speedUp;
|
||||
private static Vector3 _direction;
|
||||
private static EMovementState _movementState = EMovementState.Walk;
|
||||
|
||||
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()
|
||||
{
|
||||
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]
|
||||
[HarmonyPatch(typeof(PlayerController), nameof(PlayerController.GameTick))]
|
||||
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;
|
||||
if (player.mecha.thrusterLevel < 2) return;
|
||||
var navi = player.navigation;
|
||||
if (navi.indicatorAstroId != _indicatorAstroId)
|
||||
var astroChanged = navi.indicatorAstroId != _indicatorAstroId;
|
||||
if (astroChanged)
|
||||
{
|
||||
_indicatorAstroId = navi.indicatorAstroId;
|
||||
Functions.UIFunctions.UpdateToggleAutoCruiseCheckButtonVisiblility();
|
||||
@@ -377,25 +398,33 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
case EMovementState.Drift:
|
||||
if (!AutoCruiseEnabled.Value) return;
|
||||
if (GameMain.localStar?.astroId == _indicatorAstroId) return;
|
||||
UpdateMovementState(controller);
|
||||
/* Press jump key to fly */
|
||||
controller.input0.z = 1f;
|
||||
break;
|
||||
case EMovementState.Fly:
|
||||
if (!AutoCruiseEnabled.Value) return;
|
||||
if (GameMain.localStar?.astroId == _indicatorAstroId) return;
|
||||
UpdateMovementState(controller);
|
||||
/* Keep pressing jump and pullup key to sail */
|
||||
controller.input0.y = 1f;
|
||||
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 movementStateChanged = UpdateMovementState(controller);
|
||||
var playerPos = player.uPosition;
|
||||
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 distance = astroVec.magnitude;
|
||||
astroVec = astroVec.normalized;
|
||||
if (astroChanged || movementStateChanged)
|
||||
{
|
||||
controller.actionSail.sailPoser.targetURotWanted = Quaternion.LookRotation(astroVec);
|
||||
}
|
||||
if (distance < astro.type switch
|
||||
{
|
||||
EAstroType.Planet => 800.0 + astro.uRadius,
|
||||
@@ -413,7 +442,7 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
var autoCruise = AutoCruiseEnabled.Value;
|
||||
if (GameMain.instance.timei % 6 == 0 || _direction == Vector3.zero)
|
||||
{
|
||||
_direction = astroVec.normalized;
|
||||
_direction = astroVec;
|
||||
|
||||
/* Check nearest astroes, try to bypass them */
|
||||
var localStar = GameMain.localStar;
|
||||
@@ -477,11 +506,11 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
var speed = uVel.magnitude;
|
||||
if (player.warping)
|
||||
{
|
||||
_speedUp = false;
|
||||
if (autoCruise)
|
||||
{
|
||||
/* Speed down if too close */
|
||||
var actionSail = controller.actionSail;
|
||||
_speedUp = actionSail.currentWarpSpeed < actionSail.maxWarpSpeed;
|
||||
/* Speed down if too close */
|
||||
if (distance < GalaxyData.LY * 1.5)
|
||||
{
|
||||
if (distance < actionSail.currentWarpSpeed * distance switch
|
||||
@@ -493,9 +522,14 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
})
|
||||
{
|
||||
controller.input0.y = -1f;
|
||||
_speedUp = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_speedUp = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -505,6 +539,7 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
{
|
||||
player.warpCommand = true;
|
||||
VFAudio.Create("warp-begin", player.transform, Vector3.zero, true);
|
||||
controller.actionSail.sailPoser.targetURotWanted = Quaternion.LookRotation(astroVec);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net472</TargetFramework>
|
||||
<BepInExPluginGuid>org.soardev.uxassist</BepInExPluginGuid>
|
||||
<Description>DSP MOD - UXAssist</Description>
|
||||
<Version>1.5.3</Version>
|
||||
<Version>1.5.4</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackageId>UXAssist</PackageId>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "UXAssist",
|
||||
"version_number": "1.5.3",
|
||||
"version_number": "1.5.4",
|
||||
"website_url": "https://github.com/soarqin/DSP_Mods/tree/master/UXAssist",
|
||||
"description": "Some functions and patches for better user experience / 一些提升用户体验的功能和补丁",
|
||||
"dependencies": [
|
||||
|
||||
Reference in New Issue
Block a user