Skip to content

Commit

Permalink
De-modularize Input (#205)
Browse files Browse the repository at this point in the history
## Что этот PR делает
Достал инпут из модуля, нахуя? Не знаю :clueless:
Починил передачу кейкодов с тгуи в бйонд, теперь можно бегать и тыкать
интерфейс одновременно
Подчистил пару лишних биндов плюс повешал некоторые с пары (Передать на
V)

## Изображения изменений
<details>
<summary>Видео</summary>


https://github.com/ss220club/WyccerraBay220/assets/69762909/07ddcf25-3b5b-4297-ab6d-71f7d9bd7233

</details>


## Тестирование
Всё работает, вроде ничего не сломал

## Changelog

:cl:
add: Чейнджлог всё равно не работает, пока что.
/:cl:
  • Loading branch information
AyIong authored Apr 11, 2024
1 parent d25a094 commit fe2c2bc
Show file tree
Hide file tree
Showing 36 changed files with 492 additions and 875 deletions.
110 changes: 63 additions & 47 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
48 changes: 48 additions & 0 deletions code/_helpers/global_lists.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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/////
//////////////////////////
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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()
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit fe2c2bc

Please sign in to comment.