diff options
author | Spartan322 <Megacake1234@gmail.com> | 2024-05-08 18:22:25 +0200 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2024-05-08 18:22:25 +0200 |
commit | 042ab4383cfb9b747d7b2cf0992546bbd95cef00 (patch) | |
tree | b52e4b850b0a639ad867cb6a7b155cc6d6c62562 | |
parent | c29cc0dabe3e3c7d03280e74d2d10fc3cc479c7f (diff) |
Add right click map for diplomacy window
-rw-r--r-- | game/project.godot | 5 | ||||
-rw-r--r-- | game/src/Game/GameSession/MapView.gd | 5 |
2 files changed, 10 insertions, 0 deletions
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!") |