diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 35b1ce59421..6288faf0c7d 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -332,6 +332,9 @@ #define COMSIG_EXIT_AREA "exit_area" ///from base of atom/Click(): (location, control, params, mob/user) #define COMSIG_CLICK "atom_click" +///from base of atom/RightClick(): (/mob) +#define COMSIG_CLICK_RIGHT "right_click" + #define COMPONENT_CANCEL_CLICK_RIGHT (1<<0) ///from base of atom/ShiftClick(): (/mob) #define COMSIG_CLICK_SHIFT "shift_click" #define COMPONENT_ALLOW_EXAMINATE (1<<0) //Allows the user to examinate regardless of client.eye. diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 9a85658a84d..561c51dda3a 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -77,8 +77,10 @@ if(SEND_SIGNAL(src, COMSIG_MOB_CLICKON, A, params) & COMSIG_MOB_CANCEL_CLICKON) return - var/list/modifiers = params2list(params) + if(LAZYACCESS(modifiers, RIGHT_CLICK)) + if(RightClickOn(A)) + return if(LAZYACCESS(modifiers, SHIFT_CLICK)) if(LAZYACCESS(modifiers, MIDDLE_CLICK)) ShiftMiddleClickOn(A) @@ -300,6 +302,29 @@ */ /mob/proc/ranged_secondary_attack(atom/target, modifiers) +/** + * Right click + * + * Used for right-clicking interactions, in similar fashion of AltClick. + * Returns [atom/proc/RightClick] on the atom being right-clicked, which checks if the click chain doesn't continue. + * Arguments: + * * atom/target - The atom being rightclicked. + */ +/mob/proc/RightClickOn(atom/target) + return target.RightClick(src) + +/** + * Proc used for right-clicking + * + * Used for right-click interactions, called by [mob/proc/RightClickOn]. + * Returns TRUE if the click chain should not continue from a right-click. + * Arguments: + * * mob/user - The mob right-clicking. + */ +/atom/proc/RightClick(mob/user) + if(SEND_SIGNAL(src, COMSIG_CLICK_RIGHT, user) & COMPONENT_CANCEL_CLICK_RIGHT) + return TRUE + /** * Middle click * Mainly used for swapping hands diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 4b01a11f60f..3e19e45afb3 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -102,7 +102,7 @@ if(opened) . += "The parts are welded together." else if(secure && !opened) - . += "Alt-click to [locked ? "unlock" : "lock"]." + . += "Right-click to [locked ? "unlock" : "lock"]." if(HAS_TRAIT(user, TRAIT_SKITTISH) && divable) . += "If you bump into [p_them()] while running, you will jump inside." @@ -453,14 +453,10 @@ broken = TRUE //applies to secure lockers only open() -/obj/structure/closet/AltClick(mob/user) - ..() - if(!user.canUseTopic(src, BE_CLOSE) || !isturf(loc)) - return - if(opened || !secure) - return - else +/obj/structure/closet/RightClick(mob/user, modifiers) + if(!opened && secure) togglelock(user) + return TRUE /obj/structure/closet/proc/togglelock(mob/living/user, silent) if(secure && !broken)