Debug: log tile affinity sample and tile model URLs at board build

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:
dingo
2026-03-09 14:25:27 -04:00
co-authored by Claude Happy
parent c94fe4204d
commit 9295155fbb
@@ -389,7 +389,19 @@ func _build_board(board: Dictionary) -> void:
_tile_bodies.clear()
_unit_meshes.clear()
_unit_bodies.clear()
for tile: Dictionary in board.get("tiles", []):
# Debug: show which tile model bindings are in cache right now.
var tiles_arr : Array = board.get("tiles", [])
var sample_affinities : Array = []
for t in tiles_arr.slice(0, 8):
sample_affinities.append(t.get("resolvedAffinity", "?"))
print("GameScreen: _build_board tiles=%d first8_affinities=%s" % [tiles_arr.size(), sample_affinities])
print("GameScreen: tile model cache — Hill_Square='%s' Lake_Square='%s'" % [
ContentCache.get_tile_model_url("Hill", "Square"),
ContentCache.get_tile_model_url("Lake", "Square"),
])
for tile: Dictionary in tiles_arr:
var coord : Dictionary = tile.get("coord", {})
_add_tile(coord.get("x", 0), coord.get("y", 0),
tile.get("resolvedAffinity", "Void"))
@@ -426,8 +438,9 @@ func _add_tile(x: int, y: int, affinity: String) -> void:
var model_url := ContentCache.get_tile_model_url(affinity, "Square")
if model_url.is_empty():
return
print("GameScreen: tile [%d,%d] %s → %s" % [x, y, affinity, model_url])
var body_ref := weakref(body)
var body_ref : Variant = weakref(body)
ModelCache.load_model(model_url, func(model_node: Node3D) -> void:
var b := body_ref.get_ref() as StaticBody3D
if not is_instance_valid(b):
@@ -542,7 +555,7 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color) -> void:
if model_url.is_empty():
return
var body_ref := weakref(body)
var body_ref : Variant = weakref(body)
ModelCache.load_model(model_url, func(model_node: Node3D) -> void:
# Guard: body may have been freed by a state rebuild before load finished.
var b := body_ref.get_ref() as StaticBody3D