fix(02-04): guard nullable static event sources

- Preserve dynamic event collection while narrowing static tile access
- Record the moverImpl type diagnostic as resolved
This commit is contained in:
unanmed 2026-09-10 09:38:02 +08:00
parent a2aedb3969
commit 93453db417
3 changed files with 20 additions and 7 deletions

View File

@ -21,3 +21,10 @@
status: open
**What:** 阶段门禁 `pnpm lint:user` 仍被本计划未修改的渲染与 legacy 文件阻塞;计划归属文件的
ESLint 检查为 0 problems按范围边界规则不修复无关基线问题。
- data-state/src/hero/moverImpl.ts 的 TS18047 诊断(`loc.static` 可能为 `null`
status: resolved
**What:** `commonTrigger` 的静态图块事件收集在可空 `ILayerLocation.static` 上直接调用
`tileEvent()`,导致计划归属文件的类型门禁失败。
**Resolution:** 仅在 `loc.static` 非空时收集静态图块事件;动态事件收集、优先级排序、来源环境
与单次 executor 调用保持不变。

View File

@ -202,13 +202,15 @@ export class DefaultHeroMoveTopImpl implements IHeroMoveTopImpl {
}
}
if (loc) {
for (const [priority, id] of loc.static.tileEvent().get()) {
tileSources.push({
priority,
id,
type: BlockEventType.TileEvent,
tile: loc.static
});
if (loc.static) {
for (const [priority, id] of loc.static.tileEvent().get()) {
tileSources.push({
priority,
id,
type: BlockEventType.TileEvent,
tile: loc.static
});
}
}
for (const tile of loc.dynamics) {
for (const [priority, id] of tile.tileEvent().get()) {

View File

@ -202,6 +202,10 @@ export class HeroPathfinding implements IHeroPathfinding {
this.system.useMover(mover);
}
useMovable(movable: IObjectMovable | null): void {
this.system.useMovable(movable);
}
useFallbackPolicy(policy: PathFallbackPolicy | null): void {
this.system.useFallbackPolicy(policy);
}