From 042ab4383cfb9b747d7b2cf0992546bbd95cef00 Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Wed, 8 May 2024 12:22:25 -0400 Subject: Add right click map for diplomacy window --- game/project.godot | 5 +++++ game/src/Game/GameSession/MapView.gd | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'game') diff --git a/game/project.godot b/game/project.godot index ac627a3..bcbb28d 100644 --- a/game/project.godot +++ b/game/project.godot @@ -114,6 +114,11 @@ map_click={ "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null) ] } +map_right_click={ +"deadzone": 0.5, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null) +] +} time_pause={ "deadzone": 0.5, "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null) diff --git a/game/src/Game/GameSession/MapView.gd b/game/src/Game/GameSession/MapView.gd index a83c790..5b3fa04 100644 --- a/game/src/Game/GameSession/MapView.gd +++ b/game/src/Game/GameSession/MapView.gd @@ -13,6 +13,7 @@ const _action_zoom_in : StringName = &"map_zoom_in" const _action_zoom_out : StringName = &"map_zoom_out" const _action_drag : StringName = &"map_drag" const _action_click : StringName = &"map_click" +const _action_right_click : StringName = &"map_right_click" @export var _camera : Camera3D @@ -185,6 +186,10 @@ func _unhandled_input(event : InputEvent) -> void: GameSingleton.set_selected_province(GameSingleton.get_province_index_from_uv_coords(_mouse_pos_map)) else: print("Clicked outside the map!") + elif event.is_action_pressed(_action_right_click): + if _mouse_over_viewport: + if _map_mesh.is_valid_uv_coord(_mouse_pos_map): + Events.NationManagementScreens.open_nation_management_screen(NationManagement.Screen.DIPLOMACY) elif event.is_action_pressed(_action_drag): if _drag_active: push_warning("Drag being activated while already active!") -- cgit v1.2.3-56-ga3b1