Clean up logs and fix variant reference error

This commit is contained in:
2026-01-02 23:13:52 +01:00
parent 970ff224c3
commit 8bb0dd8780
12 changed files with 106 additions and 801 deletions

View File

@@ -158,7 +158,7 @@ export class GameRenderer {
addEntity(entity) {
if (this.entities.has(entity.id)) return;
console.log(`[GameRenderer] Adding entity ${entity.name}`);
// Standee: Larger Size (+30%)
// Old: 0.8 x 1.2 -> New: 1.04 x 1.56
const w = 1.04;
@@ -296,11 +296,11 @@ export class GameRenderer {
const newExits = exits.filter(ex => !existingDoorCells.has(`${ex.x},${ex.y}`));
if (newExits.length === 0) {
console.log('[renderExits] No new doors to render');
return;
}
console.log(`[renderExits] Rendering ${newExits.length} new door cells`);
// Set flag for this render
this._pendingExitRender = true;
@@ -446,11 +446,11 @@ export class GameRenderer {
getTexture(path, onLoad) {
if (!this.textureCache.has(path)) {
console.log(`[TextureLoader] Starting load for: ${path}`);
const tex = this.textureLoader.load(
path,
(texture) => {
console.log(`[TextureLoader] ✓ Successfully loaded: ${path}`);
texture.needsUpdate = true;
if (onLoad) onLoad(texture);
},
@@ -478,7 +478,7 @@ export class GameRenderer {
// tileDef: The definition object (has textures, dimensions)
// tileInstance: The instance object (has x, y, rotation, id)
console.log(`[GameRenderer] Rendering Tile [${type}] ID: ${tileDef?.id} at (${tileInstance?.x}, ${tileInstance?.y}) Rot: ${tileInstance?.rotation}`);
// Draw Texture Plane (The Image) - WAIT FOR TEXTURE TO LOAD
if (tileDef && tileInstance && tileDef.textures && tileDef.textures.length > 0) {
@@ -508,8 +508,7 @@ export class GameRenderer {
const cx = tileInstance.x + (rotWidth - 1) / 2;
const cy = tileInstance.y + (rotHeight - 1) / 2;
console.log(`[GameRenderer] Dimensions (Rotated): ${rotWidth}x${rotHeight}`);
console.log(`[GameRenderer] Calculated Center: (${cx}, ${cy})`);
// 3. Use BASE dimensions from NORTH variant for the Plane
// (Since we are rotating the plane itself, we start with the un-rotated image size)
@@ -549,7 +548,7 @@ export class GameRenderer {
plane.receiveShadow = true;
this.scene.add(plane);
console.log(`[GameRenderer] ✓ Tile plane added at (${cx}, 0.01, ${-cy})`);
});
} else {
console.warn(`[GameRenderer] details missing for texture render. def: ${!!tileDef}, inst: ${!!tileInstance}`);
@@ -565,7 +564,7 @@ export class GameRenderer {
doorMesh.material.map = texture;
doorMesh.material.needsUpdate = true;
doorMesh.userData.isOpen = true;
console.log('[GameRenderer] Door opened');
});
}
@@ -721,7 +720,7 @@ export class GameRenderer {
const r = rotMap[rotation] !== undefined ? rotMap[rotation] : 0;
floatingTile.rotation.z = -r * (Math.PI / 2);
console.log(`[Preview] Rotation: ${rotation}, Center: (${cx}, ${cy})`);
floatingTile.position.set(cx, 3, -cy);
this.previewGroup.add(floatingTile);