From eb1a81f00941edb0ab3898db52c7d0a7fd395afc Mon Sep 17 00:00:00 2001 From: Natalie Date: Thu, 18 Jun 2026 23:47:30 -0500 Subject: [PATCH] =?UTF-8?q?refactor(@projects/@magic-civilization):=20?= =?UTF-8?q?=F0=9F=8E=A8=20hex=5Frenderer=20reads=20biome=20colour=20from?= =?UTF-8?q?=20single=20source=20(p2-87=20phase=201b)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Delete hex_renderer.gd's hardcoded 69-entry TERRAIN_COLORS dict; the terrain sprite fallback now calls DataLoader.get_biome_color(biome_id) (the values were lifted from this very dict in phase 1a, so value-preserving). One fewer copy of the biome palette; file drops ~82 lines. gdlint clean. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/game/engine/src/rendering/hex_renderer.gd | 88 +------------------ 1 file changed, 3 insertions(+), 85 deletions(-) diff --git a/src/game/engine/src/rendering/hex_renderer.gd b/src/game/engine/src/rendering/hex_renderer.gd index 86c575d5..4ff7a016 100644 --- a/src/game/engine/src/rendering/hex_renderer.gd +++ b/src/game/engine/src/rendering/hex_renderer.gd @@ -96,90 +96,8 @@ const BIOME_TO_FLORA_COVER: Dictionary = { "inland_sea": "bare", } -## Fallback terrain colors when sprites are not available. -## Keys are biome_id strings from terrain JSON data. -const TERRAIN_COLORS: Dictionary = { - # Land - "grassland": Color(0.45, 0.68, 0.30), - "temperate_grassland": Color(0.55, 0.72, 0.30), - "plains": Color(0.72, 0.65, 0.38), - "chaparral": Color(0.62, 0.56, 0.35), - "savanna": Color(0.78, 0.72, 0.42), - "steppe": Color(0.65, 0.62, 0.45), - "land": Color(0.50, 0.60, 0.38), - # Forests - "forest": Color(0.22, 0.50, 0.22), - "temperate_forest": Color(0.18, 0.48, 0.22), - "taiga": Color(0.30, 0.45, 0.35), - "boreal_forest": Color(0.15, 0.35, 0.28), - "jungle": Color(0.15, 0.42, 0.15), - "tropical_rainforest": Color(0.06, 0.38, 0.15), - "tropical_dry_forest": Color(0.42, 0.50, 0.22), - "temperate_rainforest": Color(0.17, 0.38, 0.25), - "enchanted_forest": Color(0.44, 0.25, 0.67), - "montane_forest": Color(0.16, 0.36, 0.24), - "cloud_forest": Color(0.20, 0.44, 0.34), - "mangrove": Color(0.12, 0.35, 0.42), - # Dry / arid - "desert": Color(0.88, 0.82, 0.55), - "badlands": Color(0.72, 0.42, 0.28), - "dust_plain": Color(0.72, 0.47, 0.29), - "dune_field": Color(0.80, 0.55, 0.35), - "canyon": Color(0.62, 0.30, 0.16), - "ancient_lakebed": Color(0.55, 0.45, 0.32), - # Elevated - "hills": Color(0.58, 0.52, 0.38), - "mountain": Color(0.55, 0.50, 0.48), - "mountains": Color(0.45, 0.42, 0.48), - "highland": Color(0.62, 0.56, 0.44), - "alpine_meadow": Color(0.50, 0.60, 0.48), - "alpine_tundra": Color(0.62, 0.65, 0.56), - "peak": Color(0.78, 0.78, 0.82), - "basalt_highland": Color(0.30, 0.25, 0.22), - # Volcanic - "volcanic": Color(0.35, 0.20, 0.18), - "volcano": Color(0.48, 0.20, 0.16), - "volcanic_plains": Color(0.25, 0.18, 0.14), - "lava_field": Color(0.80, 0.16, 0.04), - "caldera": Color(0.45, 0.10, 0.08), - # Wetland - "marsh": Color(0.40, 0.52, 0.35), - "swamp": Color(0.20, 0.28, 0.12), - "bog": Color(0.38, 0.32, 0.18), - "wetland": Color(0.24, 0.32, 0.16), - "oasis": Color(0.35, 0.62, 0.48), - # Cold / ice - "tundra": Color(0.75, 0.78, 0.80), - "snow": Color(0.92, 0.94, 0.96), - "ice": Color(0.85, 0.90, 0.95), - "permanent_ice": Color(0.78, 0.86, 0.91), - "glacial": Color(0.90, 0.93, 0.97), - "sea_ice": Color(0.75, 0.85, 0.95), - "polar_desert": Color(0.72, 0.73, 0.68), - "subterranean": Color(0.32, 0.24, 0.18), - "cave": Color(0.18, 0.16, 0.13), - # Water - "ocean": Color(0.15, 0.30, 0.55), - "deep_ocean": Color(0.08, 0.18, 0.40), - "coast": Color(0.25, 0.48, 0.65), - "shallow_ocean": Color(0.18, 0.38, 0.72), - "lake": Color(0.22, 0.42, 0.62), - "inland_sea": Color(0.18, 0.37, 0.56), - "river": Color(0.25, 0.48, 0.80), - "pond": Color(0.38, 0.62, 0.82), - "estuary": Color(0.25, 0.45, 0.52), - "coral_reef": Color(0.15, 0.62, 0.58), - "deep_water": Color(0.06, 0.10, 0.25), - "shallow_water": Color(0.22, 0.48, 0.80), - "lake_bed": Color(0.24, 0.38, 0.46), - # Substrates / generic - "lowland": Color(0.55, 0.72, 0.33), - "midland": Color(0.48, 0.62, 0.32), - # Special - "mana_node": Color(0.54, 0.35, 0.68), - # Fallback - "_default": Color(0.48, 0.48, 0.48), -} +## Biome render colour comes from the single source (biome_colors.json) +## via DataLoader.get_biome_color() — no hardcoded palette here (p2-87). ## Fog overlay colors const FOG_UNEXPLORED: Color = Color(0.0, 0.0, 0.0, 1.0) @@ -332,7 +250,7 @@ func _draw() -> void: _draw_sprite_at(pixel, sprite) elif canonical_sub == "": # Only draw terrain color fallback when no substrate was available - var color: Color = TERRAIN_COLORS.get(biome_id, TERRAIN_COLORS["_default"]) + var color: Color = DataLoader.get_biome_color(biome_id) _draw_hex_at(pixel, color) # Draw fog shroud over previously-seen tiles