feat: game pause/speed control API with AI pause protocol

- POST /api/action/pause - pause game (AI must call before operations)
- POST /api/action/unpause - resume game at desired speed
- POST /api/action/speed - set game speed (1x/2x/3x)
- Game state now includes isPaused and gameSpeed
- AI pause protocol documented in SKILL.md: pause before every operation
- Introduces cell.isDiggable flag that filters neutronium properly
- pause/unpause/speed CLI commands added to oni_api.py
This commit is contained in:
root
2026-05-22 09:04:04 +08:00
parent a4f2062c1a
commit 48a70e4928
4 changed files with 183 additions and 1 deletions

View File

@ -100,6 +100,11 @@ python3 tools/oni_api.py research_select ImprovedOxygen # 科研
python3 tools/oni_api.py mop 10 10 # 清理液体
python3 tools/oni_api.py harvest 20 15 # 收获植物
# 游戏速度控制(AI 操作前必须先暂停)
python3 tools/oni_api.py pause "Reason here" # 暂停游戏
python3 tools/oni_api.py unpause 1 # 恢复(1x 速度)
python3 tools/oni_api.py speed 3 # 直接设速度(不暂停)
# 批量任务
python3 tools/oni_api.py batch docs/batch_example.json # 执行批量建造计划
@ -231,6 +236,9 @@ python3 scripts/event_daemon.py # 事件守护进程(AI 输入源)
| `/api/action/batch` | `{actions: [{type, ...}]}` — 批量执行 |
| `/api/action/priority_global` | `{target, priority}` — 全局默认优先级 |
| `/api/action/priority_type` | `{buildingType, priority}` — 按建筑类型设优先级 |
| `/api/action/pause` | `{reason?}` — 暂停游戏(AI 操作前必须调用) |
| `/api/action/unpause` | `{speed?}` — 恢复游戏 |
| `/api/action/speed` | `{speed}` — 设置速度 1x/2x/3x |
## 项目结构