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,"