se-dev-mod

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

SE Dev Mod Skill

SE Dev Mod 开发技能

Mod development for Space Engineers version 1.
⚠️ CRITICAL: Commands run in a UNIX shell. Use bash syntax. On Windows this is BusyBox; on Linux use the native shell.
Examples:
  • test -f file.txt && echo exists
  • ls -la | head -10
  • if exist file.txt (echo exists)
    - This will NOT work
Actions:
  • prepare: Run the one-time preparation (
    Prepare.bat
    on Windows,
    prepare.sh
    on Linux)
  • bash: Run UNIX shell commands via busybox
  • search: Search mod code using
    search_mods.py
适用于《太空工程师》1.x版本的Mod开发。
⚠️ 重要提示:命令在UNIX Shell中运行,请使用bash语法。Windows系统下使用BusyBox;Linux系统下使用原生Shell。
示例:
  • test -f file.txt && echo exists
  • ls -la | head -10
  • if exist file.txt (echo exists)
    - 此命令无法运行
操作:
  • prepare:执行一次性准备操作(Windows系统用
    Prepare.bat
    ,Linux系统用
    prepare.sh
  • bash:通过busybox执行UNIX Shell命令
  • search:使用
    search_mods.py
    搜索Mod代码

Routing Decision

路由决策

Check these patterns in order - first match wins:
PriorityPatternExampleRoute
1Empty or bare invocation
se-dev-mod
Show this help
2Prepare keywords
se-dev-mod prepare
,
se-dev-mod setup
,
se-dev-mod init
prepare
3Bash/shell keywords
se-dev-mod bash
,
se-dev-mod grep
,
se-dev-mod cat
bash
4Search keywords
se-dev-mod search
,
se-dev-mod find class
,
se-dev-mod lookup
search
按顺序检查以下模式,匹配到第一个即生效:
优先级模式示例路由
1空调用或仅调用技能名
se-dev-mod
显示本帮助文档
2包含Prepare相关关键词
se-dev-mod prepare
,
se-dev-mod setup
,
se-dev-mod init
prepare
3包含Bash/Shell相关关键词
se-dev-mod bash
,
se-dev-mod grep
,
se-dev-mod cat
bash
4包含搜索相关关键词
se-dev-mod search
,
se-dev-mod find class
,
se-dev-mod lookup
search

Getting Started

快速开始

⚠️ CRITICAL: Before running ANY commands, read CommandExecution.md to avoid common mistakes that cause command failures.
If the
Prepare.DONE
file is missing in this folder, you MUST run the one-time preparation steps first. See the prepare action.
⚠️ 重要提示:在执行任何命令前,请阅读CommandExecution.md,避免导致命令执行失败的常见错误。
如果当前文件夹中缺少
Prepare.DONE
文件,您必须先执行一次性准备步骤。请查看prepare操作文档

Essential Documentation

核心文档

  • CommandExecution.md - ⚠️ READ THIS FIRST - Windows command execution details; on Linux keep bash syntax and use
    prepare.sh
  • CommandExecution.md - ⚠️ 请首先阅读本文档 - Windows系统命令执行细节;Linux系统请保持bash语法并使用
    prepare.sh

Mod Development

Mod开发

Use only names matching the Mod API whitelist: ModApiWhitelist.txt The whitelist was exported from game version
1.208.015
using MDK2's
Mdk.Extractor
.
Mods are released on the Steam Workshop or Mod.IO, mostly on the former. Mods are compiled by the game on world loading with a Mod API whitelist enforced, which is supposed to guarantee safety and security. Mods may still crash the game with an exception.
Use the
se-dev-game-code
skill to search the game's decompiled code. You may need this to understand how the game's internals work and how to interface with it properly. Stick to game code searches corresponding to names on the Mod API whitelist for efficiency.
仅使用符合Mod API白名单的名称:ModApiWhitelist.txt 该白名单是使用MDK2的
Mdk.Extractor
从游戏版本
1.208.015
导出的。
Mod发布在Steam创意工坊或Mod.IO平台,其中大部分发布在前者。 游戏会在加载世界时编译Mod,并强制执行Mod API白名单,这旨在保证安全性。但Mod仍可能因异常导致游戏崩溃。
使用
se-dev-game-code
技能搜索游戏的反编译代码。您可能需要通过此方式了解游戏内部机制,以及如何正确与游戏交互。为提高效率,请仅搜索与Mod API白名单中名称对应的游戏代码。

Folder Structure

文件夹结构

  • Data/
    — junction/symlink to the per-user persistent mod data folder (
    %USERPROFILE%\.se-dev\mod
    on Windows,
    ~/.se-dev/mod
    on Linux). Persistent skill data lives here:
    • Data/mods.json
      — quick inventory of all installed mods (workshop_id, path, has_scripts, ...).
    • Data/mod_hashes.json
      — per-mod aggregate sha1 used by the indexer for change detection.
    • Data/CodeIndex/
      — full Tree-sitter C# index (one CSV per category, plus hierarchy trees).
  • LocalMods/
    — junction/symlink to the game's local-mod folder (
    %AppData%\SpaceEngineers\Mods
    on Windows, the Proton appdata equivalent on Linux).
  • Steam Workshop content is read in-place from the Steam folder; it is not copied or symlinked into the skill. The workshop folder is resolved from
    SE_GAME_ROOT
    (env var) or the Steam registry entry for app id 244850.
  • Data/
    — 指向每个用户的持久化Mod数据文件夹的连接/符号链接(Windows系统为
    %USERPROFILE%\.se-dev\mod
    ,Linux系统为
    ~/.se-dev/mod
    )。持久化技能数据存储于此:
    • Data/mods.json
      — 所有已安装Mod的快速清单(workshop_id、路径、是否包含脚本等)。
    • Data/mod_hashes.json
      — 每个Mod的聚合sha1哈希值,供索引器用于检测变更。
    • Data/CodeIndex/
      — 完整的Tree-sitter C#索引(每个分类对应一个CSV文件,外加层次树)。
  • LocalMods/
    — 指向游戏本地Mod文件夹的连接/符号链接(Windows系统为
    %AppData%\SpaceEngineers\Mods
    ,Linux系统为Proton对应的应用数据文件夹)。
  • Steam创意工坊内容直接从Steam文件夹读取;不会被复制或创建符号链接到本技能中。创意工坊文件夹由环境变量
    SE_GAME_ROOT
    或Steam中应用ID 244850的注册表项解析而来。

