From fe2c2bc139297b80a6f3f71921786a4de82da845 Mon Sep 17 00:00:00 2001
From: Aylong <69762909+AyIong@users.noreply.github.com>
Date: Thu, 11 Apr 2024 06:20:23 +0300
Subject: [PATCH] De-modularize Input (#205)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
## Что этот PR делает
Достал инпут из модуля, нахуя? Не знаю :clueless:
Починил передачу кейкодов с тгуи в бйонд, теперь можно бегать и тыкать
интерфейс одновременно
Подчистил пару лишних биндов плюс повешал некоторые с пары (Передать на
V)
## Изображения изменений
Видео
https://github.com/ss220club/WyccerraBay220/assets/69762909/07ddcf25-3b5b-4297-ab6d-71f7d9bd7233
## Тестирование
Всё работает, вроде ничего не сломал
## Changelog
:cl:
add: Чейнджлог всё равно не работает, пока что.
/:cl:
---
baystation12.dme | 110 ++++++++++-------
code/_helpers/global_lists.dm | 48 ++++++++
.../controllers/subsystems/SSinput.dm | 9 +-
.../datums/keybindings}/_defines.dm | 10 ++
.../datums}/keybindings/_keybinding.dm | 10 +-
.../code => code/datums}/keybindings/admin.dm | 42 ++-----
.../datums}/keybindings/carbon.dm | 27 ++--
.../datums}/keybindings/client.dm | 22 +---
.../datums}/keybindings/communication.dm | 20 ++-
.../code => code/datums}/keybindings/human.dm | 19 +--
.../datums}/keybindings/living.dm | 18 +--
.../code => code/datums}/keybindings/mob.dm | 72 +++--------
.../datums}/keybindings/movement.dm | 27 ++--
.../code => code/datums}/keybindings/robot.dm | 27 ++--
code/modules/admin/callproc/callproc.dm | 29 ++---
code/modules/client/client_defines.dm | 20 +++
code/modules/client/client_procs.dm | 65 +++++++++-
.../keybindings/keybindings_pref.dm | 92 ++------------
.../keybindings/keybindings_proc.dm | 61 +++++++++
code/modules/client/preferences.dm | 47 +++++++
.../modules/input/input.dm | 80 ++++++++++--
.../modules/input/movement.dm | 2 -
mods/global_modpacks.dm | 1 -
mods/ssinput/README.md | 98 ---------------
mods/ssinput/_ssinput.dm | 4 -
mods/ssinput/_ssinput.dme | 40 ------
mods/ssinput/code/README.md | 40 ------
mods/ssinput/code/_undefines.dm | 7 --
mods/ssinput/code/general/bindings_setup.dm | 76 ------------
mods/ssinput/code/general/client.dm | 116 ------------------
mods/ssinput/code/general/preferences.dm | 62 ----------
mods/ssinput/code/global_lists.dm | 13 --
mods/ssinput/code/global_maps.dm | 29 -----
mods/ssinput/code/keybindings/_defines.dm | 9 --
mods/ssinput/code/keybindings/_undefines.dm | 9 --
tgui/packages/tgui/hotkeys.ts | 6 +-
36 files changed, 492 insertions(+), 875 deletions(-)
rename mods/ssinput/code/general/subsystem.dm => code/controllers/subsystems/SSinput.dm (99%)
rename {mods/ssinput/code => code/datums/keybindings}/_defines.dm (57%)
rename {mods/ssinput/code => code/datums}/keybindings/_keybinding.dm (91%)
rename {mods/ssinput/code => code/datums}/keybindings/admin.dm (98%)
rename {mods/ssinput/code => code/datums}/keybindings/carbon.dm (97%)
rename {mods/ssinput/code => code/datums}/keybindings/client.dm (93%)
rename {mods/ssinput/code => code/datums}/keybindings/communication.dm (88%)
rename {mods/ssinput/code => code/datums}/keybindings/human.dm (97%)
rename {mods/ssinput/code => code/datums}/keybindings/living.dm (95%)
rename {mods/ssinput/code => code/datums}/keybindings/mob.dm (86%)
rename {mods/ssinput/code => code/datums}/keybindings/movement.dm (70%)
rename {mods/ssinput/code => code/datums}/keybindings/robot.dm (97%)
rename mods/ssinput/code/general/preference_setup.dm => code/modules/client/preference_setup/keybindings/keybindings_pref.dm (70%)
create mode 100644 code/modules/client/preference_setup/keybindings/keybindings_proc.dm
rename mods/ssinput/code/general/bindings_client.dm => code/modules/input/input.dm (61%)
rename mods/ssinput/code/general/bindings_atom.dm => code/modules/input/movement.dm (99%)
delete mode 100644 mods/ssinput/README.md
delete mode 100644 mods/ssinput/_ssinput.dm
delete mode 100644 mods/ssinput/_ssinput.dme
delete mode 100644 mods/ssinput/code/README.md
delete mode 100644 mods/ssinput/code/_undefines.dm
delete mode 100644 mods/ssinput/code/general/bindings_setup.dm
delete mode 100644 mods/ssinput/code/general/client.dm
delete mode 100644 mods/ssinput/code/general/preferences.dm
delete mode 100644 mods/ssinput/code/global_lists.dm
delete mode 100644 mods/ssinput/code/global_maps.dm
delete mode 100644 mods/ssinput/code/keybindings/_defines.dm
delete mode 100644 mods/ssinput/code/keybindings/_undefines.dm
diff --git a/baystation12.dme b/baystation12.dme
index 64baf07074105..4cd4783d255d6 100644
--- a/baystation12.dme
+++ b/baystation12.dme
@@ -100,8 +100,6 @@
#include "code\__defines\xenoarcheaology.dm"
#include "code\__defines\ZAS.dm"
#include "code\__defines\zmimic.dm"
-#include "code\__defines\~mods\tgs.config.dm"
-#include "code\__defines\~mods\tgs.dm"
#include "code\__defines\dcs\flags.dm"
#include "code\__defines\dcs\helpers.dm"
#include "code\__defines\dcs\signals\signals_area.dm"
@@ -115,6 +113,8 @@
#include "code\__defines\~mods\bloom_light.dm"
#include "code\__defines\~mods\expanded_culture_descriptor.dm"
#include "code\__defines\~mods\text_to_speech.dm"
+#include "code\__defines\~mods\tgs.config.dm"
+#include "code\__defines\~mods\tgs.dm"
#include "code\__defines\~mods\~master_defines.dm"
#include "code\_global_vars\edible.dm"
#include "code\_global_vars\logging.dm"
@@ -179,12 +179,11 @@
#include "code\_onclick\ghost.dm"
#include "code\_onclick\item_attack.dm"
#include "code\_onclick\MouseDrag.dm"
-#include "code\_onclick\hud\action.dm"
-#include "code\controllers\admin.dm"
#include "code\_onclick\other_mobs.dm"
#include "code\_onclick\rig.dm"
#include "code\_onclick\hud\_defines.dm"
#include "code\_onclick\hud\ability_screen_objects.dm"
+#include "code\_onclick\hud\action.dm"
#include "code\_onclick\hud\animal.dm"
#include "code\_onclick\hud\fullscreen.dm"
#include "code\_onclick\hud\ghost.dm"
@@ -200,6 +199,7 @@
#include "code\_onclick\hud\robot.dm"
#include "code\_onclick\hud\screen_objects.dm"
#include "code\_onclick\hud\skybox.dm"
+#include "code\controllers\admin.dm"
#include "code\controllers\communications.dm"
#include "code\controllers\configuration.dm"
#include "code\controllers\controller.dm"
@@ -257,6 +257,7 @@
#include "code\controllers\subsystems\shuttle.dm"
#include "code\controllers\subsystems\skybox.dm"
#include "code\controllers\subsystems\spacedrift.dm"
+#include "code\controllers\subsystems\SSinput.dm"
#include "code\controllers\subsystems\supply.dm"
#include "code\controllers\subsystems\tgui.dm"
#include "code\controllers\subsystems\throwing.dm"
@@ -301,7 +302,6 @@
#include "code\core\math\vector2.dm"
#include "code\core\math\vector3.dm"
#include "code\core\matrix\Transform.dm"
-#include "code\datums\tgs_event_helper.dm"
#include "code\datums\ai_law_sets.dm"
#include "code\datums\ai_laws.dm"
#include "code\datums\beam.dm"
@@ -325,6 +325,7 @@
#include "code\datums\signals.dm"
#include "code\datums\sound_player.dm"
#include "code\datums\suit_sensor_jammer_method.dm"
+#include "code\datums\tgs_event_helper.dm"
#include "code\datums\weakref.dm"
#include "code\datums\ai\ai_holo.dm"
#include "code\datums\appearances\appearance_data.dm"
@@ -390,6 +391,17 @@
#include "code\datums\item_modifiers\item_modifier.dm"
#include "code\datums\item_modifiers\space_suits.dm"
#include "code\datums\item_modifiers\~defines.dm"
+#include "code\datums\keybindings\_defines.dm"
+#include "code\datums\keybindings\_keybinding.dm"
+#include "code\datums\keybindings\admin.dm"
+#include "code\datums\keybindings\carbon.dm"
+#include "code\datums\keybindings\client.dm"
+#include "code\datums\keybindings\communication.dm"
+#include "code\datums\keybindings\human.dm"
+#include "code\datums\keybindings\living.dm"
+#include "code\datums\keybindings\mob.dm"
+#include "code\datums\keybindings\movement.dm"
+#include "code\datums\keybindings\robot.dm"
#include "code\datums\licences\license.dm"
#include "code\datums\mind\memory.dm"
#include "code\datums\mind\mind.dm"
@@ -1627,6 +1639,8 @@
#include "code\modules\client\preference_setup\global\05_settings.dm"
#include "code\modules\client\preference_setup\global\preferences.dm"
#include "code\modules\client\preference_setup\global\prefixes.dm"
+#include "code\modules\client\preference_setup\keybindings\keybindings_pref.dm"
+#include "code\modules\client\preference_setup\keybindings\keybindings_proc.dm"
#include "code\modules\client\preference_setup\laws\laws_pref.dm"
#include "code\modules\client\preference_setup\loadout\_defines.dm"
#include "code\modules\client\preference_setup\loadout\gear.dm"
@@ -2015,6 +2029,8 @@
#include "code\modules\hydroponics\trays\tray_soil.dm"
#include "code\modules\hydroponics\trays\tray_tools.dm"
#include "code\modules\hydroponics\trays\tray_update_icons.dm"
+#include "code\modules\input\input.dm"
+#include "code\modules\input\movement.dm"
#include "code\modules\integrated_electronics\_defines.dm"
#include "code\modules\integrated_electronics\core\analyzer.dm"
#include "code\modules\integrated_electronics\core\assemblies.dm"
@@ -3291,6 +3307,48 @@
#include "code\modules\turbolift\turbolift_floor.dm"
#include "code\modules\turbolift\turbolift_map.dm"
#include "code\modules\turbolift\turbolift_turfs.dm"
+#include "code\modules\unit_tests\_defines.dm"
+#include "code\modules\unit_tests\_includes.dm"
+#include "code\modules\unit_tests\_unit_tests.dm"
+#include "code\modules\unit_tests\alt_appearances_test.dm"
+#include "code\modules\unit_tests\area_tests.dm"
+#include "code\modules\unit_tests\area_turfs_cache.dm"
+#include "code\modules\unit_tests\atmospherics_tests.dm"
+#include "code\modules\unit_tests\cargo_tests.dm"
+#include "code\modules\unit_tests\closets.dm"
+#include "code\modules\unit_tests\component_tests.dm"
+#include "code\modules\unit_tests\culture.dm"
+#include "code\modules\unit_tests\equipment_tests.dm"
+#include "code\modules\unit_tests\food_tests.dm"
+#include "code\modules\unit_tests\foundation_tests.dm"
+#include "code\modules\unit_tests\fusion_plants.dm"
+#include "code\modules\unit_tests\graph_tests.dm"
+#include "code\modules\unit_tests\icon_tests.dm"
+#include "code\modules\unit_tests\integrated_circuits.dm"
+#include "code\modules\unit_tests\job_tests.dm"
+#include "code\modules\unit_tests\loadout_tests.dm"
+#include "code\modules\unit_tests\machine_tests.dm"
+#include "code\modules\unit_tests\map_tests.dm"
+#include "code\modules\unit_tests\mob_tests.dm"
+#include "code\modules\unit_tests\movement_tests.dm"
+#include "code\modules\unit_tests\music_test.dm"
+#include "code\modules\unit_tests\observation_tests.dm"
+#include "code\modules\unit_tests\organ_tests.dm"
+#include "code\modules\unit_tests\overmap_tests.dm"
+#include "code\modules\unit_tests\power_tests.dm"
+#include "code\modules\unit_tests\reagent_color_test.dm"
+#include "code\modules\unit_tests\seed_tests.dm"
+#include "code\modules\unit_tests\shuttle_tests.dm"
+#include "code\modules\unit_tests\submaps.dm"
+#include "code\modules\unit_tests\subsystem_tests.dm"
+#include "code\modules\unit_tests\test_obj.dm"
+#include "code\modules\unit_tests\time_tests.dm"
+#include "code\modules\unit_tests\unique_tests.dm"
+#include "code\modules\unit_tests\uplink_tests.dm"
+#include "code\modules\unit_tests\view_variables_test.dm"
+#include "code\modules\unit_tests\virtual_mob_tests.dm"
+#include "code\modules\unit_tests\zas_tests.dm"
+#include "code\modules\unit_tests\~helpers.dm"
#include "code\modules\ventcrawl\ventcrawl.dm"
#include "code\modules\ventcrawl\ventcrawl_atmospherics.dm"
#include "code\modules\ventcrawl\ventcrawl_multiz.dm"
@@ -3383,48 +3441,6 @@
#include "code\procs\dbcore.dm"
#include "code\procs\hud.dm"
#include "code\procs\radio.dm"
-#include "code\modules\unit_tests\_defines.dm"
-#include "code\modules\unit_tests\_includes.dm"
-#include "code\modules\unit_tests\_unit_tests.dm"
-#include "code\modules\unit_tests\alt_appearances_test.dm"
-#include "code\modules\unit_tests\area_tests.dm"
-#include "code\modules\unit_tests\area_turfs_cache.dm"
-#include "code\modules\unit_tests\atmospherics_tests.dm"
-#include "code\modules\unit_tests\cargo_tests.dm"
-#include "code\modules\unit_tests\closets.dm"
-#include "code\modules\unit_tests\component_tests.dm"
-#include "code\modules\unit_tests\culture.dm"
-#include "code\modules\unit_tests\equipment_tests.dm"
-#include "code\modules\unit_tests\food_tests.dm"
-#include "code\modules\unit_tests\foundation_tests.dm"
-#include "code\modules\unit_tests\fusion_plants.dm"
-#include "code\modules\unit_tests\graph_tests.dm"
-#include "code\modules\unit_tests\icon_tests.dm"
-#include "code\modules\unit_tests\integrated_circuits.dm"
-#include "code\modules\unit_tests\job_tests.dm"
-#include "code\modules\unit_tests\loadout_tests.dm"
-#include "code\modules\unit_tests\machine_tests.dm"
-#include "code\modules\unit_tests\map_tests.dm"
-#include "code\modules\unit_tests\mob_tests.dm"
-#include "code\modules\unit_tests\movement_tests.dm"
-#include "code\modules\unit_tests\music_test.dm"
-#include "code\modules\unit_tests\observation_tests.dm"
-#include "code\modules\unit_tests\organ_tests.dm"
-#include "code\modules\unit_tests\overmap_tests.dm"
-#include "code\modules\unit_tests\power_tests.dm"
-#include "code\modules\unit_tests\reagent_color_test.dm"
-#include "code\modules\unit_tests\seed_tests.dm"
-#include "code\modules\unit_tests\shuttle_tests.dm"
-#include "code\modules\unit_tests\submaps.dm"
-#include "code\modules\unit_tests\subsystem_tests.dm"
-#include "code\modules\unit_tests\test_obj.dm"
-#include "code\modules\unit_tests\time_tests.dm"
-#include "code\modules\unit_tests\unique_tests.dm"
-#include "code\modules\unit_tests\uplink_tests.dm"
-#include "code\modules\unit_tests\view_variables_test.dm"
-#include "code\modules\unit_tests\virtual_mob_tests.dm"
-#include "code\modules\unit_tests\zas_tests.dm"
-#include "code\modules\unit_tests\~helpers.dm"
#include "interface\interface.dm"
#include "interface\skin.dmf"
#include "maps\_map_include.dm"
diff --git a/code/_helpers/global_lists.dm b/code/_helpers/global_lists.dm
index caa2b8336b6d6..51d7c48274596 100644
--- a/code/_helpers/global_lists.dm
+++ b/code/_helpers/global_lists.dm
@@ -82,6 +82,45 @@ var/global/list/string_slot_flags = list(
"holster" = SLOT_HOLSTER
)
+GLOBAL_LIST_EMPTY(hotkey_keybinding_list_by_key)
+GLOBAL_LIST_EMPTY(keybindings_by_name)
+
+/// This is a mapping from JS keys to Byond - ref: https://keycode.info/
+GLOBAL_LIST_INIT(keybindings_map, list(
+ "UP" = "North",
+ "RIGHT" = "East",
+ "DOWN" = "South",
+ "LEFT" = "West",
+ "INSERT" = "Insert",
+ "HOME" = "Northwest",
+ "PAGEUP" = "Northeast",
+ "DEL" = "Delete",
+ "END" = "Southwest",
+ "PAGEDOWN" = "Southeast",
+ "SPACEBAR" = "Space",
+ "ALT" = "Alt",
+ "SHIFT" = "Shift",
+ "CONTROL" = "Ctrl",
+ "DIVIDE" = "Divide",
+ "MULTIPLY" = "Multiply",
+ "ADD" = "Add",
+ "SUBTRACT" = "Subtract",
+ "DECIMAL" = "Decimal",
+ "CLEAR" = "Center"
+))
+
+/// Without alt, shift, ctrl and etc because its not necessary
+GLOBAL_LIST_INIT(keybindings_map_reverse, list(
+ "North" = "Up",
+ "East" = "Right",
+ "South" = "Down",
+ "West" = "Left",
+ "Northwest" = "Home",
+ "Northeast" = "PageUp",
+ "Southwest" = "End",
+ "Southeast" = "PageDown",
+))
+
//////////////////////////
/////Initial Building/////
//////////////////////////
@@ -185,6 +224,15 @@ var/global/list/string_slot_flags = list(
continue
GLOB.world_topic_handlers[wth.topic_key] = topic_handler_type
+ for(var/datum/keybinding/keybinding as anything in subtypesof(/datum/keybinding))
+ if(!initial(keybinding.name))
+ continue
+ var/datum/keybinding/instance = new keybinding
+ GLOB.keybindings_by_name[instance.name] = instance
+ if(length(instance.hotkey_keys))
+ for(var/bound_key in instance.hotkey_keys)
+ GLOB.hotkey_keybinding_list_by_key[bound_key] += list(instance.name)
+
return TRUE
//*** params cache
diff --git a/mods/ssinput/code/general/subsystem.dm b/code/controllers/subsystems/SSinput.dm
similarity index 99%
rename from mods/ssinput/code/general/subsystem.dm
rename to code/controllers/subsystems/SSinput.dm
index b616b01994caa..2e63132a1da52 100644
--- a/mods/ssinput/code/general/subsystem.dm
+++ b/code/controllers/subsystems/SSinput.dm
@@ -1,20 +1,17 @@
SUBSYSTEM_DEF(input)
name = "Input"
wait = 1 //SS_TICKER means this runs every tick
- init_order = SS_INIT_INPUT
flags = SS_TICKER
+ init_order = SS_INIT_INPUT
priority = FIRE_PRIORITY_INPUT
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
-
var/list/macro_set
-
/datum/controller/subsystem/input/Initialize()
setup_default_macro_sets()
refresh_client_macro_sets()
return ..()
-
// This is for when macro sets are eventualy datumized
/datum/controller/subsystem/input/proc/setup_default_macro_sets()
macro_set = list(
@@ -25,19 +22,15 @@ SUBSYSTEM_DEF(input)
"Escape" = "Reset-Held-Keys"
)
-
// Badmins just wanna have fun ♪
/datum/controller/subsystem/input/proc/refresh_client_macro_sets()
for(var/client/C as anything in GLOB.clients)
if(!C)
continue
-
C.set_macros()
-
/datum/controller/subsystem/input/fire()
for(var/client/C as anything in GLOB.clients)
if(!C)
continue
-
C.keyLoop()
diff --git a/mods/ssinput/code/_defines.dm b/code/datums/keybindings/_defines.dm
similarity index 57%
rename from mods/ssinput/code/_defines.dm
rename to code/datums/keybindings/_defines.dm
index 75c1382cbbe1b..13d1cb93ac9cf 100644
--- a/mods/ssinput/code/_defines.dm
+++ b/code/datums/keybindings/_defines.dm
@@ -1,3 +1,13 @@
+#define KEYBIND_CATEGORY_CLIENT "CLIENT"
+#define KEYBIND_CATEGORY_EMOTE "EMOTE"
+#define KEYBIND_CATEGORY_ADMIN "ADMIN"
+#define KEYBIND_CATEGORY_CARBON "CARBON"
+#define KEYBIND_CATEGORY_HUMAN "HUMAN"
+#define KEYBIND_CATEGORY_ROBOT "ROBOT"
+#define KEYBIND_CATEGORY_MISC "MISC"
+#define KEYBIND_CATEGORY_MOVEMENT "MOVEMENT"
+#define KEYBIND_CATEGORY_COMMUNICATION "COMMUNICATION"
+
/// Max length of a keypress command before it's considered to be a forged packet/bogus command
#define MAX_KEYPRESS_COMMANDLENGTH 16
/// Maximum keys that can be bound to one button
diff --git a/mods/ssinput/code/keybindings/_keybinding.dm b/code/datums/keybindings/_keybinding.dm
similarity index 91%
rename from mods/ssinput/code/keybindings/_keybinding.dm
rename to code/datums/keybindings/_keybinding.dm
index 20133083d97f7..8047cde78642a 100644
--- a/mods/ssinput/code/keybindings/_keybinding.dm
+++ b/code/datums/keybindings/_keybinding.dm
@@ -1,25 +1,21 @@
/datum/keybinding
- var/list/hotkey_keys
- var/list/classic_keys
var/name
var/full_name
var/description = ""
- var/category = CATEGORY_MISC
-
+ var/category = KEYBIND_CATEGORY_MISC
+ var/list/hotkey_keys
+ var/list/classic_keys
/datum/keybinding/New()
// Default keys to the master "hotkey_keys"
if(LAZYLEN(hotkey_keys) && !LAZYLEN(classic_keys))
classic_keys = hotkey_keys.Copy()
-
/datum/keybinding/proc/down(client/user)
return FALSE
-
/datum/keybinding/proc/up(client/user)
return FALSE
-
/datum/keybinding/proc/can_use(client/user)
return TRUE
diff --git a/mods/ssinput/code/keybindings/admin.dm b/code/datums/keybindings/admin.dm
similarity index 98%
rename from mods/ssinput/code/keybindings/admin.dm
rename to code/datums/keybindings/admin.dm
index 7585e363021c8..776e9393af932 100644
--- a/mods/ssinput/code/keybindings/admin.dm
+++ b/code/datums/keybindings/admin.dm
@@ -1,129 +1,107 @@
/datum/keybinding/admin
- category = CATEGORY_ADMIN
-
+ category = KEYBIND_CATEGORY_ADMIN
/datum/keybinding/admin/can_use(client/user)
return !!user.holder
-
/datum/keybinding/admin/admin_say
- hotkey_keys = list("None")
name = "admin_say"
full_name = "Admin Say"
description = "Talk with other admins."
-
+ hotkey_keys = list("None")
/datum/keybinding/admin/admin_say/down(client/user)
user.get_admin_say()
return TRUE
-
/datum/keybinding/admin/moderator_say
- hotkey_keys = list("F5")
name = "moderator_say"
full_name = "Moderator Say"
description = "Talk with other moderators."
-
+ hotkey_keys = list("F5")
/datum/keybinding/admin/moderator_say/down(client/user)
user.get_mod_say()
return TRUE
-
/datum/keybinding/admin/admin_ghost
- hotkey_keys = list("None")
name = "admin_ghost"
full_name = "Aghost"
description = "Go ghost"
-
+ hotkey_keys = list("None")
/datum/keybinding/admin/admin_ghost/down(client/user)
user.admin_ghost()
return TRUE
-
/datum/keybinding/admin/list_players
- hotkey_keys = list("F6")
name = "list_players"
full_name = "Player panel"
description = "Opens up the list players panel"
-
+ hotkey_keys = list("F6")
/datum/keybinding/admin/list_players/down(client/user)
user.holder.player_panel()
return TRUE
-
/datum/keybinding/admin/admin_pm
- hotkey_keys = list("F7")
name = "admin_pm"
full_name = "Admin PM"
description = "Sends Admin PM message"
-
+ hotkey_keys = list("F7")
/datum/keybinding/admin/admin_pm/down(client/user)
user.cmd_admin_pm_panel()
return TRUE
-
/datum/keybinding/admin/invisimin
- hotkey_keys = list("F8")
name = "invisimin"
full_name = "Admin Invisibility"
description = "Toggles ghost-like invisibility (Don't abuse this)"
-
+ hotkey_keys = list("F8")
/datum/keybinding/admin/invisimin/down(client/user)
user.invisimin()
return TRUE
-
/datum/keybinding/admin/dead_say
- hotkey_keys = list("F10")
name = "dead_say"
full_name = "Dead Say"
description = "Allows you to send a message to dead chat"
-
+ hotkey_keys = list("F10")
/datum/keybinding/admin/dead_say/down(client/user)
user.get_dead_say()
return TRUE
-
/datum/keybinding/admin/deadmin
- hotkey_keys = list("None")
name = "deadmin"
full_name = "De-Admin"
description = "Shed your admin powers"
-
+ hotkey_keys = list("None")
/datum/keybinding/admin/deadmin/down(client/user)
user.deadmin_self()
return TRUE
-
/datum/keybinding/admin/readmin
- hotkey_keys = list("None")
name = "readmin"
full_name = "Re-Admin"
description = "Regain your admin powers"
-
+ hotkey_keys = list("None")
/datum/keybinding/admin/readmin/down(client/user)
user.readmin_self()
return TRUE
-
/client/proc/get_admin_say()
var/msg = input(src, null, "asay \"text\"") as text|null
cmd_admin_say(msg)
-
/client/proc/get_mod_say()
var/msg = input(src, null, "msay \"text\"") as text|null
cmd_mod_say(msg)
-
/client/proc/get_dead_say()
var/msg = input(src, null, "dsay \"text\"") as text
dsay(msg)
diff --git a/mods/ssinput/code/keybindings/carbon.dm b/code/datums/keybindings/carbon.dm
similarity index 97%
rename from mods/ssinput/code/keybindings/carbon.dm
rename to code/datums/keybindings/carbon.dm
index 6acb467e50374..a7218c7576cc3 100644
--- a/mods/ssinput/code/keybindings/carbon.dm
+++ b/code/datums/keybindings/carbon.dm
@@ -1,78 +1,65 @@
/datum/keybinding/carbon
- category = CATEGORY_CARBON
-
+ category = KEYBIND_CATEGORY_CARBON
/datum/keybinding/carbon/can_use(client/user)
return iscarbon(user.mob)
-
/datum/keybinding/carbon/toggle_throw_mode
- hotkey_keys = list("R", "Southwest") // PAGEDOWN
name = "toggle_throw_mode"
full_name = "Toggle Throw Mode"
description = "Toggle throwing the current item or not"
-
+ hotkey_keys = list("R", "Southwest") // PAGEDOWN
/datum/keybinding/carbon/toggle_throw_mode/down(client/user)
var/mob/living/carbon/C = user.mob
C.toggle_throw_mode()
return TRUE
-
/datum/keybinding/carbon/select_help_intent
- hotkey_keys = list("1")
name = "select_help_intent"
full_name = "Select Help Intent"
description = ""
-
+ hotkey_keys = list("1")
/datum/keybinding/carbon/select_help_intent/down(client/user)
user.mob?.a_intent_change(I_HELP)
return TRUE
-
/datum/keybinding/carbon/select_disarm_intent
- hotkey_keys = list("2")
name = "select_disarm_intent"
full_name = "Select Disarm Intent"
description = ""
-
+ hotkey_keys = list("2")
/datum/keybinding/carbon/select_disarm_intent/down(client/user)
user.mob?.a_intent_change(I_DISARM)
return TRUE
-
/datum/keybinding/carbon/select_grab_intent
- hotkey_keys = list("3")
name = "select_grab_intent"
full_name = "Select Grab Intent"
description = ""
-
+ hotkey_keys = list("3")
/datum/keybinding/carbon/select_grab_intent/down(client/user)
user.mob?.a_intent_change(I_GRAB)
return TRUE
-
/datum/keybinding/carbon/select_harm_intent
- hotkey_keys = list("4")
name = "select_harm_intent"
full_name = "Select Harm Intent"
description = ""
-
+ hotkey_keys = list("4")
/datum/keybinding/carbon/select_harm_intent/down(client/user)
user.mob?.a_intent_change(I_HURT)
return TRUE
-
/datum/keybinding/carbon/swap_hands
- hotkey_keys = list("X", "Northeast") // PAGEUP
name = "swap_hands"
full_name = "Swap Hands"
description = ""
-
+ hotkey_keys = list("X", "Northeast") // PAGEUP
/datum/keybinding/carbon/swap_hands/down(client/user)
var/mob/living/carbon/C = user.mob
diff --git a/mods/ssinput/code/keybindings/client.dm b/code/datums/keybindings/client.dm
similarity index 93%
rename from mods/ssinput/code/keybindings/client.dm
rename to code/datums/keybindings/client.dm
index 9c954d472ef35..8ffbe88662ad0 100644
--- a/mods/ssinput/code/keybindings/client.dm
+++ b/code/datums/keybindings/client.dm
@@ -1,61 +1,51 @@
/datum/keybinding/client
- category = CATEGORY_CLIENT
-
+ category = KEYBIND_CATEGORY_CLIENT
/datum/keybinding/client/admin_help
- hotkey_keys = list("F1")
name = "admin_help"
full_name = "Admin Help"
description = "Ask an admin for help"
-
+ hotkey_keys = list("F1")
/datum/keybinding/client/admin_help/down(client/user)
user.adminhelp()
return TRUE
-
/datum/keybinding/client/screenshot
- hotkey_keys = list("None")
name = "screenshot"
full_name = "Screenshot"
description = "Take a screenshot"
-
+ hotkey_keys = list()
/datum/keybinding/client/screenshot/down(client/user)
winset(user, null, "command=.screenshot [!user.keys_held[SHIFT_CLICK] ? "auto" : ""]")
return TRUE
-
/datum/keybinding/client/fit_viewport
- hotkey_keys = list("CtrlF11")
name = "fit_viewport"
full_name = "Fit Viewport"
description = "Fits your viewport"
-
+ hotkey_keys = list("F11")
/datum/keybinding/client/fit_viewport/down(client/user)
user.fit_viewport()
return TRUE
-
/datum/keybinding/client/toggle_fullscreen
- hotkey_keys = list("F11")
name = "toggle_fullscreen"
full_name = "Toggle Fullscreen"
description = "Opens game in fullscreen / Collapses to window"
-
+ hotkey_keys = list("F12")
/datum/keybinding/client/toggle_fullscreen/down(client/user)
user.toggle_fullscreen()
return TRUE
-
/datum/keybinding/client/minimal_hud
- hotkey_keys = list("F12")
name = "minimal_hud"
full_name = "Minimal HUD"
description = "Hide most HUD features"
-
+ hotkey_keys = list("CtrlF12")
/datum/keybinding/client/minimal_hud/down(client/user)
user.mob.button_pressed_F12()
diff --git a/mods/ssinput/code/keybindings/communication.dm b/code/datums/keybindings/communication.dm
similarity index 88%
rename from mods/ssinput/code/keybindings/communication.dm
rename to code/datums/keybindings/communication.dm
index ad37ac22fdb78..ef38147c17987 100644
--- a/mods/ssinput/code/keybindings/communication.dm
+++ b/code/datums/keybindings/communication.dm
@@ -1,48 +1,42 @@
/datum/keybinding/client/communication
- category = CATEGORY_COMMUNICATION
-
+ category = KEYBIND_CATEGORY_COMMUNICATION
/datum/keybinding/client/communication/say
- hotkey_keys = list("F3", "T")
name = "IC Say"
full_name = "IC Say"
-
+ hotkey_keys = list("F3", "T")
/datum/keybinding/client/communication/say/down(client/user)
user.mob.say_wrapper()
return TRUE
/datum/keybinding/client/communication/whisper
+ name = "Whisper"
+ full_name = "Whisper"
hotkey_keys = list("ShiftT")
- name = "IC Whisper"
- full_name = "IC Whisper"
/datum/keybinding/client/communication/whisper/down(client/user)
user.mob.whisper_wrapper()
return TRUE
/datum/keybinding/client/communication/ooc
- hotkey_keys = list("F2")
name = "OOC"
full_name = "Out Of Character Say (OOC)"
-
+ hotkey_keys = list("F2")
/datum/keybinding/client/communication/looc
- hotkey_keys = list("L")
name = "LOOC"
full_name = "Local Out Of Character Say (LOOC)"
-
+ hotkey_keys = list("L")
/datum/keybinding/client/communication/looc/down(client/user)
user.looc()
return TRUE
-
/datum/keybinding/client/communication/me
- hotkey_keys = list("F4", "M", "5")
name = "IC Me"
full_name = "Custom Emote (/Me)"
-
+ hotkey_keys = list("F4", "M")
/datum/keybinding/client/communication/me/down(client/user)
user.mob.me_wrapper()
diff --git a/mods/ssinput/code/keybindings/human.dm b/code/datums/keybindings/human.dm
similarity index 97%
rename from mods/ssinput/code/keybindings/human.dm
rename to code/datums/keybindings/human.dm
index 7ccd4d2a13cb8..9f17f853d8e02 100644
--- a/mods/ssinput/code/keybindings/human.dm
+++ b/code/datums/keybindings/human.dm
@@ -1,30 +1,25 @@
/datum/keybinding/human
- category = CATEGORY_HUMAN
-
+ category = KEYBIND_CATEGORY_HUMAN
/datum/keybinding/human/can_use(client/user)
return ishuman(user.mob)
-
/datum/keybinding/human/quick_equip
- hotkey_keys = list("E")
name = "quick_equip"
full_name = "Quick Equip"
description = "Quickly puts an item in the best slot available"
-
+ hotkey_keys = list("E")
/datum/keybinding/human/quick_equip/down(client/user)
var/mob/living/carbon/human/H = user.mob
H.quick_equip()
return TRUE
-
/datum/keybinding/human/holster
- hotkey_keys = list("H")
name = "holster"
full_name = "Holster"
description = "Draw or holster weapon"
-
+ hotkey_keys = list("H")
/datum/keybinding/human/holster/down(client/user)
var/mob/living/carbon/human/H = user.mob
@@ -60,26 +55,22 @@
return TRUE
-
/datum/keybinding/human/give
- hotkey_keys = list("None")
name = "give_item"
full_name = "Give Item"
description = "Give the item you're currently holding"
-
+ hotkey_keys = list("V")
/datum/keybinding/human/give/down(client/user)
var/mob/living/carbon/human/H = user.mob
H.give()
return TRUE
-
/datum/keybinding/human/stop_pulling
- hotkey_keys = list("C", "Delete")
name = "stop_pulling"
full_name = "Stop Pulling"
description = "Let go of the object and stop pulling"
-
+ hotkey_keys = list("C", "Delete")
/datum/keybinding/human/stop_pulling/down(client/user)
var/mob/living/carbon/human/H = user.mob
diff --git a/mods/ssinput/code/keybindings/living.dm b/code/datums/keybindings/living.dm
similarity index 95%
rename from mods/ssinput/code/keybindings/living.dm
rename to code/datums/keybindings/living.dm
index e4777f1f30da3..a15895197eb11 100644
--- a/mods/ssinput/code/keybindings/living.dm
+++ b/code/datums/keybindings/living.dm
@@ -1,54 +1,46 @@
/datum/keybinding/living
- category = CATEGORY_HUMAN
-
+ category = KEYBIND_CATEGORY_HUMAN
/datum/keybinding/living/can_use(client/user)
return isliving(user.mob)
-
/datum/keybinding/living/rest
- hotkey_keys = list("ShiftB")
name = "rest"
full_name = "Rest"
description = "You lay down/get up"
-
+ hotkey_keys = list("ShiftB")
/datum/keybinding/living/rest/down(client/user)
var/mob/living/L = user.mob
L.lay_down()
return TRUE
-
/datum/keybinding/living/resist
- hotkey_keys = list("B")
name = "resist"
full_name = "Resist"
description = "Break free of your current state. Handcuffed? On fire? Resist!"
-
+ hotkey_keys = list("B")
/datum/keybinding/living/resist/down(client/user)
var/mob/living/L = user.mob
L.resist()
return TRUE
-
/datum/keybinding/living/drop_item
- hotkey_keys = list("Q", "Northwest") // HOME
name = "drop_item"
full_name = "Drop Item"
description = ""
-
+ hotkey_keys = list("Q", "Northwest") // HOME
/datum/keybinding/living/drop_item/down(client/user)
var/mob/living/L = user.mob
L.drop_item()
return TRUE
-
/datum/keybinding/living/pixel_shift
- hotkey_keys = list("V")
name = "pixel_shift"
full_name = "Pixel Shift"
description = "Hold to pixel shift with movement keys"
+ hotkey_keys = list("B")
/datum/keybinding/living/pixel_shift/down(client/user)
if(!(SEND_SIGNAL(user.mob, COMSIG_KB_MOB_PIXEL_SHIFT_DOWN) & COMSIG_KB_ACTIVATED))
diff --git a/mods/ssinput/code/keybindings/mob.dm b/code/datums/keybindings/mob.dm
similarity index 86%
rename from mods/ssinput/code/keybindings/mob.dm
rename to code/datums/keybindings/mob.dm
index 98cba57f3c7e0..5e4f61ddd9a95 100644
--- a/mods/ssinput/code/keybindings/mob.dm
+++ b/code/datums/keybindings/mob.dm
@@ -1,180 +1,136 @@
/datum/keybinding/mob
- category = CATEGORY_HUMAN
-
+ category = KEYBIND_CATEGORY_HUMAN
/datum/keybinding/mob/can_use(client/user)
return ismob(user.mob) ? TRUE : FALSE
-
/datum/keybinding/mob/cycle_intent_right
- hotkey_keys = list("G", "Insert")
name = "cycle_intent_right"
full_name = "Сycle Intent: Right"
description = ""
-
+ hotkey_keys = list("G")
/datum/keybinding/mob/cycle_intent_right/down(client/user)
var/mob/M = user.mob
M.a_intent_change(INTENT_HOTKEY_RIGHT)
return TRUE
-
/datum/keybinding/mob/cycle_intent_left
- hotkey_keys = list("F")
name = "cycle_intent_left"
full_name = "Сycle Intent: Left"
description = ""
-
+ hotkey_keys = list("F")
/datum/keybinding/mob/cycle_intent_left/down(client/user)
var/mob/M = user.mob
M.a_intent_change(INTENT_HOTKEY_LEFT)
return TRUE
-
/datum/keybinding/mob/activate_inhand
- hotkey_keys = list("Z", "Y","Southeast") // Southeast = PAGEDOWN
name = "activate_inhand"
full_name = "Activate In-Hand"
description = "Uses whatever item you have inhand"
-
+ hotkey_keys = list("Z")
/datum/keybinding/mob/activate_inhand/down(client/user)
var/mob/M = user.mob
M.mode()
return TRUE
-
/datum/keybinding/mob/target_head_cycle
- hotkey_keys = list("Numpad8")
name = "target_head_cycle"
full_name = "Target: Cycle Head"
description = ""
-
+ hotkey_keys = list("Numpad8")
/datum/keybinding/mob/target_head_cycle/down(client/user)
user.body_toggle_head()
return TRUE
-
/datum/keybinding/mob/target_r_arm
- hotkey_keys = list("Numpad4")
name = "target_r_arm"
full_name = "Target: Right Arm"
description = ""
-
+ hotkey_keys = list("Numpad4")
/datum/keybinding/mob/target_r_arm/down(client/user)
user.body_r_arm()
return TRUE
-
/datum/keybinding/mob/target_body_chest
- hotkey_keys = list("Numpad5")
name = "target_body_chest"
full_name = "Target: Body"
description = ""
-
+ hotkey_keys = list("Numpad5")
/datum/keybinding/mob/target_body_chest/down(client/user)
user.body_chest()
return TRUE
-
/datum/keybinding/mob/target_left_arm
- hotkey_keys = list("Numpad6")
name = "target_left_arm"
full_name = "Target: Left Arm"
description = ""
-
+ hotkey_keys = list("Numpad6")
/datum/keybinding/mob/target_left_arm/down(client/user)
user.body_l_arm()
return TRUE
-
/datum/keybinding/mob/target_right_leg
- hotkey_keys = list("Numpad1")
name = "target_right_leg"
full_name = "Target: Right leg"
description = ""
-
+ hotkey_keys = list("Numpad1")
/datum/keybinding/mob/target_right_leg/down(client/user)
user.body_r_leg()
return TRUE
-
/datum/keybinding/mob/target_body_groin
- hotkey_keys = list("Numpad2")
name = "target_body_groin"
full_name = "Target: Groin"
description = ""
-
+ hotkey_keys = list("Numpad2")
/datum/keybinding/mob/target_body_groin/down(client/user)
user.body_groin()
return TRUE
-
/datum/keybinding/mob/target_left_leg
- hotkey_keys = list("Numpad3")
name = "target_left_leg"
full_name = "Target: Left Leg"
description = ""
-
+ hotkey_keys = list("Numpad3")
/datum/keybinding/mob/target_left_leg/down(client/user)
user.body_l_leg()
return TRUE
-
-/datum/keybinding/mob/prevent_movement
- hotkey_keys = list("Ctrl")
- name = "block_movement"
- full_name = "Block movement"
- description = "Prevents you from moving"
-
-
-/datum/keybinding/mob/prevent_movement/down(client/user)
- user.movement_locked = TRUE
- return TRUE
-
-
-/datum/keybinding/mob/prevent_movement/up(client/user)
- user.movement_locked = FALSE
- return TRUE
-
-
/datum/keybinding/mob/move_up
- hotkey_keys = list(",", "=")
name = "move_up"
full_name = "Move Up"
description = "Makes you go up"
-
+ hotkey_keys = list(",", "=")
/datum/keybinding/mob/move_up/down(client/user)
var/mob/M = user.mob
M.move_up()
-
/datum/keybinding/mob/move_down
- hotkey_keys = list(".", "-")
name = "move_down"
full_name = "Move Down"
description = "Makes you go down"
-
+ hotkey_keys = list(".", "-")
/datum/keybinding/mob/move_down/down(client/user)
var/mob/M = user.mob
M.down()
-
/datum/keybinding/mob/toggle_gun_mode
- hotkey_keys = list("J")
name = "toggle_gun_mode"
full_name = "Toggle Gun Mode"
-
+ hotkey_keys = list("J")
/datum/keybinding/mob/toggle_gun_mode/down(client/user)
var/mob/M = user.mob
diff --git a/mods/ssinput/code/keybindings/movement.dm b/code/datums/keybindings/movement.dm
similarity index 70%
rename from mods/ssinput/code/keybindings/movement.dm
rename to code/datums/keybindings/movement.dm
index b77f65d715b46..f84f1ee39e9eb 100644
--- a/mods/ssinput/code/keybindings/movement.dm
+++ b/code/datums/keybindings/movement.dm
@@ -1,20 +1,17 @@
/datum/keybinding/movement
- category = CATEGORY_MOVEMENT
-
+ category = KEYBIND_CATEGORY_MOVEMENT
/datum/keybinding/movement/north
- hotkey_keys = list("W", "North")
name = "North"
full_name = "Move North"
description = "Moves your character north"
-
+ hotkey_keys = list("W", "North")
/datum/keybinding/movement/south
- hotkey_keys = list("S", "South")
name = "South"
full_name = "Move South"
description = "Moves your character south"
-
+ hotkey_keys = list("S", "South")
/datum/keybinding/movement/west
hotkey_keys = list("A", "West")
@@ -22,26 +19,36 @@
full_name = "Move West"
description = "Moves your character left"
-
/datum/keybinding/movement/east
hotkey_keys = list("D", "East")
name = "East"
full_name = "Move East"
description = "Moves your character east"
-
/datum/keybinding/movement/move_quickly
hotkey_keys = list("Shift")
name = "moving_quickly"
full_name = "Move Quickly"
description = "Makes you move quickly"
-
/datum/keybinding/movement/move_quickly/down(client/user)
user.setmovingquickly()
return TRUE
-
/datum/keybinding/movement/move_quickly/up(client/user)
user.setmovingslowly()
return TRUE
+
+/datum/keybinding/movement/prevent_movement
+ name = "block_movement"
+ full_name = "Block movement"
+ description = "Prevents you from moving"
+ hotkey_keys = list("Ctrl")
+
+/datum/keybinding/movement/prevent_movement/down(client/user)
+ user.movement_locked = TRUE
+ return TRUE
+
+/datum/keybinding/movement/prevent_movement/up(client/user)
+ user.movement_locked = FALSE
+ return TRUE
diff --git a/mods/ssinput/code/keybindings/robot.dm b/code/datums/keybindings/robot.dm
similarity index 97%
rename from mods/ssinput/code/keybindings/robot.dm
rename to code/datums/keybindings/robot.dm
index 808b5173dcae1..91d1d2d2ddc87 100644
--- a/mods/ssinput/code/keybindings/robot.dm
+++ b/code/datums/keybindings/robot.dm
@@ -1,82 +1,69 @@
/datum/keybinding/robot
- category = CATEGORY_ROBOT
-
+ category = KEYBIND_CATEGORY_ROBOT
/datum/keybinding/robot/can_use(client/user)
return isrobot(user.mob)
-
/datum/keybinding/robot/moduleone
- hotkey_keys = list("1")
name = "module_one"
full_name = "Toggle Module 1"
description = "Equips or unequips the first module"
-
+ hotkey_keys = list("1")
/datum/keybinding/robot/moduleone/down(client/user)
var/mob/living/silicon/robot/R = user.mob
R.toggle_module(1)
return TRUE
-
/datum/keybinding/robot/moduletwo
- hotkey_keys = list("2")
name = "module_two"
full_name = "Toggle Module 2"
description = "Equips or unequips the second module"
-
+ hotkey_keys = list("2")
/datum/keybinding/robot/moduletwo/down(client/user)
var/mob/living/silicon/robot/R = user.mob
R.toggle_module(2)
return TRUE
-
/datum/keybinding/robot/modulethree
- hotkey_keys = list("3")
name = "module_three"
full_name = "Toggle Module 3"
description = "Equips or unequips the third module"
-
+ hotkey_keys = list("3")
/datum/keybinding/robot/modulethree/down(client/user)
var/mob/living/silicon/robot/R = user.mob
R.toggle_module(3)
return TRUE
-
/datum/keybinding/robot/intent_cycle
- hotkey_keys = list("4")
name = "cycle_intent"
full_name = "Cycle Intent Left"
description = "Cycles the intent left"
-
+ hotkey_keys = list("4")
/datum/keybinding/robot/intent_cycle/down(client/user)
var/mob/living/silicon/robot/R = user.mob
R.a_intent_change(INTENT_HOTKEY_LEFT)
return TRUE
-
/datum/keybinding/robot/module_cycle
- hotkey_keys = list("X")
name = "cycle_modules"
full_name = "Cycle Modules"
description = "Cycles your modules"
-
+ hotkey_keys = list("X")
/datum/keybinding/robot/module_cycle/down(client/user)
var/mob/living/silicon/robot/R = user.mob
R.cycle_modules()
return TRUE
-
/datum/keybinding/robot/unequip_module
- hotkey_keys = list("Q")
name = "unequip_module"
full_name = "Unequip Module"
description = "Unequips the active module"
-
+ hotkey_keys = list("Q")
/datum/keybinding/robot/unequip_module/down(client/user)
var/mob/living/silicon/robot/R = user.mob
diff --git a/code/modules/admin/callproc/callproc.dm b/code/modules/admin/callproc/callproc.dm
index d5fa55c482592..175bb83743e56 100644
--- a/code/modules/admin/callproc/callproc.dm
+++ b/code/modules/admin/callproc/callproc.dm
@@ -203,20 +203,21 @@
holder.callproc.waiting_for_click = 0
holder.callproc.do_args()
-// [SIERRA-REMOVE] - SSINPUT - Я не комментирую по правилам (/* */) чтобы точно вызвать конфликт. Он нам здесь нужен.
-// /client/Click(atom/A)
-// if(!user_acted(src))
-// return
-// if(holder && holder.callproc && holder.callproc.waiting_for_click)
-// if(alert("Do you want to select \the [A] as the [length(holder.callproc.arguments)+1]\th argument?",, "Yes", "No") == "Yes")
-// holder.callproc.arguments += A
-
-// holder.callproc.waiting_for_click = 0
-// verbs -= /client/proc/cancel_callproc_select
-// holder.callproc.do_args()
-// else
-// return ..()
-// [/SIERRA-REMOVE]
+/client/Click(atom/A)
+ if(!user_acted(src))
+ return
+
+ if(holder && holder.callproc && holder.callproc.waiting_for_click)
+ if(alert("Do you want to select \the [A] as the [length(holder.callproc.arguments)+1]\th argument?",, "Yes", "No") == "Yes")
+ holder.callproc.arguments += A
+
+ holder.callproc.waiting_for_click = 0
+ verbs -= /client/proc/cancel_callproc_select
+ holder.callproc.do_args()
+ return
+
+ update_hotkey_mode()
+ return ..()
/datum/callproc/proc/finalise()
var/returnval
diff --git a/code/modules/client/client_defines.dm b/code/modules/client/client_defines.dm
index 3c794b205f104..d4b0eccb2546e 100644
--- a/code/modules/client/client_defines.dm
+++ b/code/modules/client/client_defines.dm
@@ -65,6 +65,26 @@
*/
preload_rsc = 0
+ /// Custom movement keys for this client
+ var/list/movement_keys = list()
+ /// Are we locking our movement input?
+ var/movement_locked = FALSE
+
+ /// A buffer of currently held keys.
+ var/list/keys_held = list()
+ /// A buffer for combinations such of modifiers + keys (ex: CtrlD, AltE, ShiftT). Format: `"key"` -> `"combo"` (ex: `"D"` -> `"CtrlD"`)
+ var/list/key_combos_held = list()
+ /*
+ ** These next two vars are to apply movement for keypresses and releases made while move delayed.
+ ** Because discarding that input makes the game less responsive.
+ */
+ /// On next move, add this dir to the move that would otherwise be done
+ var/next_move_dir_add
+ /// On next move, subtract this dir from the move that would otherwise be done
+ var/next_move_dir_sub
+ /// Movement dir of the most recently pressed movement key. Used in cardinal-only movement mode.
+ var/last_move_dir_pressed
+
var/fullscreen = FALSE
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index cc93440633581..35c858cb2a10b 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -47,7 +47,6 @@ GLOBAL_LIST_INIT(localhost_addresses, list(
if(!asset_cache_job)
return
-
//search the href for script injection
if(findtext(href,"
- "}
- winshow(user, "capturekeypress", TRUE)
- var/datum/browser/popup = new(user, "capturekeypress", "
Keybindings
", 350, 300)
- popup.set_content(HTML)
- popup.open(FALSE)
-
-
/datum/category_item/player_setup_item/controls/keybindings/OnTopic(href, list/href_list, mob/user)
switch(href_list["preference"])
if("keybindings_capture")
- var/datum/keybinding/kb = global.keybindings_by_name[href_list["keybinding"]]
+ var/datum/keybinding/kb = GLOB.keybindings_by_name[href_list["keybinding"]]
var/old_key = href_list["old_key"]
capture_keybinding(user, kb, old_key)
return TOPIC_REFRESH
@@ -174,8 +115,8 @@
close_browser(user, "window=capturekeypress")
return TOPIC_REFRESH
- if(global._kbMap[new_key])
- new_key = global._kbMap[new_key]
+ if(GLOB.keybindings_map[new_key])
+ new_key = GLOB.keybindings_map[new_key]
var/full_key
switch(new_key)
@@ -201,7 +142,7 @@
return TOPIC_REFRESH
if("keybindings_reset")
- pref.key_bindings = deepCopyList(global.hotkey_keybinding_list_by_key)
+ pref.key_bindings = deepCopyList(GLOB.hotkey_keybinding_list_by_key)
user.client.set_macros()
return TOPIC_REFRESH
@@ -216,7 +157,7 @@
if(!length(pref.key_bindings[old_key]))
pref.key_bindings -= old_key
- var/datum/keybinding/kb = global.keybindings_by_name[kb_name]
+ var/datum/keybinding/kb = GLOB.keybindings_by_name[kb_name]
for(var/key in kb.hotkey_keys)
pref.key_bindings[key] += list(kb_name)
pref.key_bindings[key] = sortTim(pref.key_bindings[key], GLOBAL_PROC_REF(cmp_text_asc))
@@ -224,18 +165,3 @@
return TOPIC_REFRESH
return ..()
-
-
-/proc/sanitize_keybindings(value)
- var/list/base_bindings = sanitize_islist(value,list())
- for(var/key in base_bindings)
- base_bindings[key] = base_bindings[key] & global.keybindings_by_name
- if(!length(base_bindings[key]))
- base_bindings -= key
- return base_bindings
-
-/proc/sanitize_islist(value, default)
- if(islist(value) && length(value))
- return value
- if(default)
- return default
diff --git a/code/modules/client/preference_setup/keybindings/keybindings_proc.dm b/code/modules/client/preference_setup/keybindings/keybindings_proc.dm
new file mode 100644
index 0000000000000..50d44f275c688
--- /dev/null
+++ b/code/modules/client/preference_setup/keybindings/keybindings_proc.dm
@@ -0,0 +1,61 @@
+/datum/category_item/player_setup_item/controls/keybindings/proc/pretty_keybinding_name(keybinding)
+ var/list/keys = list()
+ var/static/regex/modKeys = regex("Shift|Ctrl|Alt")
+
+ while(modKeys.Find(keybinding))
+ keys += modKeys.match
+ keybinding = copytext(keybinding, length(modKeys.match)+1)
+
+ if (keybinding)
+ keys += keybinding
+
+ return jointext(keys, "+")
+
+/datum/category_item/player_setup_item/controls/keybindings/proc/capture_keybinding(mob/user, datum/keybinding/kb, old_key)
+ var/HTML = {"
+
+ Keybinding: [kb.full_name]
[kb.description]
+
+ Press any key to change
Press ESC to clear
+
+
+ "}
+ winshow(user, "capturekeypress", TRUE)
+ var/datum/browser/popup = new(user, "capturekeypress", "Keybindings
", 350, 300)
+ popup.set_content(HTML)
+ popup.open(FALSE)
+
+/proc/sanitize_keybindings(value)
+ var/list/base_bindings = sanitize_islist(value,list())
+ for(var/key in base_bindings)
+ base_bindings[key] = base_bindings[key] & GLOB.keybindings_by_name
+ if(!length(base_bindings[key]))
+ base_bindings -= key
+ return base_bindings
+
+/proc/sanitize_islist(value, default)
+ if(islist(value) && length(value))
+ return value
+ if(default)
+ return default
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index 4f215705beadf..8155ebf502f12 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -50,6 +50,7 @@
..()
/datum/preferences/proc/setup()
+ key_bindings = deepCopyList(GLOB.hotkey_keybinding_list_by_key)
if(!length(GLOB.skills))
GET_SINGLETON(/singleton/hierarchy/skill)
player_setup = new(src)
@@ -58,6 +59,7 @@
b_type = RANDOM_BLOOD_TYPE
if(client)
+ client.set_macros()
if(IsGuestKey(client.key))
is_guest = TRUE
else
@@ -490,3 +492,48 @@
priority = selected_branches_assoc(priority)
for (var/callback in callbacks)
. += for_each_selected_branch(callback, priority)
+
+/// checks through keybindings for outdated unbound keys and updates them
+/datum/preferences/proc/check_keybindings()
+ if(!client)
+ return
+
+ // When loading from savefile key_binding can be null
+ // This happens when player had savefile created before new kb system, but hotkeys was not saved
+ if(!length(key_bindings))
+ key_bindings = deepCopyList(GLOB.hotkey_keybinding_list_by_key) // give them default keybinds too
+
+ var/list/user_binds = list()
+ for (var/key in key_bindings)
+ for(var/kb_name in key_bindings[key])
+ user_binds[kb_name] += list(key)
+ var/list/notadded = list()
+ for (var/name in GLOB.keybindings_by_name)
+ var/datum/keybinding/kb = GLOB.keybindings_by_name[name]
+ if(length(user_binds[kb.name]))
+ continue // key is unbound and or bound to something
+ var/addedbind = FALSE
+ if(hotkeys)
+ for(var/hotkeytobind in kb.hotkey_keys)
+ if(!length(key_bindings[hotkeytobind]) || hotkeytobind == "Unbound") //Only bind to the key if nothing else is bound expect for Unbound
+ LAZYADD(key_bindings[hotkeytobind], kb.name)
+ addedbind = TRUE
+ else
+ for(var/classickeytobind in kb.classic_keys)
+ if(!length(key_bindings[classickeytobind]) || classickeytobind == "Unbound") //Only bind to the key if nothing else is bound expect for Unbound
+ LAZYADD(key_bindings[classickeytobind], kb.name)
+ addedbind = TRUE
+ if(!addedbind)
+ notadded += kb
+
+ if(length(notadded))
+ addtimer(CALLBACK(src, PROC_REF(announce_conflict), notadded), 5 SECONDS)
+
+/datum/preferences/proc/announce_conflict(list/notadded)
+ to_chat(client, SPAN_DANGER("KEYBINDING CONFLICT.\n\
+ There are new keybindings that have defaults bound to keys you already set, They will default to Unbound. You can bind them in Setup Character or Game Preferences\n\
+ Or you can click here to go straight to the keybindings page."))
+ for(var/item in notadded)
+ var/datum/keybinding/conflicted = item
+ to_chat(client, SPAN_DANGER("[conflicted.category]: [conflicted.full_name] needs updating."))
+ LAZYADD(key_bindings["None"], conflicted.name) // set it to unbound to prevent this from opening up again in the future
diff --git a/mods/ssinput/code/general/bindings_client.dm b/code/modules/input/input.dm
similarity index 61%
rename from mods/ssinput/code/general/bindings_client.dm
rename to code/modules/input/input.dm
index 6b726890313a5..28a27c46732d6 100644
--- a/mods/ssinput/code/general/bindings_client.dm
+++ b/code/modules/input/input.dm
@@ -1,5 +1,23 @@
-// Clients aren't datums so we have to define these procs indpendently.
-// These verbs are called for all key press and release events
+/// Set a client's focus to an object and override these procs on that object to let it handle keypresses
+/// Called when a key is pressed down initially
+/datum/proc/key_down(key, client/user)
+ return
+
+/// Called when a key is released
+/datum/proc/key_up(key, client/user)
+ return
+
+/// Called once every frame
+/datum/proc/keyLoop(client/user)
+ return
+
+/// Called every game tick
+/client/keyLoop()
+ holder?.keyLoop(src)
+ mob.keyLoop(src)
+
+/// Clients aren't datums so we have to define these procs indpendently.
+/// These verbs are called for all key press and release events
/client/verb/keyDown(_key as text)
set hidden = TRUE
@@ -60,7 +78,7 @@
var/keycount = 0
for(var/kb_name in prefs.key_bindings[full_key])
keycount++
- var/datum/keybinding/kb = global.keybindings_by_name[kb_name]
+ var/datum/keybinding/kb = GLOB.keybindings_by_name[kb_name]
if(kb.can_use(src) && kb.down(src) && keycount >= MAX_COMMANDS_PER_KEY)
break
@@ -89,13 +107,59 @@
// We don't do full key for release, because for mod keys you
// can hold different keys and releasing any should be handled by the key binding specifically
for (var/kb_name in prefs.key_bindings[_key])
- var/datum/keybinding/kb = global.keybindings_by_name[kb_name]
+ var/datum/keybinding/kb = GLOB.keybindings_by_name[kb_name]
if(kb.can_use(src) && kb.up(src))
break
holder?.key_up(_key, src)
mob.key_up(_key, src)
-// Called every game tick
-/client/keyLoop()
- holder?.keyLoop(src)
- mob.keyLoop(src)
+// removes all the existing macros
+/client/proc/erase_all_macros()
+ var/erase_output = ""
+ var/list/macro_set = params2list(winget(src, "default.*", "command")) // The third arg doesnt matter here as we're just removing them all
+ for(var/k in 1 to length(macro_set))
+ var/list/split_name = splittext(macro_set[k], ".")
+ var/macro_name = "[split_name[1]].[split_name[2]]" // [3] is "command"
+ erase_output = "[erase_output];[macro_name].parent=null"
+ winset(src, null, erase_output)
+
+
+/client/proc/set_macros()
+ set waitfor = FALSE
+
+ //Reset the buffer
+ reset_held_keys()
+ erase_all_macros()
+
+ var/list/macro_set = SSinput.macro_set
+ for(var/k in 1 to length(macro_set))
+ var/key = macro_set[k]
+ var/command = macro_set[key]
+ winset(src, "default-\ref[key]", "parent=default;name=[key];command=[command]")
+
+ update_special_keybinds()
+
+/client/proc/reset_macros(skip_alert = FALSE)
+ var/answer
+ if(!skip_alert)
+ answer = tgui_alert(src, "Change your keyboard language to ENG", "Reset macros")
+
+ if(skip_alert || answer)
+ set_macros()
+ to_chat(src, SPAN_NOTICE("Keybindings were fixed.")) // not yet but set_macros works fast enough
+
+/**
+ * Manually clears any held keys, in case due to lag or other undefined behavior a key gets stuck.
+ *
+ * Hardcoded to the ESC key.
+ */
+/client/verb/reset_held_keys()
+ set name = "Reset Held Keys"
+ set hidden = TRUE
+
+ for(var/key in keys_held)
+ keyUp(key)
+
+ //In case one got stuck and the previous loop didn't clean it, somehow.
+ for(var/key in key_combos_held)
+ keyUp(key_combos_held[key])
diff --git a/mods/ssinput/code/general/bindings_atom.dm b/code/modules/input/movement.dm
similarity index 99%
rename from mods/ssinput/code/general/bindings_atom.dm
rename to code/modules/input/movement.dm
index bd024fb42e338..94f7827d44cc9 100644
--- a/mods/ssinput/code/general/bindings_atom.dm
+++ b/code/modules/input/movement.dm
@@ -3,7 +3,6 @@
// You might be wondering why this isn't client level. If focus is null, we don't want you to move.
// Only way to do that is to tie the behavior into the focus's keyLoop().
-
/atom/movable/keyLoop(client/user)
var/movement_dir = 0
for(var/_key in user.keys_held)
@@ -29,7 +28,6 @@
user.next_move_dir_add = 0
user.next_move_dir_sub = 0
-
/**
* A wrapper for setDir that should only be able to fail by living mobs.
*
diff --git a/mods/global_modpacks.dm b/mods/global_modpacks.dm
index 7cf815ad84446..94639e95b2db7 100644
--- a/mods/global_modpacks.dm
+++ b/mods/global_modpacks.dm
@@ -17,7 +17,6 @@
#include "music_player/_music_player.dme"
#include "ntnet/_ntnet.dme"
#include "nyc_posters/_nyc_posters.dme"
-#include "ssinput/_ssinput.dme"
#include "statusbar/_statusbar.dme"
#include "utf8/_utf8.dme"
#include "utility_items/_utility_items.dme"
diff --git a/mods/ssinput/README.md b/mods/ssinput/README.md
deleted file mode 100644
index be410f081c4f1..0000000000000
--- a/mods/ssinput/README.md
+++ /dev/null
@@ -1,98 +0,0 @@
-
-#### Список PRов:
-
-- https://github.com/SierraBay/SierraBay12/pull/908
--https://github.com/SierraBay/SierraBay12/pull/1824
-
-
-
-## SSinput
-
-ID мода: SSINPUT
-
-
-### Описание мода
-
-Кейбинды, диагональное передвижение и русская раскладка - то, что делает этот мод.
-
-
-### Изменения *кор кода*
-
-- `code/__defines/subsystem-priority.dm`: `#define SS_PRIORITY_INPUT`
-- `code/__defines/subsystems.dm`: `#define SS_INIT_INPUT`
-- `code/_onclick/click.dm`: `/mob/proc/MiddleClickOn()`
-- `code/datums/movement/mob.dm`: `/datum/movement_handler/mob/movement/DoMove()`
-- `code/game/objects/buckling.dm`: `/obj/Move()`, `/obj/forceMove()`
-- `code/game/verbs/ooc.dm`: `/client/verb/ooc()`, `/client/verb/looc()`
-- `code/modules/admin/callproc/callproc.dm`: `/client/Click()`
-- `code/modules/client/client_procs.dm`: `/client/New()`, `/client/verb/toggle_fullscreen()`
-- `code/modules/goonchat/browserOutput.dm`: `/datum/chatOutput/Topic()`
-- `code/modules/mob/grab/grab_datum.dm`: `/datum/grab/proc/adjust_position()`
-- `code/modules/mob/living/silicon/robot/login.dm`: `/mob/living/silicon/robot/Login()`
-- `code/modules/mob/observer/ghost/ghost.dm`: `/mob/observer/ghost/appearance_flags`
-- `code/modules/mob/login.dm`: `/mob/Login()`
-- `code/modules/mob/mob_defines.dm`: `/mob/appearance_flags`
-- `code/modules/mob/mob_helpers.dm`: `/mob/verb/a_intent_change()`
-- `code/modules/mob/living/carbon/human/inventory.dm`: `/mob/living/carbon/human/verb/quick_equip()`
-- `code/modules/ventcrawl/ventcrawl_atmospherics.dm`: `/obj/machinery/atmospherics/relaymove()`
-
-
-
-### Оверрайды
-
-- `mods/ssinput/code/general/client.dm`: `/client/Topic()`
-- `mods/ssinput/code/general/preferences.dm`: `/datum/preferences/setup()`
-- `mods/ssinput/code/global_lists.dm`: `/hook/global_init/makeDatumRefLists()`
-
-
-### Дефайны
-
-- `code/__defines/subsystem-priority.dm`: `SS_PRIORITY_INPUT`
-- `code/__defines/subsystems.dm`: `SS_INIT_INPUT`
-
-
-### Используемые файлы, не содержащиеся в модпаке
-
-- Отсутствуют
-
-
-### Авторы:
-
-SuhEugene
-
diff --git a/mods/ssinput/_ssinput.dm b/mods/ssinput/_ssinput.dm
deleted file mode 100644
index 25fcc9f9c6bbb..0000000000000
--- a/mods/ssinput/_ssinput.dm
+++ /dev/null
@@ -1,4 +0,0 @@
-/singleton/modpack/ssinput
- name = "SSinput"
- desc = "Кейбинды, диагональное передвижение и русская раскладка - то, что делает этот мод."
- author = "SuhEugene"
diff --git a/mods/ssinput/_ssinput.dme b/mods/ssinput/_ssinput.dme
deleted file mode 100644
index 360cd045ce9c7..0000000000000
--- a/mods/ssinput/_ssinput.dme
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef MODPACK_SSINPUT
-#define MODPACK_SSINPUT
-
-// SIERRA TODO: УДАЛИТЬ МОД ЛИБО ПЕРЕДЕЛАТЬ ПО ГАЙДУ МОДУЛЯРИЗАЦИИ
-// SIERRA FIXME: УДАЛИТЬ МОД ЛИБО ПЕРЕДЕЛАТЬ ПО ГАЙДУ МОДУЛЯРИЗАЦИИ
-
-#include "_ssinput.dm"
-
-// Табы тут для удобства чтения
-// Синтаксически они ничего не значат
-
-#include "code/_defines.dm"
-
- #include "code/global_lists.dm"
- #include "code/global_maps.dm"
-
- #include "code/general/bindings_atom.dm"
- #include "code/general/bindings_client.dm"
- #include "code/general/bindings_setup.dm"
- #include "code/general/client.dm"
- #include "code/general/preference_setup.dm"
- #include "code/general/preferences.dm"
- #include "code/general/subsystem.dm"
-
- #include "code/keybindings/_defines.dm"
- #include "code/keybindings/_keybinding.dm"
- #include "code/keybindings/admin.dm"
- #include "code/keybindings/carbon.dm"
- #include "code/keybindings/client.dm"
- #include "code/keybindings/communication.dm"
- #include "code/keybindings/human.dm"
- #include "code/keybindings/living.dm"
- #include "code/keybindings/mob.dm"
- #include "code/keybindings/movement.dm"
- #include "code/keybindings/robot.dm"
- #include "code/keybindings/_undefines.dm"
-
-#include "code/_undefines.dm"
-
-#endif
diff --git a/mods/ssinput/code/README.md b/mods/ssinput/code/README.md
deleted file mode 100644
index 008135bba3404..0000000000000
--- a/mods/ssinput/code/README.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# In-code keypress handling system
-
-This whole system is heavily based off of forum_account's keyboard library.
-Thanks to forum_account for saving the day, the library can be found
-[here](https://secure.byond.com/developer/Forum_account/Keyboard)!
-
-.dmf macros have some very serious shortcomings. For example, they do not allow reusing parts
-of one macro in another, so giving cyborgs their own shortcuts to swap active module couldn't
-inherit the movement that all mobs should have anyways. The webclient only supports one macro,
-so having more than one was problematic. Additionally each keybind has to call an actual
-verb, which meant a lot of hidden verbs that just call one other proc. Also our existing
-macro was really bad and tied unrelated behavior into `Northeast()`, `Southeast()`, `Northwest()`,
-and `Southwest()`.
-
-The basic premise of this system is to not screw with .dmf macro setup at all and handle
-pressing those keys in the code instead. We have every key call `client.keyDown()`
-or `client.keyUp()` with the pressed key as an argument. Certain keys get processed
-directly by the client because they should be doable at any time, then we call
-`keyDown()` or `keyUp()` on the client's holder and the client's mob's focus.
-By default `mob.focus` is the mob itself, but you can set it to any datum to give control of a
-client's keypresses to another object. This would be a good way to handle a menu or driving
-a mech. You can also set it to null to disregard input from a certain user.
-
-Movement is handled by having each client call `client.keyLoop()` every game tick.
-As above, this calls holder and `focus.keyLoop()`. `atom/movable/keyLoop()` handles movement
-Try to keep the calculations in this proc light. It runs every tick for every client after all!
-
-You can also tell which keys are being held down now. Each client a list of keys pressed called
-`keys_held`. Each entry is a key as a text string associated with the world.time when it was
-pressed.
-
-Notes about certain keys:
-
-* `Tab` has client-sided behavior but acts normally
-* `T`, `O`, and `M` move focus to the input when pressed. This fires the keyUp macro right away.
-* `\` needs to be escaped in the dmf so any usage is `\\`
-
-You cannot `TICK_CHECK` or check `world.tick_usage` inside of procs called by key down and up
-events. They happen outside of a byond tick and have no meaning there. Key looping
-works correctly since it's part of a subsystem, not direct input.
diff --git a/mods/ssinput/code/_undefines.dm b/mods/ssinput/code/_undefines.dm
deleted file mode 100644
index a87ee6556ad41..0000000000000
--- a/mods/ssinput/code/_undefines.dm
+++ /dev/null
@@ -1,7 +0,0 @@
-#undef MAX_KEYPRESS_COMMANDLENGTH
-#undef MAX_COMMANDS_PER_KEY
-#undef MAX_KEYS_PER_KEYBIND
-#undef HELD_KEY_BUFFER_LENGTH
-
-#undef INTENT_HOTKEY_LEFT
-#undef INTENT_HOTKEY_RIGHT
diff --git a/mods/ssinput/code/general/bindings_setup.dm b/mods/ssinput/code/general/bindings_setup.dm
deleted file mode 100644
index c162444a6cdf4..0000000000000
--- a/mods/ssinput/code/general/bindings_setup.dm
+++ /dev/null
@@ -1,76 +0,0 @@
-// Set a client's focus to an object and override these procs on that object to let it handle keypresses
-
-/datum/proc/key_down(key, client/user) // Called when a key is pressed down initially
- return
-
-
-/datum/proc/key_up(key, client/user) // Called when a key is released
- return
-
-
-/datum/proc/keyLoop(client/user) // Called once every frame
- set waitfor = FALSE
- return
-
-
-// removes all the existing macros
-/client/proc/erase_all_macros()
- var/erase_output = ""
- var/list/macro_set = params2list(winget(src, "default.*", "command")) // The third arg doesnt matter here as we're just removing them all
- for(var/k in 1 to length(macro_set))
- var/list/split_name = splittext(macro_set[k], ".")
- var/macro_name = "[split_name[1]].[split_name[2]]" // [3] is "command"
- erase_output = "[erase_output];[macro_name].parent=null"
- winset(src, null, erase_output)
-
-
-/client/proc/set_macros()
- set waitfor = FALSE
-
- //Reset the buffer
- reset_held_keys()
-
- erase_all_macros()
-
- var/list/macro_set = SSinput.macro_set
- for(var/k in 1 to length(macro_set))
- var/key = macro_set[k]
- var/command = macro_set[key]
- winset(src, "default-\ref[key]", "parent=default;name=[key];command=[command]")
-
- update_special_keybinds()
-
-
-// byond bug ID:2694120
-/client/verb/reset_macros_wrapper()
- set category = "OOC"
- set name = "Fix Keybindings"
-
- reset_macros()
-
-
-/client/proc/reset_macros(skip_alert = FALSE)
- var/ans
- if(!skip_alert)
- ans = alert(src, "Change your keyboard language to ENG", "Reset macros")
-
- if(skip_alert || ans)
- set_macros()
- to_chat(src, SPAN_NOTICE("Keybindings were fixed.")) // not yet but set_macros works fast enough
-
-
-/**
- * Manually clears any held keys, in case due to lag or other undefined behavior a key gets stuck.
- *
- * Hardcoded to the ESC key.
- */
-/client/verb/reset_held_keys()
- set name = "Reset Held Keys"
- set hidden = TRUE
-
- for(var/key in keys_held)
- keyUp(key)
-
- //In case one got stuck and the previous loop didn't clean it, somehow.
- for(var/key in key_combos_held)
- keyUp(key_combos_held[key])
diff --git a/mods/ssinput/code/general/client.dm b/mods/ssinput/code/general/client.dm
deleted file mode 100644
index 22652658ed59f..0000000000000
--- a/mods/ssinput/code/general/client.dm
+++ /dev/null
@@ -1,116 +0,0 @@
-/client
- /// Custom movement keys for this client
- var/list/movement_keys = list()
- /// Are we locking our movement input?
- var/movement_locked = FALSE
-
- /// A buffer of currently held keys.
- var/list/keys_held = list()
- /// A buffer for combinations such of modifiers + keys (ex: CtrlD, AltE, ShiftT). Format: `"key"` -> `"combo"` (ex: `"D"` -> `"CtrlD"`)
- var/list/key_combos_held = list()
- /*
- ** These next two vars are to apply movement for keypresses and releases made while move delayed.
- ** Because discarding that input makes the game less responsive.
- */
- /// On next move, add this dir to the move that would otherwise be done
- var/next_move_dir_add
- /// On next move, subtract this dir from the move that would otherwise be done
- var/next_move_dir_sub
- /// Movement dir of the most recently pressed movement key. Used in cardinal-only movement mode.
- var/last_move_dir_pressed
-
-
-/datum/preferences
- var/dark_theme = FALSE
-
-/client/Click(atom/A)
- if(!user_acted(src))
- return
-
- if(holder && holder.callproc && holder.callproc.waiting_for_click)
- if(alert("Do you want to select \the [A] as the [length(holder.callproc.arguments)+1]\th argument?",, "Yes", "No") == "Yes")
- holder.callproc.arguments += A
-
- holder.callproc.waiting_for_click = 0
- verbs -= /client/proc/cancel_callproc_select
- holder.callproc.do_args()
- return
-
- update_hotkey_mode()
-
- return ..()
-
-
-/**
- * Updates the keybinds for special keys
- *
- * Handles adding macros for the keys that need it
- * And adding movement keys to the clients movement_keys list
- * At the time of writing this, communication(OOC, Say, IC) require macros
- * Arguments:
- * * direct_prefs - the preference we're going to get keybinds from
- */
-/client/proc/update_special_keybinds(datum/preferences/direct_prefs)
- var/datum/preferences/D = prefs || direct_prefs
- if(!D?.key_bindings)
- return
- movement_keys = list()
- var/list/communication_hotkeys = list()
- for(var/key in D.key_bindings)
- for(var/kb_name in D.key_bindings[key])
- switch(kb_name)
- if("North")
- movement_keys[key] = NORTH
- if("East")
- movement_keys[key] = EAST
- if("West")
- movement_keys[key] = WEST
- if("South")
- movement_keys[key] = SOUTH
- if("Say")
- winset(src, "default-[REF(key)]", "parent=default;name=[key];command=say")
- communication_hotkeys += key
- if("OOC")
- winset(src, "default-[REF(key)]", "parent=default;name=[key];command=ooc")
- communication_hotkeys += key
- if("Me")
- winset(src, "default-[REF(key)]", "parent=default;name=[key];command=me")
- communication_hotkeys += key
-
- // winget() does not work for F1 and F2
- for(var/key in communication_hotkeys)
- if(!(key in list("F1","F2")) && !winget(src, "default-[REF(key)]", "command"))
- to_chat(src, "You probably entered the game with a different keyboard layout.\nPlease switch to the English layout and click here to fix the communication hotkeys.")
- break
-
-/client/verb/ToggleHotkeyMode()
- set hidden = TRUE
- prefs.hotkeys = !prefs.hotkeys
- update_hotkey_mode()
-
-/client/proc/update_hotkey_mode()
- if(prefs.hotkeys)
- // If hotkey mode is enabled, then clicking the map will automatically
- // unfocus the text bar. This removes the red color from the text bar
- // so that the visual focus indicator matches reality.
- winset(src, "mainwindow.mainwindow", "macro=default")
- winset(src, "mapwindow.map", "focus=true")
- winset(src, "outputwindow.hotkeytoggle", "is-checked=true")
- winset(src, "outputwindow.input", " border=line")
- else
- winset(src, "mainwindow.mainwindow", "macro=macro")
- winset(src, "outputwindow.hotkeytoggle", "is-checked=false")
- winset(src, "outputwindow.input", "focus=true; border=sunken")
-
-// Я срал, Глист, на читаемость и отладку
-// Это уже протестировано и мы просто ждём пока на оффбей зальют эти кейбинды вонючие
-// Ну а если не зальют - так уж и быть, в коркод суну
-
-// SIERRA TODO: ПЕРЕНЕСТИ В КОР КОД ЕСЛИ ОФФЫ НЕ ЗАЛЬЮТ
-/client/Topic(href, href_list, hsrc)
- //byond bug ID:2694120
- if(href_list["reset_macros"])
- reset_macros(skip_alert = TRUE)
- return
-
- . = ..()
diff --git a/mods/ssinput/code/general/preferences.dm b/mods/ssinput/code/general/preferences.dm
deleted file mode 100644
index 62b60e79f85e8..0000000000000
--- a/mods/ssinput/code/general/preferences.dm
+++ /dev/null
@@ -1,62 +0,0 @@
-// Я срал, Глист, на читаемость и отладку
-// Это уже протестировано и мы просто ждём пока на оффбей зальют эти кейбинды вонючие
-// Ну а если не зальют - так уж и быть, в коркод суну
-
-// SIERRA TODO: ПЕРЕНЕСТИ В КОР КОД ЕСЛИ ОФФЫ НЕ ЗАЛЬЮТ
-/datum/preferences/setup()
- // give them default keybinds too
- key_bindings = deepCopyList(global.hotkey_keybinding_list_by_key)
-
- . = ..()
-
- if(client)
- client.set_macros()
-
-
-
-/// checks through keybindings for outdated unbound keys and updates them
-/datum/preferences/proc/check_keybindings()
- if(!client)
- return
-
- // When loading from savefile key_binding can be null
- // This happens when player had savefile created before new kb system, but hotkeys was not saved
- if(!length(key_bindings))
- key_bindings = deepCopyList(global.hotkey_keybinding_list_by_key) // give them default keybinds too
-
- var/list/user_binds = list()
- for (var/key in key_bindings)
- for(var/kb_name in key_bindings[key])
- user_binds[kb_name] += list(key)
- var/list/notadded = list()
- for (var/name in global.keybindings_by_name)
- var/datum/keybinding/kb = global.keybindings_by_name[name]
- if(length(user_binds[kb.name]))
- continue // key is unbound and or bound to something
- var/addedbind = FALSE
- if(hotkeys)
- for(var/hotkeytobind in kb.hotkey_keys)
- if(!length(key_bindings[hotkeytobind]) || hotkeytobind == "Unbound") //Only bind to the key if nothing else is bound expect for Unbound
- LAZYADD(key_bindings[hotkeytobind], kb.name)
- addedbind = TRUE
- else
- for(var/classickeytobind in kb.classic_keys)
- if(!length(key_bindings[classickeytobind]) || classickeytobind == "Unbound") //Only bind to the key if nothing else is bound expect for Unbound
- LAZYADD(key_bindings[classickeytobind], kb.name)
- addedbind = TRUE
- if(!addedbind)
- notadded += kb
-
- if(length(notadded))
- addtimer(CALLBACK(src, PROC_REF(announce_conflict), notadded), 5 SECONDS)
-
-
-
-/datum/preferences/proc/announce_conflict(list/notadded)
- to_chat(client, SPAN_DANGER("KEYBINDING CONFLICT.\n\
- There are new keybindings that have defaults bound to keys you already set, They will default to Unbound. You can bind them in Setup Character or Game Preferences\n\
- Or you can click here to go straight to the keybindings page."))
- for(var/item in notadded)
- var/datum/keybinding/conflicted = item
- to_chat(client, SPAN_DANGER("[conflicted.category]: [conflicted.full_name] needs updating."))
- LAZYADD(key_bindings["None"], conflicted.name) // set it to unbound to prevent this from opening up again in the future
diff --git a/mods/ssinput/code/global_lists.dm b/mods/ssinput/code/global_lists.dm
deleted file mode 100644
index 9430143688242..0000000000000
--- a/mods/ssinput/code/global_lists.dm
+++ /dev/null
@@ -1,13 +0,0 @@
-var/global/list/hotkey_keybinding_list_by_key = list()
-var/global/list/keybindings_by_name = list()
-
-/hook/global_init/makeDatumRefLists()
- . = ..()
- for(var/datum/keybinding/keybinding as anything in subtypesof(/datum/keybinding))
- if(!initial(keybinding.name))
- continue
- var/datum/keybinding/instance = new keybinding
- global.keybindings_by_name[instance.name] = instance
- if(length(instance.hotkey_keys))
- for(var/bound_key in instance.hotkey_keys)
- global.hotkey_keybinding_list_by_key[bound_key] += list(instance.name)
diff --git a/mods/ssinput/code/global_maps.dm b/mods/ssinput/code/global_maps.dm
deleted file mode 100644
index 82ed0b1b2d2ad..0000000000000
--- a/mods/ssinput/code/global_maps.dm
+++ /dev/null
@@ -1,29 +0,0 @@
-/// This is a mapping from JS keys to Byond - ref: https://keycode.info/
-var/global/list/_kbMap = list(
- "UP" = "North",
- "RIGHT" = "East",
- "DOWN" = "South",
- "LEFT" = "West",
- "INSERT" = "Insert",
- "HOME" = "Northwest",
- "PAGEUP" = "Northeast",
- "DEL" = "Delete",
- "END" = "Southwest",
- "PAGEDOWN" = "Southeast",
- "SPACEBAR" = "Space",
- "ALT" = "Alt",
- "SHIFT" = "Shift",
- "CONTROL" = "Ctrl"
-)
-
-/// Without alt, shift, ctrl and etc because its not necessary
-var/global/list/_kbMap_reverse = list(
- "North" = "Up",
- "East" = "Right",
- "South" = "Down",
- "West" = "Left",
- "Northwest" = "Home",
- "Northeast" = "PageUp",
- "Southwest" = "End",
- "Southeast" = "PageDown",
-)
diff --git a/mods/ssinput/code/keybindings/_defines.dm b/mods/ssinput/code/keybindings/_defines.dm
deleted file mode 100644
index 128e012ff3d7a..0000000000000
--- a/mods/ssinput/code/keybindings/_defines.dm
+++ /dev/null
@@ -1,9 +0,0 @@
-#define CATEGORY_CLIENT "CLIENT"
-#define CATEGORY_EMOTE "EMOTE"
-#define CATEGORY_ADMIN "ADMIN"
-#define CATEGORY_CARBON "CARBON"
-#define CATEGORY_HUMAN "HUMAN"
-#define CATEGORY_ROBOT "ROBOT"
-#define CATEGORY_MISC "MISC"
-#define CATEGORY_MOVEMENT "MOVEMENT"
-#define CATEGORY_COMMUNICATION "COMMUNICATION"
diff --git a/mods/ssinput/code/keybindings/_undefines.dm b/mods/ssinput/code/keybindings/_undefines.dm
deleted file mode 100644
index deeffbe4b75e1..0000000000000
--- a/mods/ssinput/code/keybindings/_undefines.dm
+++ /dev/null
@@ -1,9 +0,0 @@
-#undef CATEGORY_CLIENT
-#undef CATEGORY_EMOTE
-#undef CATEGORY_ADMIN
-#undef CATEGORY_CARBON
-#undef CATEGORY_HUMAN
-#undef CATEGORY_ROBOT
-#undef CATEGORY_MISC
-#undef CATEGORY_MOVEMENT
-#undef CATEGORY_COMMUNICATION
diff --git a/tgui/packages/tgui/hotkeys.ts b/tgui/packages/tgui/hotkeys.ts
index b55f3a7a9fc2d..7c34ea9043f1d 100644
--- a/tgui/packages/tgui/hotkeys.ts
+++ b/tgui/packages/tgui/hotkeys.ts
@@ -102,14 +102,14 @@ const handlePassthrough = (key: KeyEvent) => {
// Key_Down
if (key.isDown() && !keyState[byondKeyCode]) {
keyState[byondKeyCode] = true;
- const command = `Key_Down "${byondKeyCode}"`;
+ const command = `keyDown "${byondKeyCode}"`;
logger.debug(command);
return Byond.command(command);
}
// Key_Up
if (key.isUp() && keyState[byondKeyCode]) {
keyState[byondKeyCode] = false;
- const command = `Key_Up "${byondKeyCode}"`;
+ const command = `keyUp "${byondKeyCode}"`;
logger.debug(command);
return Byond.command(command);
}
@@ -138,7 +138,7 @@ export const releaseHeldKeys = () => {
if (keyState[byondKeyCode]) {
keyState[byondKeyCode] = false;
logger.log(`releasing key "${byondKeyCode}"`);
- Byond.command(`Key_Up "${byondKeyCode}"`);
+ Byond.command(`keyUp "${byondKeyCode}"`);
}
}
};