mesano
This commit is contained in:
@@ -104,6 +104,7 @@ class TerrainSystem {
|
||||
STONE: { name: 'stone', height: 0.7, color: 0x888888 },
|
||||
PAVEMENT: { name: 'pavement', height: 0.6, color: 0x777777 },
|
||||
RUINS: { name: 'ruins', height: 0.6, color: 0x555555 },
|
||||
WALL_EDGE: { name: 'WALL_EDGE', height: 0.8, color: 0x505050, solid: true }, // OBZIDJE
|
||||
PATH: { name: 'path', height: -1, color: 0xc2b280 },
|
||||
FARMLAND: { name: 'farmland', height: -1, color: 0x5c4033 },
|
||||
// MINE TYPES
|
||||
@@ -222,11 +223,26 @@ class TerrainSystem {
|
||||
if (Math.abs(x - FARM_CENTER_X) <= FARM_SIZE / 2 && Math.abs(y - FARM_CENTER_Y) <= FARM_SIZE / 2) {
|
||||
terrainType = this.terrainTypes.DIRT;
|
||||
}
|
||||
// CITY AREA - 15x15 območje z OBZIDJEM
|
||||
if (x >= CITY_START_X && x < CITY_START_X + CITY_SIZE &&
|
||||
y >= CITY_START_Y && y < CITY_START_Y + CITY_SIZE) {
|
||||
terrainType = this.terrainTypes.PAVEMENT;
|
||||
if (Math.random() < 0.2) {
|
||||
terrainType = this.terrainTypes.RUINS;
|
||||
|
||||
// Preverimo, ali smo na ROBOVIH (Obzidje)
|
||||
const isEdge = (x === CITY_START_X ||
|
||||
x === CITY_START_X + CITY_SIZE - 1 ||
|
||||
y === CITY_START_Y ||
|
||||
y === CITY_START_Y + CITY_SIZE - 1);
|
||||
|
||||
if (isEdge) {
|
||||
// OBZIDJE - trdno, igralec ne more čez
|
||||
terrainType = { name: 'WALL_EDGE', color: 0x505050, solid: true };
|
||||
} else {
|
||||
// NOTRANJOST MESTA - tlakovci (pavement)
|
||||
terrainType = this.terrainTypes.PAVEMENT;
|
||||
// Naključne ruševine v mestu
|
||||
if (Math.random() < 0.15) {
|
||||
terrainType = this.terrainTypes.RUINS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +250,8 @@ class TerrainSystem {
|
||||
type: terrainType.name,
|
||||
texture: terrainType.name,
|
||||
hasDecoration: false,
|
||||
hasCrop: false
|
||||
hasCrop: false,
|
||||
solid: terrainType.solid || false // Inherits from terrain type
|
||||
};
|
||||
|
||||
// Place Trees dynamically during generation
|
||||
@@ -712,4 +729,45 @@ class TerrainSystem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
placeStructure(x, y, type) {
|
||||
// Generate textures if needed
|
||||
if (type === 'chest' && !this.scene.textures.exists('chest')) {
|
||||
TextureGenerator.createChestSprite(this.scene, 'chest');
|
||||
}
|
||||
if (type === 'spawner' && !this.scene.textures.exists('spawner')) {
|
||||
TextureGenerator.createSpawnerSprite(this.scene, 'spawner');
|
||||
}
|
||||
if (type === 'ruin' && !this.scene.textures.exists('ruin')) {
|
||||
TextureGenerator.createStructureSprite(this.scene, 'ruin', 'ruin');
|
||||
}
|
||||
if (type === 'arena' && !this.scene.exists('arena')) {
|
||||
// Arena uses ruin texture for now
|
||||
TextureGenerator.createStructureSprite(this.scene, 'arena', 'ruin');
|
||||
}
|
||||
if (type.startsWith('signpost')) {
|
||||
const textMap = { 'signpost_city': '→', 'signpost_farm': '←', 'signpost_both': '⇅' };
|
||||
const text = textMap[type] || '?';
|
||||
if (!this.scene.textures.exists(type)) {
|
||||
TextureGenerator.createSignpostSprite(this.scene, type, text);
|
||||
}
|
||||
}
|
||||
|
||||
// Place as decoration
|
||||
this.addDecoration(x, y, type);
|
||||
console.log(`🏛️ Place ${type} at (${x}, ${y})`);
|
||||
}
|
||||
|
||||
setSolid(x, y, isSolid) {
|
||||
if (x >= 0 && x < this.width && y >= 0 && y < this.height) {
|
||||
this.tiles[y][x].solid = isSolid;
|
||||
}
|
||||
}
|
||||
|
||||
isSolid(x, y) {
|
||||
if (x >= 0 && x < this.width && y >= 0 && y < this.height) {
|
||||
return this.tiles[y][x].solid || false;
|
||||
}
|
||||
return true; // Out of bounds = solid
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user