From c7e78ba4ac7b77133d5d98e793d61892de8221f8 Mon Sep 17 00:00:00 2001 From: Jamie Greunbaum Date: Thu, 30 May 2024 20:06:52 -0400 Subject: [PATCH] Bugbot now properly uses project settings to determine raycast length for marker placement. --- Scenes/bugbot_player.gd | 9 ++++++--- bugbot.gd | 28 ++++++++++++++-------------- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Scenes/bugbot_player.gd b/Scenes/bugbot_player.gd index 7ae7b96..6a124b6 100644 --- a/Scenes/bugbot_player.gd +++ b/Scenes/bugbot_player.gd @@ -7,9 +7,6 @@ extends CharacterBody3D ## Scene to use as the bug marker. @export_file("*.scn","*.tscn") var bug_marker : String -## Distance from camera to allow placing bug markers. -@export_range(0.0, 100.0, 0.01, "or_greater", "suffix:m") var ray_length : float = 10.0 - #region InputEvent Exports @export_group("Inputs") @export_subgroup("Keyboard", "keyboard_") @@ -66,6 +63,11 @@ extends CharacterBody3D @onready var __camera : Camera3D = $CollisionShape3D/Camera3D #endregion +#region Constants +const DEFAULT_PRECISE_PLACEMENT_DISTANCE : float = 10.0 +const DEFAULT_ARBITRARY_PLACEMENT_DISTANCE : float = 2.5 +#endregion + #region Private Properties static var __bugbot_server : BugbotServerAPI static var __bug_marker_root : Node @@ -346,6 +348,7 @@ func __on_exit_placement_timer_timeout() -> void: queue_free() func __raycast_to_world() -> void: + var ray_length : float = ProjectSettings.get_setting("bugbot/bug_placement/precise_placement_distance", DEFAULT_PRECISE_PLACEMENT_DISTANCE) var space : PhysicsDirectSpaceState3D = get_world_3d().direct_space_state var query : PhysicsRayQueryParameters3D = PhysicsRayQueryParameters3D.create(global_position, global_position - global_transform.basis.z * ray_length) query.collide_with_areas = true diff --git a/bugbot.gd b/bugbot.gd index 43fa66c..f197864 100644 --- a/bugbot.gd +++ b/bugbot.gd @@ -34,8 +34,8 @@ func _exit_tree() -> void: func __initialise_project_settings() -> void: #region Placement - __add_project_setting("bugbot/bug_placement/precise_placement_distance", TYPE_FLOAT, 15.0, PROPERTY_HINT_RANGE, "0.0,100.0,0.1,or_greater") - __add_project_setting("bugbot/bug_placement/arbitrary_placement_distance", TYPE_FLOAT, 2.5, PROPERTY_HINT_RANGE, "0.0,100.0,0.1,or_greater") + __add_project_setting("bugbot/bug_placement/precise_placement_distance", TYPE_FLOAT, Bugbot.DEFAULT_PRECISE_PLACEMENT_DISTANCE, PROPERTY_HINT_RANGE, "0.0,100.0,0.1,or_greater") + __add_project_setting("bugbot/bug_placement/arbitrary_placement_distance", TYPE_FLOAT, Bugbot.DEFAULT_ARBITRARY_PLACEMENT_DISTANCE, PROPERTY_HINT_RANGE, "0.0,100.0,0.1,or_greater") #endregion #region Reporting @@ -68,18 +68,18 @@ func __initialise_project_settings() -> void: __add_project_setting("bugbot/reporting/gitea/status_labels/show_assigned_as_in_progress", TYPE_BOOL, BugbotServerGiteaAPI.DEFAULT_SHOW_ASSIGNED_AS_IN_PROGRESS) #endregion #region Jira - __add_project_setting("bugbot/reporting/jira/server", TYPE_STRING, "https://jira.example.com") - __add_project_setting("bugbot/reporting/jira/REST_URI", TYPE_STRING, "rest/") - __add_project_setting("bugbot/reporting/jira/project_name", TYPE_STRING, "ProjectName") - __add_project_setting("bugbot/reporting/jira/email", TYPE_STRING, "") - __add_project_setting("bugbot/reporting/jira/API_key", TYPE_STRING, "") - __add_project_setting("bugbot/reporting/jira/bug_issue_type", TYPE_STRING, "Bug") - __add_project_setting("bugbot/reporting/jira/map_name_field", TYPE_STRING, "") - __add_project_setting("bugbot/reporting/jira/marker_location_field", TYPE_STRING, "") - __add_project_setting("bugbot/reporting/jira/optional_fields/department_field", TYPE_STRING, "") - __add_project_setting("bugbot/reporting/jira/optional_fields/severity_field", TYPE_STRING, "") - __add_project_setting("bugbot/reporting/jira/optional_fields/platform_field", TYPE_STRING, "") - __add_project_setting("bugbot/reporting/jira/optional_fields/version_field", TYPE_STRING, "") + __add_project_setting("bugbot/reporting/jira/server", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_SERVER) + __add_project_setting("bugbot/reporting/jira/REST_URI", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_REST_URI) + __add_project_setting("bugbot/reporting/jira/project_name", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_PROJECT_NAME) + __add_project_setting("bugbot/reporting/jira/email", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_EMAIL) + __add_project_setting("bugbot/reporting/jira/API_key", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_API_KEY) + __add_project_setting("bugbot/reporting/jira/bug_issue_type", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_BUG_ISSUE_TYPE) + __add_project_setting("bugbot/reporting/jira/map_name_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_MAP_NAME_FIELD) + __add_project_setting("bugbot/reporting/jira/marker_location_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_MARKER_LOCATION_FIELD) + __add_project_setting("bugbot/reporting/jira/optional_fields/department_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_DEPARTMENT_FIELD) + __add_project_setting("bugbot/reporting/jira/optional_fields/severity_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_SEVERITY_FIELD) + __add_project_setting("bugbot/reporting/jira/optional_fields/platform_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_PLATFORM_FIELD) + __add_project_setting("bugbot/reporting/jira/optional_fields/version_field", TYPE_STRING, BugbotServerJiraAPI.DEFAULT_VERSION_FIELD) #endregion #endregion