Dyson Sphere Program
You are viewing a potentially older version of this package. View Latest Version
Install with App

Details

Date Uploaded
last week
Downloads
67
Size
17KB

HoverCoord — 指针建筑坐标显示

模组作者:妙妙在路上 抖音 @妙妙在路上

悬停建筑显示经纬度与蓝图格坐标 X/Y/Z(作者:妙妙在路上 抖音@妙妙在路上)。开关快捷键【ctrl+shift+k】【默认开启】。

鼠标停在建筑上就显示,移开就消失;不改变游戏原有操作,不发送额外物理射线,不与任何建造/蓝图模组冲突。


功能

  • 悬停即显示:不需要点击建筑,指针停在建筑模型上就会在指针旁弹出坐标。
  • 经纬度:纬度、经度保留 4 位小数。
  • 格坐标 X / Y / Z:与游戏蓝图数据同一套换算,X / Y 是“格”,Z 是“高度层”。
  • 开关:Ctrl + Shift + K,切换时指针旁有 1.2 秒提示;默认开启。
  • 智能隐藏:指针在空地、UI、菜单、暂停、窗口失焦时自动隐藏,不会挡视线。
  • 边缘翻转:靠近屏幕边缘时提示框自动翻到指针另一侧,不会出屏。

安装

需要 BepInEx 5.4.17(x64)。

方式一:r2modman / Thunderstore Mod Manager(推荐)

  1. 打开 r2modman,选择 Dyson Sphere Program。
  2. 在 Online 页搜索 HoverCoord,点 Install with Mod Manager;或下载 HoverCoord-1.6.0.zip 后点 Import local mod 导入。
  3. 确认安装到当前使用的 profile,然后从该 profile 启动游戏。
  4. 启动后 BepInEx 控制台(BepInEx/LogOutput.log)会出现: HoverCoord 1.6.0 loaded. Author: 妙妙在路上 (抖音@妙妙在路上)

方式二:手动安装

把 HoverCoord.dll 放到:

Dyson Sphere Program\BepInEx\plugins\HoverCoord.dll

如果是 r2modman 用户,请放到对应 profile 的 BepInEx/plugins/ 目录,并用该 profile 启动游戏,否则模组不会加载。

使用方法

  1. 进入游戏,降落到行星表面。
  2. 把鼠标停在任意建筑上(传送带、熔炉、制造台、物流塔等都可以)。
  3. 指针右下角出现坐标框:
装配机 Mk.I #123
经度 -45.3600°    纬度 12.2400°
X -126.0000    Y 34.0000    Z 0.0000
  1. 按 Ctrl + Shift + K 可以随时关闭/开启。

性能

v1.6.0 使用经过验证的 IMGUI 绘制方式(与 v1.4.x 相同),并保留以下优化:

优化 说明
独立的渲染组件 没有悬停目标时渲染组件直接禁用,游戏不会为它处理任何 IMGUI 事件,空闲时零开销
字体懒创建 字体只在第一次悬停建筑、真正要画提示框时才创建,不拖慢启动和行星加载
检测 0.75 秒一次 每 0.75 秒才检测一次鼠标下的建筑,其余帧不做坐标计算
重建限流 10Hz 文字重建最多约 10 次/秒
单次绘制 背景 + 一行文字,无阴影层;CalcSize 只在文字变化时调用
零每帧分配 稳定悬停时没有字符串 / 数组分配;建筑名按 protoId 缓存;StringBuilder 复用

提示:检测为 0.75 秒一次,所以悬停建筑后最慢约 0.75 秒出现坐标,移开建筑后最慢约 0.75 秒消失。

坐标说明

经纬度

  • 纬度:asin(y),北极为 +90°,南极为 -90°。
  • 经度:atan2(x, -z),-Z 方向为 0°,+X 方向为 +90°,范围 -180°~+180°。

X / Y / Z(格坐标)

和游戏蓝图(Blueprint)数据完全一致,用的是游戏自己的换算函数:

