Add Grid Type toggle (Square/Hexagon) to lobby rules editor
Replaces burying "Hexagon" in the Board Shape list with a dedicated Grid Type dropdown at the top of the BOARD section. When "Hexagon" is selected, boardShape is forced to "Hexagon" on confirm; square boards use the Board Shape field as before. Hex Sides remains visible for the sides setting. 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:
@@ -113,11 +113,14 @@ func _build_fields(r: Dictionary) -> void:
|
||||
|
||||
# ── Board ──────────────────────────────────────────────────────────────────
|
||||
_section("BOARD")
|
||||
var cur_is_hex : bool = get_s.call("boardShape", "Default") == "Hexagon"
|
||||
add_option.call("Grid Type", "_gridType", ["Square", "Hexagon"],
|
||||
"Hexagon" if cur_is_hex else "Square")
|
||||
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", "Hexagon"], "Default")
|
||||
add_int.call("Hex Sides", "hexSides", 3, 10, 5, "Hexagon board only: number of tiles per side (3–10)")
|
||||
add_option.call("Board Shape", "boardShape", ["Default", "Rectangle", "Cross", "Triangular", "RadialStar", "HexRing"], "Default")
|
||||
add_int.call("Hex Sides", "hexSides", 3, 10, 5, "Hexagon only: tiles per side (3–10)")
|
||||
|
||||
# Board template picker — populate from BoardTemplateCache (GUID values, not labels).
|
||||
var tmpl_key := "boardTemplateIdOverride"
|
||||
@@ -187,5 +190,12 @@ func _on_confirm() -> void:
|
||||
overrides[key] = ids[idx] if idx < ids.size() else ""
|
||||
else:
|
||||
overrides[key] = ctrl.get_item_text(ctrl.selected)
|
||||
|
||||
# _gridType is an internal toggle: when "Hexagon" it overrides boardShape.
|
||||
var grid_type : String = str(overrides.get("_gridType", "Square"))
|
||||
overrides.erase("_gridType")
|
||||
if grid_type == "Hexagon":
|
||||
overrides["boardShape"] = "Hexagon"
|
||||
|
||||
confirmed.emit(overrides)
|
||||
queue_free()
|
||||
|
||||
Reference in New Issue
Block a user