From 6dfc611e0d9d494078df0aa7f60437631999b7af Mon Sep 17 00:00:00 2001
From: Drathek <76988376+Drulikar@users.noreply.github.com>
Date: Thu, 27 Jun 2024 09:52:12 -0700
Subject: [PATCH 1/5] Fix hotkeys menu crash + New/Fixed keybind support
(#6565)
# About the pull request
This PR fixes a crash when using the search by key feature in the
Keybinds window when the panel is filtered, and maps a bunch of keys to
byond bindings.
Of note, there are three locations remapping keys:
https://github.com/cmss13-devs/cmss13/blob/master/tgui/packages/tgui/interfaces/KeyBinds.jsx#L14-L26
https://github.com/cmss13-devs/cmss13/blob/master/tgui/packages/common/keys.ts#L20-L39
https://github.com/cmss13-devs/cmss13/blob/master/code/_globalvars/lists/client.dm#L7-L23
Since the first two are as they are on TG, I opted to update the third
one which seems to be unique to our codebase
# Explain why it's good for the game
Fixes various keybinds (namely keypad stuff), adds a bunch of new
keybinds (media keys), and fixes a tgui crash.
Fixes:
![image](https://github.com/cmss13-devs/cmss13/assets/76988376/8c4dd0ba-7185-4f45-a089-c8ee6edf06b7)
# Testing Photographs and Procedure
Screenshots & Videos
![hotkeys](https://github.com/cmss13-devs/cmss13/assets/76988376/404483f5-9ea3-43e3-8c35-26e6e73d99fc)
# Changelog
:cl: Drathek
fix: Fixed a crash in the Hotkey menu when searching by key when
filtered
fix: Fixed/Added support for various keys (e.g. keypad and media keys)
/:cl:
---------
Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
---
code/_globalvars/lists/client.dm | 26 ++++++++++++++++++++--
tgui/packages/tgui/interfaces/KeyBinds.jsx | 14 ++++++++----
2 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/code/_globalvars/lists/client.dm b/code/_globalvars/lists/client.dm
index 78f3a20da424..404e8a662e80 100644
--- a/code/_globalvars/lists/client.dm
+++ b/code/_globalvars/lists/client.dm
@@ -6,20 +6,42 @@ GLOBAL_LIST_EMPTY(keybindings_by_name)
// This is a mapping from JS keys to Byond - ref: https://keycode.info/
GLOBAL_LIST_INIT(_kbMap, list(
"UP" = "North",
+ "ARROWUP" = "North",
"RIGHT" = "East",
+ "ARROWRIGHT" = "East",
"DOWN" = "South",
+ "ARROWDOWN" = "South",
"LEFT" = "West",
+ "ARROWLEFT" = "West",
"INSERT" = "Insert",
"HOME" = "Northwest",
"PAGEUP" = "Northeast",
- "DEL" = "Delete",
+ "DEL" = "Delete", // Unlikely this is correct now
+ "DELETE" = "Delete",
"END" = "Southwest",
"PAGEDOWN" = "Southeast",
"SPACEBAR" = "Space",
"ENTER" = "Return",
"ALT" = "Alt",
"SHIFT" = "Shift",
- "CONTROL" = "Ctrl"
+ "CONTROL" = "Ctrl",
+ "MULTIPLY" = "Multiply",
+ "DIVIDE" = "Divide",
+ "SUBTRACT" = "Subtract",
+ "ADD" = "Add",
+ "DECIMAL" = "Decimal",
+ "CLEAR" = "Center",
+ "PAUSE" = "Pause",
+ "CONTEXTMENU" = "Apps",
+ "NUMLOCK" = "Numlock",
+ "SCROLLLOCK" = "Scroll",
+ "MEDIANEXTTRACK" = "MediaNext",
+ "MEDIAPLAYPAUSE" = "MediaPlayPause",
+ "MEDIASTOP" = "MediaStop",
+ "MEDIAPREVIOUSTRACK" = "MediaPrev",
+ "VOLUMEMUTE" = "VolumeMute",
+ "VOLUMEUP" = "VolumeUp",
+ "VOLUMEDOWN" = "VolumeDown",
))
///List of ckeys that have seen a blurb of a given key.
diff --git a/tgui/packages/tgui/interfaces/KeyBinds.jsx b/tgui/packages/tgui/interfaces/KeyBinds.jsx
index 3022d3077d3b..b09a36e67dae 100644
--- a/tgui/packages/tgui/interfaces/KeyBinds.jsx
+++ b/tgui/packages/tgui/interfaces/KeyBinds.jsx
@@ -92,10 +92,16 @@ export const KeyBinds = (props) => {
if (!targetEntry) {
return;
}
- // If a keybind was found, scroll to the first match.
- document
- .getElementById(targetEntry[0])
- .scrollIntoView();
+ // If a keybind was found, scroll to the first match currently rendered.
+ for (let i = 0; i < targetEntry.length; i++) {
+ const element = document.getElementById(
+ targetEntry[i],
+ );
+ if (element) {
+ element.scrollIntoView();
+ break;
+ }
+ }
}}
/>
From d303404af198c6e2625cda2e061adcd54fde9b71 Mon Sep 17 00:00:00 2001
From: cm13-github <128137806+cm13-github@users.noreply.github.com>
Date: Thu, 27 Jun 2024 17:56:45 +0100
Subject: [PATCH 2/5] Automatic changelog for PR #6565 [ci skip]
---
html/changelogs/AutoChangeLog-pr-6565.yml | 5 +++++
1 file changed, 5 insertions(+)
create mode 100644 html/changelogs/AutoChangeLog-pr-6565.yml
diff --git a/html/changelogs/AutoChangeLog-pr-6565.yml b/html/changelogs/AutoChangeLog-pr-6565.yml
new file mode 100644
index 000000000000..26ed76a815cf
--- /dev/null
+++ b/html/changelogs/AutoChangeLog-pr-6565.yml
@@ -0,0 +1,5 @@
+author: "Drathek"
+delete-after: True
+changes:
+ - bugfix: "Fixed a crash in the Hotkey menu when searching by key when filtered"
+ - bugfix: "Fixed/Added support for various keys (e.g. keypad and media keys)"
\ No newline at end of file
From d4a93eff3aea809084f02c949e231e8bdcea18b7 Mon Sep 17 00:00:00 2001
From: Git-Nivrak <59925169+Git-Nivrak@users.noreply.github.com>
Date: Thu, 27 Jun 2024 20:06:56 +0300
Subject: [PATCH 3/5] Fixes drawing weapons when knocked down (#6569)
# About the pull request
Prevents you from drawing weapons when you are knocked down
# Explain why it's good for the game
When you draw a weapon and are knocked down it will simply drop the
weapon since you can't hold it which is pretty annoying.
# Testing Photographs and Procedure
Screenshots & Videos
Put screenshots and videos here with an empty line between the
screenshots and the `` tags.
# Changelog
:cl:
fix: Fixes being able to draw weapons when knocked down
/:cl:
Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
---
code/modules/projectiles/gun_helpers.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/projectiles/gun_helpers.dm b/code/modules/projectiles/gun_helpers.dm
index c4cce7c5f996..9fe8c1ee46be 100644
--- a/code/modules/projectiles/gun_helpers.dm
+++ b/code/modules/projectiles/gun_helpers.dm
@@ -530,7 +530,7 @@ DEFINES in setup.dm, referenced here.
/mob/living/carbon/human/verb/holster_verb(unholster_number_offset = 1 as num)
set name = "holster"
set hidden = TRUE
- if(usr.is_mob_incapacitated(TRUE) || usr.is_mob_restrained())
+ if(usr.is_mob_incapacitated(TRUE) || usr.is_mob_restrained() || IsKnockDown() || HAS_TRAIT_FROM(src, TRAIT_UNDENSE, LYING_DOWN_TRAIT))
to_chat(src, SPAN_WARNING("You can't draw a weapon in your current state."))
return
From 4fff70a7c6e0d786dd86b6c3595ba5e9e60a3c2b Mon Sep 17 00:00:00 2001
From: cm13-github <128137806+cm13-github@users.noreply.github.com>
Date: Thu, 27 Jun 2024 18:11:36 +0100
Subject: [PATCH 4/5] Automatic changelog for PR #6569 [ci skip]
---
html/changelogs/AutoChangeLog-pr-6569.yml | 4 ++++
1 file changed, 4 insertions(+)
create mode 100644 html/changelogs/AutoChangeLog-pr-6569.yml
diff --git a/html/changelogs/AutoChangeLog-pr-6569.yml b/html/changelogs/AutoChangeLog-pr-6569.yml
new file mode 100644
index 000000000000..991b2ab3fadc
--- /dev/null
+++ b/html/changelogs/AutoChangeLog-pr-6569.yml
@@ -0,0 +1,4 @@
+author: "Git-Nivrak"
+delete-after: True
+changes:
+ - bugfix: "Fixes being able to draw weapons when knocked down"
\ No newline at end of file
From 29d93a39ce7dfac85b33198bd9486688e85d72da Mon Sep 17 00:00:00 2001
From: Changelogs
Date: Fri, 28 Jun 2024 01:16:19 +0000
Subject: [PATCH 5/5] Automatic changelog compile [ci skip]
---
html/changelogs/AutoChangeLog-pr-6493.yml | 4 ----
html/changelogs/AutoChangeLog-pr-6494.yml | 4 ----
html/changelogs/AutoChangeLog-pr-6507.yml | 4 ----
html/changelogs/AutoChangeLog-pr-6555.yml | 4 ----
html/changelogs/AutoChangeLog-pr-6558.yml | 4 ----
html/changelogs/AutoChangeLog-pr-6565.yml | 5 -----
html/changelogs/AutoChangeLog-pr-6569.yml | 4 ----
html/changelogs/archive/2024-06.yml | 16 ++++++++++++++++
8 files changed, 16 insertions(+), 29 deletions(-)
delete mode 100644 html/changelogs/AutoChangeLog-pr-6493.yml
delete mode 100644 html/changelogs/AutoChangeLog-pr-6494.yml
delete mode 100644 html/changelogs/AutoChangeLog-pr-6507.yml
delete mode 100644 html/changelogs/AutoChangeLog-pr-6555.yml
delete mode 100644 html/changelogs/AutoChangeLog-pr-6558.yml
delete mode 100644 html/changelogs/AutoChangeLog-pr-6565.yml
delete mode 100644 html/changelogs/AutoChangeLog-pr-6569.yml
diff --git a/html/changelogs/AutoChangeLog-pr-6493.yml b/html/changelogs/AutoChangeLog-pr-6493.yml
deleted file mode 100644
index 57d67e75aca3..000000000000
--- a/html/changelogs/AutoChangeLog-pr-6493.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-author: "HeresKozmos"
-delete-after: True
-changes:
- - maptweak: "Filled in a hole in the map."
\ No newline at end of file
diff --git a/html/changelogs/AutoChangeLog-pr-6494.yml b/html/changelogs/AutoChangeLog-pr-6494.yml
deleted file mode 100644
index cf50283ef6a2..000000000000
--- a/html/changelogs/AutoChangeLog-pr-6494.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-author: "HeresKozmos"
-delete-after: True
-changes:
- - maptweak: "Fixed an area in the easter egg section of Sorokyne"
\ No newline at end of file
diff --git a/html/changelogs/AutoChangeLog-pr-6507.yml b/html/changelogs/AutoChangeLog-pr-6507.yml
deleted file mode 100644
index 7153d4e603a2..000000000000
--- a/html/changelogs/AutoChangeLog-pr-6507.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-author: "kiVts"
-delete-after: True
-changes:
- - code_imp: "Prevented potential unintended behavior with research upgrade items on initialize"
\ No newline at end of file
diff --git a/html/changelogs/AutoChangeLog-pr-6555.yml b/html/changelogs/AutoChangeLog-pr-6555.yml
deleted file mode 100644
index ed55fd0f3534..000000000000
--- a/html/changelogs/AutoChangeLog-pr-6555.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-author: "coldironwarrior"
-delete-after: True
-changes:
- - spellcheck: "fixed a few typos in the xeno bioscan announcement"
\ No newline at end of file
diff --git a/html/changelogs/AutoChangeLog-pr-6558.yml b/html/changelogs/AutoChangeLog-pr-6558.yml
deleted file mode 100644
index bc921a138301..000000000000
--- a/html/changelogs/AutoChangeLog-pr-6558.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-author: "private-tristan"
-delete-after: True
-changes:
- - qol: "Facehuggers no longer show as having any plasma"
\ No newline at end of file
diff --git a/html/changelogs/AutoChangeLog-pr-6565.yml b/html/changelogs/AutoChangeLog-pr-6565.yml
deleted file mode 100644
index 26ed76a815cf..000000000000
--- a/html/changelogs/AutoChangeLog-pr-6565.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-author: "Drathek"
-delete-after: True
-changes:
- - bugfix: "Fixed a crash in the Hotkey menu when searching by key when filtered"
- - bugfix: "Fixed/Added support for various keys (e.g. keypad and media keys)"
\ No newline at end of file
diff --git a/html/changelogs/AutoChangeLog-pr-6569.yml b/html/changelogs/AutoChangeLog-pr-6569.yml
deleted file mode 100644
index 991b2ab3fadc..000000000000
--- a/html/changelogs/AutoChangeLog-pr-6569.yml
+++ /dev/null
@@ -1,4 +0,0 @@
-author: "Git-Nivrak"
-delete-after: True
-changes:
- - bugfix: "Fixes being able to draw weapons when knocked down"
\ No newline at end of file
diff --git a/html/changelogs/archive/2024-06.yml b/html/changelogs/archive/2024-06.yml
index e43d1aa00938..4075db8b6a2c 100644
--- a/html/changelogs/archive/2024-06.yml
+++ b/html/changelogs/archive/2024-06.yml
@@ -240,3 +240,19 @@
iloveloopers:
- balance: Custom research chemicals with an intensityfire above or equal to 50
will now burn white.
+2024-06-28:
+ Drathek:
+ - bugfix: Fixed a crash in the Hotkey menu when searching by key when filtered
+ - bugfix: Fixed/Added support for various keys (e.g. keypad and media keys)
+ Git-Nivrak:
+ - bugfix: Fixes being able to draw weapons when knocked down
+ HeresKozmos:
+ - maptweak: Filled in a hole in the map.
+ - maptweak: Fixed an area in the easter egg section of Sorokyne
+ coldironwarrior:
+ - spellcheck: fixed a few typos in the xeno bioscan announcement
+ kiVts:
+ - code_imp: Prevented potential unintended behavior with research upgrade items
+ on initialize
+ private-tristan:
+ - qol: Facehuggers no longer show as having any plasma