From 1bd26f11be6aaf3dc9b8ffbd7850cfd77c5ead7f Mon Sep 17 00:00:00 2001 From: dingo Date: Wed, 1 Apr 2026 17:16:22 -0400 Subject: [PATCH] Add hex grid to lobby rules editor; fix hex model/texture CDN loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - rules_editor_dialog: add "Hexagon" to Board Shape picker and a Hex Sides spinner (3–10, default 5) so custom lobbies can configure hex boards - game_screen _add_tile: has_model check now looks for Hex-shape CDN models (falls back to Square), so hex tiles get height variance when a Hex model is registered on the CDN instead of always using the flat placeholder height - game_screen _try_load_tile_model: texture fallback now checks shape_key ("Hex") first, then falls back to "Square" — consistent with model loading Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../scenes/free_play/components/rules_editor_dialog.gd | 3 ++- Client/origin-client/scenes/game/game_screen.gd | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Client/origin-client/scenes/free_play/components/rules_editor_dialog.gd b/Client/origin-client/scenes/free_play/components/rules_editor_dialog.gd index ca173c5..f79c65a 100644 --- a/Client/origin-client/scenes/free_play/components/rules_editor_dialog.gd +++ b/Client/origin-client/scenes/free_play/components/rules_editor_dialog.gd @@ -116,7 +116,8 @@ func _build_fields(r: Dictionary) -> void: add_int.call("Board Width", "boardWidth", 3, 12, 6, "") add_int.call("Board Height", "boardHeight", 3, 12, 6, "") add_int.call("Starting Tile Affinity %","startingRandomTilePct",0, 100, 0, "% of tiles with a random basic affinity") - add_option.call("Board Shape", "boardShape", ["Default", "Rectangle", "Cross", "Triangular", "RadialStar", "HexRing"], "Default") + add_option.call("Board Shape", "boardShape", ["Default", "Rectangle", "Cross", "Triangular", "RadialStar", "HexRing", "Hexagon"], "Default") + add_int.call("Hex Sides", "hexSides", 3, 10, 5, "Hexagon board only: number of tiles per side (3–10)") # Board template picker — populate from BoardTemplateCache (GUID values, not labels). var tmpl_key := "boardTemplateIdOverride" diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 6f51109..d658e94 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -1200,7 +1200,9 @@ func _add_tile(x: int, y: int, affinity: String) -> void: # Every tile gets a seeded RNG for deterministic variety. # First roll: height (0.8-1.0 for model tiles, fixed 0.5 for placeholders). # Second roll: vertical stagger (±0.15) so the board isn't completely flat. - var has_model : bool = not ContentCache.get_tile_model_url(affinity, "Square").is_empty() + var _shape_key_chk := "Hex" if _board_grid_type == "Hexagon" else "Square" + var has_model : bool = not ContentCache.get_tile_model_url(affinity, _shape_key_chk).is_empty() \ + or (_board_grid_type == "Hexagon" and not ContentCache.get_tile_model_url(affinity, "Square").is_empty()) var rng := RandomNumberGenerator.new() rng.seed = hash("%d_%d" % [x, y]) var h : float = rng.randf_range(0.8, 1.0) if has_model else 0.5 @@ -1263,7 +1265,9 @@ func _try_load_tile_model(body: StaticBody3D, affinity: String) -> void: if model_url.is_empty(): # No 3D model — apply a 2D texture to the placeholder box and attach # a stalagmite bottom so undecorated tiles still look coherent. - var tex_url := ContentCache.get_tile_texture_url(affinity, "Square") + var tex_url := ContentCache.get_tile_texture_url(affinity, shape_key) + if tex_url.is_empty() and _board_grid_type == "Hexagon": + tex_url = ContentCache.get_tile_texture_url(affinity, "Square") if not tex_url.is_empty(): _apply_tile_texture(body, tex_url) if want_bottom: