se-dev-server-code
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSE Dev Server Code Skill
SE Dev Server Code Skill
Allows reading the decompiled C# code of the Space Engineers Dedicated Server. The "game logic" of the server is largely the same as the game (client) is running. The entry point (main executable), some aspects of logging and configuration differ. Also, some of the libraries are not used by the server, but they may still present to provide the necessary data structures and some backend functionality.
⚠️ 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 - ❌ - This will NOT work
if exist file.txt (echo exists)
Actions:
- prepare: Run the one-time preparation (on Windows,
Prepare.baton Linux)prepare.sh - bash: Run UNIX shell commands via busybox
- search: Run code searches using
search_server_code.py - test: Test this skill by running
test_search_server_code.bat
允许读取《太空工程师》专用服务器的反编译C#代码。服务器的「游戏逻辑」与客户端运行的游戏基本一致,但入口点(主可执行文件)、日志记录和配置的某些方面存在差异。此外,部分库并未被服务器使用,但它们仍可能存在以提供必要的数据结构和某些后端功能。
⚠️ 重要提示:命令在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系统用,Linux系统用
Prepare.bat)prepare.sh - bash: 通过busybox运行UNIX shell命令
- search: 使用执行代码搜索
search_server_code.py - test: 运行测试此工具
test_search_server_code.bat
Routing Decision
路由规则
Check these patterns in order - first match wins:
| Priority | Pattern | Example | Route |
|---|---|---|---|
| 1 | Empty or bare invocation | | Show this help |
| 2 | Prepare keywords | | prepare |
| 3 | Bash/shell keywords | | bash |
| 4 | Search keywords | | search |
| 5 | Test keywords | | test |
按顺序检查以下匹配模式,第一个匹配项生效:
| 优先级 | 匹配模式 | 示例 | 路由 |
|---|---|---|---|
| 1 | 空调用或直接调用 | | 显示本帮助文档 |
| 2 | 准备类关键词 | | prepare |
| 3 | Bash/Shell类关键词 | | bash |
| 4 | 搜索类关键词 | | search |
| 5 | 测试类关键词 | | test |
Requirements
环境要求
The host system must have the following on :
PATH- Python 3.11 or newer
- git command line client (used to version each decompiled server build)
- dotnet SDK (for installing )
ilspycmd
主机系统的中必须包含以下组件:
PATH- Python 3.11或更高版本
- git命令行客户端(用于为每个反编译的服务器版本做版本控制)
- dotnet SDK(用于安装)
ilspycmd
Getting Started
快速开始
⚠️ CRITICAL: Before running ANY commands, read CommandExecution.md to avoid common mistakes that cause command failures.
If the file is missing in this folder, you MUST run the one-time preparation steps first. See the prepare action.
Prepare.DONEIf server auto-detection fails, set before running the preparation script. It may point to either the dedicated server root or directly to the directory.
SE_SERVER_ROOTDedicatedServer64⚠️ 重要提示:在执行任何命令之前,请阅读CommandExecution.md以避免导致命令失败的常见错误。
如果此文件夹中缺少文件,必须先执行一次性准备步骤。请查看prepare操作。
Prepare.DONE如果服务器自动检测失败,请在运行准备脚本前设置环境变量。它可以指向专用服务器的根目录,也可以直接指向目录。
SE_SERVER_ROOTDedicatedServer64Folder Layout
文件夹结构
After preparation the skill folder contains a junction/symlink. The actual data lives outside the skill folder so that it is preserved across / / cycles.
DataClean.batPrepare.batprepare.shskills/se-dev-server-code/
├── Data/ (junction/symlink → per-user persistent server-code data)
│ ├── .git/ local Git repository tracking decompiled sources
│ ├── .gitignore ignores CodeIndex/, Content/, __pycache__, *.py[cod], *.bak, *.log
│ ├── game_version.txt recorded SE_VERSION / CLIENT_BUILD_NUMBER / SERVER_BUILD_NUMBER
│ ├── Decompiled/ decompiled C# sources, organised per assembly (committed)
│ ├── Content/ textual server content (NOT committed - regenerated)
│ └── CodeIndex/ CSV indexes (NOT committed - regenerated)
├── Bin64/ (junction/symlink → server's DedicatedServer64, removed after preparation)
└── ... skill scripts and documentationThe folder is a junction/symlink to the per-user persistent server-code data directory ( on Windows, on Linux). Treat , and exactly as before.
Data%USERPROFILE%\.se-dev\server-code~/.se-dev/server-codeData/DecompiledData/ContentData/CodeIndex准备完成后,工具文件夹中会包含一个链接/符号链接。实际数据存储在工具文件夹之外,以便在//循环中保留数据。
DataClean.batPrepare.batprepare.shskills/se-dev-server-code/
├── Data/ (链接/符号链接 → 每个用户的持久化服务器代码数据)
│ ├── .git/ 本地Git仓库,用于跟踪反编译的源代码
│ ├── .gitignore 忽略CodeIndex/、Content/、__pycache__、*.py[cod]、*.bak、*.log
│ ├── game_version.txt 记录SE_VERSION / CLIENT_BUILD_NUMBER / SERVER_BUILD_NUMBER
│ ├── Decompiled/ 反编译的C#源代码,按程序集组织(已提交到Git)
│ ├── Content/ 服务器文本内容(未提交到Git - 可重新生成)
│ └── CodeIndex/ CSV索引文件(未提交到Git - 可重新生成)
├── Bin64/ (链接/符号链接 → 服务器的DedicatedServer64目录,准备完成后会被移除)
└── ... 工具脚本和文档Data%USERPROFILE%\.se-dev\server-code~/.se-dev/server-codeData/DecompiledData/ContentData/CodeIndexLocal Versioning of Decompiled Sources
反编译源代码的本地版本控制
The folder is a local Git repository. Every successful preparation creates a commit of the decompiled C# sources whose message is the server's version label, e.g. .
Data1.208.015 b4This means:
- All previously decompiled server versions are preserved in the local Git history. You can any past commit inside
git checkoutto inspect or diff against an older build.Data/ - Server updates are detected automatically by comparing the binaries' embedded version constants with . If they differ (or the file is missing),
Data/game_version.txt,Decompiled/andContent/are wiped and a fresh decompilation runs.CodeIndex/ - This makes it easy to update plugins, mods and scripts for compatibility with new server releases: diff the relevant source between two commits inside to see exactly what changed.
Data/
The repository uses an internal author/email () so commits work even on machines without a configured global Git identity.
se-dev-skills@localhostData1.208.015 b4这意味着:
- 所有之前反编译的服务器版本都保存在本地Git历史中。你可以在目录中执行
Data/命令切换到任何过往提交,以查看或对比旧版本的代码。git checkout - 服务器更新会被自动检测:通过比较二进制文件中嵌入的版本常量与中的内容。如果两者不同(或文件缺失),则会清空
Data/game_version.txt、Decompiled/和Content/并重新执行反编译。CodeIndex/ - 这使得更新插件、模组和脚本以适配新服务器版本变得容易:对比目录中两个提交之间的相关源代码,即可准确查看变更内容。
Data/
该仓库使用内部作者/邮箱(),因此即使机器未配置全局Git身份,提交操作仍可正常进行。
se-dev-skills@localhostEssential 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
Code Search Documentation
代码搜索文档
- QuickStart.md - More examples and quick reference
- CodeSearch.md - Complete guide to searching classes, methods, fields, etc.
- HierarchySearch.md - Finding class/interface inheritance and implementations
- Advanced.md - Power user techniques for complex searches
- Troubleshooting.md - What to do when searches return NO-MATCHES or too many results
- Implementation.md - Technical details for skill contributors (optional)
- QuickStart.md - 更多示例和快速参考指南
- CodeSearch.md - 搜索类、方法、字段等的完整指南
- HierarchySearch.md - 查找类/接口的继承关系和实现
- Advanced.md - 高级用户的复杂搜索技巧
- Troubleshooting.md - 当搜索无结果或结果过多时的解决方法
- Implementation.md - 工具贡献者的技术细节(可选阅读)
Quick Search Examples
快速搜索示例
bash
undefinedbash
undefinedFind class declarations
查找类声明
uv run search_server_code.py class declaration MyCubeBlock
uv run search_server_code.py class declaration MyCubeBlock
Find method signatures
查找方法签名
uv run search_server_code.py method signature UpdateBeforeSimulation
uv run search_server_code.py method signature UpdateBeforeSimulation
Find class hierarchy
查找类继承层级
uv run search_server_code.py class children MyTerminalBlock
uv run search_server_code.py class children MyTerminalBlock
Count results before viewing (useful for large result sets)
在查看结果前先统计数量(适用于大型结果集)
uv run search_server_code.py class usage MyEntity --count
uv run search_server_code.py class usage MyEntity --count
Limit number of results
限制结果数量
uv run search_server_code.py class usage MyEntity --limit 10
uv run search_server_code.py class usage MyEntity --limit 10
Paginate through results
分页查看结果
uv run search_server_code.py class usage MyEntity --limit 10 --offset 0
uv run search_server_code.py class usage MyEntity --limit 10 --offset 20
Always check the server code when:
- You're unsure about the server's internal APIs and how to interface with them.
- The inner workings of the Space Engineers Dedicated Server is unclear.uv run search_server_code.py class usage MyEntity --limit 10 --offset 0
uv run search_server_code.py class usage MyEntity --limit 10 --offset 20
在以下情况下,请务必查看服务器代码:
- 你不确定服务器的内部API以及如何与它们交互。
- 《太空工程师》专用服务器的内部运行机制不明确。Custom Scripting
自定义脚本
For building your own utility scripts to work with the indexes and decompiled code:
- ScriptingGuide.md - How to write Python scripts, use BusyBox, handle Windows paths
如需构建自己的实用脚本以处理索引和反编译代码:
- ScriptingGuide.md - 如何编写Python脚本、使用BusyBox、处理Windows路径
Server Content Data
服务器内容数据
The textual part of the server's is copied into the folder for free text search:
ContentData/Content- Language translations, including the string IDs
- Block and other entity definitions
- Default blueprints and scenarios
- See ContentTypes.md for the full list of content types
服务器目录中的文本内容会被复制到文件夹中,以便进行全文搜索:
ContentData/Content- 语言翻译,包括字符串ID
- 方块和其他实体定义
- 默认蓝图和场景
- 完整的内容类型列表请查看ContentTypes.md
Content Index
内容索引
Data/CodeIndex/content_index.csvrel_pathData/Content/usageData/Decompiled/rel_pathusageData/CodeIndex/content_index.csvrel_pathData/Content/usageData/Decompiled/rel_pathusageRunning the Dedicated Server
运行专用服务器
The server executable is in the folder.
SpaceEngineersDedicated.exeDedicatedServer64服务器可执行文件是文件夹中的。
DedicatedServer64SpaceEngineersDedicated.exeHeadless Mode (No UI)
无头模式(无UI)
SpaceEngineersDedicated.exe -consoleThis bypasses the Telerik WinForms configuration UI and runs the server directly.
SpaceEngineersDedicated.exe -console此命令会绕过Telerik WinForms配置UI,直接运行服务器。
Configuration
配置
The server is configured via XML files. The primary configuration file is located in the server's AppData directory (typically ).
SpaceEngineers-Dedicated.cfg%APPDATA%\SpaceEngineersDedicated\Key configuration areas:
- Server settings (name, world, mods, max players)
- World settings (game mode, inventory size, welding speed)
- Network settings (port, public/private)
Configuration should be done by editing the XML files directly or with utility Python scripts. See below for planned utilities.
服务器通过XML文件进行配置。主配置文件是,位于服务器的AppData目录中(通常为)。
SpaceEngineers-Dedicated.cfg%APPDATA%\SpaceEngineersDedicated\关键配置领域:
- 服务器设置(名称、世界、模组、最大玩家数)
- 世界设置(游戏模式、背包大小、焊接速度)
- 网络设置(端口、公开/私有)
配置应通过直接编辑XML文件或使用Python实用脚本完成。以下是计划中的实用工具:
Planned Utility Scripts (Not Yet Implemented)
计划中的实用脚本(尚未实现)
- config_editor.py — Read and modify values from the command line (e.g. set server name, max players, world name)
SpaceEngineers-Dedicated.cfg - world_manager.py — List, backup, and manage saved worlds in the server data directory
- mod_manager.py — List and validate mods referenced in the configuration
- config_editor.py — 从命令行读取和修改中的值(例如设置服务器名称、最大玩家数、世界名称)
SpaceEngineers-Dedicated.cfg - world_manager.py — 列出、备份和管理服务器数据目录中的已保存世界
- mod_manager.py — 列出并验证配置中引用的模组
Server-Only Assemblies
服务器专属程序集
| Assembly | Description |
|---|---|
| Server entry point (replaces |
| Dedicated server framework, lifecycle, and configuration |
| Remote client support (RCON-like functionality) |
| 程序集 | 描述 |
|---|---|
| 服务器入口点(替代 |
| 专用服务器框架、生命周期和配置 |
| 远程客户端支持(类似RCON的功能) |
General Rules
通用规则
- In the folder search only inside the C# source files (.cs) in general. If you work on transpiler or preloader patches, then also search in the IL code (.il) files.
Data/Decompiled - In the folder search the files appropriate for the task. See ContentTypes.md for the list of types.
Data/Content - Do not search for decompiled server code outside the folder. The decompiled server source tree must be there if the preparation succeeded.
Data/Decompiled - Do not search for server content data outside the folder. The copied server content must be there if the preparation succeeded.
Data/Content
- 通常仅在文件夹中搜索C#源代码文件(.cs)。如果你从事转译器或预加载器补丁开发,也可以搜索IL代码文件(.il)。
Data/Decompiled - 在文件夹中搜索与任务相关的文件。完整的内容类型列表请查看ContentTypes.md。
Data/Content - 不要在文件夹之外搜索反编译的服务器代码。如果准备操作成功,反编译的服务器源代码树必须位于该文件夹中。
Data/Decompiled - 不要在文件夹之外搜索服务器内容数据。如果准备操作成功,复制的服务器内容必须位于该文件夹中。
Data/Content
Action References
操作参考
Follow the detailed instructions in:
- prepare action - One-time preparation
- bash action - Running UNIX shell commands via busybox
- search action - Running code searches
- test action - Testing this skill
请遵循以下文档中的详细说明:
- prepare操作 - 一次性准备
- bash操作 - 通过busybox运行UNIX shell命令
- search操作 - 执行代码搜索
- test操作 - 测试此工具
Remarks
备注
The original source of this skill: https://github.com/viktor-ferenczi/se-dev-skills