Fix Biome System integration, memory optimization, and Tiled live sync workflow

This commit is contained in:
2025-12-27 12:50:58 +01:00
parent f8d533465b
commit 43f4b11c87
19 changed files with 1314 additions and 591 deletions

View File

@@ -59,9 +59,10 @@ class MicroFarmSystem {
const expandCost = this.expansionCost;
// Button positions relative to farm center
const farmWorldX = this.farmCenterX * 48;
const farmWorldY = this.farmCenterY * 48;
const farmPixelSize = this.farmSize * 48;
const tileSize = (this.scene.terrainSystem && this.scene.terrainSystem.tileSize) || 48;
const farmWorldX = this.farmCenterX * tileSize;
const farmWorldY = this.farmCenterY * tileSize;
const farmPixelSize = this.farmSize * tileSize;
const halfSize = farmPixelSize / 2;
const buttons = [
@@ -166,41 +167,66 @@ class MicroFarmSystem {
}
createFarmBoundaries() {
// Visual indicator of farm boundaries
// Clear previous if exists
if (this.boundaryGraphics) {
this.boundaryGraphics.destroy();
}
const graphics = this.scene.add.graphics();
const tileSize = (this.scene.terrainSystem && this.scene.terrainSystem.tileSize) || 48;
// 🏗️ 1. LARGE MASTER PLATFORM (32x32)
const largeSize = 32;
const largeHalf = largeSize / 2;
const lx1 = (this.farmCenterX - largeHalf) * tileSize;
const ly1 = (this.farmCenterY - largeHalf) * tileSize;
const lWidth = largeSize * tileSize;
const lHeight = largeSize * tileSize;
// Draw Master Platform
graphics.fillStyle(0x0000FF, 0.05); // Very subtle blue for "Large Platform"
graphics.fillRect(lx1, ly1, lWidth, lHeight);
graphics.lineStyle(2, 0x0000FF, 0.3);
graphics.strokeRect(lx1, ly1, lWidth, lHeight);
// 🏗️ 2. SMALL MICRO FARM PLATFORM (8x8)
const halfSize = Math.floor(this.farmSize / 2);
const startX = (this.farmCenterX - halfSize) * tileSize;
const startY = (this.farmCenterY - halfSize) * tileSize;
const width = this.farmSize * tileSize;
const height = this.farmSize * tileSize;
const startX = (this.farmCenterX - halfSize) * 48;
const startY = (this.farmCenterY - halfSize) * 48;
const width = this.farmSize * 48;
const height = this.farmSize * 48;
// Draw Highlight
graphics.fillStyle(0xFFFFFF, 0.15); // 15% white for "Starter Platform"
graphics.fillRect(startX, startY, width, height);
// Farm border (white dashed line)
graphics.lineStyle(3, 0xFFFFFF, 0.8);
// Draw Bold Boundary
graphics.lineStyle(4, 0x00FF00, 0.8); // High vis green
graphics.strokeRect(startX, startY, width, height);
// Corner markers
graphics.fillStyle(0xFFFFFF, 0.9);
const markerSize = 8;
graphics.fillRect(startX - markerSize / 2, startY - markerSize / 2, markerSize, markerSize);
graphics.fillRect(startX + width - markerSize / 2, startY - markerSize / 2, markerSize, markerSize);
graphics.fillRect(startX - markerSize / 2, startY + height - markerSize / 2, markerSize, markerSize);
graphics.fillRect(startX + width - markerSize / 2, startY + height - markerSize / 2, markerSize, markerSize);
graphics.fillStyle(0xFFFF00, 1);
const markerSize = 12;
graphics.fillCircle(startX, startY, markerSize);
graphics.fillCircle(startX + width, startY, markerSize);
graphics.fillCircle(startX, startY + height, markerSize);
graphics.fillCircle(startX + width, startY + height, markerSize);
graphics.setDepth(5); // Above ground, below player
// Store graphics for later updates
graphics.setDepth(50);
this.boundaryGraphics = graphics;
console.log(`🏰 Dual platforms rendered: Master (${largeSize}x${largeSize}) & Micro (${this.farmSize}x${this.farmSize})`);
}
renderLockedTileOverlay() {
// Render dark overlay on locked tiles
if (!this.scene || !this.lockedOverlayGraphics) {
// Create overlay graphics if not exists
this.lockedOverlayGraphics = this.scene.add.graphics();
this.lockedOverlayGraphics.setDepth(4); // Above ground, below boundaries
if (this.lockedOverlayGraphics) {
this.lockedOverlayGraphics.destroy();
}
this.lockedOverlayGraphics = this.scene.add.graphics();
this.lockedOverlayGraphics.setDepth(4); // Above ground, below boundaries
this.lockedOverlayGraphics.clear();
// Darken all tiles that are NOT unlocked
@@ -220,10 +246,11 @@ class MicroFarmSystem {
}
// Draw dark overlay (lighter)
const worldX = x * 48;
const worldY = y * 48;
const tileSize = (this.scene.terrainSystem && this.scene.terrainSystem.tileSize) || 48;
const worldX = x * tileSize;
const worldY = y * tileSize;
this.lockedOverlayGraphics.fillStyle(0x000000, 0.3); // 0.5 -> 0.3
this.lockedOverlayGraphics.fillRect(worldX, worldY, 48, 48);
this.lockedOverlayGraphics.fillRect(worldX, worldY, tileSize, tileSize);
}
}