Files
oniagent/SKILL.md
root 0e17e8a6ac feat: complete ONI Agent project with full Mod API, Python toolchain, and development guide
- Implement all Mod API endpoints (buildings, research, geysers, alerts, critters, deconstruct, prioritize, research, schedule, wardrobe)
- Enhance Python tools with comprehensive CLI, analysis (O2/food/power/temp/water), and 7 blueprints (SPOM, toilet, ranch, farm, cooling, bedroom)
- Add utility scripts: auto_repair, auto_analyze, watch mode, setup
- Write Agent-Mod integration constraints and development guide
- Create skills directory with ONI agent skill definition
2026-05-22 08:44:56 +08:00

97 lines
2.9 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Oxygen Not Included (ONI) Agent
## 职责
协助玩家操作和管理游戏"缺氧"(Oxygen Not Included),提供游戏知识、策略建议,并通过 Mod API 直接操控游戏。
## 通信方式
- Mod 在游戏内启动 HTTP 服务,暴露 RESTful API
- 通过 `http://127.0.0.1:PORT` 与游戏通信
- 端口在 `oni-agent/config.json` 中配置(默认 23876
## 可用 API 端点
### 状态查询 (GET)
| 端点 | 返回内容 |
|------|---------|
| `/api/state/game` | 周期、复制人数量、全局资源 |
| `/api/state/resources` | 所有主要资源存量 |
| `/api/state/duplicants` | 所有复制人状态 |
| `/api/state/buildings` | 所有建筑列表 |
| `/api/state/research` | 科技树进度 |
| `/api/state/geysers` | 喷泉状态 |
| `/api/state/alert` | 当前警报 |
| `/api/state/critters` | 小动物状态 |
### 操作 (POST)
| 端点 | 请求体 |
|------|--------|
| `/api/action/dig` | `{x, y, width, height}` |
| `/api/action/build` | `{buildingId, x, y, rotation?}` |
| `/api/action/deconstruct` | `{buildingId, x, y}` |
| `/api/action/prioritize` | `{x, y, priority}` |
| `/api/action/research` | `{techId}` |
| `/api/action/schedule` | `{duplicantId, schedule}` |
| `/api/action/wardrobe` | `{duplicantId, equipment}` |
## 工具列表
| 工具 | 用途 |
|------|------|
| `tools/oni_api.py` | 与 Mod HTTP API 通信 |
| `tools/oni_analyzer.py` | 分析游戏状态、生成建议 |
| `tools/oni_builder.py` | 蓝图/建造规划 |
| `scripts/auto_repair.sh` | 诊断连接问题 |
| `scripts/auto_analyze.sh` | 一键拉取状态+分析 |
| `scripts/watch.sh` | 持续监控模式 |
| `scripts/setup.sh` | 环境初始化 |
## 使用方式
```bash
# 检查游戏连接
python3 tools/oni_api.py health
# 获取游戏状态概览
python3 tools/oni_api.py status
# 列出所有资源
python3 tools/oni_api.py resources
# 分析并生成建议
python3 tools/oni_analyzer.py
# 查看可用蓝图
python3 tools/oni_builder.py list
# 执行建造计划
python3 tools/oni_builder.py build spom 15 10
# 持续监控(每 60 秒)
bash scripts/watch.sh 60
# 诊断连接
bash scripts/auto_repair.sh
```
## 核心游戏知识
### 生存优先级
1. **氧气** — 电解器 > 藻类制氧(前期过渡)
2. **食物** — 浆果 > 烤肉 > 营养膏
3. **温度控制** — 液冷 + 蒸汽机
4. **电力** — 氢气发电 > 煤炭 > 手动
5. **水资源管理** — 净水器、污水过滤
### 常用布局
- SPOM (Self-Powered Oxygen Module): 电解制氧 + 氢气发电闭环
- 卫生间水循环: 卫生间 → 净水器 → 卫生间
- 冷却系统: 液冷 + 蒸汽机 + 导热管
- Ranch 模块: 养殖哈奇/滑鳞/飞鱼
### 关键事件预警
- 氧气不足 (< 500g/tile) 增加制氧
- 温度超标 (> 40°C 或 < -10°C) 增加温控
- 食物短缺 (< 5 周期余量) 扩大种植/养殖
- 电力不足 增加发电或减少负载
- 污水满溢 增加净水/扩大存储