diff options
Diffstat (limited to 'Game/Selection')
-rw-r--r-- | Game/Selection/selectable_area.gd | 12 | ||||
-rw-r--r-- | Game/Selection/selection_rectangle.gd | 15 |
2 files changed, 16 insertions, 11 deletions
diff --git a/Game/Selection/selectable_area.gd b/Game/Selection/selectable_area.gd index 59d4be7..b3336f1 100644 --- a/Game/Selection/selectable_area.gd +++ b/Game/Selection/selectable_area.gd @@ -6,12 +6,12 @@ signal hover_exit signal select(event: InputEvent) -func _on_area_entered(_area: Area2D) -> void: - hover_enter.emit() - - -func _on_area_exited(_area: Area2D) -> void: - hover_exit.emit() +#func _on_area_entered(_area: Area2D) -> void: + #hover_enter.emit() +# +# +#func _on_area_exited(_area: Area2D) -> void: + #hover_exit.emit() func _on_mouse_entered() -> void: diff --git a/Game/Selection/selection_rectangle.gd b/Game/Selection/selection_rectangle.gd index a57f25b..5e7d1c1 100644 --- a/Game/Selection/selection_rectangle.gd +++ b/Game/Selection/selection_rectangle.gd @@ -14,7 +14,9 @@ var size: Vector2 = Vector2.ZERO : var is_active: bool : get(): - return abs(size) > Vector2(1, 1) + return abs(size) > Vector2(1, 1) and Client.state is StateDefault + +@onready var camera: Camera2D = get_tree().get_first_node_in_group("camera") func _process(_delta: float) -> void: @@ -30,7 +32,8 @@ func _process(_delta: float) -> void: if is_active and Input.is_action_just_released("select"): for area in get_overlapping_areas(): if "is_selected" in area.get_parent(): - area.get_parent().is_selected = true + if area.get_parent().owner_id == multiplayer.get_unique_id(): + area.get_parent().is_selected = true size = Vector2.ZERO queue_redraw() @@ -40,12 +43,14 @@ func _draw(): if is_active: var rect = Rect2(Vector2.ZERO, size) draw_rect(rect, color_background) - draw_rect(rect, color_border, false, 2.0) + draw_rect(rect, color_border, false, 1.25 / max(camera.zoom.x, camera.zoom.y)) func _on_area_entered(area: Area2D) -> void: - area.get_parent().is_hovered = true + if area.get_parent().owner_id == multiplayer.get_unique_id(): + area.get_parent().is_hovered = true func _on_area_exited(area: Area2D) -> void: - area.get_parent().is_hovered = false + if area.get_parent().owner_id == multiplayer.get_unique_id(): + area.get_parent().is_hovered = false |