XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFE.SpaceEngineers.AgentBridge

【SpaceEngineer】AI调试插件

公开
关注 0 Fork 0 Star 0
返回提交历史

SpaceEngineersModDev/XFE.SpaceEngineers.AgentBridge

Prepare sector cache before loading an authorized debug world

d80085d
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

2 个文件 +11 -0
Modified docs/API.md +2 -0
@@ -92,6 +92,8 @@ JSON 字段名区分大小写。请求最大深度 32,不接受重复属性名
92 92
93 93 `world.load` 的 `accepted` 只表示请求已发起。轮询 `world.status`,核对 `ready:true`、`path` 是目标世界,写操作前再核对 `canMutate:true`。加载观察超过 10 分钟会清除 `loadingPath` 并设置 `loadError`;这不等于取消了游戏自身的加载流程。读取/保存调用也可能因游戏加载界面或繁忙而超时。
94 94
95 加载前会用引擎自身的存档读取器检查 sector,并允许从 XML 重建缺失或失效的二进制缓存。离线部署清除旧缓存后,无需手动确认游戏的 XML 恢复界面;重建仅针对已授权的目标副本,仍保留正常的模组及世界加载流程。缓存准备完成或返回 `accepted` 都不等于世界已经就绪。
96
95 97 事件同时追加至 `%LOCALAPPDATA%\XFE\SpaceEngineersAgent\agent.log`,当前日志超过 4 MiB 后在下次写入时轮换为 `agent.log.1`。`agent.events` 是有限日志记录,不是完整方块状态变更流。
96 98
97 99 ## 4. 网格与方块查询
Modified src/XFE.SeAgent.Plugin/Game/GameDebugApi.cs +9 -0
@@ -130,6 +130,15 @@ namespace XFE.SeAgent.Plugin.Game
130 130 _loadStarted = DateTime.UtcNow;
131 131 try
132 132 {
133 // Offline deployments invalidate the protobuf sector cache. The normal
134 // loader starts with XML disabled and otherwise stalls on an interactive
135 // recovery screen. Let the engine validate/rebuild its own cache first.
136 ulong checkpointBytes, sectorBytes;
137 var checkpoint = Sandbox.Engine.Networking.MyLocalCache.LoadCheckpoint(path, out checkpointBytes, null, MyOnlineModeEnum.OFFLINE);
138 if (checkpoint == null) throw new InvalidOperationException("The authorized world checkpoint could not be read.");
139 bool needsXml;
140 var sector = Sandbox.Engine.Networking.MyLocalCache.LoadSector(path, checkpoint.CurrentSector, true, out sectorBytes, out needsXml);
141 if (sector == null) throw new InvalidOperationException("The authorized world's sector could not be read from its cache or XML.");
133 142 MySessionLoader.LoadSingleplayerSession(path, null, null, MyOnlineModeEnum.OFFLINE, 1, null, null);
134 143 }
135 144 catch { _loadingPath = null; throw; }