Right-click context menu includes mobs on their previous tile while moving.
Remember the departed tile during movement lerp so Attack/Follow still appear where the mob just stood.
@@ -1149,7 +1149,7 @@ function handleRightClick (event, mouseX, mouseY)
1149
1149
}
1150
1150
});
1151
1151
1152
for (const entity of view.entitiesAtTile(tile.tileX, tile.tileY))
1152
for (const entity of view.entitiesAtTile(tile.tileX, tile.tileY, { includePrevious: true }))
1153
1153
{
1154
1154
if (entity.entityId === view.localEntityId)
1155
1155
{ continue; }
@@ -1149,7 +1149,7 @@ function handleRightClick (event, mouseX, mouseY)1149
}1149
}1150
});1150
});1151
1151
1152
for (const entity of view.entitiesAtTile(tile.tileX, tile.tileY))1152
for (const entity of view.entitiesAtTile(tile.tileX, tile.tileY, { includePrevious: true }))1153
{1153
{1154
if (entity.entityId === view.localEntityId)1154
if (entity.entityId === view.localEntityId)1155
{ continue; }1155
{ continue; }@@ -767,6 +767,11 @@ export class WorldView
767
767
existing.fromY = existing.visualY;
768
768
existing.shadeFromTileX = existing.tileX;
769
769
existing.shadeFromTileY = existing.tileY;
770
if (existing.tileX !== payload.tileX || existing.tileY !== payload.tileY)
771
{
772
existing.previousTileX = existing.tileX;
773
existing.previousTileY = existing.tileY;
774
}
770
775
existing.tileX = payload.tileX;
771
776
existing.tileY = payload.tileY;
772
777
existing.gait = payload.gait;
@@ -1304,12 +1309,23 @@ export class WorldView
1304
1309
return items;
1305
1310
}
1306
1311
1307
entitiesAtTile (tileX, tileY)
1312
entitiesAtTile (tileX, tileY, options = {})
1308
1313
{
1314
const includePrevious = !!options.includePrevious;
1309
1315
const matches = [];
1310
1316
for (const entity of this.entities.values())
1311
1317
{
1312
1318
if (entity.tileX === tileX && entity.tileY === tileY)
1319
{
1320
matches.push(entity);
1321
continue;
1322
}
1323
if (
1324
includePrevious
1325
&& entity.lerpStarted != null
1326
&& entity.previousTileX === tileX
1327
&& entity.previousTileY === tileY
1328
)
1313
1329
{ matches.push(entity); }
1314
1330
}
1315
1331
matches.sort((a, b) => (b.object?.layer ?? 0) - (a.object?.layer ?? 0));
@@ -1424,7 +1440,11 @@ export class WorldView
1424
1440
entity.visualX = entity.fromX + (target.x - entity.fromX) * t;
1425
1441
entity.visualY = entity.fromY + (target.y - entity.fromY) * t;
1426
1442
if (t >= 1)
1427
{ entity.lerpStarted = null; }
1443
{
1444
entity.lerpStarted = null;
1445
entity.previousTileX = null;
1446
entity.previousTileY = null;
1447
}
1428
1448
}
1429
1449
else
1430
1450
{
@@ -767,6 +767,11 @@ export class WorldView767
existing.fromY = existing.visualY;767
existing.fromY = existing.visualY;768
existing.shadeFromTileX = existing.tileX;768
existing.shadeFromTileX = existing.tileX;769
existing.shadeFromTileY = existing.tileY;769
existing.shadeFromTileY = existing.tileY;770
if (existing.tileX !== payload.tileX || existing.tileY !== payload.tileY)771
{772
existing.previousTileX = existing.tileX;773
existing.previousTileY = existing.tileY;774
}770
existing.tileX = payload.tileX;775
existing.tileX = payload.tileX;771
existing.tileY = payload.tileY;776
existing.tileY = payload.tileY;772
existing.gait = payload.gait;777
existing.gait = payload.gait;@@ -1304,12 +1309,23 @@ export class WorldView1304
return items;1309
return items;1305
}1310
}1306
1311
1307
entitiesAtTile (tileX, tileY)1312
entitiesAtTile (tileX, tileY, options = {})1308
{1313
{1314
const includePrevious = !!options.includePrevious;1309
const matches = [];1315
const matches = [];1310
for (const entity of this.entities.values())1316
for (const entity of this.entities.values())1311
{1317
{1312
if (entity.tileX === tileX && entity.tileY === tileY)1318
if (entity.tileX === tileX && entity.tileY === tileY)1319
{1320
matches.push(entity);1321
continue;1322
}1323
if (1324
includePrevious1325
&& entity.lerpStarted != null1326
&& entity.previousTileX === tileX1327
&& entity.previousTileY === tileY1328
)1313
{ matches.push(entity); }1329
{ matches.push(entity); }1314
}1330
}1315
matches.sort((a, b) => (b.object?.layer ?? 0) - (a.object?.layer ?? 0));1331
matches.sort((a, b) => (b.object?.layer ?? 0) - (a.object?.layer ?? 0));@@ -1424,7 +1440,11 @@ export class WorldView1424
entity.visualX = entity.fromX + (target.x - entity.fromX) * t;1440
entity.visualX = entity.fromX + (target.x - entity.fromX) * t;1425
entity.visualY = entity.fromY + (target.y - entity.fromY) * t;1441
entity.visualY = entity.fromY + (target.y - entity.fromY) * t;1426
if (t >= 1)1442
if (t >= 1)1427
{ entity.lerpStarted = null; }1443
{1444
entity.lerpStarted = null;1445
entity.previousTileX = null;1446
entity.previousTileY = null;1447
}1428
}1448
}1429
else1449
else1430
{1450
{