-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #339 from Spartan322/fix/default-hotkey
Fix default hotkeys being erroneously set
- Loading branch information
Showing
5 changed files
with
42 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
extends "res://addons/keychain/ShortcutEdit.gd" | ||
|
||
func _ready() -> void: | ||
# Setup Keychain for Hotkeys | ||
for action : StringName in InputMap.get_actions(): | ||
if not Keychain.keep_binding_check.call(action): | ||
continue | ||
Keychain.actions[action] = Keychain.InputAction.new( | ||
action.erase(0, "button_".length()).left(-"_hotkey".length()).capitalize(), | ||
"Hotkeys") | ||
var display_name : String = Keychain.actions[action].display_name | ||
if display_name.begins_with("Mapmode"): | ||
var mapmode_index := display_name.replace("Mapmode", "").to_int() | ||
display_name = tr(GameSingleton.get_mapmode_localisation_key(mapmode_index)) | ||
if mapmode_index <= 10: | ||
display_name = display_name\ | ||
.replace(" Mapmode", "")\ | ||
.replace("Mode de carte ", "")\ | ||
.replace("-Kartenmodus", "")\ | ||
.replace("Modo de mapa de ", "")\ | ||
.replace("Modo mapa de ", "")\ | ||
.replace("Modo mapa ", "") | ||
display_name = tr("Mapmode %s") % display_name.capitalize() | ||
Keychain.actions[action].display_name = display_name | ||
Keychain.profiles[0].bindings[action] = InputMap.action_get_events(action) | ||
|
||
super._ready() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[gd_scene load_steps=3 format=3 uid="uid://cka0tjqrek13"] | ||
|
||
[ext_resource type="PackedScene" uid="uid://bq7ibhm0txl5p" path="res://addons/keychain/ShortcutEdit.tscn" id="1_47eix"] | ||
[ext_resource type="Script" path="res://src/Game/Menu/OptionMenu/KeychainShortcutEdit.gd" id="2_gr2m0"] | ||
|
||
[node name="ShortcutEdit" instance=ExtResource("1_47eix")] | ||
script = ExtResource("2_gr2m0") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters