posodobitev
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// ========================================================
|
||||
// NOVE GLOBALNE KONSTANTE ZA LOKACIJE
|
||||
// ========================================================
|
||||
const FARM_SIZE = 100; // 100x100 VELIKA PLATFORMA!
|
||||
const FARM_SIZE = 8; // 8x8 MICRO FARM - Začetek igre!
|
||||
const FARM_CENTER_X = 50; // Center mape (50,50)
|
||||
const FARM_CENTER_Y = 50; // Center mape (50,50)
|
||||
|
||||
@@ -453,6 +453,7 @@ class TerrainSystem {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- CHUNK DECORATION PASS ---
|
||||
// DISABLED - User wants clean platform (no trees, rocks, flowers)
|
||||
|
||||
@@ -477,6 +478,81 @@ class TerrainSystem {
|
||||
// this.addDecoration(pos.x, pos.y, 'path_stone');
|
||||
// }
|
||||
// });
|
||||
|
||||
// MICRO FARM FENCE (8x8 starting area) - DISABLED FOR NOW
|
||||
// Will be added properly later
|
||||
const farmMinX = FARM_CENTER_X - FARM_SIZE / 2;
|
||||
const farmMaxX = FARM_CENTER_X + FARM_SIZE / 2;
|
||||
const farmMinY = FARM_CENTER_Y - FARM_SIZE / 2;
|
||||
const farmMaxY = FARM_CENTER_Y + FARM_SIZE / 2;
|
||||
|
||||
// DECORATIONS: Flowers & Bushes on grass tiles (random)
|
||||
for (let y = startY; y < endY; y++) {
|
||||
for (let x = startX; x < endX; x++) {
|
||||
const tile = this.tiles[y][x]; // Corrected access to this.tiles
|
||||
|
||||
// Only on grass tiles, outside farm area
|
||||
if (tile && tile.type === 'GRASS_FULL' && // Changed 'grass' to 'GRASS_FULL' to match terrainType.name
|
||||
(x < farmMinX || x > farmMaxX || y < farmMinY || y > farmMaxY)) {
|
||||
|
||||
const rand = Math.random();
|
||||
|
||||
// 10% chance for flowers
|
||||
if (rand < 0.10) {
|
||||
const flowerTypes = ['flowers_new', 'flowers_pink_isometric'];
|
||||
const randomType = flowerTypes[Math.floor(Math.random() * flowerTypes.length)];
|
||||
this.addDecoration(x, y, randomType);
|
||||
}
|
||||
// 8% chance for grass patches (visual variety)
|
||||
else if (rand >= 0.10 && rand < 0.18) {
|
||||
this.addDecoration(x, y, 'grass_sprite');
|
||||
}
|
||||
// 5% chance for bushes
|
||||
else if (rand >= 0.18 && rand < 0.23) {
|
||||
this.addDecoration(x, y, 'bush_small');
|
||||
}
|
||||
// 3% chance for small rocks
|
||||
else if (rand >= 0.23 && rand < 0.26) {
|
||||
const rockTypes = ['rock_small', 'rock_2'];
|
||||
const randomRock = rockTypes[Math.floor(Math.random() * rockTypes.length)];
|
||||
this.addDecoration(x, y, randomRock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if this chunk contains farm border
|
||||
if (cx * this.chunkSize <= farmMaxX && (cx + 1) * this.chunkSize >= farmMinX &&
|
||||
cy * this.chunkSize <= farmMaxY && (cy + 1) * this.chunkSize >= farmMinY) {
|
||||
|
||||
// Top border (y = farmMinY)
|
||||
if (startY <= farmMinY && endY > farmMinY) {
|
||||
for (let x = Math.max(startX, farmMinX); x <= Math.min(endX - 1, farmMaxX); x++) {
|
||||
this.addDecoration(x, farmMinY, 'fence_isometric');
|
||||
}
|
||||
}
|
||||
|
||||
// Bottom border (y = farmMaxY)
|
||||
if (startY <= farmMaxY && endY > farmMaxY) {
|
||||
for (let x = Math.max(startX, farmMinX); x <= Math.min(endX - 1, farmMaxX); x++) {
|
||||
this.addDecoration(x, farmMaxY, 'fence_isometric');
|
||||
}
|
||||
}
|
||||
|
||||
// Left border (x = farmMinX)
|
||||
if (startX <= farmMinX && endX > farmMinX) {
|
||||
for (let y = Math.max(startY, farmMinY); y <= Math.min(endY - 1, farmMaxY); y++) {
|
||||
this.addDecoration(farmMinX, y, 'fence_isometric');
|
||||
}
|
||||
}
|
||||
|
||||
// Right border (x = farmMaxX)
|
||||
if (startX <= farmMaxX && endX > farmMaxX) {
|
||||
for (let y = Math.max(startY, farmMinY); y <= Math.min(endY - 1, farmMaxY); y++) {
|
||||
this.addDecoration(farmMaxX, y, 'fence_isometric');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateChunks(camera) {
|
||||
@@ -732,14 +808,15 @@ class TerrainSystem {
|
||||
typeLower.includes('small_rock') ||
|
||||
typeLower.includes('path_stone') ||
|
||||
typeLower.includes('mushroom') ||
|
||||
typeLower.includes('puddle');
|
||||
typeLower.includes('puddle') ||
|
||||
typeLower.includes('fence'); // OGRAJE SO PREHODNE!
|
||||
|
||||
const isSolid = !isSmallDecor && (
|
||||
typeLower.includes('tree') ||
|
||||
typeLower.includes('sapling') ||
|
||||
typeLower.includes('rock') ||
|
||||
typeLower.includes('stone') ||
|
||||
typeLower.includes('fence') ||
|
||||
// fence REMOVED - it's walkable now!
|
||||
typeLower.includes('wall') ||
|
||||
typeLower.includes('signpost') ||
|
||||
typeLower.includes('hill') ||
|
||||
|
||||
Reference in New Issue
Block a user