You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
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:
@@ -291,9 +291,51 @@ export class RoomMessageHandler
|
|||||||
|
|
||||||
roomObject.processUpdateMessage(new ObjectRoomMapUpdateMessage(roomMap));
|
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;
|
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
|
* Shared body of `onRoomModelEvent` and
|
||||||
* `applyFloorModelLocally`. Feeds the floor heightmap into
|
* `applyFloorModelLocally`. Feeds the floor heightmap into
|
||||||
|
|||||||
Reference in New Issue
Block a user