fix(room): applyFloorModelLocally also rebuilds the furniture stacking map

The first cut updated wallGeometry + RoomMapData (so the
visualization rebuilt) but NOT the FurnitureStackingHeightMap.
The stacking map is what governs whether the room treats a
tile as 'a room tile you can stack furni on' vs. 'blocked'.
Without rebuilding it, every newly-painted tile in the live
preview looks walkable but rejects furniture placement -
user reported exactly that.

Mirror the structure of onRoomHeightMapEvent: build a fresh
FurnitureStackingHeightMap from the parsed floor (height +
isRoomTile from FloorHeightMapMessageParser.TILE_BLOCKED),
default stackingBlocked=false, then setFurnitureStackingHeightMap
+ refreshTileObjectMap so the room object map picks up the
new tile set.
This commit is contained in:
simoleo89
2026-05-24 19:16:40 +02:00
committed by simoleo89
parent afd0a4fa16
commit 28a41ba543
+42
View File
@@ -291,9 +291,51 @@ export class RoomMessageHandler
roomObject.processUpdateMessage(new ObjectRoomMapUpdateMessage(roomMap));
// Floor visualization is updated above. Without this second
// step the FurnitureStackingHeightMap still reflects the
// pre-edit floor, so the room thinks every newly-painted
// tile is "blocked" and rejects furni placement on it.
// Rebuild it from the same parser so the stacking-map and
// the visual floor agree.
this._rebuildFurnitureStackingMap(parser);
return true;
}
private _rebuildFurnitureStackingMap(parser: FloorHeightMapMessageParser): void
{
if(!this._roomEngine) return;
const width = parser.width;
const height = parser.height;
const heightMap = new FurnitureStackingHeightMap(width, height);
const BLOCKED = FloorHeightMapMessageParser.TILE_BLOCKED;
let y = 0;
while(y < height)
{
let x = 0;
while(x < width)
{
const tileHeight = parser.getHeight(x, y);
const isRoomTile = (tileHeight !== BLOCKED);
heightMap.setTileHeight(x, y, isRoomTile ? tileHeight : 0);
heightMap.setStackingBlocked(x, y, false);
heightMap.setIsRoomTile(x, y, isRoomTile);
x++;
}
y++;
}
this._roomEngine.setFurnitureStackingHeightMap(this._currentRoomId, heightMap);
this._roomEngine.refreshTileObjectMap(this._currentRoomId, 'RoomMessageHandler.applyFloorModelLocally');
}
/**
* Shared body of `onRoomModelEvent` and
* `applyFloorModelLocally`. Feeds the floor heightmap into