mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
fix(uxassist): auto-cruise leaves every obstacle the mecha is inside
ComputeDirection returned the escape heading of the first obstacle in the list whose path radius contains the mecha. A mecha standing on a moon close to its gas giant is inside two path radii at once (the moon's 2200 m and the giant's 2800 m), and the giant comes first. Taking off from the moon's giant-facing side, "away from the giant" points into the ground: the mecha dives right after entering space, drops back under the game's landing rule, takes off again, and so on. Sum the inward directions of all obstacles that contain the mecha, each weighted by how deep the mecha is inside it, and escape from that. The body right below dominates near its surface. Route blocking is checked only when the mecha is inside no obstacle, as before for a single obstacle. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
a1ba5266bb
commit
5e6cfe7fa5
2 files changed
+27
-3
No files matched your search
@@ -5,6 +5,7 @@
|
||||
|
||||
* 1.6.4
|
||||
* `Hide battle-related techs in Peace mode`: Fix an array index error when opening the tech tree after switching from a Peace-mode save to a Combat-mode save in the same game process, including when disabling the option after loading another Peace-mode save.
|
||||
* `Auto-cruise`: Fix the mecha diving back into the ground right after taking off from a moon that is close to its gas giant.
|
||||
* 1.6.3
|
||||
* `Quick build Mining Machines`:
|
||||
* Add a Factory-tab button to arrange ordinary Mining Machines densely around the nearest solid vein group. Each miner covers at least 3 nodes from that group, without including nearby groups. Layouts are not limited by stock; missing miners remain as ghosts awaiting materials. Placement respects construction range and does not include belts or power facilities. Click again to cancel a search.
|
||||
@@ -448,6 +449,7 @@
|
||||
|
||||
* 1.6.4
|
||||
* `在和平模式下隐藏战斗相关科技`:修复在同一次游戏运行中从和平模式存档切换到战斗模式存档后打开科技树时的数组越界,以及再次加载和平模式存档后关闭选项时的同类问题。
|
||||
* `自动巡航`:修复从紧邻气态巨星的卫星上起飞后,机甲又扎回地面的问题。
|
||||
* 1.6.3
|
||||
* `快速铺设采矿机`:
|
||||
* 在「工厂」页增加按钮,自动在最近的固体矿脉周围密集铺设普通采矿机。每台至少覆盖选中矿脉的 3 个矿点,不混入附近其他矿脉。布局数量不受库存限制,采矿机不足的位置保留待建造虚影。遵守建造范围,不自动铺设传送带和电力设施。计算期间再次点击可取消。
|
||||
|
||||
@@ -654,6 +654,14 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
return default;
|
||||
|
||||
VectorLF3 baseDir = toTarget.normalized;
|
||||
|
||||
// The mecha can be inside several path radii at once: a moon close to its gas giant puts a mecha
|
||||
// on the moon inside both, and the giant comes first in the list. Leaving only the first one
|
||||
// sends a mecha that takes off from the moon's giant-facing side back into the ground, because
|
||||
// "away from the giant" points down there. Leave all of them together, each weighted by how deep
|
||||
// the mecha is inside it, so the body right below dominates.
|
||||
VectorLF3 inward = default;
|
||||
bool insideObstacle = false;
|
||||
foreach (Obstacle obstacle in obstacles)
|
||||
{
|
||||
double pathRadius = GetReachablePathRadius(obstacle);
|
||||
@@ -662,10 +670,24 @@ public class PlayerPatch : PatchImpl<PlayerPatch>
|
||||
|
||||
VectorLF3 toObstacle = obstacle.Position - playerPos;
|
||||
double obstacleDistance = toObstacle.magnitude;
|
||||
if (obstacleDistance < pathRadius)
|
||||
return ComputeEscapeDirection(currentDirection, toObstacle, baseDir);
|
||||
if (obstacleDistance >= pathRadius)
|
||||
continue;
|
||||
|
||||
inward += SafeNorm(toObstacle, baseDir) * (pathRadius - obstacleDistance);
|
||||
insideObstacle = true;
|
||||
}
|
||||
|
||||
if (insideObstacle)
|
||||
return ComputeEscapeDirection(currentDirection, inward, baseDir);
|
||||
|
||||
foreach (Obstacle obstacle in obstacles)
|
||||
{
|
||||
double pathRadius = GetReachablePathRadius(obstacle);
|
||||
if (pathRadius <= 0.0)
|
||||
continue;
|
||||
|
||||
if (IsSegmentBlocked(playerPos, _targetUniversePosition, obstacle.Position, pathRadius))
|
||||
return ComputeTangentDirection(currentDirection, toObstacle, pathRadius, baseDir);
|
||||
return ComputeTangentDirection(currentDirection, obstacle.Position - playerPos, pathRadius, baseDir);
|
||||
}
|
||||
|
||||
return baseDir;
|
||||
|
||||
Reference in new issue
Block a user