References

参考资料

Mod Code Search

Mod代码搜索

Search the source code of Steam and local mods for examples and patterns:
bash
undefined
搜索Steam和本地Mod的源代码,查找示例与模式:
bash
undefined

Search for patterns

搜索模式

uv run search_mods.py class declaration MyBlock uv run search_mods.py method usage Update uv run search_mods.py class children MyGameLogicComponent
uv run search_mods.py class declaration MyBlock uv run search_mods.py method usage Update uv run search_mods.py class children MyGameLogicComponent

Count results before viewing (useful for large result sets)

在查看结果前先计数(适用于大型结果集)

uv run search_mods.py class usage Init --count
uv run search_mods.py class usage Init --count

Limit number of results

限制结果数量

uv run search_mods.py class usage Init --limit 10

Before searching, ensure the index exists. If `Data/CodeIndex/` is missing, run:
```bash
uv run list_mods.py     # quick inventory (always cheap)
uv run index_mods.py    # full code index (incremental: only changed mods reparsed)
Re-indexing after new subscriptions: When you subscribe to new mods on Steam Workshop, load them in a world once (so the game downloads them), then re-run the two commands above (or just
Prepare.bat
). The indexer hashes each mod's .cs files and only reparses mods whose hash changed since the previous run, so reruns are fast.
See search action for complete documentation.
uv run search_mods.py class usage Init --limit 10

搜索前请确保索引已存在。如果`Data/CodeIndex/`不存在,请执行:
```bash
uv run list_mods.py     # 快速生成清单(操作轻便)
uv run index_mods.py    # 完整代码索引(增量式:仅重新解析变更的Mod)
订阅新Mod后重新索引: 当您在Steam创意工坊订阅新Mod后,先在游戏世界中加载一次(确保游戏完成下载),然后重新运行上述两个命令(或直接运行
Prepare.bat
)。索引器会对每个Mod的.cs文件计算哈希值,仅重新解析自上次运行以来哈希值发生变化的Mod,因此重新运行速度较快。
完整文档请查看search操作文档

Action References

操作参考

Follow the detailed instructions in:
  • prepare action - One-time preparation
  • bash action - Running UNIX shell commands via busybox
  • search action - Search mod code for examples
请遵循以下详细说明:
  • prepare操作文档 - 一次性准备操作
  • bash操作文档 - 通过busybox执行UNIX Shell命令
  • search操作文档 - 搜索Mod代码示例

Remarks

备注