Client selection fixes

This commit is contained in:
dingo
2026-05-22 14:18:18 -04:00
parent 91ba3d094d
commit 32693d303b
4 changed files with 37 additions and 8 deletions
@@ -129,8 +129,11 @@ func _input(event: InputEvent) -> void:
var is_card_active: bool = card_mode_active or ability_card_active
if is_card_active:
if not _hand_blocks_pointer(mb.position):
_deselect_pending = true
_do_deselect_if_pending.call_deferred()
if _pointer_hits_board_target(mb.position):
_deselect_pending = false
else:
_deselect_pending = true
_do_deselect_if_pending.call_deferred()
# ── Deselect-if-pending (called deferred so board click can cancel it first) ──
@@ -377,3 +380,14 @@ func _hand_blocks_pointer(screen_pos: Vector2) -> bool:
if hand_area.has_method("blocks_pointer"):
return bool(hand_area.call("blocks_pointer", screen_pos))
return hand_area.get_global_rect().has_point(screen_pos)
func _pointer_hits_board_target(screen_pos: Vector2) -> bool:
if fn_mouse_to_tile_coord.is_valid():
var coord: Vector2i = fn_mouse_to_tile_coord.call(screen_pos)
if coord.x >= 0:
return true
if fn_mouse_to_unit_id.is_valid():
var unit_id: String = str(fn_mouse_to_unit_id.call(screen_pos))
return not unit_id.is_empty()
return false