From bb696fc33c2b19723370f1b5b5772f83dc9fcd9e Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Sat, 13 Jul 2024 00:28:09 +0300 Subject: [PATCH] Using ctrl + your quick MOD button now opens module selector on your mouse position (#84879) ## About The Pull Request Title. Ctrl + middle by default, can be ctrl + alt + LMB if changed in prefs. Both are unused and default to ctrl/alt click behavior respectively. ## Why It's Good For The Game A quick way to change modules. You *can* bind your module wheel to a hotkey but that still opens it on your sprite, making it harder to quickly swap modules in combat/danger. ## Changelog :cl: qol: Using ctrl + your quick MOD button now opens module selector on your mouse position /:cl: --- code/modules/mod/mod_control.dm | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/code/modules/mod/mod_control.dm b/code/modules/mod/mod_control.dm index 13aa69ca38dec..3b47453ef374f 100644 --- a/code/modules/mod/mod_control.dm +++ b/code/modules/mod/mod_control.dm @@ -465,6 +465,7 @@ SEND_SIGNAL(src, COMSIG_MOD_WEARER_SET, wearer) RegisterSignal(wearer, COMSIG_ATOM_EXITED, PROC_REF(on_exit)) RegisterSignal(wearer, COMSIG_SPECIES_GAIN, PROC_REF(on_species_gain)) + RegisterSignal(wearer, COMSIG_MOB_CLICKON, PROC_REF(click_on)) update_charge_alert() for(var/obj/item/mod/module/module as anything in modules) module.on_equip() @@ -472,7 +473,7 @@ /obj/item/mod/control/proc/unset_wearer() for(var/obj/item/mod/module/module as anything in modules) module.on_unequip() - UnregisterSignal(wearer, list(COMSIG_ATOM_EXITED, COMSIG_SPECIES_GAIN)) + UnregisterSignal(wearer, list(COMSIG_ATOM_EXITED, COMSIG_SPECIES_GAIN, COMSIG_MOB_CLICKON)) SEND_SIGNAL(src, COMSIG_MOD_WEARER_UNSET, wearer) wearer.update_spacesuit_hud_icon("0") wearer = null @@ -506,7 +507,14 @@ forceMove(drop_location()) return -/obj/item/mod/control/proc/quick_module(mob/user) +/obj/item/mod/control/proc/click_on(mob/source, atom/A, list/modifiers) + SIGNAL_HANDLER + + if (LAZYACCESS(modifiers, CTRL_CLICK) && LAZYACCESS(modifiers, source.client?.prefs.read_preference(/datum/preference/choiced/mod_select) || MIDDLE_CLICK)) + INVOKE_ASYNC(src, PROC_REF(quick_module), source, get_turf(A)) + return COMSIG_MOB_CANCEL_CLICKON + +/obj/item/mod/control/proc/quick_module(mob/user, anchor_override = null) if(!length(modules)) return var/list/display_names = list() @@ -528,7 +536,9 @@ var/radial_anchor = src if(istype(user.loc, /obj/effect/dummy/phased_mob)) radial_anchor = get_turf(user.loc) //they're phased out via some module, anchor the radial on the turf so it may still display - var/pick = show_radial_menu(user, radial_anchor, items, custom_check = FALSE, require_near = TRUE, tooltips = TRUE) + if (!isnull(anchor_override)) + radial_anchor = anchor_override + var/pick = show_radial_menu(user, radial_anchor, items, custom_check = FALSE, require_near = isnull(anchor_override), tooltips = TRUE) if(!pick) return var/module_reference = display_names[pick]