Shortcut fix

This commit is contained in:
Rendo 2025-07-17 22:42:14 +05:00
commit fdff25d451
6 changed files with 224 additions and 39 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=32 format=3 uid="uid://cfnmspei3k4p7"]
[gd_scene load_steps=48 format=3 uid="uid://cfnmspei3k4p7"]
[ext_resource type="PackedScene" uid="uid://ky35veswaytr" path="res://scenes/gui/sun_counter.tscn" id="1_le3od"]
[ext_resource type="Theme" uid="uid://b8l285cjcgeyi" path="res://resources/themes/GameStyle.tres" id="1_xf6ra"]
@ -6,6 +6,7 @@
[ext_resource type="Texture2D" uid="uid://bbh0uwloi87tn" path="res://assets/sprites/gui/PlantPanel.png" id="2_eg3hk"]
[ext_resource type="PackedScene" uid="uid://t0vpmycj6c8j" path="res://scenes/gui/shovel_button.tscn" id="3_bheea"]
[ext_resource type="PackedScene" uid="uid://cgm7td1hgs0rr" path="res://scenes/gui/fast_forward_button.tscn" id="4_66uy4"]
[ext_resource type="Script" uid="uid://di45o67gxmiql" path="res://scripts/gui/seedpackets/HotbarShortcutSetter.cs" id="5_5kkbf"]
[ext_resource type="PackedScene" uid="uid://u5l3jd00s8vd" path="res://scenes/gui/pause_button.tscn" id="5_jyq78"]
[ext_resource type="PackedScene" uid="uid://b4lx8adw6rbqs" path="res://scenes/particles/dirt_explosion.tscn" id="6_5jtun"]
[ext_resource type="Script" uid="uid://c36bj8u7jghc7" path="res://scripts/audio/ChannelPlayer.cs" id="7_5kkbf"]
@ -19,72 +20,116 @@ texture_margin_right = 4.0
texture_margin_bottom = 4.0
axis_stretch_horizontal = 1
[sub_resource type="GDScript" id="GDScript_lxxir"]
resource_name = "shortcutter"
script/source = "extends Node
@export var keys : Array[InputEventKey]
@export var where_to_map : Node
func _ready() -> void:
while get_tree() != null and get_tree().paused:
await get_tree().process_frame
for i in range(where_to_map.get_child_count()):
var key = InputEventKey.new()
where_to_map.get_child(i).shortcut = Shortcut.new()
where_to_map.get_child(i).shortcut.events.append(keys[i])
"
[sub_resource type="InputEventKey" id="InputEventKey_lxxir"]
[sub_resource type="InputEventKey" id="InputEventKey_xq48m"]
device = -1
keycode = 49
unicode = 49
[sub_resource type="InputEventKey" id="InputEventKey_5kkbf"]
[sub_resource type="Shortcut" id="Shortcut_hmpwl"]
events = [SubResource("InputEventKey_xq48m")]
[sub_resource type="InputEventKey" id="InputEventKey_kqrbi"]
device = -1
keycode = 50
unicode = 50
[sub_resource type="InputEventKey" id="InputEventKey_xq48m"]
[sub_resource type="Shortcut" id="Shortcut_s6pj4"]
events = [SubResource("InputEventKey_kqrbi")]
[sub_resource type="InputEventKey" id="InputEventKey_ar74i"]
device = -1
keycode = 51
unicode = 51
[sub_resource type="InputEventKey" id="InputEventKey_cti1a"]
[sub_resource type="Shortcut" id="Shortcut_k8sc7"]
events = [SubResource("InputEventKey_ar74i")]
[sub_resource type="InputEventKey" id="InputEventKey_6klug"]
device = -1
keycode = 52
unicode = 52
[sub_resource type="InputEventKey" id="InputEventKey_s07y0"]
[sub_resource type="Shortcut" id="Shortcut_lxteg"]
events = [SubResource("InputEventKey_6klug")]
[sub_resource type="InputEventKey" id="InputEventKey_vbeir"]
device = -1
keycode = 53
unicode = 53
[sub_resource type="InputEventKey" id="InputEventKey_hmpwl"]
[sub_resource type="InputEventKey" id="InputEventKey_7hbdx"]
device = -1
keycode = 81
unicode = 1081
[sub_resource type="Shortcut" id="Shortcut_q5vyg"]
events = [SubResource("InputEventKey_vbeir"), SubResource("InputEventKey_7hbdx")]
[sub_resource type="InputEventKey" id="InputEventKey_6l5gn"]
device = -1
keycode = 54
unicode = 54
[sub_resource type="InputEventKey" id="InputEventKey_kqrbi"]
[sub_resource type="InputEventKey" id="InputEventKey_2abg0"]
device = -1
keycode = 87
unicode = 1094
[sub_resource type="Shortcut" id="Shortcut_6awm7"]
events = [SubResource("InputEventKey_6l5gn"), SubResource("InputEventKey_2abg0")]
[sub_resource type="InputEventKey" id="InputEventKey_mu0ut"]
device = -1
keycode = 55
unicode = 55
[sub_resource type="InputEventKey" id="InputEventKey_s6pj4"]
[sub_resource type="InputEventKey" id="InputEventKey_o6p06"]
device = -1
keycode = 69
unicode = 1091
[sub_resource type="Shortcut" id="Shortcut_dsi7v"]
events = [SubResource("InputEventKey_mu0ut"), SubResource("InputEventKey_o6p06")]
[sub_resource type="InputEventKey" id="InputEventKey_iruld"]
device = -1
keycode = 56
unicode = 56
[sub_resource type="InputEventKey" id="InputEventKey_ar74i"]
[sub_resource type="InputEventKey" id="InputEventKey_hr1by"]
device = -1
keycode = 82
unicode = 1082
[sub_resource type="Shortcut" id="Shortcut_d5mmq"]
events = [SubResource("InputEventKey_iruld"), SubResource("InputEventKey_hr1by")]
[sub_resource type="InputEventKey" id="InputEventKey_h2jfj"]
device = -1
keycode = 57
unicode = 57
[sub_resource type="InputEventKey" id="InputEventKey_k8sc7"]
[sub_resource type="InputEventKey" id="InputEventKey_xrhoa"]
device = -1
keycode = 84
unicode = 1077
[sub_resource type="Shortcut" id="Shortcut_yda1n"]
events = [SubResource("InputEventKey_h2jfj"), SubResource("InputEventKey_xrhoa")]
[sub_resource type="InputEventKey" id="InputEventKey_iupjv"]
device = -1
keycode = 48
unicode = 48
[sub_resource type="InputEventKey" id="InputEventKey_icels"]
device = -1
keycode = 89
unicode = 1085
[sub_resource type="Shortcut" id="Shortcut_lnrbg"]
events = [SubResource("InputEventKey_iupjv"), SubResource("InputEventKey_icels")]
[sub_resource type="InputEventAction" id="InputEventAction_xq48m"]
action = &"short_shovel"
pressed = true
@ -194,11 +239,11 @@ layout_mode = 2
mouse_filter = 2
theme_override_constants/separation = 0
[node name="ShortcutSetter" type="Node" parent="MarginContainer/Control/Hotbar/PanelContainer" node_paths=PackedStringArray("where_to_map")]
[node name="ShortcutSetter" type="Node" parent="MarginContainer/Control/Hotbar/PanelContainer" node_paths=PackedStringArray("hotbar")]
process_mode = 1
script = SubResource("GDScript_lxxir")
keys = Array[InputEventKey]([SubResource("InputEventKey_lxxir"), SubResource("InputEventKey_5kkbf"), SubResource("InputEventKey_xq48m"), SubResource("InputEventKey_cti1a"), SubResource("InputEventKey_s07y0"), SubResource("InputEventKey_hmpwl"), SubResource("InputEventKey_kqrbi"), SubResource("InputEventKey_s6pj4"), SubResource("InputEventKey_ar74i"), SubResource("InputEventKey_k8sc7")])
where_to_map = NodePath("../Seedpackets")
script = ExtResource("5_5kkbf")
shortcuts = Array[Shortcut]([SubResource("Shortcut_hmpwl"), SubResource("Shortcut_s6pj4"), SubResource("Shortcut_k8sc7"), SubResource("Shortcut_lxteg"), SubResource("Shortcut_q5vyg"), SubResource("Shortcut_6awm7"), SubResource("Shortcut_dsi7v"), SubResource("Shortcut_d5mmq"), SubResource("Shortcut_yda1n"), SubResource("Shortcut_lnrbg")])
hotbar = NodePath("../Seedpackets")
[node name="Space" type="Control" parent="MarginContainer/Control/Hotbar"]
layout_mode = 2