量 含义 单位
X 经度方向格数,0° 经线为 0,向东为正 格,每格 = 360 /(该纬度圈经度格数)°
Y 纬度方向格数,赤道为 0,向北为正 格,每格 = 0.36°(半径 200 时 1.2566 m)
Z 高度层数,贴地面层为 0,每升高一层 +1 层,每层 = 1.3333 高度

计算公式(与游戏内部一致):

Y = latRad / (2π / (segment × 5))        // segment = 200 → 每格 0.36°
X = lonRad / (2π / (latitudeSegmentCount × 5))
Z = (|pos| − realRadius − 0.2) / 1.3333

对应:

  • BlueprintUtils.GetLatitudeGridIdx()
  • BlueprintUtils.GetLongitudeGridIdx()
  • 蓝图 localOffset_z 的原始算法

自检

  • 从赤道向北走 1 格:Y 从 0.0000 → 1.0000。
  • 赤道沿经度向东走 1 格:X 从 0.0000 → 1.0000。
  • 贴地面建筑:Z = 0.0000;抬高一层:Z = 1.0000,再一层 2.0000。
  • 建筑都吸附在格子上,因此正常建筑的 X / Y / Z 基本都是整数(浮点误差 ±0.0001 以内)。

符号与范围

  • Y:约 ±250(南北极),赤道为 0,北正南负。
  • X:约 ±(该纬度圈格数 / 2),0° 经线为 0,东正西负;越过 180° 会跳到另一侧的负值(和 ±180° 经度一致)。
  • Z:地面层 0,往上为正,往下(坑)为负。

兼容性

  • 游戏:Dyson Sphere Program(Unity 2018.4,编译自本机当前安装的 Assembly-CSharp.dll)。
  • BepInEx:5.4.17(x64,即 r2modman 里的 xiaoye97-BepInEx 包)。
  • 与常见模组(Nebula 联机、LDBTool、蓝图类模组等)无冲突;联机时仅本地显示,不参与同步。
  • 只读游戏数据,不修改存档、不改变建筑。

已知问题 / 排查

  • 没有显示:确认 BepInEx 已加载(BepInEx/LogOutput.log 有 HoverCoord 1.6.0 loaded),并确认你是用装了模组的 r2modman profile 启动游戏。
  • 快捷键无效:输入法/键盘占用时可能收不到 K,切换到英文输入法再试。
  • 游戏更新后失效:需要按新版 Assembly-CSharp.dll 重新编译(源码与 build.ps1 已附带)。
  • 悬停矿脉、植被、空地时不会显示(只显示工厂建筑实体)。

更新日志

见包内的 CHANGELOG.md(Thunderstore 页面的 Changelog 标签页)。

作者

妙妙在路上 — 抖音 @妙妙在路上

如果这个模组帮到了你,欢迎在抖音点个关注;有问题或建议可以留言。


English summary

HoverCoord by 妙妙在路上 (Douyin @妙妙在路上).

Hover a building to show its latitude/longitude and blueprint grid coordinates X/Y/Z (Author: 妙妙在路上, Douyin @妙妙在路上). Hotkey: Ctrl+Shift+K, enabled by default.

Details: the tooltip shows X/Y in 0.36° grid cells and Z in 1.3333 height layers, with 4 decimals, next to the cursor.

  • Coordinates come from the game's own blueprint helpers (BlueprintUtils.GetLatitudeGridIdx/GetLongitudeGridIdx, localOffset_z), so they match blueprint data exactly.
  • No clicking required: the hovered building is read from the game's own raycast (PlanetPhysics.raycastLogic), no extra physics casts, no Harmony patches.
  • Performance (v1.6.0): the IMGUI renderer component is disabled while nothing is hovered (zero idle cost); the font is created lazily on the first tooltip draw, so game loading is not affected; hover detection runs every 0.75 s; text size is measured only when the text changes; no per-frame allocations.
  • v1.6.0 uses the proven IMGUI label rendering (no uGUI Text, no pre-rendered texture), with hover detection every 0.75 s and zero idle cost.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.