From ef7d45f40e949b7b2e985bb78f9a0ce6799f904f Mon Sep 17 00:00:00 2001 From: dingo Date: Sat, 7 Mar 2026 09:11:45 -0500 Subject: [PATCH] Fix GDScript type inference errors in game_screen.gd - Explicit Dictionary type on pd variable (unit position) - Explicit int type on all dist variables (abs() returns Variant when operands are from Dictionary.get() calls) Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- Client/origin-client/scenes/game/game_screen.gd | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Client/origin-client/scenes/game/game_screen.gd b/Client/origin-client/scenes/game/game_screen.gd index 88fa6b3..365c935 100644 --- a/Client/origin-client/scenes/game/game_screen.gd +++ b/Client/origin-client/scenes/game/game_screen.gd @@ -412,7 +412,7 @@ func _rebuild_units(state: Dictionary) -> void: func _add_unit_mesh(unit: Dictionary, team_color: Color) -> void: - var pd := unit.get("position", {}) + var pd : Dictionary = unit.get("position", {}) if pd.is_empty(): return var wp := _coord_to_world(pd.get("x", 0), pd.get("y", 0)) var card_type : String = unit.get("cardType", "Spirit") @@ -520,7 +520,7 @@ func _valid_play_tiles(card: Dictionary) -> Array: var max_r : int = card.get("maxChannelRange", 2) for tx in range(bw): for ty in range(bh): - var dist := abs(tx - ax) + abs(ty - ay) + var dist : int = abs(tx - ax) + abs(ty - ay) if dist < min_r or dist > max_r: continue if Game.get_tile(tx, ty).get("occupantId", "") != "": continue results.append(Vector2i(tx, ty)) @@ -556,7 +556,7 @@ func _valid_move_tiles(unit: Dictionary) -> Array: if mp <= 0 or unit.get("isExhausted", false): return results for tx in range(bw): for ty in range(bh): - var dist := abs(tx - ux) + abs(ty - uy) + var dist : int = abs(tx - ux) + abs(ty - uy) if dist == 0 or dist > mp: continue if Game.get_tile(tx, ty).get("occupantId", "") != "": continue results.append(Vector2i(tx, ty)) @@ -582,7 +582,7 @@ func _valid_attack_target_coords(unit: Dictionary) -> Array: if not t.get("canBeAttacked", true): continue var tp : Dictionary = t.get("position", {}) if tp.is_empty(): continue - var dist := abs(tp.get("x", 0) - ux) + abs(tp.get("y", 0) - uy) + var dist : int = abs(tp.get("x", 0) - ux) + abs(tp.get("y", 0) - uy) if dist >= min_r and dist <= max_r: results.append(tp) return results @@ -607,7 +607,7 @@ func _valid_attack_target_ids(unit: Dictionary) -> Array: if not t.get("canBeAttacked", true): continue var tp : Dictionary = t.get("position", {}) if tp.is_empty(): continue - var dist := abs(tp.get("x", 0) - ux) + abs(tp.get("y", 0) - uy) + var dist : int = abs(tp.get("x", 0) - ux) + abs(tp.get("y", 0) - uy) if dist >= min_r and dist <= max_r: results.append(t.get("instanceId", "")) return results