From 11f4a3e6aa737eca028f0846b25aed7161acdc9d Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 25 Mar 2026 10:00:02 +0000 Subject: [PATCH 1/2] =?UTF-8?q?Add=20=E2=80=9CReport=20a=20Problem?= =?UTF-8?q?=E2=80=9D=20button=20to=20pause=20screen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This opens your browser at a bug report form, with the game version and current scene pre-filled into the appropriate fields. This does mean you need a GitHub account to report a problem. In future you could imagine directing users somewhere else, but this is an simple start based on infrastructure that already exists. To do this, refactor the code that determines the version from `git describe` so that it can also be used when running the game from the editor. For good measure, put the version number on the pause screen too. Resolves https://github.com/endlessm/threadbare/issues/2080 --- addons/threadbare_git_describe/export.gd | 10 ++---- addons/threadbare_git_describe/version.gd | 35 +++++++++++++++++++ addons/threadbare_git_describe/version.gd.uid | 1 + .../threadbare_git_describe/version_label.gd | 11 ++++++ .../version_label.gd.uid | 0 scenes/globals/pause/pause_overlay.tscn | 26 ++++++++++++++ scenes/globals/pause/report_bug_button.gd | 25 +++++++++++++ scenes/globals/pause/report_bug_button.gd.uid | 1 + scenes/menus/title/components/main_menu.tscn | 4 +-- .../menus/title/components/version_label.gd | 7 ---- 10 files changed, 104 insertions(+), 16 deletions(-) create mode 100644 addons/threadbare_git_describe/version.gd create mode 100644 addons/threadbare_git_describe/version.gd.uid create mode 100644 addons/threadbare_git_describe/version_label.gd rename {scenes/menus/title/components => addons/threadbare_git_describe}/version_label.gd.uid (100%) create mode 100644 scenes/globals/pause/report_bug_button.gd create mode 100644 scenes/globals/pause/report_bug_button.gd.uid delete mode 100644 scenes/menus/title/components/version_label.gd diff --git a/addons/threadbare_git_describe/export.gd b/addons/threadbare_git_describe/export.gd index 78194b19ab..581735a53a 100644 --- a/addons/threadbare_git_describe/export.gd +++ b/addons/threadbare_git_describe/export.gd @@ -2,6 +2,8 @@ # SPDX-License-Identifier: MPL-2.0 extends EditorExportPlugin +const Version = preload("./version.gd") + func _get_name() -> String: return "threadbare_git_describe_exporter" @@ -17,13 +19,7 @@ func set_version(version: Variant) -> void: func _export_begin( _features: PackedStringArray, _is_debug: bool, _path: String, _flags: int ) -> void: - var output: Array[String] = [] - var ret := OS.execute("git", ["describe", "--tags"], output) - if ret != 0: - printerr("git describe --tags failed: %d" % ret) - else: - var version := output[0].strip_edges() - set_version(version) + set_version(Version.git_describe(true)) func _export_end() -> void: diff --git a/addons/threadbare_git_describe/version.gd b/addons/threadbare_git_describe/version.gd new file mode 100644 index 0000000000..30f631f071 --- /dev/null +++ b/addons/threadbare_git_describe/version.gd @@ -0,0 +1,35 @@ +# SPDX-FileCopyrightText: The Threadbare Authors +# SPDX-License-Identifier: MPL-2.0 +extends Object +## Functions to determine the game version + +static var _initialized := false +static var _version: String + + +## Gets the project version based on [code]git describe[/code], +## or [code]""[/code] if this fails. +static func git_describe(warn_on_error: bool) -> String: + var output: Array[String] = [] + var ret := OS.execute("git", ["describe", "--tags"], output) + if ret != 0: + if warn_on_error: + printerr("git describe --tags failed: %d" % ret) + return "" + + var version := output[0].strip_edges() + return version + + +## Gets the game version from the project configuration, falling back to +## calling [member git_describe]. +static func get_version() -> String: + if not _initialized: + _version = ProjectSettings.get(&"application/config/version") + + if not _version: + _version = git_describe(false) + + _initialized = true + + return _version diff --git a/addons/threadbare_git_describe/version.gd.uid b/addons/threadbare_git_describe/version.gd.uid new file mode 100644 index 0000000000..443ba37785 --- /dev/null +++ b/addons/threadbare_git_describe/version.gd.uid @@ -0,0 +1 @@ +uid://c76eh40rjua1l diff --git a/addons/threadbare_git_describe/version_label.gd b/addons/threadbare_git_describe/version_label.gd new file mode 100644 index 0000000000..69203d2fdf --- /dev/null +++ b/addons/threadbare_git_describe/version_label.gd @@ -0,0 +1,11 @@ +# SPDX-FileCopyrightText: The Threadbare Authors +# SPDX-License-Identifier: MPL-2.0 +extends Label +## A label which shows the project version +## +## The version is determined from the project configuration, falling back to +## [code]git describe[/code] if necessary. + + +func _ready() -> void: + text = preload("./version.gd").get_version() diff --git a/scenes/menus/title/components/version_label.gd.uid b/addons/threadbare_git_describe/version_label.gd.uid similarity index 100% rename from scenes/menus/title/components/version_label.gd.uid rename to addons/threadbare_git_describe/version_label.gd.uid diff --git a/scenes/globals/pause/pause_overlay.tscn b/scenes/globals/pause/pause_overlay.tscn index 0d14e8c211..e493043b6a 100644 --- a/scenes/globals/pause/pause_overlay.tscn +++ b/scenes/globals/pause/pause_overlay.tscn @@ -3,7 +3,9 @@ [ext_resource type="Script" uid="uid://y88qplkioj1q" path="res://scenes/globals/pause/pause_overlay.gd" id="1_lf64b"] [ext_resource type="Texture2D" uid="uid://lg5dl13njsg3" path="res://assets/first_party/tiles/Grass_And_Sand_Tiles.png" id="2_1tcw0"] [ext_resource type="Theme" uid="uid://cvitou84ni7qe" path="res://scenes/ui_elements/components/theme.tres" id="2_sd5t1"] +[ext_resource type="Script" uid="uid://i4urwefxrrdt" path="res://addons/threadbare_git_describe/version_label.gd" id="3_m62bn"] [ext_resource type="PackedScene" uid="uid://dkeb0yjgcfi86" path="res://scenes/menus/options/options.tscn" id="3_sd5t1"] +[ext_resource type="Script" uid="uid://gntvq01vvati" path="res://scenes/globals/pause/report_bug_button.gd" id="4_mjd51"] [ext_resource type="PackedScene" uid="uid://56ja3m4283wa" path="res://scenes/menus/debug/debug_settings.tscn" id="5_ai8ue"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_1tcw0"] @@ -27,6 +29,22 @@ region_rect = Rect2(384, 64, 64, 64) axis_stretch_horizontal = 1 axis_stretch_vertical = 1 +[node name="MarginContainer" type="MarginContainer" parent="." unique_id=1289064546] +anchors_preset = 3 +anchor_left = 1.0 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -33.0 +offset_top = -68.0 +grow_horizontal = 0 +grow_vertical = 0 +theme = ExtResource("2_sd5t1") + +[node name="VersionLabel" type="Label" parent="MarginContainer" unique_id=494777321] +layout_mode = 2 +script = ExtResource("3_m62bn") + [node name="TabContainer" type="TabContainer" parent="." unique_id=877845808] anchors_preset = 8 anchor_left = 0.5 @@ -89,6 +107,14 @@ size_flags_horizontal = 4 theme_type_variation = &"FlatButton" text = "Debug Settings" +[node name="ReportBugButton" type="Button" parent="TabContainer/PauseMenu/VBoxContainer" unique_id=1750937607] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 4 +theme_type_variation = &"FlatButton" +text = "Report a Problem" +script = ExtResource("4_mjd51") + [node name="TitleScreenButton" type="Button" parent="TabContainer/PauseMenu/VBoxContainer" unique_id=830702640] unique_name_in_owner = true layout_mode = 2 diff --git a/scenes/globals/pause/report_bug_button.gd b/scenes/globals/pause/report_bug_button.gd new file mode 100644 index 0000000000..2ab2d94239 --- /dev/null +++ b/scenes/globals/pause/report_bug_button.gd @@ -0,0 +1,25 @@ +# SPDX-FileCopyrightText: The Threadbare Authors +# SPDX-License-Identifier: MPL-2.0 +extends Button +## Opens a bug report form in the web browser when clicked. + +const Version := preload("res://addons/threadbare_git_describe/version.gd") +const URL_BASE := "https://github.com/endlessm/threadbare/issues/new?template=bug.yml" + + +func _ready() -> void: + pressed.connect(_on_pressed) + + +func _on_pressed() -> void: + var url := URL_BASE + + var version := Version.get_version() + if version: + url += "&version=" + version.uri_encode() + + var current_scene := get_tree().current_scene + if current_scene: + url += "&scene=" + current_scene.scene_file_path.uri_encode() + + OS.shell_open(url) diff --git a/scenes/globals/pause/report_bug_button.gd.uid b/scenes/globals/pause/report_bug_button.gd.uid new file mode 100644 index 0000000000..8bd741dc25 --- /dev/null +++ b/scenes/globals/pause/report_bug_button.gd.uid @@ -0,0 +1 @@ +uid://gntvq01vvati diff --git a/scenes/menus/title/components/main_menu.tscn b/scenes/menus/title/components/main_menu.tscn index 3393e199a7..378d0f2259 100644 --- a/scenes/menus/title/components/main_menu.tscn +++ b/scenes/menus/title/components/main_menu.tscn @@ -3,8 +3,8 @@ [ext_resource type="Theme" uid="uid://cvitou84ni7qe" path="res://scenes/ui_elements/components/theme.tres" id="1_vmxej"] [ext_resource type="Script" uid="uid://bkl8j1as8ylag" path="res://scenes/menus/title/components/main_menu.gd" id="1_xuf5f"] [ext_resource type="Script" uid="uid://dfx8s2ybd11mt" path="res://scenes/menus/storybook/components/animated_texture_rect.gd" id="4_rpgwp"] -[ext_resource type="Script" uid="uid://i4urwefxrrdt" path="res://scenes/menus/title/components/version_label.gd" id="4_snvmp"] -[ext_resource type="SpriteFrames" uid="uid://bg538lufloka6" path="res://scenes/menus/title/components/threadbare_logo_animation.tres" id="5_rpgwp"] +[ext_resource type="Script" uid="uid://i4urwefxrrdt" path="res://addons/threadbare_git_describe/version_label.gd" id="4_snvmp"] +[ext_resource type="SpriteFrames" uid="uid://bg538lufloka6" path="res://scenes/menus/title/components/logos/threadbare_logo_animation.tres" id="5_rpgwp"] [node name="MainMenu" type="Control" unique_id=1449128276] layout_mode = 3 diff --git a/scenes/menus/title/components/version_label.gd b/scenes/menus/title/components/version_label.gd deleted file mode 100644 index dd36d4fa27..0000000000 --- a/scenes/menus/title/components/version_label.gd +++ /dev/null @@ -1,7 +0,0 @@ -# SPDX-FileCopyrightText: The Threadbare Authors -# SPDX-License-Identifier: MPL-2.0 -extends Label - - -func _ready() -> void: - text = ProjectSettings.get(&"application/config/version") From b0cfe934c633921964a1d22fa19dcd2aa4d6e971 Mon Sep 17 00:00:00 2001 From: Will Thompson Date: Wed, 25 Mar 2026 14:26:26 +0000 Subject: [PATCH 2/2] Bug report form: clarify that you can change the prefilled scene if desired --- .github/ISSUE_TEMPLATE/bug.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml index 496388210e..88ca056a93 100644 --- a/.github/ISSUE_TEMPLATE/bug.yml +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -26,9 +26,12 @@ body: label: Affected scene placeholder: e.g. Fray's End, quests/lore_quests/quest_002/3_void_grappling/void_grappling_round_2.tscn description: > - In which scene in the game is the problem? If it affects multiple - scenes, give an example. If you're not sure, describe the scene - visually, or leave it blank. + Give an example of a scene in the game where you see this problem. If + you're not sure, describe the scene visually, or leave this blank. + + If you report a problem from within the game, this will have been filled + automatically with the current scene. You can change this if you are + reporting a problem you saw in a different scene. validations: required: false