maeT-HalfGridSnap icon

HalfGridSnap

Allows you to snap coordinates to half-grid points. 允许你进行对半格点的坐标进行吸附。

Last updated 4 days ago
Total downloads 129
Total rating 1 
Categories Quality of Life
Dependency string maeT-HalfGridSnap-1.1.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

xiaoye97-BepInEx-5.4.17 icon
xiaoye97-BepInEx

BepInEx5.4.17 mod plugin framework, Mod框架

Preferred version: 5.4.17
CommonAPI-CommonAPI-1.6.7 icon
CommonAPI-CommonAPI

A modding library for Dyson Sphere Program. Currently is under development.

Preferred version: 1.6.7

README

HalfGridSnap | English Description

允许将坐标吸附到“半格点”。本插件通过 Harmony Transpiler 替换游戏中 PlanetGrid 的硬编码常量,从而改变网格吸附间距,实现半格点吸附效果。

主要功能

  • PlanetGrid 中的硬编码常量 5.0f 替换为 10.0f,改变吸附间距以实现半格点行为。
  • 在运行时通过按默认快捷键 ~ 切换半格点吸附(默认已启用),快捷键可通过游戏内自定义。

安装

  1. 直接拷贝输出的 DLL 到 BepInEx/plugins 或者通过模组管理器导入 Output 目录下的 zip 压缩包进行安装。

从源码构建

  1. 使用支持 .NET Standard 2.1 的 SDK / Visual Studio(例如 Visual Studio 2026)。
  2. 恢复 NuGet 包或手动引用 BepInEx 与 HarmonyLib 的程序集(项目中应已有引用)。
  3. 编辑项目 .csproj 里面的 GameDir 为你的实际游戏目录。
  4. 在解决方案中选择 Release/Debug,生成项目:
    • Visual Studio:打开解决方案 -> 右键项目 -> 生成

实现说明(开发者)

  • 关键实现位于 PlanetGridPatch.cs
    • 使用 HarmonyTranspiler 遍历 IL 指令,查找 ldc.r4 5.0,并将其替换为 ldc.r4 10.0
  • 这样修改后,PlanetGrid 的吸附行为会以新的常量进行计算,从而实现期望的吸附效果。