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
🆑
qol: Using ctrl + your quick MOD button now opens module selector on
your mouse position
/🆑
This commit is contained in:
SmArtKar
2024-07-12 23:28:09 +02:00
committed by GitHub
parent 1e80a72dee
commit bb696fc33c
+13 -3
View File
@@ -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]