/
RaskolnickOFF
/
3D
Обзор
Документация
Войти
/
RaskolnickOFF
/
3D
Код
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
js/source/world/WorldMapData.js
46 строк
2 KB
RaskolnickOFF
Structure update
06 июн 2026, 03:18
06 июн 2026, 03:18
9bc1c25
Код
Авторство
О чём код?
// js/game/world/WorldMapData.js — единый источник правды для биомов (F0) // Биом определяется ТОЛЬКО по высоте. // Раскраска террейна — через levelColors в Ground.js, биомы на неё не влияют. export class WorldMapData { constructor(settings) { this.settings = settings; this.biomeConfigs = settings.biomes || {}; this.worldSize = settings.terrain?.size || 60; } /** * Определяет биом по высоте. * @param {number} worldX — мировая координата X (для совместимости) * @param {number} worldZ — мировая координата Z (для совместимости) * @param {number} height — высота в точке */ getBiomeAt(worldX, worldZ, height = 0) { let type; if (height >= 5) { type = 'snow'; } else if (height >= 0.5) { type = 'forest'; } else { type = 'swamp'; } const config = this.biomeConfigs[type] || this.biomeConfigs.forest; return { type, spawnTable: config.spawnTable || { enemies: [], loot: [], trees: [] }, palette: config.palette || { low: '#ffe894', mid: '#85d534', high: '#ffffff' }, density: config.density ?? 1.0, fog: config.fog || '#c8e6c9', roughness: config.roughness ?? 0.7, metalness: config.metalness ?? 0.0 }; } getSpawnTable(biomeType) { const config = this.biomeConfigs[biomeType] || this.biomeConfigs.forest; return config.spawnTable || { enemies: [], loot: [], trees: [] }; } }