diff --git a/src/game/engine/scenes/hud/minimap.gd b/src/game/engine/scenes/hud/minimap.gd index 29668341..0e963cde 100644 --- a/src/game/engine/scenes/hud/minimap.gd +++ b/src/game/engine/scenes/hud/minimap.gd @@ -9,30 +9,10 @@ const CityScript: GDScript = preload("res://engine/src/entities/city.gd") const UnitScript: GDScript = preload("res://engine/src/entities/unit.gd") const PlayerScript: GDScript = preload("res://engine/src/entities/player.gd") -## Minimap terrain palette indexed by terrain_id. These are game-content -## colors (no UI design token applies) and are a deliberately distinct, -## muted minimap rendering — NOT a mirror of terrain.json's `color` arrays -## (those diverge by 10-70/channel; only `coast` coincides). p2-74 leaves -## this hardcoded; routing it through a data source is a Rail-2 follow-up -## (logic change, out of scope for the visual-only token pass). -const TERRAIN_COLORS: Dictionary = { - "ocean": Color(0.12, 0.24, 0.55), - "coast": Color(0.31, 0.71, 0.86), - "lake": Color(0.27, 0.55, 0.78), - "inland_sea": Color(0.22, 0.45, 0.76), - "grassland": Color(0.39, 0.71, 0.20), - "plains": Color(0.75, 0.78, 0.42), - "forest": Color(0.13, 0.45, 0.13), - "jungle": Color(0.06, 0.35, 0.10), - "boreal_forest": Color(0.22, 0.40, 0.28), - "hills": Color(0.63, 0.51, 0.27), - "mountains": Color(0.55, 0.55, 0.63), - "desert": Color(0.86, 0.75, 0.43), - "tundra": Color(0.78, 0.82, 0.86), - "swamp": Color(0.27, 0.35, 0.16), - "volcano": Color(0.55, 0.16, 0.12), -} -const DEFAULT_TERRAIN_COLOR: Color = Color(0.3, 0.3, 0.3) +## Minimap terrain colour comes from the single source (biome_colors.json) via +## DataLoader.get_biome_color() — keyed by biome_id, the same palette the main +## map renderer (hex_renderer.gd) uses. No separate hardcoded minimap palette +## (p2-87: one colour source, no divergent one-offs). const CITY_DOT_RADIUS: float = 4.0 const UNIT_DOT_RADIUS: float = 3.0 const OWNER_TINT_ALPHA: float = 0.38 @@ -125,16 +105,8 @@ func _on_terrain_transformed(_tile: Variant, _old_type: String, _new_type: Strin call_deferred("_rebuild_terrain") -func _get_terrain_color(terrain_id: String) -> Color: - if TERRAIN_COLORS.has(terrain_id): - return TERRAIN_COLORS[terrain_id] - var data: Dictionary = DataLoader.get_terrain(terrain_id) - if data.is_empty(): - return DEFAULT_TERRAIN_COLOR - var rgb: Array = data.get("color", []) - if rgb.size() >= 3: - return Color(float(rgb[0]) / 255.0, float(rgb[1]) / 255.0, float(rgb[2]) / 255.0, 1.0) - return DEFAULT_TERRAIN_COLOR +func _get_terrain_color(biome_id: String) -> Color: + return DataLoader.get_biome_color(biome_id) func _rebuild_terrain() -> void: @@ -162,10 +134,10 @@ func _rebuild_terrain() -> void: for px: int in img_w: var world_pos: Vector2 = _mini_to_world(Vector2(float(px), float(py))) var axial: Vector2i = HexUtilsScript.pixel_to_axial(world_pos) - var terrain_id: String = _get_tile_terrain(game_map, axial) - if terrain_id.is_empty(): + var biome_id: String = _get_tile_terrain(game_map, axial) + if biome_id.is_empty(): continue - _cached_image.set_pixel(px, py, _get_terrain_color(terrain_id)) + _cached_image.set_pixel(px, py, _get_terrain_color(biome_id)) _texture = ImageTexture.create_from_image(_cached_image) _map_rect.texture = _texture @@ -174,11 +146,11 @@ func _rebuild_terrain() -> void: func _get_tile_terrain(game_map: RefCounted, axial: Vector2i) -> String: - ## Returns terrain_id for the tile at axial, or "" if not found. + ## Returns the tile's biome_id at axial, or "" if not found. var raw_tile: RefCounted = game_map.get_tile(axial) as RefCounted if raw_tile == null: return "" - return str(raw_tile.get("terrain_id")) + return str(raw_tile.get("biome_id")) func pulse_at(axial: Vector2i) -> void: