Add hex grid to lobby rules editor; fix hex model/texture CDN loading
- 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 <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user