Skip to content

Commit 425a2b5

Browse files
authored
Merge pull request #75 from Maaack/updates-from-game-template
Updates from game template
2 parents 2164d61 + 78dc1d6 commit 425a2b5

File tree

79 files changed

+1370
-745
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1370
-745
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ These instructions assume starting with just the contents of `addons/`. This wil
142142

143143
## Featured Games
144144

145-
| Spud Customs | Rent Seek Kill | A Darkness Like Gravity |
145+
| Baking Godium | Spud Customs | Rent Seek Kill |
146146
| :-------:| :-------: | :-------: |
147-
![Spud Customs](/addons/maaacks_menus_template/media/thumbnail-game-spud-customs.png) | ![Rent-Seek-Kill](/addons/maaacks_menus_template/media/thumbnail-game-rent-seek-kill.png) | ![A Darkness Like Gravity](/addons/maaacks_menus_template/media/thumbnail-game-a-darkness-like-gravity.png) |
148-
[Find on Steam](https://store.steampowered.com/app/3291880/Spud_Customs/) | [Play on itch.io](https://xandruher.itch.io/rent-seek-kill) | [Play on itch.io](https://maaack.itch.io/a-darkness-like-gravity) |
147+
| ![Baking Godium](/addons/maaacks_menus_template/media/thumbnail-game-baking-godium.png) | ![Spud Customs](/addons/maaacks_menus_template/media/thumbnail-game-spud-customs.png) | ![Rent-Seek-Kill](/addons/maaacks_menus_template/media/thumbnail-game-rent-seek-kill.png) |
148+
| [Play on itch.io](https://maaack.itch.io/baking-godium) | [Find on Steam](https://store.steampowered.com/app/3291880/Spud_Customs/) | [Play on itch.io](https://xandruher.itch.io/rent-seek-kill) |
149149

150150

151151
[All Shared Games](/addons/maaacks_menus_template/docs/GamesMade.md)

addons/maaacks_menus_template/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ These instructions assume starting with just the contents of `addons/`. This wil
142142

143143
## Featured Games
144144

145-
| Spud Customs | Rent Seek Kill | A Darkness Like Gravity |
145+
| Baking Godium | Spud Customs | Rent Seek Kill |
146146
| :-------:| :-------: | :-------: |
147-
![Spud Customs](/addons/maaacks_menus_template/media/thumbnail-game-spud-customs.png) | ![Rent-Seek-Kill](/addons/maaacks_menus_template/media/thumbnail-game-rent-seek-kill.png) | ![A Darkness Like Gravity](/addons/maaacks_menus_template/media/thumbnail-game-a-darkness-like-gravity.png) |
148-
[Find on Steam](https://store.steampowered.com/app/3291880/Spud_Customs/) | [Play on itch.io](https://xandruher.itch.io/rent-seek-kill) | [Play on itch.io](https://maaack.itch.io/a-darkness-like-gravity) |
147+
| ![Baking Godium](/addons/maaacks_menus_template/media/thumbnail-game-baking-godium.png) | ![Spud Customs](/addons/maaacks_menus_template/media/thumbnail-game-spud-customs.png) | ![Rent-Seek-Kill](/addons/maaacks_menus_template/media/thumbnail-game-rent-seek-kill.png) |
148+
| [Play on itch.io](https://maaack.itch.io/baking-godium) | [Find on Steam](https://store.steampowered.com/app/3291880/Spud_Customs/) | [Play on itch.io](https://xandruher.itch.io/rent-seek-kill) |
149149

150150

151151
[All Shared Games](/addons/maaacks_menus_template/docs/GamesMade.md)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@tool
2+
extends Label
3+
## Displays the value of `version` from the config file of the specified plugin.
4+
5+
const NO_VERSION_STRING : String = "0.0.0"
6+
7+
@export var plugin_directory : String
8+
@export var version_prefix : String = "v"
9+
10+
func _get_plugin_version() -> String:
11+
if not plugin_directory.is_empty():
12+
for enabled_plugin in ProjectSettings.get_setting("editor_plugins/enabled"):
13+
if enabled_plugin.contains(plugin_directory):
14+
var config := ConfigFile.new()
15+
var error = config.load(enabled_plugin)
16+
if error != OK:
17+
break
18+
return config.get_value("plugin", "version", NO_VERSION_STRING)
19+
return ""
20+
21+
func update_version_label() -> void:
22+
var plugin_version = _get_plugin_version()
23+
if plugin_version.is_empty():
24+
plugin_version = NO_VERSION_STRING
25+
text = version_prefix + plugin_version
26+
27+
func _ready() -> void:
28+
update_version_label()
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
uid://ctwrcfydwaq34

addons/maaacks_menus_template/base/nodes/menus/options_menu/input/input_actions_list.gd

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ func _replace_action(action_name : String, readable_input_name : String = "") ->
9393
func _on_button_pressed(action_name : String, action_group : int) -> void:
9494
editing_action_name = action_name
9595
editing_action_group = action_group
96-
_replace_action(action_name)
96+
var button = _get_button_by_action(action_name, action_group)
97+
var readable_input_name : String
98+
if button and button in button_readable_input_map:
99+
readable_input_name = button_readable_input_map[button]
100+
_replace_action(action_name, readable_input_name)
97101

98102
func _new_action_box() -> Node:
99103
var new_action_box : Node = %ActionBoxContainer.duplicate()

addons/maaacks_menus_template/base/nodes/menus/options_menu/input/input_options_menu.gd

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,16 @@ const KEY_DELETION_TEXT : String = "Are you sure you want to remove {key} from {
1717
%InputActionsList.hide()
1818
%InputActionsTree.show()
1919

20-
@onready var assignment_placeholder_text = $KeyAssignmentDialog.dialog_text
20+
@onready var assignment_placeholder_text = $KeyAssignmentWindow.text
2121

2222
var last_input_readable_name
2323

24-
func _horizontally_align_popup_labels() -> void:
25-
$KeyAssignmentDialog.get_label().horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
26-
$KeyDeletionDialog.get_label().horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
27-
$OneInputMinimumDialog.get_label().horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
28-
$AlreadyAssignedDialog.get_label().horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
29-
$ResetConfirmationDialog.get_label().horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
30-
3124
func _ready() -> void:
3225
remapping_mode = remapping_mode
33-
if Engine.is_editor_hint(): return
34-
_horizontally_align_popup_labels()
3526

3627
func _add_action_event() -> void:
37-
var last_input_event = $KeyAssignmentDialog.last_input_event
38-
last_input_readable_name = $KeyAssignmentDialog.last_input_text
28+
var last_input_event = $KeyAssignmentWindow.last_input_event
29+
last_input_readable_name = $KeyAssignmentWindow.last_input_text
3930
match(remapping_mode):
4031
0:
4132
%InputActionsList.add_action_event(last_input_readable_name, last_input_event)
@@ -46,54 +37,54 @@ func _remove_action_event(item : TreeItem) -> void:
4637
%InputActionsTree.remove_action_event(item)
4738

4839
func _on_reset_button_pressed() -> void:
49-
$ResetConfirmationDialog.popup_centered()
40+
$ResetConfirmation.show()
5041

51-
func _on_key_deletion_dialog_confirmed() -> void:
42+
func _on_key_deletion_confirmation_confirmed() -> void:
5243
var editing_item = %InputActionsTree.editing_item
5344
if is_instance_valid(editing_item):
5445
_remove_action_event(editing_item)
5546

56-
func _on_key_assignment_dialog_confirmed() -> void:
47+
func _on_key_assignment_window_confirmed() -> void:
5748
_add_action_event()
5849

59-
func _open_key_assignment_dialog(action_name : String, readable_input_name : String = assignment_placeholder_text) -> void:
60-
$KeyAssignmentDialog.title = tr("Assign Key for {action}").format({action = action_name})
61-
$KeyAssignmentDialog.dialog_text = readable_input_name
62-
$KeyAssignmentDialog.get_ok_button().disabled = true
63-
$KeyAssignmentDialog.popup_centered()
50+
func _open_key_assignment_window(action_name : String, readable_input_name : String = assignment_placeholder_text) -> void:
51+
$KeyAssignmentWindow.title = tr("Assign Key for {action}").format({action = action_name})
52+
$KeyAssignmentWindow.text = readable_input_name
53+
$KeyAssignmentWindow.confirm_button.disabled = true
54+
$KeyAssignmentWindow.show()
6455

6556
func _on_input_actions_tree_add_button_clicked(action_name) -> void:
66-
_open_key_assignment_dialog(action_name)
57+
_open_key_assignment_window(action_name)
6758

6859
func _on_input_actions_tree_remove_button_clicked(action_name, input_name) -> void:
69-
$KeyDeletionDialog.title = tr("Remove Key for {action}").format({action = action_name})
70-
$KeyDeletionDialog.dialog_text = tr(KEY_DELETION_TEXT).format({key = input_name, action = action_name})
71-
$KeyDeletionDialog.popup_centered()
60+
$KeyDeletionConfirmation.title = tr("Remove Key for {action}").format({action = action_name})
61+
$KeyDeletionConfirmation.text = tr(KEY_DELETION_TEXT).format({key = input_name, action = action_name})
62+
$KeyDeletionConfirmation.show()
7263

7364
func _popup_already_assigned(action_name, input_name) -> void:
74-
$AlreadyAssignedDialog.dialog_text = tr(ALREADY_ASSIGNED_TEXT).format({key = input_name, action = action_name})
75-
$AlreadyAssignedDialog.popup_centered.call_deferred()
65+
$AlreadyAssignedMessage.text = tr(ALREADY_ASSIGNED_TEXT).format({key = input_name, action = action_name})
66+
$AlreadyAssignedMessage.show()
7667

7768
func _popup_minimum_reached(action_name : String) -> void:
78-
$OneInputMinimumDialog.dialog_text = ONE_INPUT_MINIMUM_TEXT % action_name
79-
$OneInputMinimumDialog.popup_centered.call_deferred()
69+
$OneInputMinimumMessage.text = ONE_INPUT_MINIMUM_TEXT % action_name
70+
$OneInputMinimumMessage.show()
8071

8172
func _on_input_actions_tree_already_assigned(action_name, input_name) -> void:
82-
_popup_already_assigned(action_name, input_name)
73+
_popup_already_assigned.call_deferred(action_name, input_name)
8374

8475
func _on_input_actions_tree_minimum_reached(action_name) -> void:
85-
_popup_minimum_reached(action_name)
76+
_popup_minimum_reached.call_deferred(action_name)
8677

8778
func _on_input_actions_list_already_assigned(action_name, input_name) -> void:
88-
_popup_already_assigned(action_name, input_name)
79+
_popup_already_assigned.call_deferred(action_name, input_name)
8980

9081
func _on_input_actions_list_minimum_reached(action_name) -> void:
91-
_popup_minimum_reached(action_name)
82+
_popup_minimum_reached.call_deferred(action_name)
9283

9384
func _on_input_actions_list_button_clicked(action_name, readable_input_name) -> void:
94-
_open_key_assignment_dialog(action_name, readable_input_name)
85+
_open_key_assignment_window(action_name, readable_input_name)
9586

96-
func _on_reset_confirmation_dialog_confirmed() -> void:
87+
func _on_reset_confirmation_confirmed() -> void:
9788
match(remapping_mode):
9889
0:
9990
%InputActionsList.reset()
Lines changed: 69 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
[gd_scene load_steps=6 format=3 uid="uid://dp3rgqaehb3xu"]
1+
[gd_scene load_steps=8 format=3 uid="uid://dp3rgqaehb3xu"]
22

33
[ext_resource type="Script" uid="uid://eborw7q4b07h" path="res://addons/maaacks_menus_template/base/nodes/menus/options_menu/input/input_options_menu.gd" id="1"]
44
[ext_resource type="Script" uid="uid://1nf36h0gms3q" path="res://addons/maaacks_menus_template/base/nodes/utilities/capture_focus.gd" id="2_wft4x"]
5-
[ext_resource type="Script" uid="uid://custha7r0uoic" path="res://addons/maaacks_menus_template/base/nodes/menus/options_menu/input/key_assignment_dialog.gd" id="3_wsh2h"]
65
[ext_resource type="PackedScene" uid="uid://bxp45814v6ydv" path="res://addons/maaacks_menus_template/base/nodes/menus/options_menu/input/input_actions_list.tscn" id="4_lf2nw"]
76
[ext_resource type="PackedScene" uid="uid://ci6wgl2ngd35n" path="res://addons/maaacks_menus_template/base/nodes/menus/options_menu/input/input_actions_tree.tscn" id="5_b2whh"]
7+
[ext_resource type="PackedScene" uid="uid://cwt4p3bufkke5" path="res://addons/maaacks_menus_template/base/nodes/windows/confirmation_overlaid_window.tscn" id="7_5j1ya"]
8+
[ext_resource type="PackedScene" uid="uid://6gdbfi0172ji" path="res://addons/maaacks_menus_template/base/nodes/windows/overlaid_window.tscn" id="8_jtpjy"]
9+
[ext_resource type="Script" uid="uid://custha7r0uoic" path="res://addons/maaacks_menus_template/base/nodes/menus/options_menu/input/key_assignment_window.gd" id="9_pdk84"]
810

911
[node name="Controls" type="MarginContainer"]
1012
anchors_preset = 15
@@ -39,13 +41,13 @@ horizontal_alignment = 1
3941

4042
[node name="InputActionsList" parent="VBoxContainer/InputMappingContainer" instance=ExtResource("4_lf2nw")]
4143
unique_name_in_owner = true
42-
custom_minimum_size = Vector2(560, 480)
44+
custom_minimum_size = Vector2(560, 440)
4345
layout_mode = 2
4446

4547
[node name="InputActionsTree" parent="VBoxContainer/InputMappingContainer" instance=ExtResource("5_b2whh")]
4648
unique_name_in_owner = true
4749
visible = false
48-
custom_minimum_size = Vector2(400, 480)
50+
custom_minimum_size = Vector2(400, 440)
4951
layout_mode = 2
5052

5153
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/InputMappingContainer"]
@@ -56,33 +58,58 @@ alignment = 1
5658
layout_mode = 2
5759
text = "Reset"
5860

59-
[node name="KeyAssignmentDialog" type="ConfirmationDialog" parent="."]
60-
title = "Assign Key"
61-
size = Vector2i(400, 158)
62-
dialog_text = "
61+
[node name="KeyDeletionConfirmation" parent="." instance=ExtResource("7_5j1ya")]
62+
visible = false
63+
custom_minimum_size = Vector2(420, 200)
64+
layout_mode = 2
65+
update_content = true
66+
text = "Are you sure you want to remove KEY from ACTION?"
67+
title = "Remove Key"
6368

69+
[node name="ResetConfirmation" parent="." instance=ExtResource("7_5j1ya")]
70+
visible = false
71+
custom_minimum_size = Vector2(420, 200)
72+
layout_mode = 2
73+
update_content = true
74+
text = "Are you sure you want to reset controls back to the defaults?"
75+
title = "Reset to Default"
6476

65-
"
66-
script = ExtResource("3_wsh2h")
77+
[node name="OneInputMinimumMessage" parent="." instance=ExtResource("8_jtpjy")]
78+
visible = false
79+
custom_minimum_size = Vector2(420, 200)
80+
layout_mode = 2
81+
update_content = true
82+
title = "One Input Minimum"
6783

68-
[node name="VBoxContainer" type="VBoxContainer" parent="KeyAssignmentDialog"]
69-
anchors_preset = 15
70-
anchor_right = 1.0
71-
anchor_bottom = 1.0
72-
offset_left = 8.0
73-
offset_top = 8.0
74-
offset_right = -8.0
75-
offset_bottom = -49.0
76-
grow_horizontal = 2
77-
grow_vertical = 2
84+
[node name="AlreadyAssignedMessage" parent="." instance=ExtResource("8_jtpjy")]
85+
visible = false
86+
custom_minimum_size = Vector2(420, 200)
87+
layout_mode = 2
88+
update_content = true
89+
title = "Already Assigned"
90+
91+
[node name="KeyAssignmentWindow" parent="." instance=ExtResource("7_5j1ya")]
92+
visible = false
93+
custom_minimum_size = Vector2(420, 200)
94+
layout_mode = 2
95+
script = ExtResource("9_pdk84")
96+
input_confirmation = 0
97+
update_content = true
98+
99+
[node name="DescriptionLabel" parent="KeyAssignmentWindow/ContentContainer/BoxContainer/BodyMargin" index="0"]
100+
visible = false
78101

79-
[node name="InputLabel" type="Label" parent="KeyAssignmentDialog/VBoxContainer"]
102+
[node name="VBoxContainer" type="VBoxContainer" parent="KeyAssignmentWindow/ContentContainer/BoxContainer/BodyMargin" index="1"]
103+
layout_mode = 2
104+
size_flags_vertical = 3
105+
106+
[node name="InputLabel" type="Label" parent="KeyAssignmentWindow/ContentContainer/BoxContainer/BodyMargin/VBoxContainer"]
80107
unique_name_in_owner = true
81108
layout_mode = 2
82109
text = "None"
83110
horizontal_alignment = 1
84111

85-
[node name="InputTextEdit" type="TextEdit" parent="KeyAssignmentDialog/VBoxContainer"]
112+
[node name="InputTextEdit" type="TextEdit" parent="KeyAssignmentWindow/ContentContainer/BoxContainer/BodyMargin/VBoxContainer"]
86113
unique_name_in_owner = true
87114
layout_mode = 2
88115
size_flags_vertical = 3
@@ -95,27 +122,21 @@ drag_and_drop_selection_enabled = false
95122
middle_mouse_paste_enabled = false
96123
caret_move_on_right_click = false
97124

98-
[node name="DelayTimer" type="Timer" parent="KeyAssignmentDialog"]
99-
unique_name_in_owner = true
100-
wait_time = 0.1
101-
one_shot = true
102-
103-
[node name="KeyDeletionDialog" type="ConfirmationDialog" parent="."]
104-
title = "Remove Key"
105-
size = Vector2i(419, 100)
106-
dialog_text = "Are you sure you want to remove KEY from ACTION?"
125+
[node name="MenuButtons" parent="KeyAssignmentWindow/ContentContainer/BoxContainer/MenuButtonsMargin" index="0"]
126+
null_focus_enabled = false
127+
joypad_enabled = false
128+
mouse_hidden_enabled = false
107129

108-
[node name="OneInputMinimumDialog" type="AcceptDialog" parent="."]
109-
title = "Cannot Remove"
110-
size = Vector2i(398, 100)
130+
[node name="CloseButton" parent="KeyAssignmentWindow/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="0"]
131+
focus_neighbor_top = NodePath("../../../BodyMargin/VBoxContainer/InputTextEdit")
111132

112-
[node name="AlreadyAssignedDialog" type="AcceptDialog" parent="."]
113-
title = "Already Assigned"
114-
size = Vector2i(398, 100)
133+
[node name="ConfirmButton" parent="KeyAssignmentWindow/ContentContainer/BoxContainer/MenuButtonsMargin/MenuButtons" index="1"]
134+
focus_neighbor_top = NodePath("../../../BodyMargin/VBoxContainer/InputTextEdit")
115135

116-
[node name="ResetConfirmationDialog" type="ConfirmationDialog" parent="."]
117-
size = Vector2i(486, 100)
118-
dialog_text = "Are you sure you want to reset controls back to the defaults?"
136+
[node name="DelayTimer" type="Timer" parent="KeyAssignmentWindow"]
137+
unique_name_in_owner = true
138+
wait_time = 0.1
139+
one_shot = true
119140

120141
[connection signal="already_assigned" from="VBoxContainer/InputMappingContainer/InputActionsList" to="." method="_on_input_actions_list_already_assigned"]
121142
[connection signal="button_clicked" from="VBoxContainer/InputMappingContainer/InputActionsList" to="." method="_on_input_actions_list_button_clicked"]
@@ -125,10 +146,11 @@ dialog_text = "Are you sure you want to reset controls back to the defaults?"
125146
[connection signal="minimum_reached" from="VBoxContainer/InputMappingContainer/InputActionsTree" to="." method="_on_input_actions_tree_minimum_reached"]
126147
[connection signal="remove_button_clicked" from="VBoxContainer/InputMappingContainer/InputActionsTree" to="." method="_on_input_actions_tree_remove_button_clicked"]
127148
[connection signal="pressed" from="VBoxContainer/InputMappingContainer/HBoxContainer/ResetButton" to="." method="_on_reset_button_pressed"]
128-
[connection signal="confirmed" from="KeyAssignmentDialog" to="." method="_on_key_assignment_dialog_confirmed"]
129-
[connection signal="visibility_changed" from="KeyAssignmentDialog" to="KeyAssignmentDialog" method="_on_visibility_changed"]
130-
[connection signal="focus_entered" from="KeyAssignmentDialog/VBoxContainer/InputTextEdit" to="KeyAssignmentDialog" method="_on_text_edit_focus_entered"]
131-
[connection signal="focus_exited" from="KeyAssignmentDialog/VBoxContainer/InputTextEdit" to="KeyAssignmentDialog" method="_on_input_text_edit_focus_exited"]
132-
[connection signal="gui_input" from="KeyAssignmentDialog/VBoxContainer/InputTextEdit" to="KeyAssignmentDialog" method="_on_input_text_edit_gui_input"]
133-
[connection signal="confirmed" from="KeyDeletionDialog" to="." method="_on_key_deletion_dialog_confirmed"]
134-
[connection signal="confirmed" from="ResetConfirmationDialog" to="." method="_on_reset_confirmation_dialog_confirmed"]
149+
[connection signal="confirmed" from="KeyDeletionConfirmation" to="." method="_on_key_deletion_confirmation_confirmed"]
150+
[connection signal="confirmed" from="ResetConfirmation" to="." method="_on_reset_confirmation_confirmed"]
151+
[connection signal="confirmed" from="KeyAssignmentWindow" to="." method="_on_key_assignment_window_confirmed"]
152+
[connection signal="focus_entered" from="KeyAssignmentWindow/ContentContainer/BoxContainer/BodyMargin/VBoxContainer/InputTextEdit" to="KeyAssignmentWindow" method="_on_input_text_edit_focus_entered"]
153+
[connection signal="focus_exited" from="KeyAssignmentWindow/ContentContainer/BoxContainer/BodyMargin/VBoxContainer/InputTextEdit" to="KeyAssignmentWindow" method="_on_input_text_edit_focus_exited"]
154+
[connection signal="gui_input" from="KeyAssignmentWindow/ContentContainer/BoxContainer/BodyMargin/VBoxContainer/InputTextEdit" to="KeyAssignmentWindow" method="_on_input_text_edit_gui_input"]
155+
156+
[editable path="KeyAssignmentWindow"]

0 commit comments

Comments
 (0)