16 lines
967 B
Markdown
16 lines
967 B
Markdown
# Mod API
|
||
|
||
联机兼容面是 `IDemo2Mod.Register(Demo2ContentRegistry)`,允许注册机器、配方、规则牌和波次。规则先变为 `RuleInstruction` 动态缓冲与 BlobAsset,再由 ECS 系统解释;禁止在每个物料上执行托管 Mod 回调,也不把 Harmony 改写 ECS System 作为受支持的联机接口。
|
||
|
||
示例位于 `Assets/Demos/Demo2/Mods/NightShiftProtocol`:
|
||
|
||
- Mod ID:`example.night-shift-protocol`
|
||
- 机器:夜班熔炉
|
||
- 配方:循环冷却(ID 100)
|
||
- 规则:连续夜班
|
||
- 命令:`demo2 night-shift status`
|
||
|
||
热重载先调用 `demo2 reload-mods` 暂存新目录。已开始的生产周期不改变内容;新内容只在下一周期边界或下一局生效。加入 LAN 前,双方需提供一致的 Mod ID、版本和内容 SHA-256。
|
||
|
||
新增规则操作需要在编译期扩展 `Demo2RuleOpcode` 及其解释分支,并提升模拟协议版本。不要通过反射或运行时委托绕过指令解释器。
|