mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(uxassist): correct auto-cruise sail frame, braking and lifecycle
visual_uvel subtracted the unblended planet velocity. PlayerMove_Sail and PlayerNavigation.DetermineSailVelocity both fade that reference frame out with altitude and drop it entirely above 600 m, and PlayerController.UpdateRotation runs after the whole action loop and turns visual_uvel into the mecha heading and the speed readout, so the mecha visibly misaimed while sailing near a planet. Apply the same blend, and stop writing uRotation from the sail postfix, which the game recomputes immediately afterwards anyway. Fixed targets had no approach deceleration: the cruise always aimed at maxSailSpeed and simply stopped at the arrival radius. PlayerMove_Sail only hands over to PlayerMove_Fly below 75 m/s of planet-relative speed, so the mecha could never land. Cap the speed from the remaining distance, apply the brake directly as the original does instead of folding it into the turn interpolation (which weakened it by up to 1/t), and release warp early enough for that brake to settle, since the game's own warp guard only covers planets and never stars. Yield to the game's own autopilot: PlayerNavigation zeroes the movement input inside PlayerMove_Sail and PlayerMove_Fly and drives uVelocity itself, so both were fighting over the same state. AutoConstructPatch already did this. Guard SpaceSector.dfHives, which Init never allocates and Import only allocates when the save carries hive data; the game null-checks it everywhere for that reason and this ran on every sailing tick. Follow AutoCruiseEnabled with the Harmony patches so disabling the feature no longer leaves a transpiler on the hot PlayerController.GameTick installed, and require a resolvable target before starting so the feature cannot emit a started and a stopped popup in the same frame. Refresh the toggle button label wherever Checked is set directly, since MyCheckButton.Checked only updates the colours and the label lives on the OnChecked handlers; toggling by shortcut left it stale. Rename the user-facing strings to auto-cruise so they stop colliding with the game's own navigation feature, and clean up the region: fix the misspelled safety-radius constants, invert and rename the precondition helper, drop the unused Obstacle.Radius, raise the degenerate-vector epsilon, and convert the file's mixed tab indentation to spaces.
This commit is contained in:
1 parent
3a840e7b2d
commit
b5cb9aefb9
5 files changed
+1005
-925
No files matched your search
+12
-10
@@ -154,16 +154,17 @@ public static class I18NKeys
|
||||
public const string ShortcutKeysForShowingStarsName = "Shortcut keys for showing stars' name";
|
||||
public const string AutoBoost = "Auto boost";
|
||||
public const string DistanceToUseWarp = "Distance to use warp";
|
||||
public const string StopAutoNavigationOnManualInput = "Stop auto-navigation on manual input";
|
||||
public const string StopAutoCruiseOnManualInput = "Stop auto-cruise on manual input";
|
||||
public const string UseWarp = "Use warp";
|
||||
public const string UseWarpMinimalEnergy = "Use warp minimal energy";
|
||||
public const string AutoBoostMinimalEnergy = "Auto boost minimal energy";
|
||||
public const string DarkFogHiveFollowDistance = "Dark Fog Hive follow distance";
|
||||
public const string DarkFogCarrierFollowDistance = "Dark Fog Carrier follow distance";
|
||||
public const string AutoNavigationActive = "Auto-navigation active";
|
||||
public const string AutoNavigationEnableHint = "Press {0} to enable auto-navigation";
|
||||
public const string AutoNavigationStarted = "Auto-navigation started";
|
||||
public const string AutoNavigationStopped = "Auto-navigation stopped";
|
||||
public const string AutoCruiseActive = "Auto-cruise active";
|
||||
public const string AutoCruiseEnableHint = "Press {0} to enable auto-cruise";
|
||||
public const string AutoCruiseStarted = "Auto-cruise started";
|
||||
public const string AutoCruiseStopped = "Auto-cruise stopped";
|
||||
public const string AutoCruiseNoTarget = "Auto-cruise needs a navigation target";
|
||||
public const string TreatStackItemsAsSingleInMonitorComponents = "Treat stack items as single in monitor components";
|
||||
public const string InitializeThisPlanet = "Initialize This Planet";
|
||||
public const string InitializeThisPlanetConfirm = "Initialize This Planet Confirm";
|
||||
@@ -418,16 +419,17 @@ You can set 2 shortcut keys in Settings panel:
|
||||
I18N.Add(ShortcutKeysForShowingStarsName, "Shortcut keys for showing stars' name", "启用显示所有星系名称的快捷键");
|
||||
I18N.Add(AutoBoost, "Auto boost", "自动加速");
|
||||
I18N.Add(DistanceToUseWarp, "Distance to use warp (AU)", "使用曲速的距离(AU)");
|
||||
I18N.Add(StopAutoNavigationOnManualInput, "Stop auto-navigation on manual input", "手动输入时停止自动导航");
|
||||
I18N.Add(StopAutoCruiseOnManualInput, "Stop auto-cruise on manual input", "手动输入时停止自动巡航");
|
||||
I18N.Add(UseWarp, "Use warp", "启用曲速");
|
||||
I18N.Add(UseWarpMinimalEnergy, "Minimum energy to use warp (MJ)", "使用曲速最低能量(MJ)");
|
||||
I18N.Add(AutoBoostMinimalEnergy, "Minimum energy for auto boost (MJ)", "自动加速最低能量(MJ)");
|
||||
I18N.Add(DarkFogHiveFollowDistance, "Dark Fog Hive follow distance (AU)", "黑雾巢穴跟踪距离(AU)");
|
||||
I18N.Add(DarkFogCarrierFollowDistance, "Dark Fog Carrier follow distance (m)", "黑雾火种跟踪距离(m)");
|
||||
I18N.Add(AutoNavigationActive, "Auto-navigation active", "自动导航中");
|
||||
I18N.Add(AutoNavigationEnableHint, "Press {0} to enable auto-navigation", "按 {0} 启用自动导航");
|
||||
I18N.Add(AutoNavigationStarted, "Auto-navigation started", "自动导航启动");
|
||||
I18N.Add(AutoNavigationStopped, "Auto-navigation stopped", "自动导航关闭");
|
||||
I18N.Add(AutoCruiseActive, "Auto-cruise active", "自动巡航中");
|
||||
I18N.Add(AutoCruiseEnableHint, "Press {0} to enable auto-cruise", "按 {0} 启用自动巡航");
|
||||
I18N.Add(AutoCruiseStarted, "Auto-cruise started", "自动巡航启动");
|
||||
I18N.Add(AutoCruiseStopped, "Auto-cruise stopped", "自动巡航关闭");
|
||||
I18N.Add(AutoCruiseNoTarget, "Auto-cruise needs a navigation target", "自动巡航需要先设置导航目标");
|
||||
I18N.Add(TreatStackItemsAsSingleInMonitorComponents, "Treat stack items as single in monitor components", "在流速计中将堆叠物品视为单个物品");
|
||||
I18N.Add(InitializeThisPlanet, "Initialize this planet", "初始化本行星");
|
||||
I18N.Add(InitializeThisPlanetConfirm, "This operation will destroy all buildings and revert terrains on this planet, are you sure?", "此操作将会摧毁本行星上的所有建筑并恢复地形,确定吗?");
|
||||
|
||||
@@ -29,19 +29,7 @@ internal static class AutoCruiseUI
|
||||
rectTrans.localScale = new Vector3(1f, 1f, 1f);
|
||||
|
||||
UpdateToggleAutoCruiseCheckButtonVisiblility();
|
||||
ToggleAutoCruiseChecked();
|
||||
ToggleAutoCruise.OnChecked += ToggleAutoCruiseChecked;
|
||||
static void ToggleAutoCruiseChecked()
|
||||
{
|
||||
if (ToggleAutoCruise.Checked)
|
||||
{
|
||||
ToggleAutoCruise.SetLabelText(I18NKeys.DisableAutoCruise);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToggleAutoCruise.SetLabelText(I18NKeys.EnableAutoCruise);
|
||||
}
|
||||
}
|
||||
ToggleAutoCruise.OnChecked += UpdateToggleAutoCruiseLabel;
|
||||
ToggleAutoCruise.OnChecked += Patches.PlayerPatch.AutoNavigation.Toggle;
|
||||
}
|
||||
|
||||
@@ -50,7 +38,19 @@ internal static class AutoCruiseUI
|
||||
if (ToggleAutoCruise == null) return;
|
||||
var active = Patches.PlayerPatch.AutoCruiseEnabled.Value
|
||||
&& Patches.PlayerPatch.AutoNavigation.HasNavigationTarget();
|
||||
// MyCheckButton.Checked only refreshes the colours; the label lives on the OnChecked
|
||||
// handlers. Auto-cruise can also be toggled by its shortcut or stopped automatically on
|
||||
// arrival, so the label has to be refreshed here as well or it goes stale.
|
||||
ToggleAutoCruise.Checked = Patches.PlayerPatch.AutoNavigation.IsActive;
|
||||
UpdateToggleAutoCruiseLabel();
|
||||
ToggleAutoCruise.gameObject.SetActive(active);
|
||||
}
|
||||
|
||||
private static void UpdateToggleAutoCruiseLabel()
|
||||
{
|
||||
if (ToggleAutoCruise == null) return;
|
||||
ToggleAutoCruise.SetLabelText(ToggleAutoCruise.Checked
|
||||
? I18NKeys.DisableAutoCruise
|
||||
: I18NKeys.EnableAutoCruise);
|
||||
}
|
||||
}
|
||||
+971
-896
File diff suppressed because it is too large.
Load diff
@@ -700,7 +700,7 @@ public static class UIConfigWindow
|
||||
y += 36f;
|
||||
var autoCruiseCheckBox = wnd.AddCheckBox(x, y, tab4, PlayerPatch.AutoCruiseEnabled, I18NKeys.EnableAutoCruise);
|
||||
y += 27f;
|
||||
var autoStopCheckBox = wnd.AddCheckBox(x + 20f, y, tab4, PlayerPatch.StopOnArrivalAndInput, I18NKeys.StopAutoNavigationOnManualInput, 13);
|
||||
var autoStopCheckBox = wnd.AddCheckBox(x + 20f, y, tab4, PlayerPatch.StopOnArrivalAndInput, I18NKeys.StopAutoCruiseOnManualInput, 13);
|
||||
y += 27f;
|
||||
var useWarpCheckBox = wnd.AddCheckBox(x + 20f, y, tab4, PlayerPatch.UseWarper, I18NKeys.UseWarp, 13);
|
||||
y += 27f;
|
||||
|
||||
Reference in new issue
Block a user