fix(02-02): repair mover step-end coordinate writeback condition per approved P1 decision

This commit is contained in:
unanmed 2026-09-09 17:09:37 +08:00
parent 9efadc9806
commit e1f61013ac
2 changed files with 5 additions and 5 deletions

View File

@ -127,7 +127,7 @@ function createMover(tile: TestTile) {
describe('object mover position writeback', () => {
// 验证正交步(仅 x 变化)移动后经 setPos 回写 x 轴坐标,覆盖 mover.ts:651 条件缺陷场景
it.skip('writes back the x position after an orthogonal x-only step', async () => {
it('writes back the x position after an orthogonal x-only step', async () => {
const tile = new TestTile();
tile.x = 0;
tile.y = 0;
@ -142,7 +142,7 @@ describe('object mover position writeback', () => {
});
// 验证正交步(仅 y 变化)移动后经 setPos 回写 y 轴坐标,覆盖另一正交方向
it.skip('writes back the y position after an orthogonal y-only step', async () => {
it('writes back the y position after an orthogonal y-only step', async () => {
const tile = new TestTile();
tile.x = 0;
tile.y = 0;
@ -157,7 +157,7 @@ describe('object mover position writeback', () => {
});
// 验证斜向步移动后经 setPos 双轴同时回写,保证修复不破坏双轴步语义
it.skip('writes back both axes after a diagonal step', async () => {
it('writes back both axes after a diagonal step', async () => {
const tile = new TestTile();
tile.x = 1;
tile.y = 1;
@ -172,7 +172,7 @@ describe('object mover position writeback', () => {
});
// 验证传送步ObjectMoveType.Teleport移动后经 setPos 双轴回写至目标坐标
it.skip('writes back both axes after a teleport step', async () => {
it('writes back both axes after a teleport step', async () => {
const tile = new TestTile();
tile.x = 1;
tile.y = 1;

View File

@ -648,7 +648,7 @@ export abstract class ObjectMover<T extends IObjectMovable>
const loc = await this.onStepEnd(code, step, this.tile, controller);
const before: ITileLocator = { x: this.tile.x, y: this.tile.y };
const curr: ITileLocator = { x: loc.x, y: loc.y };
if (this.tile.x !== loc.x && this.tile.y !== loc.y) {
if (this.tile.x !== loc.x || this.tile.y !== loc.y) {
this.tile.setPos(loc.x, loc.y);
}
await this.onStepSettled(before, curr, this.tile, step, controller);