diff --git a/code/__DEFINES/click.dm b/code/__DEFINES/click.dm new file mode 100644 index 00000000000..5900dd54210 --- /dev/null +++ b/code/__DEFINES/click.dm @@ -0,0 +1,8 @@ +/// Action has succeeded, preventing further alt click interaction +#define CLICK_ACTION_SUCCESS (1<<0) +/// Action failed, preventing further alt click interaction +#define CLICK_ACTION_BLOCKING (1<<1) +/// Either return state +#define CLICK_ACTION_ANY (CLICK_ACTION_SUCCESS | CLICK_ACTION_BLOCKING) + +/// Use NONE for continue interaction diff --git a/code/__DEFINES/dcs/signals.dm b/code/__DEFINES/dcs/signals.dm index 74cd4928cac..1dff22c9d0f 100644 --- a/code/__DEFINES/dcs/signals.dm +++ b/code/__DEFINES/dcs/signals.dm @@ -264,7 +264,7 @@ #define COMPONENT_ALLOW_EXAMINATE (1<<0) //Allows the user to examinate regardless of client.eye. ///from base of atom/CtrlClickOn(): (/mob) #define COMSIG_CLICK_CTRL "ctrl_click" -///from base of atom/AltClick(): (/mob) +///from base of atom/base_click_alt(): (/mob) #define COMSIG_CLICK_ALT "alt_click" ///from base of atom/CtrlShiftClick(/mob) #define COMSIG_CLICK_CTRL_SHIFT "ctrl_shift_click" diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm index 4ddca05d5c2..15c7842c2c7 100644 --- a/code/__DEFINES/flags.dm +++ b/code/__DEFINES/flags.dm @@ -237,9 +237,4 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204 #define DEFAULT_DOAFTER_IGNORE (DA_IGNORE_LYING|DA_IGNORE_RESTRAINED) -//Incapacitated ignore flags for [/proc/incapacitated()] -/// If the incapacitated will ignore a mob in restraints -#define INC_IGNORE_RESTRAINED (1<<0) -/// If the incapacitated will ignore a mob being agressively grabbed -#define INC_IGNORE_GRABBED (1<<1) diff --git a/code/__DEFINES/is_helpers.dm b/code/__DEFINES/is_helpers.dm index abdf6d2953d..97674e93254 100644 --- a/code/__DEFINES/is_helpers.dm +++ b/code/__DEFINES/is_helpers.dm @@ -1,3 +1,9 @@ +// simple is_type and similar inline helpers +#define in_range(source, user) (get_dist(source, user) <= 1 && (get_step(source, 0)?:z) == (get_step(user, 0)?:z)) + +/// Within given range, but not counting z-levels +#define IN_GIVEN_RANGE(source, other, given_range) (get_dist(source, other) <= given_range && (get_step(source, 0)?:z) == (get_step(other, 0)?:z)) + // Atoms #define isatom(A) (isloc(A)) diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 79da7d55b9b..ecb13b91854 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -98,8 +98,6 @@ #define STAGE_FIVE 9 #define STAGE_SIX 11 //From supermatter shard -#define in_range(source, user) (get_dist(source, user) <= 1) - #define FOR_DVIEW(type, range, center, invis_flags) \ GLOB.dview_mob.loc = center; \ GLOB.dview_mob.set_invis_see(invis_flags); \ diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 3079723d3f7..a41d2e38c21 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -467,3 +467,35 @@ /// Eyes examine time mod #define EXAMINE_INSTANT 0 // 0 seconds + +//Incapacitated ignore flags for [/proc/incapacitated()]. +// They also used at interaction_flags_c var. +/// If the incapacitated will ignore a mob in restraints +#define INC_IGNORE_RESTRAINED (1<<0) +/// If the incapacitated will ignore a mob being agressively grabbed +#define INC_IGNORE_GRABBED (1<<1) + +/// If reading is required to perform action (can't read a book if you are illiterate) +#define NEED_LITERACY (1<<0) +/// If incapacitated doesn't needed to be checked. +#define BYPASS_INCAPACITATED (1<<1) +/// If other mobs (monkeys, aliens, etc) can perform action (can't use computers if you are a monkey) +#define NEED_DEXTERITY (1<<2) +/// If hands are required to perform action (can't use objects that require hands if you are a cyborg) +#define NEED_HANDS (1<<3) +/// If telekinesis is forbidden to perform action from a distance (ex. canisters are blacklisted from telekinesis manipulation) +#define FORBID_TELEKINESIS_REACH (1<<4) +/// If silicons are allowed to perform action from a distance (silicons can operate airlocks from far away) +#define ALLOW_SILICON_REACH (1<<5) +/// If resting on the floor is allowed to perform action (pAIs can play music while resting) +#define ALLOW_RESTING (1<<6) +/// If this is accessible to creatures with ventcrawl capabilities +#define NEED_VENTCRAWL (1<<7) +/// Skips adjacency checks +#define BYPASS_ADJACENCY (1<<8) +/// Skips recursive loc checks +#define NOT_INSIDE_TARGET (1<<9) +/// Checks for base adjacency, but silences the error +#define SILENT_ADJACENCY (1<<10) +/// Allows pAIs to perform an action +#define ALLOW_PAI (1<<11) diff --git a/code/__DEFINES/traits/declarations.dm b/code/__DEFINES/traits/declarations.dm index 8b24b7f64ae..711d2fb2db6 100644 --- a/code/__DEFINES/traits/declarations.dm +++ b/code/__DEFINES/traits/declarations.dm @@ -299,6 +299,3 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai #define TRAIT_BLOB_ZOMBIFIED "blob_zombified" #define TRAIT_BEING_OFFERED "offered" - -/// Prevents the affected object from opening a loot window via alt click. See atom/AltClick() -#define TRAIT_ALT_CLICK_BLOCKER "no_alt_click" diff --git a/code/__HELPERS/view.dm b/code/__HELPERS/view.dm new file mode 100644 index 00000000000..d591985fccb --- /dev/null +++ b/code/__HELPERS/view.dm @@ -0,0 +1,3 @@ +#define DEFAULT_SIGHT_DISTANCE 7 +/// Basic check to see if the src object can see the target object. +#define CAN_I_SEE(target) ((src in viewers(DEFAULT_SIGHT_DISTANCE, target)) || in_range(target, src)) diff --git a/code/_globalvars/traits.dm b/code/_globalvars/traits.dm index c0cfec719ec..163c57f10f0 100644 --- a/code/_globalvars/traits.dm +++ b/code/_globalvars/traits.dm @@ -8,7 +8,6 @@ GLOBAL_LIST_INIT(traits_by_type, list( /atom = list( "TRAIT_AI_PAUSED" = TRAIT_AI_PAUSED, - "TRAIT_ALT_CLICK_BLOCKER" = TRAIT_ALT_CLICK_BLOCKER, "TRAIT_BEING_SHOCKED" = TRAIT_BEING_SHOCKED, "TRAIT_BLOCK_RADIATION" = TRAIT_BLOCK_RADIATION, "TRAIT_CMAGGED" = TRAIT_CMAGGED, diff --git a/code/_onclick/ai.dm b/code/_onclick/ai.dm index b4e0a05b6f6..b4838f4f954 100644 --- a/code/_onclick/ai.dm +++ b/code/_onclick/ai.dm @@ -75,7 +75,7 @@ ShiftClickOn(A) return if(modifiers["alt"]) // alt and alt-gr (rightalt) - AltClickOn(A) + ai_base_click_alt(A) return if(modifiers["ctrl"]) CtrlClickOn(A) @@ -126,8 +126,6 @@ A.AIShiftClick(src) /mob/living/silicon/ai/CtrlClickOn(atom/A) A.AICtrlClick(src) -/mob/living/silicon/ai/AltClickOn(atom/A) - A.AIAltClick(src) /mob/living/silicon/ai/MiddleClickOn(atom/A) A.AIMiddleClick(src) /mob/living/silicon/ai/MiddleShiftClickOn(atom/A) @@ -151,8 +149,26 @@ /atom/proc/AICtrlClick(mob/living/silicon/user) return -/atom/proc/AIAltClick(atom/A) - AltClick(A) +/// Reimplementation of base_click_alt for AI +/mob/living/silicon/ai/proc/ai_base_click_alt(atom/target) + // If for some reason we can't alt click + if(SEND_SIGNAL(src, COMSIG_MOB_ALTCLICKON, target) & COMSIG_MOB_CANCEL_CLICKON) + return + + if(!isturf(target) && can_perform_action(target, (target.interaction_flags_click | SILENT_ADJACENCY))) + // Signal intercept + if(SEND_SIGNAL(target, COMSIG_CLICK_ALT, src) & CLICK_ACTION_ANY) + return + + // AI alt click interaction succeeds + if(target.ai_click_alt(src) & CLICK_ACTION_ANY) + return + + client.loot_panel.open(get_turf(target)) + +/atom/proc/ai_click_alt(mob/living/silicon/ai/user) + return + /atom/proc/AIMiddleClick(mob/living/user) return @@ -179,7 +195,7 @@ enabled = !enabled updateTurrets() -/obj/machinery/turretid/AIAltClick() //toggles lethal on turrets +/obj/machinery/turretid/ai_click_alt(mob/living/silicon/ai/user) //toggles lethal on turrets if(lethal_is_configurable) lethal = !lethal updateTurrets() @@ -201,7 +217,7 @@ return toggle_bolt(user) -/obj/machinery/door/airlock/AIAltClick(mob/living/silicon/user) // Electrifies doors. +/obj/machinery/door/airlock/ai_click_alt(mob/living/silicon/ai/user) // Electrifies doors. if(!ai_control_check(user)) return if(wires.is_cut(WIRE_ELECTRIFY)) @@ -222,5 +238,5 @@ /obj/machinery/ai_slipper/AICtrlClick(mob/living/silicon/ai/user) //Turns liquid dispenser on or off ToggleOn() -/obj/machinery/ai_slipper/AIAltClick() //Dispenses liquid if on +/obj/machinery/ai_slipper/ai_click_alt(mob/living/silicon/ai/user) //Dispenses liquid if on Activate() diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index bfa165fbbd4..b485f2da169 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -210,7 +210,7 @@ return FALSE // Default behavior: ignore double clicks, consider them normal clicks instead -/mob/proc/DblClickOn(var/atom/A, var/params) +/mob/proc/DblClickOn(atom/A, params) return /* @@ -252,14 +252,14 @@ Used when you are handcuffed and click things. Not currently used by anything but could easily be. */ -/mob/proc/RestrainedClickOn(var/atom/A) +/mob/proc/RestrainedClickOn(atom/A) return /* Middle click Only used for swapping hands */ -/mob/proc/MiddleClickOn(var/atom/A) +/mob/proc/MiddleClickOn(atom/A) pointed(A) return @@ -313,10 +313,10 @@ For most mobs, examine. This is overridden in ai.dm */ -/mob/proc/ShiftClickOn(var/atom/A) +/mob/proc/ShiftClickOn(atom/A) A.ShiftClick(src) return -/atom/proc/ShiftClick(var/mob/user) +/atom/proc/ShiftClick(mob/user) if(user.client && get_turf(user.client.eye) == get_turf(user)) user.examinate(src) return @@ -325,7 +325,7 @@ Ctrl click For most objects, pull */ -/mob/proc/CtrlClickOn(var/atom/A) +/mob/proc/CtrlClickOn(atom/A) A.CtrlClick(src) return @@ -350,50 +350,6 @@ return ..() -/* - Alt click - Unused except for AI -*/ -/mob/proc/AltClickOn(var/atom/A) - A.AltClick(src) - return - -// See click_override.dm -/mob/living/AltClickOn(atom/A) - if(middleClickOverride) - middleClickOverride.onClick(A, src) - else - ..() - -/** - * Alt click on an atom. - * Performs alt-click actions before attempting to open a loot window. - * Returns TRUE if successful, FALSE if not. - */ -/atom/proc/AltClick(mob/user) - if(HAS_TRAIT(src, TRAIT_ALT_CLICK_BLOCKER) && !isobserver(user)) - return TRUE - - var/turf/T = get_turf(src) - if(isnull(T)) - return FALSE - - if(!isturf(loc) && !isturf(src)) - return FALSE - - if(!user.TurfAdjacent(T)) - return FALSE - - if(HAS_TRAIT(user, TRAIT_MOVE_VENTCRAWLING)) - return FALSE - - var/datum/lootpanel/panel = user.client?.loot_panel - if(isnull(panel)) - return FALSE - - panel.open(T) - return TRUE - /mob/proc/TurfAdjacent(turf/T) return T.Adjacent(src) @@ -402,18 +358,18 @@ Control+Shift/Alt+Shift click Unused except for AI */ -/mob/proc/CtrlShiftClickOn(var/atom/A) +/mob/proc/CtrlShiftClickOn(atom/A) A.CtrlShiftClick(src) return -/atom/proc/CtrlShiftClick(var/mob/user) +/atom/proc/CtrlShiftClick(mob/user) return -/mob/proc/AltShiftClickOn(var/atom/A) +/mob/proc/AltShiftClickOn(atom/A) A.AltShiftClick(src) return -/atom/proc/AltShiftClick(var/mob/user) +/atom/proc/AltShiftClick(mob/user) return diff --git a/code/_onclick/click_alt.dm b/code/_onclick/click_alt.dm new file mode 100644 index 00000000000..900461da634 --- /dev/null +++ b/code/_onclick/click_alt.dm @@ -0,0 +1,88 @@ +///Main proc for primary alt click +/mob/proc/AltClickOn(atom/target) + base_click_alt(target) + +/** + * ### Base proc for alt click interaction. Returns if the click was intercepted & handled + * + * If you wish to add custom `click_alt` behavior for a single type, use that proc. + */ +/mob/proc/base_click_alt(atom/target) + SHOULD_NOT_OVERRIDE(TRUE) + + // Check if they've hooked in to prevent src from alt clicking anything + //if(SEND_SIGNAL(src, COMSIG_MOB_ALTCLICKON, target) & COMSIG_MOB_CANCEL_CLICKON) + // return TRUE + + // Ghosties just see loot + if(isobserver(src)) + client.loot_panel.open(get_turf(target)) + return + + // If it has a signal handler that returns a click action, done. + if(SEND_SIGNAL(target, COMSIG_CLICK_ALT, src) & CLICK_ACTION_ANY) + return TRUE + + // If it has a custom click_alt that returns success/block, done. + if(can_perform_action(target, (target.interaction_flags_click | SILENT_ADJACENCY))) + return target.click_alt(src) & CLICK_ACTION_ANY + + // No alt clicking to view turf from beneath + if(HAS_TRAIT(src, TRAIT_MOVE_VENTCRAWLING)) + return + + client.loot_panel.open(get_turf(target)) + + return FALSE + +/mob/living/base_click_alt(atom/target) + SHOULD_NOT_OVERRIDE(TRUE) + + if(..()) + return + if(!CAN_I_SEE(target) || (!has_vision() && !IN_GIVEN_RANGE(src, target, 1))) + return + + // No alt clicking to view turf from beneath + if(HAS_TRAIT(src, TRAIT_MOVE_VENTCRAWLING)) + return + + /// No loot panel if it's on our person + if(isobj(target) && (target in get_all_gear())) + to_chat(src, span_warning("You can't search for this item, it's already in your inventory! Take it off first.")) + return + + client.loot_panel.open(get_turf(target)) + return TRUE + + +/** + * ## Custom alt click interaction + * Override this to change default alt click behavior. Return `CLICK_ACTION_SUCCESS`, `CLICK_ACTION_BLOCKING` or `NONE`. + * + * ### Guard clauses + * Consider adding `interaction_flags_click` before adding unique guard clauses. + * + * ### Return flags + * Forgetting your return will cause the default alt click behavior to occur thereafter. + * + * The difference between NONE and BLOCKING can get hazy, but I like to keep NONE limited to guard clauses and "never" cases. + * + * A good usage for BLOCKING over NONE is when it's situational for the item and there's some feedback indicating this. + * + * ### Examples: + * User is a ghost, alt clicks on item with special disk eject: NONE + * + * Machine broken, no feedback: NONE + * + * Alt click a pipe to max output but its already max: BLOCKING + * + * Alt click a gun that normally works, but is out of ammo: BLOCKING + * + * User unauthorized, machine beeps: BLOCKING + * + * @param {mob} user - The person doing the alt clicking. + */ +/atom/proc/click_alt(mob/user) + SHOULD_CALL_PARENT(FALSE) + return NONE diff --git a/code/_onclick/cogscarab.dm b/code/_onclick/cogscarab.dm index c0dce81fd3d..397a9aac6be 100644 --- a/code/_onclick/cogscarab.dm +++ b/code/_onclick/cogscarab.dm @@ -93,7 +93,7 @@ return /mob/living/silicon/robot/cogscarab/AltClickOn(atom/A) - A.AltClick(src) + base_click_alt(A) return /mob/living/silicon/robot/cogscarab/CtrlShiftClickOn(atom/A) diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index 529ac974280..b92c40a68d3 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -37,7 +37,7 @@ ShiftClickOn(A) return if(modifiers["alt"]) // alt and alt-gr (rightalt) - AltClickOn(A) + A.borg_click_alt(src) return if(modifiers["ctrl"]) CtrlClickOn(A) @@ -117,8 +117,6 @@ A.BorgShiftClick(src) /mob/living/silicon/robot/CtrlClickOn(atom/A) A.BorgCtrlClick(src) -/mob/living/silicon/robot/AltClickOn(atom/A) - A.BorgAltClick(src) /mob/living/silicon/robot/CtrlShiftClickOn(atom/A) A.BorgCtrlShiftClick(src) /mob/living/silicon/robot/AltShiftClickOn(atom/A) @@ -133,8 +131,8 @@ /atom/proc/BorgCtrlClick(mob/living/silicon/robot/user) //forward to human click if not overriden CtrlClick(user) -/atom/proc/BorgAltClick(mob/living/silicon/robot/user) - AltClick(user) +/atom/proc/borg_click_alt(mob/living/silicon/robot/user) + user.base_click_alt(src) return /atom/proc/BorgCtrlShiftClick(mob/user) // Examines @@ -154,8 +152,8 @@ /obj/machinery/door/airlock/BorgCtrlClick(mob/living/silicon/robot/user) // Bolts doors. Forwards to AI code. AICtrlClick(user) -/obj/machinery/door/airlock/BorgAltClick(mob/living/silicon/robot/user) // Eletrifies doors. Forwards to AI code. - AIAltClick(user) +/obj/machinery/door/airlock/borg_click_alt(mob/living/silicon/robot/user) // Eletrifies doors. Forwards to AI code. + ai_click_alt(user) /obj/machinery/door/airlock/BorgAltShiftClick(mob/living/silicon/robot/user) // Enables emergency override on doors! Forwards to AI code. AIAltShiftClick(user) @@ -172,7 +170,7 @@ /obj/machinery/ai_slipper/BorgCtrlClick(mob/living/silicon/robot/user) //Turns liquid dispenser on or off ToggleOn() -/obj/machinery/ai_slipper/BorgAltClick(mob/living/silicon/robot/user) //Dispenses liquid if on +/obj/machinery/ai_slipper/borg_click_alt(mob/living/silicon/robot/user) //Dispenses liquid if on Activate() @@ -181,8 +179,8 @@ /obj/machinery/turretid/BorgCtrlClick(mob/living/silicon/robot/user) //turret control on/off. Forwards to AI code. AICtrlClick(user) -/obj/machinery/turretid/BorgAltClick(mob/living/silicon/robot/user) //turret lethal on/off. Forwards to AI code. - AIAltClick(user) +/obj/machinery/turretid/borg_click_alt(mob/living/silicon/robot/user) //turret lethal on/off. Forwards to AI code. + ai_click_alt(user) /* As with AI, these are not used in click code, diff --git a/code/_onclick/hud/action_button.dm b/code/_onclick/hud/action_button.dm index 9727964d176..7e112e7ad2b 100644 --- a/code/_onclick/hud/action_button.dm +++ b/code/_onclick/hud/action_button.dm @@ -52,7 +52,7 @@ to_chat(usr, span_notice("Action button \"[name]\" [locked ? "" : "un"]locked.")) return TRUE if(modifiers["alt"]) - AltClick(usr) + usr.base_click_alt(src) return TRUE if(modifiers["middle"]) linked_action.Trigger(left_click = FALSE) @@ -83,9 +83,10 @@ to_chat(user, span_info("Your active keybinding on [src] has been cleared.")) -/atom/movable/screen/movable/action_button/AltClick(mob/user) - . = linked_action.AltTrigger() +/atom/movable/screen/movable/action_button/click_alt(mob/user) + linked_action.AltTrigger() linked_action.UpdateButtonIcon() + return CLICK_ACTION_SUCCESS /atom/movable/screen/movable/action_button/proc/clean_up_keybinds(mob/owner) if(linked_keybind) @@ -121,7 +122,7 @@ usr.changeNext_click(1) var/list/modifiers = params2list(params) if(modifiers["alt"]) - AltClick(usr) + usr.base_click_alt(src) return TRUE usr.hud_used.action_buttons_hidden = !usr.hud_used.action_buttons_hidden @@ -135,7 +136,7 @@ usr.update_action_buttons() -/atom/movable/screen/movable/action_button/hide_toggle/AltClick(mob/user) +/atom/movable/screen/movable/action_button/hide_toggle/click_alt(mob/user) for(var/datum/action/action as anything in user.actions) var/atom/movable/screen/movable/action_button/our_button = action.button our_button.moved = FALSE @@ -143,6 +144,7 @@ moved = FALSE user.update_action_buttons(reload_screen = TRUE) to_chat(user, span_notice("Action button positions have been reset.")) + return CLICK_ACTION_SUCCESS /atom/movable/screen/movable/action_button/hide_toggle/proc/InitialiseIcon(mob/living/user) @@ -155,7 +157,7 @@ if(user.client) // Apply the client's UI style icon = ui_style2icon(user.client.prefs?.UI_style) icon_state = "template" - + if(user.client) alpha = user.client.prefs?.UI_style_alpha color = user.client.prefs?.UI_style_color diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index 1012e90ffe2..1ccbcd9e0d4 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -293,12 +293,12 @@ return TRUE if(PL["alt"]) - AltClick(usr, choice) + usr.base_click_alt(src) return return set_selected_zone(choice) -/atom/movable/screen/zone_sel/AltClick(mob/user, choice) +/atom/movable/screen/zone_sel/click_alt(mob/user, choice) if(user.next_click > world.time || user.next_move > world.time) return FALSE @@ -312,6 +312,7 @@ return FALSE holding_item.melee_attack_chain(user, user) set_selected_zone(old_selecting, FALSE) + return CLICK_ACTION_SUCCESS /atom/movable/screen/zone_sel/MouseEntered(location, control, params) diff --git a/code/_onclick/overmind.dm b/code/_onclick/overmind.dm index 881b3b06410..9348cf690aa 100644 --- a/code/_onclick/overmind.dm +++ b/code/_onclick/overmind.dm @@ -10,7 +10,7 @@ ShiftClickOn(A) return if(modifiers["alt"]) - AltClickOn(A) + blob_click_alt(A) return if(modifiers["ctrl"]) CtrlClickOn(A) @@ -29,7 +29,7 @@ if(T) create_shield(T) -/mob/camera/blob/AltClickOn(atom/A) //Remove a blob +/mob/camera/blob/proc/blob_click_alt(atom/A) //Remove a blob var/turf/T = get_turf(A) if(T) remove_blob(T) diff --git a/code/_onclick/pai.dm b/code/_onclick/pai.dm index 79d619aeff5..04e213d325f 100644 --- a/code/_onclick/pai.dm +++ b/code/_onclick/pai.dm @@ -74,7 +74,7 @@ if(!ai_capability) return ..() if(!capa_is_cooldown) - if(A.PAIAltClick(src)) + if(A.pai_click_alt(src)) capa_is_cooldown = TRUE addtimer(CALLBACK(src, PROC_REF(reset_cooldown)), ai_capability_cooldown) return @@ -110,8 +110,8 @@ CtrlClick(user) return FALSE -/atom/proc/PAIAltClick(mob/living/silicon/robot/user) - AltClick(user) +/atom/proc/pai_click_alt(mob/living/silicon/robot/user) + user.base_click_alt(src) return FALSE /atom/proc/PAICtrlShiftClick(mob/user) // Examines @@ -132,12 +132,12 @@ AICtrlClick(user) return TRUE -/obj/machinery/door/airlock/PAIAltClick(mob/living/silicon/pai/user) // Eletrifies doors. Forwards to AI code. +/obj/machinery/door/airlock/pai_click_alt(mob/living/silicon/pai/user) // Eletrifies doors. Forwards to AI code. var/turf/door_turf = get_turf(src) var/turf/pai_turf = get_turf(user) if(!istype(door_turf) || !istype(pai_turf) || door_turf.z != pai_turf.z) return FALSE - AIAltClick(user) + ai_click_alt(user) return TRUE /obj/machinery/door/airlock/PAIAltShiftClick(mob/living/silicon/pai/user) // Enables emergency override on doors! Forwards to AI code. @@ -157,7 +157,7 @@ ToggleOn() return TRUE -/obj/machinery/ai_slipper/PAIAltClick(mob/living/silicon/pai/user) //Dispenses liquid if on +/obj/machinery/ai_slipper/pai_click_alt(mob/living/silicon/pai/user) //Dispenses liquid if on Activate() return TRUE @@ -167,8 +167,8 @@ AICtrlClick(user) return TRUE -/obj/machinery/turretid/PAIAltClick(mob/living/silicon/pai/user) //turret lethal on/off. Forwards to AI code. - AIAltClick(user) +/obj/machinery/turretid/pai_click_alt(mob/living/silicon/pai/user) //turret lethal on/off. Forwards to AI code. + ai_click_alt(user) return TRUE /mob/living/silicon/pai/proc/reset_cooldown() diff --git a/code/datums/action.dm b/code/datums/action.dm index dc2f1492c83..e08a36ed50c 100644 --- a/code/datums/action.dm +++ b/code/datums/action.dm @@ -706,7 +706,7 @@ /datum/action/spell_action/AltTrigger() if(target) var/obj/effect/proc_holder/spell/spell = target - spell.AltClick(usr) + owner.base_click_alt(spell) return TRUE /datum/action/spell_action/IsAvailable(message = FALSE) diff --git a/code/datums/outfits/outfit_debug.dm b/code/datums/outfits/outfit_debug.dm index 8153d1daf2b..2ff44ceecef 100644 --- a/code/datums/outfits/outfit_debug.dm +++ b/code/datums/outfits/outfit_debug.dm @@ -139,12 +139,12 @@ . = ..() . += span_info("Щелкните Alt + ЛКМ, чтобы переключить иксрей.") -/obj/item/clothing/glasses/hud/debug/AltClick(mob/user) +/obj/item/clothing/glasses/hud/debug/click_alt(mob/user) if(!ishuman(user)) - return + return NONE var/mob/living/carbon/human/human_user = user if(human_user.glasses != src) - return + return CLICK_ACTION_BLOCKING if(xray) remove_xray(human_user) else @@ -152,6 +152,7 @@ xray = !xray balloon_alert(user, "рентген-зрение [!xray ? "де" : ""]активировано") // ctodo test human_user.update_sight() + return CLICK_ACTION_SUCCESS /obj/item/clothing/glasses/hud/debug/visor_toggling(mob/living/carbon/human/user) return diff --git a/code/datums/spells/lavaland_spells/watchers_look.dm b/code/datums/spells/lavaland_spells/watchers_look.dm index 6f76e822528..0f0d9737c87 100644 --- a/code/datums/spells/lavaland_spells/watchers_look.dm +++ b/code/datums/spells/lavaland_spells/watchers_look.dm @@ -37,8 +37,9 @@ return TRUE -/obj/effect/proc_holder/spell/watchers_look/AltClick(mob/user) +/obj/effect/proc_holder/spell/watchers_look/click_alt(mob/user) //switch to next type of projectile and update action's icon selected_projectile = selected_projectile % length(projectiles_icons) + 1 action.button_icon_state = projectiles_icons[selected_projectile] action.UpdateButtonIcon() + return CLICK_ACTION_SUCCESS diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 81f3068c5ce..8dd3c7fc8d0 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -25,6 +25,9 @@ /// Things we can pass through while moving. If any of this matches the thing we're trying to pass's [pass_flags_self], then we can pass through. var/pass_flags = NONE + /// Flags to check for in can_perform_action. Used in alt-click checks + var/interaction_flags_click = NONE + /// How this atom should react to having its astar blocking checked var/can_astar_pass = CANASTARPASS_DENSITY @@ -1724,8 +1727,6 @@ GLOBAL_LIST_EMPTY(blood_splatter_icons) if(!usr?.client) return - if(loc != usr.listed_turf) - return if(href_list["statpanel_item_click"]) var/client/usr_client = usr.client diff --git a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm index 6bbaa4e37a8..acbb4b46ba9 100644 --- a/code/game/gamemodes/miniantags/abduction/abduction_gear.dm +++ b/code/game/gamemodes/miniantags/abduction/abduction_gear.dm @@ -423,8 +423,8 @@ Congratulations! You are now trained for invasive xenobiology research!"} /obj/item/paper/abductor/update_icon_state() return -/obj/item/paper/abductor/AltClick() - return +/obj/item/paper/abductor/click_alt() + return NONE #define BATON_STUN 0 diff --git a/code/game/gamemodes/miniantags/demons/pulse_demon/pulse_demon_abilities.dm b/code/game/gamemodes/miniantags/demons/pulse_demon/pulse_demon_abilities.dm index 38d9309f080..f83044751ac 100644 --- a/code/game/gamemodes/miniantags/demons/pulse_demon/pulse_demon_abilities.dm +++ b/code/game/gamemodes/miniantags/demons/pulse_demon/pulse_demon_abilities.dm @@ -80,9 +80,9 @@ return FALSE // handles purchasing and upgrading abilities -/obj/effect/proc_holder/spell/pulse_demon/AltClick(mob/living/simple_animal/demon/pulse_demon/user) +/obj/effect/proc_holder/spell/pulse_demon/click_alt(mob/living/simple_animal/demon/pulse_demon/user) if(!istype(user)) - return + return NONE if(locked) if(user.charge >= unlock_cost) @@ -115,6 +115,7 @@ update_info() else to_chat(user, span_warning("You cannot afford to upgrade this ability! It costs [format_si_suffix(upgrade_cost)]W to upgrade.")) + return CLICK_ACTION_SUCCESS /obj/effect/proc_holder/spell/pulse_demon/proc/do_upgrade(mob/living/simple_animal/demon/pulse_demon/user) cooldown_handler.recharge_duration = round(base_cooldown / (1.5 ** spell_level)) @@ -275,19 +276,20 @@ user.do_drain = do_toggle(!user.do_drain, user) return TRUE -/obj/effect/proc_holder/spell/pulse_demon/toggle/do_drain/AltClick(mob/living/simple_animal/demon/pulse_demon/user) +/obj/effect/proc_holder/spell/pulse_demon/toggle/do_drain/click_alt(mob/living/simple_animal/demon/pulse_demon/user) if(!istype(user)) - return + return NONE var/amount = text2num(input(user, "Input a value between 1 and [user.max_drain_rate]. 0 will reset it to the maximum.", "Drain Speed Setting")) if(amount == null || amount < 0) to_chat(user, span_warning("Invalid input. Drain speed has not been modified.")) - return + return CLICK_ACTION_BLOCKING if(amount == 0) amount = user.max_drain_rate user.power_drain_rate = amount to_chat(user, span_notice("Drain speed has been set to [format_si_suffix(user.power_drain_rate)]W per second.")) + return CLICK_ACTION_SUCCESS /obj/effect/proc_holder/spell/pulse_demon/toggle/can_exit_cable name = "Toggle Self-Sustaining" @@ -324,16 +326,17 @@ /obj/effect/proc_holder/spell/pulse_demon/cycle_camera/create_new_targeting() return new /datum/spell_targeting/self -/obj/effect/proc_holder/spell/pulse_demon/cycle_camera/AltClick(mob/living/simple_animal/demon/pulse_demon/user) +/obj/effect/proc_holder/spell/pulse_demon/cycle_camera/click_alt(mob/living/simple_animal/demon/pulse_demon/user) if(!istype(user)) - return + return NONE current_camera = 0 if(!isapc(user.current_power)) - return + return NONE if(get_area(user.loc) != user.controlling_area) - return + return NONE user.forceMove(user.current_power) + return CLICK_ACTION_SUCCESS /obj/effect/proc_holder/spell/pulse_demon/cycle_camera/try_cast_action(mob/living/simple_animal/demon/pulse_demon/user, atom/target) if(!length(user.controlling_area.cameras)) @@ -426,14 +429,15 @@ upgrades["[upgrade] ([format_si_suffix(cost)]W)"] = upgrade_icons[upgrade] return upgrades -/obj/effect/proc_holder/spell/pulse_demon/open_upgrades/AltClick(mob/living/simple_animal/demon/pulse_demon/user) +/obj/effect/proc_holder/spell/pulse_demon/open_upgrades/click_alt(mob/living/simple_animal/demon/pulse_demon/user) if(!istype(user)) - return + return NONE to_chat(user, "Pulse Demon upgrades:") for(var/upgrade in upgrade_descs) var/cost = calc_cost(user, upgrade) to_chat(user, "[upgrade] ([cost == -1 ? "Fully Upgraded" : "[format_si_suffix(cost)]W"]) - [upgrade_descs[upgrade]]") + return CLICK_ACTION_SUCCESS /obj/effect/proc_holder/spell/pulse_demon/open_upgrades/try_cast_action(mob/living/simple_animal/demon/pulse_demon/user, atom/target) var/upgrades = get_upgrades(user) diff --git a/code/game/gamemodes/miniantags/demons/pulse_demon/pulse_demon_interactions.dm b/code/game/gamemodes/miniantags/demons/pulse_demon/pulse_demon_interactions.dm index 3b2ca5e87c3..af55d72ab8f 100644 --- a/code/game/gamemodes/miniantags/demons/pulse_demon/pulse_demon_interactions.dm +++ b/code/game/gamemodes/miniantags/demons/pulse_demon/pulse_demon_interactions.dm @@ -74,9 +74,9 @@ /mob/living/simple_animal/demon/pulse_demon/AltClickOn(atom/A) if(get_area(A) == controlling_area) - A.AIAltClick(src) + ai_click_alt(A) else - A.AltClick(src) + base_click_alt(A) /mob/living/simple_animal/demon/pulse_demon/CtrlClickOn(atom/A) if(get_area(A) == controlling_area) diff --git a/code/game/gamemodes/miniantags/demons/shadow_demon/shadow_demon.dm b/code/game/gamemodes/miniantags/demons/shadow_demon/shadow_demon.dm index ce7e06c8e0c..a5026bfb3b7 100644 --- a/code/game/gamemodes/miniantags/demons/shadow_demon/shadow_demon.dm +++ b/code/game/gamemodes/miniantags/demons/shadow_demon/shadow_demon.dm @@ -133,15 +133,18 @@ time_since_last_hallucination = 0 -/obj/structure/shadowcocoon/AltClick(mob/user) - if(!isdemon(user) || user.incapacitated()) - return ..() +/obj/structure/shadowcocoon/click_alt(mob/user) + if(!isdemon(user)) + return NONE + if(user.incapacitated()) + return CLICK_ACTION_BLOCKING if(silent) to_chat(user, span_notice("You twist and change your trapped victim in [src] to lure in more prey.")) silent = FALSE - return + return CLICK_ACTION_BLOCKING to_chat(user, span_notice("The tendrils from [src] snap back to their orignal form.")) silent = TRUE + return CLICK_ACTION_SUCCESS /obj/structure/shadowcocoon/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = NONE) diff --git a/code/game/gamemodes/miniantags/revenant/revenant.dm b/code/game/gamemodes/miniantags/revenant/revenant.dm index 5f966b4b62f..7705fed44c8 100644 --- a/code/game/gamemodes/miniantags/revenant/revenant.dm +++ b/code/game/gamemodes/miniantags/revenant/revenant.dm @@ -86,6 +86,9 @@ to_chat(src, "You can move again!") update_icon(UPDATE_ICON_STATE) +/mob/living/simple_animal/revenant/can_perform_action(atom/target, action_bitflags) + return FALSE + /mob/living/simple_animal/revenant/ex_act(severity) return 1 //Immune to the effects of explosions. diff --git a/code/game/gamemodes/nuclear/pinpointer.dm b/code/game/gamemodes/nuclear/pinpointer.dm index d86e0db9350..2ddce994600 100644 --- a/code/game/gamemodes/nuclear/pinpointer.dm +++ b/code/game/gamemodes/nuclear/pinpointer.dm @@ -220,19 +220,10 @@ pinpoint_at(target) -/obj/item/pinpointer/advpinpointer/AltClick(mob/user) +/obj/item/pinpointer/advpinpointer/click_alt(mob/user) if(Adjacent(user)) toggle_mode(user) - return - ..() - - -/obj/item/pinpointer/advpinpointer/verb/toggle_mode_verb() - set category = "Object" - set name = "Toggle Pinpointer Mode" - set src in usr - - toggle_mode(usr) + return CLICK_ACTION_SUCCESS /obj/item/pinpointer/advpinpointer/proc/toggle_mode(mob/user) @@ -497,19 +488,9 @@ ..() -/obj/item/pinpointer/crew/AltClick(mob/user) - if(Adjacent(user)) - choose_signal(user) - return - ..() - - -/obj/item/pinpointer/crew/verb/choose_signal_verb() - set category = "Object" - set name = "Track Signals" - set src in usr - - choose_signal(usr) +/obj/item/pinpointer/crew/click_alt(mob/user) + choose_signal(user) + return CLICK_ACTION_SUCCESS /obj/item/pinpointer/crew/proc/choose_signal(mob/living/carbon/user) @@ -611,19 +592,9 @@ to_chat(user, span_notice("Режим пинпоинтера не определен.")) -/obj/item/pinpointer/thief/AltClick(mob/user) - if(Adjacent(user)) - toggle_mode(user) - return - ..() - - -/obj/item/pinpointer/thief/verb/toggle_mode_verb() - set category = "Object" - set name = "Переключить Режим Пинпоинтера" - set src in usr - - toggle_mode(usr) +/obj/item/pinpointer/thief/click_alt(mob/user) + toggle_mode(user) + return CLICK_ACTION_SUCCESS /obj/item/pinpointer/thief/proc/toggle_mode(mob/user) diff --git a/code/game/machinery/computer/buildandrepair.dm b/code/game/machinery/computer/buildandrepair.dm index e4cee1999bb..2e35757d203 100644 --- a/code/game/machinery/computer/buildandrepair.dm +++ b/code/game/machinery/computer/buildandrepair.dm @@ -550,6 +550,7 @@ max_integrity = 100 var/state = STATE_EMPTY var/obj/item/circuitboard/circuit = null + interaction_flags_click = NEED_HANDS | NEED_DEXTERITY /obj/structure/computerframe/Initialize(mapload, obj/item/circuitboard/circuit) @@ -607,16 +608,12 @@ return ..() -/obj/structure/computerframe/AltClick(mob/user) - if(!Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, span_warning("You can't do that right now!")) - return +/obj/structure/computerframe/click_alt(mob/user) if(anchored) to_chat(user, span_warning("The frame is anchored to the floor!")) - return + return CLICK_ACTION_BLOCKING setDir(turn(dir, 90)) + return CLICK_ACTION_SUCCESS /obj/structure/computerframe/obj_break(damage_flag) diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 24bdc7bfa61..dcbf3d6f8ea 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -26,6 +26,7 @@ armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 30, "acid" = 30) on = FALSE vent_movement = VENTCRAWL_CAN_SEE + interaction_flags_click = NEED_HANDS var/temperature_archived var/mob/living/carbon/occupant /// A separate effect for the occupant, as you can't animate overlays reliably and constantly removing and adding overlays is spamming the subsystem. @@ -506,11 +507,10 @@ return TRUE -/obj/machinery/atmospherics/unary/cryo_cell/AltClick(mob/living/carbon/user) - if(!iscarbon(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user)) - return +/obj/machinery/atmospherics/unary/cryo_cell/click_alt(mob/living/carbon/user) go_out() add_fingerprint(user) + return CLICK_ACTION_SUCCESS /obj/machinery/atmospherics/unary/cryo_cell/verb/move_eject() diff --git a/code/game/machinery/customat.dm b/code/game/machinery/customat.dm index 1816baaba8e..a5204c45b98 100644 --- a/code/game/machinery/customat.dm +++ b/code/game/machinery/customat.dm @@ -753,17 +753,18 @@ stat |= BROKEN update_icon(UPDATE_OVERLAYS) -/obj/machinery/customat/AltClick(atom/movable/A) +/obj/machinery/customat/click_alt(atom/movable/A) if(!panel_open) balloon_alert(A, "панель закрыта") - return + return CLICK_ACTION_BLOCKING if(isLocked()) balloon_alert(A, "автомат заблокирован") - return + return CLICK_ACTION_BLOCKING balloon_alert(A, "быстрый режим " + (fast_insert ? "отключен" : "включен")) fast_insert = !fast_insert + return CLICK_ACTION_SUCCESS /obj/machinery/customat/emp_act(severity) switch(severity) diff --git a/code/game/machinery/defib_mount.dm b/code/game/machinery/defib_mount.dm index 2b53c6d6e14..d6fe3b6df82 100644 --- a/code/game/machinery/defib_mount.dm +++ b/code/game/machinery/defib_mount.dm @@ -146,23 +146,18 @@ qdel(src) -/obj/machinery/defibrillator_mount/AltClick(mob/living/carbon/human/user) - if(!istype(user) || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - balloon_alert(user, "невозможно!") - return +/obj/machinery/defibrillator_mount/click_alt(mob/living/carbon/human/user) if(!defib) balloon_alert(user, "дефибриллятор отсутствует!") - return + return CLICK_ACTION_BLOCKING var/obj/item/organ/external/hand_right = user.get_organ(BODY_ZONE_PRECISE_R_HAND) var/obj/item/organ/external/hand_left = user.get_organ(BODY_ZONE_PRECISE_L_HAND) if((!hand_right || !hand_right.is_usable()) && (!hand_left || !hand_left.is_usable())) balloon_alert(user, "невозможно!") - return + return CLICK_ACTION_BLOCKING if(clamps_locked) balloon_alert(user, "заблокировано!") - return + return CLICK_ACTION_BLOCKING defib.forceMove_turf() user.put_in_hands(defib, ignore_anim = FALSE) visible_message(span_notice("[user] вынима[pluralize_ru(user.gender, "ет", "ют")] [defib.declent_ru(ACCUSATIVE)] из [declent_ru(GENITIVE)].")) @@ -170,6 +165,7 @@ playsound(src, 'sound/items/deconstruct.ogg', 50, TRUE) defib = null update_icon(UPDATE_OVERLAYS) + return CLICK_ACTION_SUCCESS //wallframe, for attaching the mounts easily diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index f1bd6736acd..3d676d2acfb 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -176,10 +176,9 @@ . = ..() . += span_notice("Alt-click to toggle modes.") -/obj/item/grenade/barrier/AltClick(mob/living/carbon/user) - if(!istype(user) || !user.Adjacent(src) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return +/obj/item/grenade/barrier/click_alt(mob/living/carbon/user) toggle_mode(user) + return CLICK_ACTION_SUCCESS /obj/item/grenade/barrier/proc/toggle_mode(mob/user) switch(mode) diff --git a/code/game/machinery/doppler_array.dm b/code/game/machinery/doppler_array.dm index 3708e026360..58b8e5b66fa 100644 --- a/code/game/machinery/doppler_array.dm +++ b/code/game/machinery/doppler_array.dm @@ -9,6 +9,7 @@ GLOBAL_LIST_EMPTY(doppler_arrays) density = TRUE anchored = TRUE atom_say_verb = "states coldly" + interaction_flags_click = NEED_HANDS | NEED_DEXTERITY var/list/logged_explosions = list() var/explosion_target var/datum/tech/toxins/toxins_tech @@ -20,13 +21,17 @@ GLOBAL_LIST_EMPTY(doppler_arrays) var/actual_size_message var/theoretical_size_message -/datum/explosion_log/New(var/log_time, var/log_epicenter, var/log_actual_size_message, var/log_theoretical_size_message) +/datum/explosion_log/New(log_time, log_epicenter, log_actual_size_message, log_theoretical_size_message) ..() logged_time = log_time epicenter = log_epicenter actual_size_message = log_actual_size_message theoretical_size_message = log_theoretical_size_message +/obj/machinery/doppler_array/examine(mob/user) + . = ..() + . += span_info("Alt-Click to rotate.") + /obj/machinery/doppler_array/New() ..() GLOB.doppler_arrays += src @@ -70,25 +75,11 @@ GLOBAL_LIST_EMPTY(doppler_arrays) ui_interact(user) -/obj/machinery/doppler_array/AltClick(mob/user) +/obj/machinery/doppler_array/click_alt(mob/user) rotate(user) - - -/obj/machinery/doppler_array/verb/rotate_verb() - set name = "Rotate Tachyon-doppler Dish" - set category = "Object" - set src in oview(1) - rotate(usr) - + return CLICK_ACTION_SUCCESS /obj/machinery/doppler_array/proc/rotate(mob/user) - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return - if(!Adjacent(user)) - return - if(!user.IsAdvancedToolUser()) - to_chat(user, span_warning("You don't have the dexterity to do that!")) - return add_fingerprint(user) dir = turn(dir, 90) to_chat(user, span_notice("You rotate [src].")) diff --git a/code/game/machinery/hologram.dm b/code/game/machinery/hologram.dm index a00629f0c23..161e6748732 100644 --- a/code/game/machinery/hologram.dm +++ b/code/game/machinery/hologram.dm @@ -164,12 +164,10 @@ GLOBAL_LIST_EMPTY(holopads) user.set_machine(src) interact(user) -/obj/machinery/hologram/holopad/AltClick(mob/living/carbon/human/user) - if(..()) - return +/obj/machinery/hologram/holopad/click_alt(mob/living/carbon/human/user) if(isAI(user)) hangup_all_calls() - return + return CLICK_ACTION_SUCCESS //Stop ringing the AI!! /obj/machinery/hologram/holopad/proc/hangup_all_calls() diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 23789cfe01a..ab3aa7fea61 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -103,6 +103,7 @@ Class Procs: layer = BELOW_OBJ_LAYER pass_flags_self = PASSMACHINE|LETPASSCLICKS pull_push_slowdown = 1.3 + interaction_flags_click = NEED_HANDS var/stat = 0 var/emagged = 0 var/use_power = IDLE_POWER_USE diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 2e85b1d6024..0eacc868139 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -151,9 +151,9 @@ else return ..() -/obj/item/pipe/AltClick(mob/user) - if(Adjacent(user)) - rotate() +/obj/item/pipe/click_alt(mob/user) + rotate() + return CLICK_ACTION_SUCCESS /obj/item/pipe/proc/update(var/obj/machinery/atmospherics/make_from) name = "[get_pipe_name(pipe_type, PIPETYPE_ATMOS)] fitting" diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 29eeb3d35a9..c4e392e2f68 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -227,11 +227,11 @@ if(aggressive) . += span_warning("Его индикаторы зловеще мигают...") -/obj/machinery/vending/AltClick(mob/user) - if(!tilted || !Adjacent(user) || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return - +/obj/machinery/vending/click_alt(mob/user) + if(!tilted) + return NONE untilt(user) + return CLICK_ACTION_SUCCESS /obj/machinery/vending/Destroy() SStgui.close_uis(wires) diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index 0a02a9f4aa0..af909c20908 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -153,6 +153,9 @@ GLOBAL_LIST_INIT(dye_registry, list( /// Our sweet wires var/datum/wires/washing_machine/wires +/obj/machinery/washing_machine/examine(mob/user) + . = ..() + . += span_info("Alt-click to start washing.") /obj/machinery/washing_machine/Initialize(mapload) . = ..() @@ -485,19 +488,11 @@ GLOBAL_LIST_INIT(dye_registry, list( turn_on(user) -/obj/machinery/washing_machine/AltClick(mob/user) - if(Adjacent(user) && generic_check(user)) - turn_on(user) - - -/obj/machinery/washing_machine/verb/start() - set name = "Start Washing" - set category = "Object" - set src in oview(1) - - if(generic_check(usr)) - turn_on(usr) - +/obj/machinery/washing_machine/click_alt(mob/user) + if(!generic_check(user)) + return CLICK_ACTION_BLOCKING + turn_on(user) + return CLICK_ACTION_SUCCESS /// Engages washing cycle /obj/machinery/washing_machine/proc/turn_on(mob/user) diff --git a/code/game/mecha/mecha_actions.dm b/code/game/mecha/mecha_actions.dm index b17d10f0887..85b4f3f3642 100644 --- a/code/game/mecha/mecha_actions.dm +++ b/code/game/mecha/mecha_actions.dm @@ -276,10 +276,11 @@ return chassis.toggle_strafe() -/obj/mecha/AltClick(mob/living/user) //Strafing is toggled by interface button or by Alt-clicking on mecha +/obj/mecha/click_alt(mob/living/user) //Strafing is toggled by interface button or by Alt-clicking on mecha if(!occupant || occupant != user) return toggle_strafe() + return CLICK_ACTION_SUCCESS /** * Proc that toggles strafe mode of the mecha ON/OFF diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 8fa6b399925..392fe26cebe 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -5,6 +5,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/g blocks_emissive = EMISSIVE_BLOCK_GENERIC pass_flags_self = PASSITEM pass_flags = PASSTABLE + interaction_flags_click = NEED_HANDS move_resist = null // Set in the Initialise depending on the item size. Unless it's overriden by a specific item diff --git a/code/game/objects/items/devices/radio/radio.dm b/code/game/objects/items/devices/radio/radio.dm index a5b170e9725..363cb9357c9 100644 --- a/code/game/objects/items/devices/radio/radio.dm +++ b/code/game/objects/items/devices/radio/radio.dm @@ -613,16 +613,10 @@ GLOBAL_LIST_INIT(default_medbay_channels, list( . += "\the [src] can not be modified or attached!" . += "Ctrl-Shift-click on the [name] to toggle speaker.
Alt-click on the [name] to toggle broadcasting.
" -/obj/item/radio/AltClick(mob/user) - if(!iscarbon(user) && !isrobot(user)) - return - if(!Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/item/radio/click_alt(mob/user) broadcasting = !broadcasting to_chat(user, "You toggle broadcasting [broadcasting ? "on" : "off"].") + return CLICK_ACTION_SUCCESS /obj/item/radio/CtrlShiftClick(mob/user) //weird checks if(!Adjacent(user)) diff --git a/code/game/objects/items/devices/scanners/gas_analyzer.dm b/code/game/objects/items/devices/scanners/gas_analyzer.dm index 689c457e535..355c056895e 100644 --- a/code/game/objects/items/devices/scanners/gas_analyzer.dm +++ b/code/game/objects/items/devices/scanners/gas_analyzer.dm @@ -40,24 +40,19 @@ user.visible_message(span_suicide("[user] begins to analyze [user.p_them()]self with [src]! The display shows that [user.p_theyre()] dead!")) return BRUTELOSS -/obj/item/analyzer/AltClick(mob/living/user) //Barometer output for measuring when the next storm happens - if(!istype(user) || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/item/analyzer/click_alt(mob/living/user) //Barometer output for measuring when the next storm happens if(cooldown) - to_chat(user, "[src]'s barometer function is prepraring itself.") - return + to_chat(user, span_warning("[src]'s barometer function is prepraring itself.")) + return CLICK_ACTION_BLOCKING var/turf/T = get_turf(user) if(!T) - return + return NONE playsound(src, 'sound/effects/pop.ogg', 100) var/area/user_area = T.loc var/datum/weather/ongoing_weather = null if(!user_area.outdoors) - to_chat(user, "[src]'s barometer function won't work indoors!") - return + to_chat(user, span_warning("[src]'s barometer function won't work indoors!")) + return CLICK_ACTION_BLOCKING for(var/V in SSweather.processing) var/datum/weather/W = V if(W.barometer_predictable && (T.z in W.impacted_z_levels) && W.area_type == user_area.type && !(W.stage == END_STAGE)) @@ -65,20 +60,21 @@ break if(ongoing_weather) if((ongoing_weather.stage == MAIN_STAGE) || (ongoing_weather.stage == WIND_DOWN_STAGE)) - to_chat(user, "[src]'s barometer function can't trace anything while the storm is [ongoing_weather.stage == MAIN_STAGE ? "already here!" : "winding down."]") - return - to_chat(user, "The next [ongoing_weather] will hit in [butchertime(ongoing_weather.next_hit_time - world.time)].") + to_chat(user, span_warning("[src]'s barometer function can't trace anything while the storm is [ongoing_weather.stage == MAIN_STAGE ? "already here!" : "winding down."]")) + return CLICK_ACTION_BLOCKING + to_chat(user, span_warning("The next [ongoing_weather] will hit in [butchertime(ongoing_weather.next_hit_time - world.time)].")) if(ongoing_weather.aesthetic) - to_chat(user, "[src]'s barometer function says that the next storm will breeze on by.") + to_chat(user, span_warning("[src]'s barometer function says that the next storm will breeze on by.")) else var/next_hit = SSweather.next_hit_by_zlevel["[T.z]"] var/fixed = next_hit ? next_hit - world.time : -1 if(fixed < 0) - to_chat(user, "[src]'s barometer function was unable to trace any weather patterns.") + to_chat(user, span_warning("[src]'s barometer function was unable to trace any weather patterns.")) else - to_chat(user, "[src]'s barometer function says a storm will land in approximately [butchertime(fixed)].") + to_chat(user, span_warning("[src]'s barometer function says a storm will land in approximately [butchertime(fixed)].")) cooldown = TRUE addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/item/analyzer, ping)), cooldown_time) + return CLICK_ACTION_SUCCESS /obj/item/analyzer/proc/ping() if(isliving(loc)) diff --git a/code/game/objects/items/devices/taperecorder.dm b/code/game/objects/items/devices/taperecorder.dm index b2d5888157f..6296db5789c 100644 --- a/code/game/objects/items/devices/taperecorder.dm +++ b/code/game/objects/items/devices/taperecorder.dm @@ -122,23 +122,25 @@ record() -/obj/item/taperecorder/AltClick(mob/living/user) - if(istype(user) && mytape && !user.incapacitated() && !HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) && Adjacent(user)) - var/list/options = list( "Playback Tape" = image(icon = 'icons/obj/device.dmi', icon_state = "taperecorder_playing"), - "Print Transcript" = image(icon = 'icons/obj/bureaucracy.dmi', icon_state = "paper_words"), - "Eject Tape" = image(icon = 'icons/obj/device.dmi', icon_state = "[mytape.icon_state]") - ) - var/choice = show_radial_menu(user, src, options, require_near = TRUE) - if(!choice || user.incapacitated()) - return - switch(choice) - if("Playback Tape") - play(user) - if("Print Transcript") - print_transcript(user) - if("Eject Tape") - eject(user) - +/obj/item/taperecorder/click_alt(mob/living/user) + if(!mytape) + return NONE + + var/list/options = list( "Playback Tape" = image(icon = 'icons/obj/device.dmi', icon_state = "taperecorder_playing"), + "Print Transcript" = image(icon = 'icons/obj/bureaucracy.dmi', icon_state = "paper_words"), + "Eject Tape" = image(icon = 'icons/obj/device.dmi', icon_state = "[mytape.icon_state]") + ) + var/choice = show_radial_menu(user, src, options, require_near = TRUE) + if(!choice || user.incapacitated()) + return CLICK_ACTION_BLOCKING + switch(choice) + if("Playback Tape") + play(user) + if("Print Transcript") + print_transcript(user) + if("Eject Tape") + eject(user) + return CLICK_ACTION_SUCCESS /obj/item/taperecorder/proc/recorder_say(message, datum/tape_piece/record_datum) if(record_datum) diff --git a/code/game/objects/items/devices/tts.dm b/code/game/objects/items/devices/tts.dm index 7a2bce06026..a8e41dcf268 100644 --- a/code/game/objects/items/devices/tts.dm +++ b/code/game/objects/items/devices/tts.dm @@ -25,15 +25,10 @@ atom_say(input) add_say_logs(user, input, language = "TTS") -/obj/item/ttsdevice/AltClick(mob/living/user) - if(!istype(user) || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/item/ttsdevice/click_alt(mob/living/user) var/noisechoice = input(user, "What noise would you like to make?", "Robot Noises") as null|anything in list("Beep","Buzz","Ping") if(!noisechoice || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return + return CLICK_ACTION_BLOCKING switch(noisechoice) if("Beep") user.visible_message("[user] has made their TTS beep!", "You make your TTS beep!") @@ -44,6 +39,7 @@ if("Ping") user.visible_message("[user] has made their TTS ping!", "You make your TTS ping!") playsound(user, 'sound/machines/ping.ogg', 50, 1, -1) + return CLICK_ACTION_SUCCESS /obj/item/ttsdevice/CtrlClick(mob/living/user) if(!Adjacent(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) diff --git a/code/game/objects/items/stacks/stack.dm b/code/game/objects/items/stacks/stack.dm index 9a55f9681d1..912ae7517ab 100644 --- a/code/game/objects/items/stacks/stack.dm +++ b/code/game/objects/items/stacks/stack.dm @@ -289,22 +289,20 @@ list_recipes(user) -/obj/item/stack/AltClick(mob/living/user) - if(!ishuman(user) || amount < 1 || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, span_warning("You can't do that right now!")) - return +/obj/item/stack/click_alt(mob/living/user) + if(!ishuman(user) || amount < 1) + return NONE //get amount from user var/max = get_amount() var/stackmaterial = tgui_input_number(user, "How many sheets do you wish to take out of this stack? (Max: [max])", "Stack Split", max_value = max) if(isnull(stackmaterial) || stackmaterial <= 0 || stackmaterial > get_amount()) - return + return CLICK_ACTION_BLOCKING if(amount < 1 || !Adjacent(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return + return CLICK_ACTION_BLOCKING split_stack(user, stackmaterial) do_pickup_animation(user) to_chat(user, span_notice("You take [stackmaterial] sheets out of the stack.")) + return CLICK_ACTION_SUCCESS /obj/item/stack/attack_tk(mob/user) diff --git a/code/game/objects/items/toys.dm b/code/game/objects/items/toys.dm index ca513c71682..698996dbe95 100644 --- a/code/game/objects/items/toys.dm +++ b/code/game/objects/items/toys.dm @@ -2329,9 +2329,9 @@ return TRUE -/obj/item/toy/desk/AltClick(mob/user) - if(Adjacent(user)) - rotate() +/obj/item/toy/desk/click_alt(mob/user) + rotate() + return CLICK_ACTION_SUCCESS /obj/item/toy/desk/officetoy name = "office toy" diff --git a/code/game/objects/items/weapons/fishing_rod.dm b/code/game/objects/items/weapons/fishing_rod.dm index 6a67e2bf02f..0446dc40e79 100644 --- a/code/game/objects/items/weapons/fishing_rod.dm +++ b/code/game/objects/items/weapons/fishing_rod.dm @@ -168,12 +168,14 @@ return ATTACK_CHAIN_PROCEED_SUCCESS -/obj/item/twohanded/fishing_rod/AltClick(mob/user) - if(bait) - user.put_in_hands(bait) - to_chat(user, span_notice("Вы сняли [bait.declent_ru(ACCUSATIVE)] с крючка.")) - bait = null - update_icon(UPDATE_OVERLAYS) +/obj/item/twohanded/fishing_rod/click_alt(mob/user) + if(!bait) + return NONE + user.put_in_hands(bait) + to_chat(user, span_notice("Вы сняли [bait.declent_ru(ACCUSATIVE)] с крючка.")) + bait = null + update_icon(UPDATE_OVERLAYS) + return CLICK_ACTION_SUCCESS /obj/item/twohanded/fishing_rod/update_overlays() . = ..() diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm index ae8b3524b8c..0dee6d84a6e 100644 --- a/code/game/objects/items/weapons/flamethrower.dm +++ b/code/game/objects/items/weapons/flamethrower.dm @@ -157,18 +157,15 @@ /obj/item/flamethrower/attack_self(mob/user) toggle_igniter(user) -/obj/item/flamethrower/AltClick(mob/living/user) - if(!istype(user) || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return - if(ptank) - ptank.forceMove_turf() - user.put_in_hands(ptank, ignore_anim = FALSE) - ptank = null - to_chat(user, "You remove the plasma tank from [src]!") - update_icon() +/obj/item/flamethrower/click_alt(mob/living/user) + if(!ptank) + return NONE + ptank.forceMove_turf() + user.put_in_hands(ptank, ignore_anim = FALSE) + ptank = null + to_chat(user, span_notice("You remove the plasma tank from [src]!")) + update_icon() + return CLICK_ACTION_SUCCESS /obj/item/flamethrower/examine(mob/user) . = ..() diff --git a/code/game/objects/items/weapons/grenades/grenade.dm b/code/game/objects/items/weapons/grenades/grenade.dm index f2ea8c103e9..238c05127c5 100644 --- a/code/game/objects/items/weapons/grenades/grenade.dm +++ b/code/game/objects/items/weapons/grenades/grenade.dm @@ -16,10 +16,6 @@ var/det_time = 5 SECONDS var/display_timer = TRUE -/obj/item/grenade/Initialize(mapload) - . = ..() - ADD_TRAIT(src, TRAIT_ALT_CLICK_BLOCKER, UNIQUE_TRAIT_SOURCE(src)) - /obj/item/grenade/deconstruct(disassembled = TRUE) if(!disassembled) prime() diff --git a/code/game/objects/items/weapons/holosign.dm b/code/game/objects/items/weapons/holosign.dm index e507400067a..c56be42a575 100644 --- a/code/game/objects/items/weapons/holosign.dm +++ b/code/game/objects/items/weapons/holosign.dm @@ -74,18 +74,14 @@ holosign_type = /obj/structure/holosign/wetsign var/wet_enabled = TRUE -/obj/item/holosign_creator/janitor/AltClick(mob/living/user) - if(!istype(user) || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/item/holosign_creator/janitor/click_alt(mob/living/user) wet_enabled = !wet_enabled playsound(loc, 'sound/weapons/empty.ogg', 20) if(wet_enabled) - to_chat(user, "You enable the W.E.T. (wet evaporation timer)\nAny newly placed holographic signs will clear after the likely time it takes for a mopped tile to dry.") + to_chat(user, span_notice("You enable the W.E.T. (wet evaporation timer)\nAny newly placed holographic signs will clear after the likely time it takes for a mopped tile to dry.")) else - to_chat(user, "You disable the W.E.T. (wet evaporation timer)\nAny newly placed holographic signs will now stay indefinitely.") + to_chat(user, span_notice("You disable the W.E.T. (wet evaporation timer)\nAny newly placed holographic signs will now stay indefinitely.")) + return CLICK_ACTION_SUCCESS /obj/item/holosign_creator/janitor/examine(mob/user) . = ..() diff --git a/code/game/objects/items/weapons/implants/implantpad.dm b/code/game/objects/items/weapons/implants/implantpad.dm index 925622c37fd..bb42353d811 100644 --- a/code/game/objects/items/weapons/implants/implantpad.dm +++ b/code/game/objects/items/weapons/implants/implantpad.dm @@ -53,10 +53,9 @@ update_icon(UPDATE_ICON_STATE) -/obj/item/implantpad/AltClick(mob/living/user) - if(!ishuman(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user)) - return +/obj/item/implantpad/click_alt(mob/living/user) eject_case(user) + return CLICK_ACTION_SUCCESS /obj/item/implantpad/ui_interact(mob/user, datum/tgui/ui = null) diff --git a/code/game/objects/items/weapons/rpd.dm b/code/game/objects/items/weapons/rpd.dm index 506d1cc5b43..a93c6278406 100644 --- a/code/game/objects/items/weapons/rpd.dm +++ b/code/game/objects/items/weapons/rpd.dm @@ -188,13 +188,9 @@ get_asset_datum(/datum/asset/spritesheet/rpd) ) -/obj/item/rpd/AltClick(mob/living/user) - if(!istype(user) || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/item/rpd/click_alt(mob/living/user) radial_menu(user) + return CLICK_ACTION_SUCCESS /obj/item/rpd/ui_data(mob/user) var/list/data = list() diff --git a/code/game/objects/items/weapons/storage/secure.dm b/code/game/objects/items/weapons/storage/secure.dm index eb80450a051..64ccffea392 100644 --- a/code/game/objects/items/weapons/storage/secure.dm +++ b/code/game/objects/items/weapons/storage/secure.dm @@ -117,9 +117,9 @@ to_chat(user, "You short out the lock on [src].") -/obj/item/storage/secure/AltClick(mob/living/user) +/obj/item/storage/secure/click_alt(mob/living/user) if(!try_to_open(user)) - return FALSE + return CLICK_ACTION_BLOCKING return ..() /obj/item/storage/secure/MouseDrop(atom/over_object, src_location, over_location, src_control, over_control, params) @@ -132,7 +132,7 @@ return TRUE if(locked) add_fingerprint(usr) - to_chat(usr, "It's locked!") + to_chat(usr, span_warning("It's locked!")) return FALSE return TRUE diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index 2010e9a637a..1ecb6a7d908 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -139,14 +139,12 @@ return ..() -/obj/item/storage/AltClick(mob/user) - if((ishuman(user) || issilicon(user)) \ - && Adjacent(user) && !user.incapacitated() \ - && !HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - open(user) - - else if(isobserver(user)) +/obj/item/storage/click_alt(mob/user) + if(isobserver(user)) show_to(user) + return CLICK_ACTION_SUCCESS + open(user) + return CLICK_ACTION_SUCCESS /obj/item/storage/proc/return_inv() var/list/L = list() diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 0021f306b59..980dc3335ef 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -13,6 +13,7 @@ GLOBAL_LIST_EMPTY(closets) armor = list("melee" = 20, "bullet" = 10, "laser" = 10, "energy" = 0, "bomb" = 10, "bio" = 0, "rad" = 0, "fire" = 70, "acid" = 60) pass_flags_self = PASSSTRUCTURE|LETPASSCLICKS pull_push_slowdown = 1.3 // Same as a prone mob + interaction_flags_click = NEED_HANDS /// Special marker for the closet to use default icon_closed/icon_opened states, skipping everything else. var/no_overlays = FALSE @@ -503,11 +504,12 @@ GLOBAL_LIST_EMPTY(closets) return -/obj/structure/closet/AltClick(mob/living/simple_animal/hostile/gorilla/gorilla) - if(istype(gorilla) && !gorilla.incapacitated() && !HAS_TRAIT(gorilla, TRAIT_HANDS_BLOCKED) && Adjacent(gorilla)) +/obj/structure/closet/click_alt(mob/living/simple_animal/hostile/gorilla/gorilla) + if(istype(gorilla)) gorilla.face_atom(src) toggle() gorilla.oogaooga() + return CLICK_ACTION_SUCCESS return ..() /obj/structure/closet/shove_impact(mob/living/target, mob/living/attacker) diff --git a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm index ee176401cc5..66635fcf3df 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/secure_closets.dm @@ -88,9 +88,9 @@ togglelock(user) -/obj/structure/closet/secure_closet/AltClick(mob/user) - if(Adjacent(user)) - togglelock(user) +/obj/structure/closet/secure_closet/click_alt(mob/user) + togglelock(user) + return CLICK_ACTION_SUCCESS /obj/structure/closet/secure_closet/attack_hand(mob/user) diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index 9c8992df453..03150cb624e 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -210,9 +210,9 @@ return !locked -/obj/structure/closet/crate/secure/AltClick(mob/living/user) - if(Adjacent(user)) - togglelock(user) +/obj/structure/closet/crate/secure/click_alt(mob/living/user) + togglelock(user) + return CLICK_ACTION_SUCCESS /obj/structure/closet/crate/secure/proc/togglelock(mob/living/user) diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index 0a28526c34f..89d2b4ae482 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -12,6 +12,7 @@ density = FALSE max_integrity = 200 integrity_failure = 50 + interaction_flags_click = NEED_HANDS var/obj/item/extinguisher/has_extinguisher = null var/extinguishertype var/opened = FALSE @@ -33,19 +34,13 @@ /obj/structure/extinguisher_cabinet/examine(mob/user) . = ..() - . += "Alt-click to [opened ? "close":"open"] it." + . += span_notice("Alt-click to [opened ? "close":"open"] it.") -/obj/structure/extinguisher_cabinet/AltClick(mob/living/user) - if(!iscarbon(usr) && !isrobot(usr)) - return - if(!in_range(src, user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/structure/extinguisher_cabinet/click_alt(mob/living/user) playsound(loc, 'sound/machines/click.ogg', 15, TRUE, -3) opened = !opened update_icon(UPDATE_ICON_STATE) + return CLICK_ACTION_SUCCESS /obj/structure/extinguisher_cabinet/Destroy() QDEL_NULL(has_extinguisher) diff --git a/code/game/objects/structures/inflatable.dm b/code/game/objects/structures/inflatable.dm index 097fe518d02..ece5f416874 100644 --- a/code/game/objects/structures/inflatable.dm +++ b/code/game/objects/structures/inflatable.dm @@ -21,6 +21,7 @@ max_integrity = 50 icon = 'icons/obj/inflatable.dmi' icon_state = "wall" + interaction_flags_click = NEED_HANDS var/torn = /obj/item/inflatable/torn var/intact = /obj/item/inflatable @@ -46,13 +47,9 @@ /obj/structure/inflatable/attack_hand(mob/user) add_fingerprint(user) -/obj/structure/inflatable/AltClick(mob/living/user) - if(!istype(user) || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/structure/inflatable/click_alt(mob/living/user) deconstruct(TRUE) + return CLICK_ACTION_SUCCESS /obj/structure/inflatable/deconstruct(disassembled = TRUE) diff --git a/code/game/objects/structures/railings.dm b/code/game/objects/structures/railings.dm index e26f981fa64..af1dec93084 100644 --- a/code/game/objects/structures/railings.dm +++ b/code/game/objects/structures/railings.dm @@ -10,6 +10,7 @@ obj_flags = BLOCKS_CONSTRUCTION_DIR climbable = TRUE layer = ABOVE_MOB_LAYER + interaction_flags_click = NEED_HANDS var/currently_climbed = FALSE var/buildstacktype = /obj/item/stack/rods var/buildstackamount = 3 @@ -124,12 +125,12 @@ /obj/structure/railing/proc/can_be_rotated(mob/user) if(anchored) - to_chat(user, "[src] cannot be rotated while it is fastened to the floor!") + to_chat(user, span_warning("[src] cannot be rotated while it is fastened to the floor!")) return FALSE var/target_dir = turn(dir, -45) if(!valid_build_direction(loc, target_dir)) //Expanded to include rails, as well! - to_chat(user, "[src] cannot be rotated in that direction!") + to_chat(user, span_warning("[src] cannot be rotated in that direction!")) return FALSE return TRUE @@ -139,15 +140,11 @@ /obj/structure/railing/proc/after_rotation(mob/user) add_fingerprint(user) -/obj/structure/railing/AltClick(mob/user) - if(!Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return - if(can_be_rotated(user)) - setDir(turn(dir, 45)) - +/obj/structure/railing/click_alt(mob/user) + if(!can_be_rotated(user)) + return CLICK_ACTION_BLOCKING + setDir(turn(dir, 45)) + return CLICK_ACTION_SUCCESS /obj/structure/railing/setDir(newdir) . = ..() @@ -182,17 +179,13 @@ else layer = HIGH_OBJ_LAYER -/obj/structure/railing/wooden/AltClick(mob/user) - if(!Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/structure/railing/wooden/click_alt(mob/user) if(anchored) to_chat(user, "It is fastened to the floor!") - return + return CLICK_ACTION_BLOCKING setDir(turn(dir, 90)) after_rotation(user) + return CLICK_ACTION_SUCCESS /obj/structure/railing/wooden/wrench_act(mob/user, obj/item/I) . = TRUE diff --git a/code/game/objects/structures/reflector.dm b/code/game/objects/structures/reflector.dm index 24abc86cf67..06d63c4d386 100644 --- a/code/game/objects/structures/reflector.dm +++ b/code/game/objects/structures/reflector.dm @@ -137,10 +137,9 @@ return TRUE -/obj/structure/reflector/AltClick(mob/user) - if(!Adjacent(user)) - return +/obj/structure/reflector/click_alt(mob/user) rotate() + return CLICK_ACTION_SUCCESS //TYPES OF REFLECTORS, SINGLE, DOUBLE, BOX diff --git a/code/game/objects/structures/snow.dm b/code/game/objects/structures/snow.dm index a9336c48d6f..2af2bca066b 100644 --- a/code/game/objects/structures/snow.dm +++ b/code/game/objects/structures/snow.dm @@ -8,21 +8,23 @@ icon = 'icons/turf/snow.dmi' icon_state = "snow" max_integrity = 15 + interaction_flags_click = NEED_HANDS var/cooldown = 0 // very cool down /obj/structure/snow/has_prints() return FALSE -/obj/structure/snow/AltClick(mob/user) - . = ..() +/obj/structure/snow/click_alt(mob/user) if(cooldown > world.time) - return - if(ishuman(user) && Adjacent(user) && !user.incapacitated() && !HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - var/mob/living/carbon/human/H = user - var/obj/item/snowball/S = new(drop_location()) - cooldown = world.time + 3 SECONDS + balloon_alert(user, "Снег копиться!") + return CLICK_ACTION_BLOCKING - if(H.put_in_hands(S, ignore_anim = FALSE)) - playsound(src, 'sound/weapons/slashmiss.ogg', 15) // crunchy snow sound - else - qdel(S) // Spawn in hands only + var/mob/living/carbon/human/H = user + var/obj/item/snowball/S = new(drop_location()) + cooldown = world.time + 3 SECONDS + + if(H.put_in_hands(S, ignore_anim = FALSE)) + playsound(src, 'sound/weapons/slashmiss.ogg', 15) // crunchy snow sound + else + qdel(S) // Spawn in hands only + return CLICK_ACTION_SUCCESS diff --git a/code/game/objects/structures/stairs.dm b/code/game/objects/structures/stairs.dm index 103c84c0102..473a6509e39 100644 --- a/code/game/objects/structures/stairs.dm +++ b/code/game/objects/structures/stairs.dm @@ -136,6 +136,7 @@ icon_state = "stairs_frame" density = FALSE anchored = FALSE + interaction_flags_click = NEED_HANDS /// What type of stack will this drop on deconstruction? var/frame_stack = /obj/item/stack/rods /// How much of frame_stack should this drop on deconstruction? @@ -146,18 +147,13 @@ desc = "Everything you need to build a staircase, minus the actual stairs, this one is made of wood." frame_stack = /obj/item/stack/sheet/wood -/obj/structure/stairs_frame/AltClick(mob/user) - if(!Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/structure/stairs_frame/click_alt(mob/user) if(anchored) - to_chat(user, "It is fastened to the floor!") - return + to_chat(user, span_warning("It is fastened to the floor!")) + return CLICK_ACTION_BLOCKING add_fingerprint(usr) setDir(turn(dir, 90)) - + return CLICK_ACTION_SUCCESS /obj/structure/stairs_frame/examine(mob/living/carbon/human/user) . = ..() diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm index 6207d1beb45..a7f36eee3aa 100644 --- a/code/game/objects/structures/statues.dm +++ b/code/game/objects/structures/statues.dm @@ -293,17 +293,14 @@ /obj/structure/statue/tranquillite/mime name = "statue of a mime" icon_state = "mime" + interaction_flags_click = NEED_HANDS -/obj/structure/statue/tranquillite/mime/AltClick(mob/user)//has 4 dirs - if(!Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/structure/statue/tranquillite/mime/click_alt(mob/user)//has 4 dirs if(anchored) - to_chat(user, "It is fastened to the floor!") - return + to_chat(user, span_warning("It is fastened to the floor!")) + return CLICK_ACTION_BLOCKING setDir(turn(dir, 90)) + return CLICK_ACTION_SUCCESS /obj/structure/statue/tranquillite/mime/unique name = "статуя гордости пантомимы" diff --git a/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm b/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm index 4b392bcd359..ea8648d540e 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/alien_nests.dm @@ -93,7 +93,7 @@ /obj/structure/bed/nest/post_buckle_mob(mob/living/target) - ADD_TRAIT(target, TRAIT_HANDS_BLOCKED, type) + ADD_TRAIT(target, TRAIT_RESTRAINED, type) target.pixel_y = target.base_pixel_y target.pixel_x = target.base_pixel_x + 2 target.layer = BELOW_MOB_LAYER @@ -101,7 +101,7 @@ /obj/structure/bed/nest/post_unbuckle_mob(mob/living/target) - REMOVE_TRAIT(target, TRAIT_HANDS_BLOCKED, type) + REMOVE_TRAIT(target, TRAIT_RESTRAINED, type) target.pixel_x = target.base_pixel_x + target.body_position_pixel_x_offset target.pixel_y = target.base_pixel_y + target.body_position_pixel_y_offset target.layer = initial(target.layer) diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index ea305843f97..1569d133355 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -10,6 +10,7 @@ max_integrity = 250 integrity_failure = 25 pull_push_slowdown = 0.5 + interaction_flags_click = NEED_HANDS var/buildstacktype = /obj/item/stack/sheet/metal var/buildstackamount = 1 var/item_chair = /obj/item/chair // if null it can't be picked up @@ -152,8 +153,9 @@ return TRUE -/obj/structure/chair/AltClick(mob/living/user) +/obj/structure/chair/click_alt(mob/living/user) rotate(user) + return CLICK_ACTION_SUCCESS // CHAIR TYPES @@ -534,12 +536,7 @@ /obj/structure/chair/brass/ratvar_act() return -/obj/structure/chair/brass/AltClick(mob/living/user) - if(!istype(user) || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, span_warning("You can't do that right now!")) - return +/obj/structure/chair/brass/click_alt(mob/living/user) add_fingerprint(user) turns = 0 if(!isprocessing) @@ -550,6 +547,7 @@ user.visible_message(span_notice("[user] stops [src]'s uncontrollable spinning."), \ span_notice("You grab [src] and stop its wild spinning.")) STOP_PROCESSING(SSfastprocess, src) + return CLICK_ACTION_SUCCESS /obj/structure/chair/brass/fake name = "brass chair" diff --git a/code/game/objects/structures/tribune.dm b/code/game/objects/structures/tribune.dm index b27f557186a..23093f1cef4 100644 --- a/code/game/objects/structures/tribune.dm +++ b/code/game/objects/structures/tribune.dm @@ -9,6 +9,7 @@ max_integrity = 100 resistance_flags = FLAMMABLE pass_flags_self = PASSGLASS + interaction_flags_click = NEED_HANDS var/buildstacktype = /obj/item/stack/sheet/wood var/buildstackamount = 5 var/mover_dir = null @@ -61,17 +62,13 @@ else layer = ABOVE_MOB_LAYER -/obj/structure/tribune/AltClick(mob/user) - if(!Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/structure/tribune/click_alt(mob/user) if(anchored) - to_chat(user, "It is fastened to the floor!") - return + to_chat(user, span_warning("It is fastened to the floor!")) + return CLICK_ACTION_BLOCKING setDir(turn(dir, 90)) after_rotation(user) + return CLICK_ACTION_SUCCESS /obj/structure/tribune/CanAllowThrough(atom/movable/mover, border_dir) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index c3ec2aafc37..42dd03352ba 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -21,6 +21,7 @@ pass_flags_self = PASSGLASS obj_flags = BLOCKS_CONSTRUCTION_DIR set_dir_on_move = FALSE + interaction_flags_click = NEED_HANDS var/ini_dir var/obj/item/access_control/electronics var/created_name @@ -32,7 +33,7 @@ /obj/structure/windoor_assembly/examine(mob/user) . = ..() - . += "Alt-click to rotate it clockwise." + . += span_info("Alt-click to rotate it clockwise.") /obj/structure/windoor_assembly/Initialize(mapload, set_dir) . = ..() @@ -322,21 +323,20 @@ qdel(src) +/obj/structure/windoor_assembly/click_alt(mob/user) + if(revrotate()) + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING + //Rotates the windoor assembly clockwise /obj/structure/windoor_assembly/verb/revrotate() - set name = "Rotate Windoor Assembly" - set category = "Object" - set src in oview(1) - if(usr.incapacitated() || HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED)) - to_chat(usr, "You can't do that right now!") - return if(anchored) - to_chat(usr, "[src] cannot be rotated while it is fastened to the floor!") + to_chat(usr, span_warning("[src] cannot be rotated while it is fastened to the floor!")) return FALSE var/target_dir = turn(dir, 270) if(!valid_build_direction(loc, target_dir)) - to_chat(usr, "[src] cannot be rotated in that direction!") + to_chat(usr, span_warning("[src] cannot be rotated in that direction!")) return FALSE setDir(target_dir) @@ -345,10 +345,6 @@ update_icon(UPDATE_ICON_STATE) return TRUE -/obj/structure/windoor_assembly/AltClick(mob/user) - if(!Adjacent(user)) - return - revrotate() //Flips the windoor assembly, determines whather the door opens to the left or the right /obj/structure/windoor_assembly/verb/flip() diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 4c15926b394..1a716a899be 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -37,6 +37,7 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", max_integrity = 25 resistance_flags = ACID_PROOF armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 80, "acid" = 100) + interaction_flags_click = NEED_HANDS var/ini_dir = null var/state = WINDOW_OUT_OF_FRAME var/reinf = FALSE @@ -125,7 +126,7 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", else . += "The window is unscrewed from the floor, and could be deconstructed by wrenching." if(!anchored && !fulltile) - . += "Alt-click to rotate it." + . += span_info("Alt-click to rotate it.") /obj/structure/window/narsie_act() @@ -426,30 +427,21 @@ GLOBAL_LIST_INIT(wcCommon, pick(list("#379963", "#0d8395", "#58b5c3", "#49e46e", return RCD_ACT_FAILED -/obj/structure/window/AltClick(mob/user) - - if(!Adjacent(user)) - to_chat(user, "Move closer to the window!") - return - - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return - +/obj/structure/window/click_alt(mob/user) if(anchored) - to_chat(user, "[src] cannot be rotated while it is fastened to the floor!") - return FALSE + to_chat(user, span_warning("[src] cannot be rotated while it is fastened to the floor!")) + return CLICK_ACTION_BLOCKING var/target_dir = turn(dir, 90) if(!valid_build_direction(loc, target_dir, fulltile)) - to_chat(user, "There is no room to rotate the [src]") - return FALSE + to_chat(user, span_warning("There is no room to rotate the [src]")) + return CLICK_ACTION_BLOCKING setDir(target_dir) ini_dir = dir add_fingerprint(user) - return TRUE + return CLICK_ACTION_SUCCESS /obj/structure/window/Move(atom/newloc, direct = NONE, glide_size_override = 0, update_dir = TRUE) diff --git a/code/modules/admin/sound_emitter.dm b/code/modules/admin/sound_emitter.dm index 6531f43390a..6118bf8632a 100644 --- a/code/modules/admin/sound_emitter.dm +++ b/code/modules/admin/sound_emitter.dm @@ -58,10 +58,11 @@ return edit_emitter(user) -/obj/effect/sound_emitter/AltClick(mob/user) +/obj/effect/sound_emitter/click_alt(mob/user) if(check_rights_for(user.client, R_SOUNDS)) activate(user) to_chat(user, span_notice("Звуковой излучатель активирован.")) + return CLICK_ACTION_SUCCESS /obj/effect/sound_emitter/proc/edit_emitter(mob/user) var/dat = "" diff --git a/code/modules/antagonists/thief/thief_kit.dm b/code/modules/antagonists/thief/thief_kit.dm index 0e5e61f42e0..7ea97c1d946 100644 --- a/code/modules/antagonists/thief/thief_kit.dm +++ b/code/modules/antagonists/thief/thief_kit.dm @@ -117,7 +117,7 @@ if("undoKit") undoKit(params["item"]) -/obj/item/thief_kit/proc/openKit(var/mob/user) +/obj/item/thief_kit/proc/openKit(mob/user) if(uses >= possible_uses) var/obj/item/storage/box/thief_kit/kit = new(src) @@ -126,7 +126,7 @@ kit.contents.Add(new item_type(src)) user.put_in_hands(kit) - kit.AltClick(user) + kit.open(user) SStgui.close_uis(src) qdel(src) else diff --git a/code/modules/assembly/infrared.dm b/code/modules/assembly/infrared.dm index d5e486022f7..1bd00d9ae39 100644 --- a/code/modules/assembly/infrared.dm +++ b/code/modules/assembly/infrared.dm @@ -186,10 +186,9 @@ attack_self(usr) -/obj/item/assembly/infra/AltClick(mob/user) - if(!Adjacent(user)) - return ..() +/obj/item/assembly/infra/click_alt(mob/user) rotate(user) + return CLICK_ACTION_SUCCESS /obj/item/assembly/infra/verb/rotate_verb() diff --git a/code/modules/assembly/mousetrap.dm b/code/modules/assembly/mousetrap.dm index cd457ac5de5..0584368ef62 100644 --- a/code/modules/assembly/mousetrap.dm +++ b/code/modules/assembly/mousetrap.dm @@ -162,10 +162,9 @@ armed = TRUE -/obj/item/assembly/mousetrap/AltClick(mob/user) - if(!Adjacent(user)) - return ..() +/obj/item/assembly/mousetrap/click_alt(mob/user) hide_under(user) + return CLICK_ACTION_SUCCESS /obj/item/assembly/mousetrap/verb/hide_under_verb() diff --git a/code/modules/assembly/signaler.dm b/code/modules/assembly/signaler.dm index 2c13464e033..f710b4013b9 100644 --- a/code/modules/assembly/signaler.dm +++ b/code/modules/assembly/signaler.dm @@ -38,11 +38,10 @@ . += span_info("Alt+Click to send a signal.") -/obj/item/assembly/signaler/AltClick(mob/user) - if(!isliving(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user)) - return ..() +/obj/item/assembly/signaler/click_alt(mob/user) to_chat(user, span_notice("You activate [src].")) activate() + return CLICK_ACTION_SUCCESS /obj/item/assembly/signaler/activate() diff --git a/code/modules/atmospherics/machinery/atmospherics.dm b/code/modules/atmospherics/machinery/atmospherics.dm index 2ea3edfc557..d099723a115 100644 --- a/code/modules/atmospherics/machinery/atmospherics.dm +++ b/code/modules/atmospherics/machinery/atmospherics.dm @@ -389,11 +389,10 @@ Pipelines + Other Objects -> Pipe network #undef VENT_SOUND_DELAY -/obj/machinery/atmospherics/AltClick(mob/living/user) +/obj/machinery/atmospherics/click_alt(mob/living/user) if((vent_movement & VENTCRAWL_ALLOWED) && istype(user)) user.handle_ventcrawl(src) - return - return ..() + return CLICK_ACTION_SUCCESS /obj/machinery/atmospherics/proc/change_color(new_color) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm index 80ef38098b8..c4a32ea92c7 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -14,10 +14,6 @@ var/id = null -/obj/machinery/atmospherics/binary/passive_gate/Initialize(mapload) - . = ..() - ADD_TRAIT(src, TRAIT_ALT_CLICK_BLOCKER, UNIQUE_TRAIT_SOURCE(src)) - /obj/machinery/atmospherics/binary/passive_gate/atmos_init() ..() if(frequency) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 4d43dcf3dae..31b41559eae 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -20,16 +20,13 @@ Thus, the two variables affect pump operation are set in New(): desc = "A pump" can_unwrench = TRUE + interaction_flags_click = NEED_HANDS | ALLOW_SILICON_REACH on = FALSE var/target_pressure = ONE_ATMOSPHERE var/id = null -/obj/machinery/atmospherics/binary/pump/Initialize(mapload) - . = ..() - ADD_TRAIT(src, TRAIT_ALT_CLICK_BLOCKER, UNIQUE_TRAIT_SOURCE(src)) - /obj/machinery/atmospherics/binary/pump/CtrlClick(mob/living/user) if(!ishuman(user) && !issilicon(user)) return @@ -46,18 +43,12 @@ Thus, the two variables affect pump operation are set in New(): return ..() -/obj/machinery/atmospherics/binary/pump/AltClick(mob/living/user) - if(!ishuman(user) && !issilicon(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, span_warning("You can't do that right now!")) - return - if(!in_range(src, user) && !issilicon(user)) - return +/obj/machinery/atmospherics/binary/pump/click_alt(mob/living/user) set_max() + return CLICK_ACTION_SUCCESS -/obj/machinery/atmospherics/binary/pump/AIAltClick() +/obj/machinery/atmospherics/binary/pump/ai_click_alt() set_max() return ..() diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 888174a0716..feacc03c4c6 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -20,16 +20,13 @@ Thus, the two variables affect pump operation are set in New(): desc = "A volumetric pump" can_unwrench = TRUE + interaction_flags_click = NEED_HANDS | ALLOW_SILICON_REACH on = FALSE var/transfer_rate = 200 var/id = null -/obj/machinery/atmospherics/binary/volume_pump/Initialize(mapload) - . = ..() - ADD_TRAIT(src, TRAIT_ALT_CLICK_BLOCKER, UNIQUE_TRAIT_SOURCE(src)) - /obj/machinery/atmospherics/binary/volume_pump/CtrlClick(mob/living/user) if(!ishuman(user) && !issilicon(user)) return @@ -44,17 +41,11 @@ Thus, the two variables affect pump operation are set in New(): toggle() return ..() -/obj/machinery/atmospherics/binary/volume_pump/AltClick(mob/living/user) - if(!ishuman(user) && !issilicon(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, span_warning("You can't do that right now!")) - return - if(!in_range(src, user) && !issilicon(user)) - return +/obj/machinery/atmospherics/binary/volume_pump/click_alt(mob/living/user) set_max() + return CLICK_ACTION_SUCCESS -/obj/machinery/atmospherics/binary/volume_pump/AIAltClick() +/obj/machinery/atmospherics/binary/volume_pump/ai_click_alt() set_max() return ..() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index 56d4ba18908..3c87617c03a 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -17,6 +17,7 @@ icon = 'icons/obj/pipes_and_stuff/atmospherics/atmos/filter.dmi' icon_state = "map" can_unwrench = TRUE + interaction_flags_click = NEED_HANDS | ALLOW_SILICON_REACH /// The amount of pressure the filter wants to operate at. var/target_pressure = ONE_ATMOSPHERE /// The type of gas we want to filter. Valid values that go here are from the `FILTER` defines at the top of the file. @@ -45,17 +46,11 @@ toggle() return ..() -/obj/machinery/atmospherics/trinary/filter/AltClick(mob/living/user) - if(!ishuman(usr) && !issilicon(usr)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, span_warning("You can't do that right now!")) - return - if(!in_range(src, user) && !issilicon(user)) - return +/obj/machinery/atmospherics/trinary/filter/click_alt(mob/living/user) set_max() + return CLICK_ACTION_SUCCESS -/obj/machinery/atmospherics/trinary/filter/AIAltClick() +/obj/machinery/atmospherics/trinary/filter/ai_click_alt() set_max() return ..() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index fe0df6aed60..4e1e6ad4125 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -5,6 +5,7 @@ can_unwrench = TRUE name = "gas mixer" + interaction_flags_click = NEED_HANDS | ALLOW_SILICON_REACH var/target_pressure = ONE_ATMOSPHERE var/node1_concentration = 0.5 @@ -26,17 +27,11 @@ toggle() return ..() -/obj/machinery/atmospherics/trinary/mixer/AltClick(mob/living/user) - if(!ishuman(user) && !issilicon(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, span_warning("You can't do that right now!")) - return - if(!in_range(src, user) && !issilicon(user)) - return +/obj/machinery/atmospherics/trinary/mixer/click_alt(mob/living/user) set_max() + return CLICK_ACTION_SUCCESS -/obj/machinery/atmospherics/trinary/mixer/AIAltClick() +/obj/machinery/atmospherics/trinary/mixer/ai_click_alt() set_max() return ..() diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 0b20a38af65..b54771a2554 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -4,6 +4,7 @@ max_integrity = 250 pull_push_slowdown = 1.3 armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 60, "acid" = 30) + interaction_flags_click = NEED_HANDS | ALLOW_SILICON_REACH var/datum/gas_mixture/air_contents = new var/obj/machinery/atmospherics/unary/portables_connector/connected_port @@ -92,17 +93,12 @@ /obj/machinery/portable_atmospherics/portableConnectorReturnAir() return air_contents -/obj/machinery/portable_atmospherics/AltClick(mob/living/user) - if(!ishuman(user) && !issilicon(user)) - return - if(!Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, span_warning("You can't do that right now!")) - return - if(holding) - to_chat(user, span_notice("You remove [holding] from [src].")) - replace_tank(user, TRUE) +/obj/machinery/portable_atmospherics/click_alt(mob/living/user) + if(!holding) + return NONE + to_chat(user, span_notice("You remove [holding] from [src].")) + replace_tank(user, TRUE) + return CLICK_ACTION_SUCCESS /obj/machinery/portable_atmospherics/examine(mob/user) . = ..() diff --git a/code/modules/clothing/clothing.dm b/code/modules/clothing/clothing.dm index 5d3d19974ac..24182bd96c4 100644 --- a/code/modules/clothing/clothing.dm +++ b/code/modules/clothing/clothing.dm @@ -1144,25 +1144,22 @@ BLIND // can't see anything handle_accessories_removal(usr) -/obj/item/clothing/under/AltClick(mob/user) - if(Adjacent(user)) - handle_accessories_removal(user) +/obj/item/clothing/under/click_alt(mob/user) + if(handle_accessories_removal(user)) + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/item/clothing/under/proc/handle_accessories_removal(mob/user) - if(!isliving(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return var/accessories_len = LAZYLEN(accessories) if(!accessories_len) to_chat(user, span_notice("There are no accessories attached to [src].")) - return + return FALSE var/obj/item/clothing/accessory/accessory if(accessories_len > 1) accessory = tgui_input_list(user, "Select an accessory to remove from [src]", "Accessory Removal", accessories) if(!accessory || !LAZYIN(accessories, accessory) || !Adjacent(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return + return FALSE else accessory = accessories[1] @@ -1170,6 +1167,7 @@ BLIND // can't see anything accessory.on_removed(user) if(!user.put_in_hands(accessory, ignore_anim = FALSE)) accessory.forceMove_turf() + return TRUE /obj/item/clothing/under/examine(mob/user) diff --git a/code/modules/clothing/masks/breath.dm b/code/modules/clothing/masks/breath.dm index 7b7cf4c8306..4c07fcc5fed 100644 --- a/code/modules/clothing/masks/breath.dm +++ b/code/modules/clothing/masks/breath.dm @@ -34,13 +34,9 @@ /obj/item/clothing/mask/breath/attack_self(mob/user) adjustmask(user) -/obj/item/clothing/mask/breath/AltClick(mob/living/user) - if(!istype(user) || !Adjacent(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/item/clothing/mask/breath/click_alt(mob/living/user) adjustmask(user) + return CLICK_ACTION_SUCCESS /obj/item/clothing/mask/breath/medical desc = "A close-fitting sterile mask that can be connected to an air supply." @@ -62,5 +58,5 @@ /obj/item/clothing/mask/breath/vox/attack_self(mob/user) return -/obj/item/clothing/mask/breath/vox/AltClick(mob/user) - return +/obj/item/clothing/mask/breath/vox/click_alt(mob/user) + return NONE diff --git a/code/modules/clothing/neck/ponchos.dm b/code/modules/clothing/neck/ponchos.dm index a85a5f3582c..2964635a857 100644 --- a/code/modules/clothing/neck/ponchos.dm +++ b/code/modules/clothing/neck/ponchos.dm @@ -29,10 +29,11 @@ icon_state = "[item_color]poncho[flipped ? "_flip" : ""]" -/obj/item/clothing/neck/poncho/AltClick(mob/living/carbon/human/user) +/obj/item/clothing/neck/poncho/click_alt(mob/living/carbon/human/user) if(!(src in user)) - return ..() + return NONE flip(user) + return CLICK_ACTION_SUCCESS /obj/item/clothing/neck/poncho/verb/flip_poncho() diff --git a/code/modules/clothing/spacesuits/plasmamen.dm b/code/modules/clothing/spacesuits/plasmamen.dm index 292f6636e5c..3fb12d5977f 100644 --- a/code/modules/clothing/spacesuits/plasmamen.dm +++ b/code/modules/clothing/spacesuits/plasmamen.dm @@ -37,9 +37,9 @@ weldingvisortoggle(silent = TRUE) -/obj/item/clothing/head/helmet/space/plasmaman/AltClick(mob/user) - if(Adjacent(user)) - weldingvisortoggle(user) +/obj/item/clothing/head/helmet/space/plasmaman/click_alt(mob/user) + weldingvisortoggle(user) + return CLICK_ACTION_SUCCESS /obj/item/clothing/head/helmet/space/plasmaman/ui_action_click(mob/user, datum/action/action, leftclick) diff --git a/code/modules/detectivework/microscope/dnascanner.dm b/code/modules/detectivework/microscope/dnascanner.dm index 80ce381084f..428c16a0f7e 100644 --- a/code/modules/detectivework/microscope/dnascanner.dm +++ b/code/modules/detectivework/microscope/dnascanner.dm @@ -93,8 +93,9 @@ swab = null update_icon(UPDATE_ICON_STATE) -/obj/machinery/dnaforensics/AltClick(mob/user) +/obj/machinery/dnaforensics/click_alt(mob/user) remove_sample(user) + return CLICK_ACTION_SUCCESS /obj/machinery/dnaforensics/MouseDrop(atom/over_object, src_location, over_location, src_control, over_control, params) if(usr == over_object) diff --git a/code/modules/detectivework/microscope/microscope.dm b/code/modules/detectivework/microscope/microscope.dm index d405e8363c2..21fba2102d1 100644 --- a/code/modules/detectivework/microscope/microscope.dm +++ b/code/modules/detectivework/microscope/microscope.dm @@ -117,8 +117,9 @@ /obj/machinery/microscope/proc/is_complete_print(print) return stringpercent(print) <= fingerprint_complete -/obj/machinery/microscope/AltClick(mob/user) +/obj/machinery/microscope/click_alt(mob/user) remove_sample(user) + return CLICK_ACTION_SUCCESS /obj/machinery/microscope/MouseDrop(atom/over_object, src_location, over_location, src_control, over_control, params) if(usr == over_object) diff --git a/code/modules/economy/EFTPOS.dm b/code/modules/economy/EFTPOS.dm index 3755d2be661..c682402351d 100644 --- a/code/modules/economy/EFTPOS.dm +++ b/code/modules/economy/EFTPOS.dm @@ -43,9 +43,10 @@ return -/obj/item/paper/check/AltClick(mob/living/carbon/human/user) +/obj/item/paper/check/click_alt(mob/living/carbon/human/user) if(ishuman(user) && user.is_in_hands(src)) to_chat(user, span_warning("Paper is too small! You fail to fold [src] into the shape of a plane!")) + return CLICK_ACTION_BLOCKING /obj/item/eftpos/Initialize(mapload) diff --git a/code/modules/fish/fishtank.dm b/code/modules/fish/fishtank.dm index 55d7fec3a6b..fc3896551c7 100644 --- a/code/modules/fish/fishtank.dm +++ b/code/modules/fish/fishtank.dm @@ -85,10 +85,9 @@ // VERBS & PROCS // ////////////////////////////// -/obj/machinery/fishtank/AltClick(mob/user) - if(!Adjacent(user)) - return ..() +/obj/machinery/fishtank/click_alt(mob/user) toggle_lid(user) + return CLICK_ACTION_SUCCESS /obj/machinery/fishtank/AltShiftClick(mob/user) diff --git a/code/modules/food_and_drinks/food/snacks.dm b/code/modules/food_and_drinks/food/snacks.dm index 576dc37fe22..8ae70a63b55 100644 --- a/code/modules/food_and_drinks/food/snacks.dm +++ b/code/modules/food_and_drinks/food/snacks.dm @@ -195,31 +195,27 @@ /obj/item/reagent_containers/food/snacks/sliceable/examine(mob/user) . = ..() - . += "Alt-click to put something small inside." + . += span_info("Alt-click to put something small inside.") -/obj/item/reagent_containers/food/snacks/sliceable/AltClick(mob/living/user) - if(!iscarbon(user)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/item/reagent_containers/food/snacks/sliceable/click_alt(mob/living/user) var/obj/item/I = user.get_active_hand() if(!I) - return + return NONE if(I.w_class > WEIGHT_CLASS_SMALL) - to_chat(user, "You cannot fit [I] in [src]!") - return + to_chat(user, span_warning("You cannot fit [I] in [src]!")) + return CLICK_ACTION_BLOCKING var/newweight = GetTotalContentsWeight() + I.GetTotalContentsWeight() + I.w_class if(newweight > MAX_WEIGHT_CLASS) // Nope, no bluespace slice food - to_chat(user, "You cannot fit [I] in [src]!") - return + to_chat(user, span_warning("You cannot fit [I] in [src]!")) + return CLICK_ACTION_BLOCKING if(!user.drop_transfer_item_to_loc(I, src)) - to_chat(user, "You cannot slip [I] inside [src]!") - return - to_chat(user, "You slip [I] inside [src].") + to_chat(user, span_warning("You cannot slip [I] inside [src]!")) + return CLICK_ACTION_BLOCKING + to_chat(user, span_warning("You slip [I] inside [src].")) total_w_class += I.w_class add_fingerprint(user) + return CLICK_ACTION_SUCCESS /obj/item/reagent_containers/food/snacks/sliceable/attackby(obj/item/I, mob/user, params) diff --git a/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm b/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm index 7a57fccb10c..26474b99838 100644 --- a/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm +++ b/code/modules/food_and_drinks/kitchen_machinery/kitchen_machine.dm @@ -158,20 +158,15 @@ /obj/machinery/kitchen_machine/examine(mob/user) . = ..() if(in_range(src, user)) - . += "Alt-click to activate it.
Ctrl-Shift-click to dispose content.
" - -/obj/machinery/kitchen_machine/AltClick(mob/living/carbon/human/human) - if(!istype(human) || !human.Adjacent(src)) - return - - if(human.incapacitated() || HAS_TRAIT(human, TRAIT_HANDS_BLOCKED)) - return + . += span_info("Alt-click to activate it.
Ctrl-Shift-click to dispose content.") +/obj/machinery/kitchen_machine/click_alt(mob/living/carbon/human/human) if(operating) - return + return NONE add_fingerprint(human) cook() + return CLICK_ACTION_SUCCESS /obj/machinery/kitchen_machine/CtrlShiftClick(mob/living/carbon/human/human) if(!istype(human) || !human.Adjacent(src)) diff --git a/code/modules/games/cards.dm b/code/modules/games/cards.dm index 335650e7363..7baaff92571 100644 --- a/code/modules/games/cards.dm +++ b/code/modules/games/cards.dm @@ -275,9 +275,9 @@ deckshuffle(user) -/obj/item/deck/AltClick(mob/user) - if(Adjacent(user)) - deckshuffle(user) +/obj/item/deck/click_alt(mob/user) + deckshuffle(user) + return CLICK_ACTION_SUCCESS /obj/item/deck/proc/deckshuffle(mob/user) diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 5aaefacfddf..49f12e29e20 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -126,10 +126,9 @@ return connected -/obj/machinery/hydroponics/AltClick(mob/living/user) - if(!istype(user) || !Adjacent(user)) - return +/obj/machinery/hydroponics/click_alt(mob/living/user) toggle_lid(user) + return CLICK_ACTION_SUCCESS /obj/machinery/hydroponics/proc/toggle_lid(mob/living/user) diff --git a/code/modules/instruments/objs/structures/drumkit.dm b/code/modules/instruments/objs/structures/drumkit.dm index 61f27b2d1d2..d045046e05e 100644 --- a/code/modules/instruments/objs/structures/drumkit.dm +++ b/code/modules/instruments/objs/structures/drumkit.dm @@ -90,8 +90,9 @@ if(!anchored) . += span_info("You can Alt-Click [src] to rotate it.") -/obj/structure/musician/drumkit/AltClick(mob/living/user) +/obj/structure/musician/drumkit/click_alt(mob/living/user) rotate(user) + return CLICK_ACTION_SUCCESS /obj/structure/musician/drumkit/proc/rotate(mob/living/user) diff --git a/code/modules/lootpanel/_lootpanel.dm b/code/modules/lootpanel/_lootpanel.dm index 86a94cc9957..49e70a1d508 100644 --- a/code/modules/lootpanel/_lootpanel.dm +++ b/code/modules/lootpanel/_lootpanel.dm @@ -37,6 +37,8 @@ ui.set_autoupdate(FALSE) ui.open() +/datum/lootpanel/ui_state(mob/user) + return GLOB.range_state /datum/lootpanel/ui_close(mob/user) . = ..() @@ -55,13 +57,20 @@ /datum/lootpanel/ui_status(mob/user, datum/ui_state/state) - if(!source_turf.Adjacent(user)) - return UI_CLOSE + if(isobserver(user)) + return UI_INTERACTIVE if(user.incapacitated()) return UI_DISABLED - return UI_INTERACTIVE + var/dist = get_dist(source_turf, user) + if(dist <= 1) + return UI_INTERACTIVE + + else if(dist <= 6) + return UI_UPDATE + + return UI_CLOSE /datum/lootpanel/ui_act(action, list/params) diff --git a/code/modules/lootpanel/contents.dm b/code/modules/lootpanel/contents.dm index 4bb255b1561..9c355f9ade2 100644 --- a/code/modules/lootpanel/contents.dm +++ b/code/modules/lootpanel/contents.dm @@ -24,6 +24,8 @@ continue if(thing.invisibility > owner.mob.see_invisible) continue + if(!thing.name) + continue // convert var/datum/search_object/index = new(owner, thing) diff --git a/code/modules/mining/equipment/marker_beacons.dm b/code/modules/mining/equipment/marker_beacons.dm index 2518d66aaa3..1dba8de45ef 100644 --- a/code/modules/mining/equipment/marker_beacons.dm +++ b/code/modules/mining/equipment/marker_beacons.dm @@ -57,15 +57,15 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list( var/obj/structure/marker_beacon/M = new(user.loc, picked_color) transfer_fingerprints_to(M) -/obj/item/stack/marker_beacon/AltClick(mob/living/user) - if(!istype(user) || ui_status(user, GLOB.physical_state) != UI_INTERACTIVE) - return +/obj/item/stack/marker_beacon/click_alt(mob/living/user) var/input_color = tgui_input_list(user, "Choose a color.", "Beacon Color", GLOB.marker_beacon_colors) - if(!istype(user) || ui_status(user, GLOB.physical_state) != UI_INTERACTIVE) - return - if(input_color) - picked_color = input_color - update_icon(UPDATE_ICON_STATE) + if(!Adjacent(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) + return CLICK_ACTION_BLOCKING + if(!input_color) + return CLICK_ACTION_BLOCKING + picked_color = input_color + update_icon(UPDATE_ICON_STATE) + return CLICK_ACTION_SUCCESS /obj/structure/marker_beacon name = "marker beacon" @@ -78,6 +78,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list( anchored = TRUE light_range = 2 light_power = 3 + interaction_flags_click = NEED_HANDS var/remove_speed = 15 var/picked_color @@ -148,13 +149,12 @@ GLOBAL_LIST_INIT(marker_beacon_colors, list( return ..() -/obj/structure/marker_beacon/AltClick(mob/living/user) - ..() - if(!istype(user) || !Adjacent(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || ui_status(user, GLOB.physical_state) != UI_INTERACTIVE) - return +/obj/structure/marker_beacon/click_alt(mob/living/user) var/input_color = tgui_input_list(user, "Choose a color.", "Beacon Color", GLOB.marker_beacon_colors) - if(!istype(user) || !Adjacent(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || ui_status(user, GLOB.physical_state) != UI_INTERACTIVE) - return - if(input_color) - picked_color = input_color - update_state() + if(!Adjacent(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) + return CLICK_ACTION_BLOCKING + if(!input_color) + return CLICK_ACTION_BLOCKING + picked_color = input_color + update_state() + return CLICK_ACTION_SUCCESS diff --git a/code/modules/mining/equipment/mineral_scanner.dm b/code/modules/mining/equipment/mineral_scanner.dm index 1c0fb75be78..51b7c300369 100644 --- a/code/modules/mining/equipment/mineral_scanner.dm +++ b/code/modules/mining/equipment/mineral_scanner.dm @@ -16,11 +16,10 @@ origin_tech = "engineering=1;magnets=1" -/obj/item/mining_scanner/AltClick(mob/user) - if(!Adjacent(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return +/obj/item/mining_scanner/click_alt(mob/user) speaker = !speaker - to_chat(user, "You toggle [src]'s speaker to [speaker ? "ON" : "OFF"].") + to_chat(user, span_notice("You toggle [src]'s speaker to [speaker ? "ON" : "OFF"].")) + return CLICK_ACTION_SUCCESS /obj/item/mining_scanner/attack_self(mob/user) if(!user.client) @@ -59,11 +58,10 @@ origin_tech = "engineering=3;magnets=3" -/obj/item/t_scanner/adv_mining_scanner/AltClick(mob/user) - if(!Adjacent(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return +/obj/item/t_scanner/adv_mining_scanner/click_alt(mob/user) speaker = !speaker - to_chat(user, "You toggle [src]'s speaker to [speaker ? "ON" : "OFF"].") + to_chat(user, span_notice("You toggle [src]'s speaker to [speaker ? "ON" : "OFF"].")) + return CLICK_ACTION_SUCCESS /obj/item/t_scanner/adv_mining_scanner/cyborg flags = CONDUCT @@ -161,5 +159,5 @@ /obj/item/t_scanner/adv_mining_scanner/bleary_eye/attack_self(mob/user) return -/obj/item/t_scanner/adv_mining_scanner/bleary_eye/AltClick(mob/user) - return +/obj/item/t_scanner/adv_mining_scanner/bleary_eye/click_alt(mob/user) + return NONE diff --git a/code/modules/mining/lavaland/loot/tendril_loot.dm b/code/modules/mining/lavaland/loot/tendril_loot.dm index d973e6be4ca..53ec519a031 100644 --- a/code/modules/mining/lavaland/loot/tendril_loot.dm +++ b/code/modules/mining/lavaland/loot/tendril_loot.dm @@ -108,12 +108,12 @@ open_bag(user) -/obj/item/shared_storage/AltClick(mob/user) +/obj/item/shared_storage/click_alt(mob/user) if(!bag || !iscarbon(user) || loc != user) - return ..() + return NONE open_bag(user) - + return CLICK_ACTION_SUCCESS /obj/item/shared_storage/attack_hand(mob/living/carbon/user) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 3bcdede33d0..08b7104da36 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -749,6 +749,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp return new_char +/mob/dead/observer/can_perform_action(atom/movable/target, action_bitflags) + return can_advanced_admin_interact() + /mob/dead/observer/is_literate() return TRUE diff --git a/code/modules/mob/holder_pet_carrier.dm b/code/modules/mob/holder_pet_carrier.dm index 951a65a199c..3df13d03103 100644 --- a/code/modules/mob/holder_pet_carrier.dm +++ b/code/modules/mob/holder_pet_carrier.dm @@ -64,9 +64,10 @@ M.ex_act(intensity) -/obj/item/pet_carrier/AltClick(mob/user) - if(ishuman(user) && Adjacent(user) && !user.incapacitated() && !HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - try_free_content(null, user) +/obj/item/pet_carrier/click_alt(mob/user) + if(try_free_content(null, user)) + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/item/pet_carrier/proc/put_in_carrier(mob/living/target, mob/living/user) @@ -98,6 +99,7 @@ to_chat(user, span_warning("Ваша переноска закрыта! Содержимое невозможно выгрузить!")) return FALSE free_content(new_location) + return TRUE /obj/item/pet_carrier/proc/free_content(atom/new_location) diff --git a/code/modules/mob/inventory.dm b/code/modules/mob/inventory.dm index 64d307e18ad..354284b9a62 100644 --- a/code/modules/mob/inventory.dm +++ b/code/modules/mob/inventory.dm @@ -640,6 +640,16 @@ /mob/proc/is_general_slot(slot) return (slot & (ITEM_SLOT_HANDS|ITEM_SLOT_POCKETS|ITEM_SLOT_BACKPACK|ITEM_SLOT_HANDCUFFED|ITEM_SLOT_LEGCUFFED|ITEM_SLOT_ACCESSORY)) +//GetAllContents that is reasonable and not stupid +/mob/living/proc/get_all_gear(recursive = TRUE) + var/list/processing_list = get_equipped_items(TRUE, TRUE) + listclearnulls(processing_list) // handles empty hands + var/i = 0 + while(i < length(processing_list)) + var/obj/item/storage/A = processing_list[++i] + if(istype(A) && recursive) + processing_list += A.return_inv() + return processing_list /// Collects all items in possibly equipped slots. /mob/proc/get_equipped_items(include_pockets = FALSE, include_hands = FALSE) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 518bad7d313..97b37d48854 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -419,6 +419,76 @@ return TRUE +/mob/living/can_perform_action(atom/target, action_bitflags) + if(!istype(target)) + CRASH("Missing target arg for can_perform_action") + + if(stat != CONSCIOUS) + to_chat(src, span_warning("You are not conscious enough for this action!")) + return FALSE + + if(!(action_bitflags & BYPASS_INCAPACITATED)) // should be interaction_flags_atom, but we haven't implemented yet and won't + var/ignore_flags = NONE + if(action_bitflags & INC_IGNORE_RESTRAINED) + ignore_flags |= INC_IGNORE_RESTRAINED + if(!(action_bitflags & INC_IGNORE_GRABBED)) + ignore_flags |= INC_IGNORE_GRABBED + + if(incapacitated(ignore_flags)) + to_chat(src, span_warning("You are incapacitated at the moment!")) + return FALSE + + // If the MOBILITY_UI bitflag is not set it indicates the mob's hands are cutoff, blocked, or handcuffed + // Note - AI's and borgs have the MOBILITY_UI bitflag set even though they don't have hands + // Also if it is not set, the mob could be incapcitated, knocked out, unconscious, asleep, EMP'd, etc. + if(!(mobility_flags & MOBILITY_UI) && !(action_bitflags & ALLOW_RESTING)) + to_chat(src, span_warning("You don't have the mobility for this!")) + return FALSE + + // NEED_HANDS is already checked by MOBILITY_UI for humans so this is for silicons + if((action_bitflags & NEED_HANDS)) + if(HAS_TRAIT(src, TRAIT_HANDS_BLOCKED)) + to_chat(src, span_warning("You hands are blocked for this action!")) + return FALSE + if(!usable_hands) // almost redundant if it weren't for mobs + to_chat(src, span_warning("You don't have the hands for this action!")) + return FALSE + + if(!(action_bitflags & ALLOW_PAI) && ispAI(src)) + to_chat(src, span_warning("Your holochasis does not allow you to do this!")) + return FALSE + + if(!(action_bitflags & BYPASS_ADJACENCY) && ((action_bitflags & NOT_INSIDE_TARGET) || !Adjacent(target))) + if(has_unlimited_silicon_privilege && !ispAI(src)) + if(!(action_bitflags & ALLOW_SILICON_REACH)) // silicons can ignore range checks (except pAIs) + if(!(action_bitflags & SILENT_ADJACENCY)) + to_chat(src, span_warning("You are too far away!")) + return FALSE + else // just a normal carbon mob + if((action_bitflags & FORBID_TELEKINESIS_REACH)) + if(!(action_bitflags & SILENT_ADJACENCY)) + to_chat(src, span_warning("You are too far away!")) + return FALSE + + if(!HAS_TRAIT(src, TRAIT_TELEKINESIS)) + if(!(action_bitflags & SILENT_ADJACENCY)) + to_chat(src, span_warning("You are too far away!")) + return FALSE + + if((action_bitflags & NEED_VENTCRAWL) && !HAS_TRAIT(src, TRAIT_VENTCRAWLER_NUDE) && !HAS_TRAIT(src, TRAIT_VENTCRAWLER_ALWAYS)) + to_chat(src, span_warning("You wouldn't fit!")) + return FALSE + + if((action_bitflags & NEED_DEXTERITY) && !IsAdvancedToolUser(src)) + to_chat(src, span_warning("You don't have the dexterity to do this!")) + return FALSE + + if((action_bitflags & NEED_LITERACY) && !is_literate()) + to_chat(src, span_warning("You can't comprehend any of this!")) + return FALSE + + return TRUE + /mob/living/CanAllowThrough(atom/movable/mover, border_dir) . = ..() // all this repeated spaghetti code is used to properly register projectiles diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 90117f09812..d484be8e938 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -1343,6 +1343,11 @@ GLOBAL_LIST_INIT(ai_verbs_default, list( to_chat(src, "You have been downloaded to a mobile storage device. Remote device connection severed.") to_chat(user, "Transfer successful: [name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory.") +/mob/living/silicon/ai/can_perform_action(atom/target, action_bitflags) + if(control_disabled) + to_chat(src, span_warning("You can't do that right now!")) + return FALSE + return can_see(target) && ..() //stop AIs from leaving windows open and using then after they lose vision /mob/living/silicon/ai/switch_to_camera(obj/machinery/camera/C) if(!C.can_use() || !is_in_chassis()) diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 8efe5264e71..6bf17f6abc5 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -284,6 +284,11 @@ if(EXPLODE_LIGHT) apply_damage(30) +// See software.dm for Topic() +/mob/living/silicon/pai/can_perform_action(atom/target, action_bitflags) + action_bitflags |= ALLOW_RESTING // Resting is just an aesthetic feature for them + action_bitflags &= ~ALLOW_SILICON_REACH // They don't get long reach like the rest of silicons + return ..(target, action_bitflags) // See software.dm for ui_act() diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index 5bd7a375662..0d00029fd3c 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -1773,6 +1773,11 @@ GLOBAL_LIST_INIT(robot_verbs_default, list( notify_ai(ROBOT_NOTIFY_AI_CONNECTED) sync() +/mob/living/silicon/robot/can_perform_action(atom/target, action_bitflags) + if(lockcharge || low_power_mode) + to_chat(src, span_warning("You can't do that right now!")) + return FALSE + return ..() /mob/living/silicon/robot/adjustOxyLoss( amount = 0, diff --git a/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla.dm b/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla.dm index 6d2bca66042..84432d962fd 100644 --- a/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla.dm +++ b/code/modules/mob/living/simple_animal/hostile/gorilla/gorilla.dm @@ -120,10 +120,11 @@ gorilla.update_icon(UPDATE_ICON_STATE) -/mob/living/simple_animal/hostile/gorilla/AltClick(mob/living/simple_animal/hostile/gorilla/user) +/mob/living/simple_animal/hostile/gorilla/click_alt(mob/living/simple_animal/hostile/gorilla/user) if(!istype(user) || src != user || !gorilla_toggle) - return ..() + return NONE gorilla_toggle.Activate() + return CLICK_ACTION_SUCCESS /** diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index b99581f13ff..e900752b69b 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -562,6 +562,35 @@ return FALSE SEND_SIGNAL(src, COMSIG_DO_MOB_STRIP, user, usr) +/** + * Checks whether a mob can perform an action to interact with an object + * + * The default behavior checks if the mob is: + * * Directly adjacent (1-tile radius) + * * Standing up (not resting) + * * Allows telekinesis to be used to skip adjacent checks (if they have DNA mutation) + * * + * action_bitflags: (see code/__DEFINES/mobs.dm) + * * NEED_GRAVITY - If gravity must be present to perform action (can't use pens without gravity) + * * NEED_LITERACY - If reading is required to perform action (can't read a book if you are illiterate) + * * NEED_LIGHT - If lighting must be present to perform action (can't heal someone in the dark) + * * NEED_DEXTERITY - If other mobs (monkeys, aliens, etc) can perform action (can't use computers if you are a monkey) + * * NEED_HANDS - If hands are required to perform action (can't pickup items if you are a cyborg) + * * FORBID_TELEKINESIS_REACH - If telekinesis is forbidden to perform action from a distance (ex. canisters are blacklisted from telekinesis manipulation) + * * ALLOW_SILICON_REACH - If silicons are allowed to perform action from a distance (silicons can operate airlocks from far away) + * * ALLOW_RESTING - If resting on the floor is allowed to perform action () + * * ALLOW_VENTCRAWL - Mobs with ventcrawl traits can alt-click this to vent + * * BYPASS_ADJACENCY - The target does not have to be adjacent + * * SILENT_ADJACENCY - Adjacency is required but errors are not printed + * * NOT_INSIDE_TARGET - The target maybe adjacent but the mob should not be inside the target + * * ALLOW_PAI - Allows pAIs to perform an action + * + * silence_adjacency: Sometimes we want to use this proc to check interaction without allowing it to throw errors for base case adjacency + * Alt click uses this, as otherwise you can detect what is interactable from a distance via the error message +**/ +/mob/proc/can_perform_action(atom/target, action_bitflags) + return + /mob/proc/is_mechanical() return mind && (mind.assigned_role == JOB_TITLE_CYBORG || mind.assigned_role == JOB_TITLE_AI) diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index 5283ecd89dd..bee8d8f3ca6 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -224,8 +224,6 @@ //Ghosted var, set only if a player has manually ghosted out of this mob. var/player_ghosted = 0 - var/turf/listed_turf = null //the current turf being examined in the stat panel - var/list/active_genes var/last_movement = -100 // Last world.time the mob actually moved of its own accord. diff --git a/code/modules/newscaster/obj/newspaper.dm b/code/modules/newscaster/obj/newspaper.dm index cedcb794aaa..48d1fe7ddb5 100644 --- a/code/modules/newscaster/obj/newspaper.dm +++ b/code/modules/newscaster/obj/newspaper.dm @@ -188,15 +188,15 @@ return ..() -/obj/item/newspaper/AltClick(mob/user) - if(ishuman(user) && Adjacent(user) && !user.incapacitated() && !HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - rolled = !rolled - icon_state = "newspaper[rolled ? "_rolled" : ""]" - update_icon() - var/verbtext = "[rolled ? "" : "un"]roll" - user.visible_message("[user] [verbtext]s [src].",\ - "You [verbtext] [src].") - name = "[rolled ? "rolled" : ""] [initial(name)]" +/obj/item/newspaper/click_alt(mob/user) + rolled = !rolled + icon_state = "newspaper[rolled ? "_rolled" : ""]" + update_icon() + var/verbtext = "[rolled ? "" : "un"]roll" + user.visible_message(span_notice("[user] [verbtext]s [src]."),\ + span_notice("You [verbtext] [src].")) + name = "[rolled ? "rolled" : ""] [initial(name)]" + return CLICK_ACTION_SUCCESS #undef SCREEN_COVER #undef SCREEN_PAGE_INNER diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index 3433a51503c..4d74d323cca 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -19,14 +19,12 @@ update_icon(UPDATE_OVERLAYS) -/obj/item/clipboard/AltClick(mob/user) - if(Adjacent(user) && !user.incapacitated() && !HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - if(is_pen(user.get_active_hand())) - penPlacement(user, user.get_active_hand(), TRUE) - else - removePen(user) - return - . = ..() +/obj/item/clipboard/click_alt(mob/user) + if(is_pen(user.get_active_hand())) + penPlacement(user, user.get_active_hand(), TRUE) + else + removePen(user) + return CLICK_ACTION_SUCCESS /obj/item/clipboard/verb/removePen() diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index 93fc4b8d0fa..293a9d285b2 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -113,16 +113,13 @@ return data -/obj/item/paper/AltClick(mob/living/carbon/human/user) - if(!ishuman(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user)) - return +/obj/item/paper/click_alt(mob/living/carbon/human/user) if(is_pen(user.get_active_hand())) rename(user) - return + return CLICK_ACTION_SUCCESS if(user.is_in_hands(src)) ProcFoldPlane(user, src) - return - return ..() + return CLICK_ACTION_SUCCESS /obj/item/paper/proc/rename(mob/user) diff --git a/code/modules/paperwork/photography/camera.dm b/code/modules/paperwork/photography/camera.dm index c3e4d6bbaf9..2a46dc0d2be 100644 --- a/code/modules/paperwork/photography/camera.dm +++ b/code/modules/paperwork/photography/camera.dm @@ -9,6 +9,7 @@ item_state = "camera" w_class = WEIGHT_CLASS_SMALL slot_flags = ITEM_SLOT_BELT|ITEM_SLOT_NECK + interaction_flags_click = NONE var/list/matter = list("metal" = 2000) var/pictures_max = 10 var/pictures_left = 10 @@ -51,14 +52,15 @@ icon_state = on ? icon_on : icon_off item_state = on ? item_on : item_off -/obj/item/camera/AltClick(mob/user) - if(!issilicon(user) && (user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))) +/obj/item/camera/click_alt(mob/user) + if(!issilicon(user) && (user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED))) // silicons have inbuilt cameras, that' why unique check here return var/nsize = tgui_input_list(user, "Photo Size", "Pick a size of resulting photo.", list(1,3,5,7)) if(nsize) size = nsize to_chat(user, span_notice("Camera will now take [size]x[size] photos.")) + return CLICK_ACTION_SUCCESS /obj/item/camera/AltShiftClick(mob/user) if(!issilicon(usr) && (usr.incapacitated() || HAS_TRAIT(usr, TRAIT_HANDS_BLOCKED))) diff --git a/code/modules/paperwork/photography/photo.dm b/code/modules/paperwork/photography/photo.dm index fc3ab3647b3..f4d30b2cde0 100644 --- a/code/modules/paperwork/photography/photo.dm +++ b/code/modules/paperwork/photography/photo.dm @@ -42,17 +42,18 @@ return ..() -/obj/item/photo/AltClick(mob/user) +/obj/item/photo/click_alt(mob/user) if(user.incapacitated() || !isAI(usr) && HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return + return NONE var/n_name = tgui_input_text(user, "What would you like to label the photo?", "Photo Labelling", name) if(!n_name) - return + return CLICK_ACTION_BLOCKING //loc.loc check is for making possible renaming photos in clipboards if((loc == user || (loc.loc && loc.loc == user)) && !user.incapacitated() && !HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) name = "[(n_name ? text("[n_name]") : "photo")]" add_fingerprint(user) + return CLICK_ACTION_SUCCESS /obj/item/photo/proc/burnphoto(obj/item/lighter/P, mob/user) var/class = "" diff --git a/code/modules/pda/PDA.dm b/code/modules/pda/PDA.dm index 5a197dfc2d7..243b0195ddb 100755 --- a/code/modules/pda/PDA.dm +++ b/code/modules/pda/PDA.dm @@ -217,14 +217,13 @@ GLOBAL_LIST_EMPTY(PDAs) else to_chat(usr, "You cannot do this while restrained.") -/obj/item/pda/AltClick(mob/living/user) - if(!iscarbon(user)) - return +/obj/item/pda/click_alt(mob/living/user) if(can_use(user)) if(id) remove_id(user) else - to_chat(user, "This PDA does not have an ID in it!") + to_chat(user, span_warning("This PDA does not have an ID in it!")) + return CLICK_ACTION_SUCCESS /obj/item/pda/CtrlClick(mob/user) diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index eb4c46ad259..3593d74693b 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -793,22 +793,19 @@ /obj/machinery/power/apc/examine(mob/user) . = ..() if(in_range(src, user)) - . += "Alt-click to toggle locker.
Ctrl-click to toggle power.
" + . += span_info("Alt-click to toggle locker.
Ctrl-click to toggle power.") -/obj/machinery/power/apc/AltClick(mob/user) - var/mob/living/carbon/human/human = user - if(!istype(human) || human.incapacitated() || HAS_TRAIT(human, TRAIT_HANDS_BLOCKED)) - return - - if(!Adjacent(human) || (get_turf(user) != user.loc)) - return - - var/obj/item/card/id/card = human.get_id_card() +/obj/machinery/power/apc/click_alt(mob/living/carbon/human/H) + if(!istype(H)) + return NONE + var/obj/item/card/id/card = H.get_id_card() if(!istype(card)) - return + return NONE + + add_fingerprint(H) + togglelock(H) + return CLICK_ACTION_SUCCESS - add_fingerprint(user) - togglelock(user) /obj/machinery/power/apc/CtrlClick(mob/user) SEND_SIGNAL(src, COMSIG_CLICK_CTRL, user) diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 3c5078b0add..89236a4a36c 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -72,9 +72,9 @@ return TRUE -/obj/machinery/power/emitter/AltClick(mob/user) - if(Adjacent(user)) - rotate() +/obj/machinery/power/emitter/click_alt(mob/user) + rotate() + return CLICK_ACTION_SUCCESS /obj/machinery/power/emitter/Destroy() diff --git a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm index 61f5602019e..8e7eede4ff9 100644 --- a/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm +++ b/code/modules/power/singularity/particle_accelerator/particle_accelerator.dm @@ -75,6 +75,10 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin var/strength = null var/desc_holder = null +/obj/structure/particle_accelerator/examine(mob/user) + . = ..() + . += span_info("Alt-click to rotate.") + /obj/structure/particle_accelerator/Destroy() construction_state = 0 if(master) @@ -87,16 +91,9 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin icon_state = "end_cap" reference = "end_cap" - -/obj/structure/particle_accelerator/verb/rotate() - set name = "Rotate Clockwise" - set category = "Object" - set src in oview(1) - - rotate_accelerator(usr) - -/obj/structure/particle_accelerator/AltClick(mob/user) +/obj/structure/particle_accelerator/click_alt(mob/user) rotate_accelerator(user) + return CLICK_ACTION_SUCCESS /obj/structure/particle_accelerator/proc/rotate_accelerator(mob/user) if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user)) @@ -262,19 +259,11 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin /obj/machinery/particle_accelerator/examine(mob/user) . = ..() - . += "Alt-Click to rotate it." - - -/obj/machinery/particle_accelerator/verb/rotate() - set name = "Rotate Clockwise" - set category = "Object" - set src in oview(1) + . += span_info("Alt-Click to rotate it.") - rotate_accelerator(usr) - -/obj/machinery/particle_accelerator/AltClick(mob/user) +/obj/machinery/particle_accelerator/click_alt(mob/user) rotate_accelerator(user) - + return CLICK_ACTION_SUCCESS /obj/machinery/particle_accelerator/proc/rotate_accelerator(mob/user) if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user)) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index efc860d4026..5953f7b9ea5 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -574,13 +574,14 @@ azoom.Remove(user) -/obj/item/gun/AltClick(mob/user) +/obj/item/gun/click_alt(mob/user) if(!unique_reskin || current_skin || loc != user) - return ..() + return NONE if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) to_chat(user, span_warning("You can't do that right now!")) - return ..() + return CLICK_ACTION_BLOCKING reskin_gun(user) + return CLICK_ACTION_SUCCESS /obj/item/gun/proc/reskin_gun(mob/user) diff --git a/code/modules/projectiles/guns/projectile/shotgun.dm b/code/modules/projectiles/guns/projectile/shotgun.dm index 15406e29ae9..715a30200ce 100644 --- a/code/modules/projectiles/guns/projectile/shotgun.dm +++ b/code/modules/projectiles/guns/projectile/shotgun.dm @@ -387,10 +387,8 @@ balloon_alert(user, "переключено на второй ствол") playsound(user, 'sound/weapons/gun_interactions/selector.ogg', 100, 1) -/obj/item/gun/projectile/shotgun/automatic/dual_tube/AltClick(mob/living/user) - . = ..() - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED) || !Adjacent(user) || !istype(user)) - return +/obj/item/gun/projectile/shotgun/automatic/dual_tube/click_alt(mob/living/user) pump() + return CLICK_ACTION_SUCCESS // DOUBLE BARRELED SHOTGUN, IMPROVISED SHOTGUN, and CANE SHOTGUN are in revolver.dm diff --git a/code/modules/projectiles/guns/throw/crossbow.dm b/code/modules/projectiles/guns/throw/crossbow.dm index 6648a72e0a7..da865f808db 100644 --- a/code/modules/projectiles/guns/throw/crossbow.dm +++ b/code/modules/projectiles/guns/throw/crossbow.dm @@ -142,9 +142,10 @@ cell = null -/obj/item/gun/throw/crossbow/AltClick(mob/user) +/obj/item/gun/throw/crossbow/click_alt(mob/user) if(src in user) set_tension() + return CLICK_ACTION_SUCCESS /obj/item/gun/throw/crossbow/verb/set_tension() diff --git a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm index 84c76fe676c..5f9348d9a3c 100644 --- a/code/modules/reagents/chemistry/machinery/reagentgrinder.dm +++ b/code/modules/reagents/chemistry/machinery/reagentgrinder.dm @@ -112,18 +112,13 @@ if(in_range(src, user)) . += span_info("Используйте Alt + ЛКМ, чтобы активировать.
Используйте Alt + Shift + ЛКМ, чтобы удалить содержимое") -/obj/machinery/reagentgrinder/AltClick(mob/living/carbon/human/human) - if(!istype(human) || !human.Adjacent(src)) - return - - if(human.incapacitated() || HAS_TRAIT(human, TRAIT_HANDS_BLOCKED)) - return - +/obj/machinery/reagentgrinder/click_alt(mob/living/carbon/human/human) if(operating) - return + return NONE add_fingerprint(human) grind() + return CLICK_ACTION_SUCCESS /obj/machinery/reagentgrinder/CtrlShiftClick(mob/living/carbon/human/human) if(!istype(human) || !human.Adjacent(src)) diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 40eaff37d54..10088ffa0a4 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -43,9 +43,9 @@ amount_per_transfer_from_this = N to_chat(usr, span_notice("Теперь [declent_ru(NOMINATIVE)] буд[pluralize_ru(gender, "ет", "ут")] перемещать по [N] единиц[declension_ru(N, "у", "ы", "")] вещества за раз.")) -/obj/item/reagent_containers/AltClick(mob/user) - if(Adjacent(user)) - set_APTFT() +/obj/item/reagent_containers/click_alt(mob/user) + set_APTFT() + return CLICK_ACTION_SUCCESS /obj/item/reagent_containers/verb/empty() diff --git a/code/modules/recycling/conveyor2.dm b/code/modules/recycling/conveyor2.dm index a91574d96c1..a269db663a7 100644 --- a/code/modules/recycling/conveyor2.dm +++ b/code/modules/recycling/conveyor2.dm @@ -509,9 +509,9 @@ GLOBAL_LIST_EMPTY(conveyors_by_id) . += span_info("Use a crowbar to dislodge.") -/obj/machinery/conveyor_switch/AltClick(mob/user) - if(Adjacent(user)) - on_user_activation(user, CONVEYOR_BACKWARDS) +/obj/machinery/conveyor_switch/click_alt(mob/user) + on_user_activation(user, CONVEYOR_BACKWARDS) + return CLICK_ACTION_SUCCESS /obj/machinery/conveyor_switch/attack_robot(mob/user) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index cc2c646014a..29691e76763 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -398,21 +398,20 @@ update() -/obj/machinery/disposal/AltClick(mob/user) - if(!Adjacent(user) || !ishuman(user) || user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - return ..() +/obj/machinery/disposal/click_alt(mob/user) user.visible_message( - "[user] tries to eject the contents of [src] manually.", - "You operate the manual ejection lever on [src]." + span_notice("[user] tries to eject the contents of [src] manually."), + span_notice("You operate the manual ejection lever on [src].") ) if(!do_after(user, 5 SECONDS, src)) - return ..() + return CLICK_ACTION_BLOCKING user.visible_message( - "[user] ejects the contents of [src].", - "You eject the contents of [src].", + span_notice("[user] ejects the contents of [src]."), + span_notice("You eject the contents of [src]."), ) eject() + return CLICK_ACTION_SUCCESS // update the icon & overlays to reflect mode & status diff --git a/code/modules/recycling/disposal/construction.dm b/code/modules/recycling/disposal/construction.dm index 3563c57b15a..b67915b29ce 100644 --- a/code/modules/recycling/disposal/construction.dm +++ b/code/modules/recycling/disposal/construction.dm @@ -117,9 +117,9 @@ rotate(usr) -/obj/structure/disposalconstruct/AltClick(mob/user) - if(Adjacent(user)) - rotate(user) +/obj/structure/disposalconstruct/click_alt(mob/user) + rotate(user) + return CLICK_ACTION_SUCCESS /// Rotates construct 90 degrees counter-clockwise diff --git a/code/modules/research/xenobiology/xenobio_camera.dm b/code/modules/research/xenobiology/xenobio_camera.dm index 4ba73ee4d92..f36e3394d31 100644 --- a/code/modules/research/xenobiology/xenobio_camera.dm +++ b/code/modules/research/xenobiology/xenobio_camera.dm @@ -396,8 +396,9 @@ ..() //Feeds a potion to slime -/mob/living/simple_animal/slime/AltClick(mob/user) +/mob/living/simple_animal/slime/click_alt(mob/user) SEND_SIGNAL(user, COMSIG_XENO_SLIME_CLICK_ALT, src) + return CLICK_ACTION_SUCCESS //Picks up slime /mob/living/simple_animal/slime/ShiftClick(mob/user) diff --git a/code/modules/spacepods/parts.dm b/code/modules/spacepods/parts.dm index d945ea7d98a..0d4a2affd28 100644 --- a/code/modules/spacepods/parts.dm +++ b/code/modules/spacepods/parts.dm @@ -115,9 +115,9 @@ return TRUE -/obj/item/pod_parts/pod_frame/AltClick(mob/user) - if(Adjacent(user)) - rotate() +/obj/item/pod_parts/pod_frame/click_alt(mob/user) + rotate() + return CLICK_ACTION_SUCCESS /obj/item/pod_parts/pod_frame/attack_hand() diff --git a/code/modules/telesci/gps.dm b/code/modules/telesci/gps.dm index a760816b42c..2ed66dcbe98 100644 --- a/code/modules/telesci/gps.dm +++ b/code/modules/telesci/gps.dm @@ -15,6 +15,7 @@ GLOBAL_LIST_EMPTY(GPS_list) w_class = WEIGHT_CLASS_SMALL slot_flags = ITEM_SLOT_BELT origin_tech = "materials=2;magnets=1;bluespace=2" + interaction_flags_click = NEED_HANDS | NEED_DEXTERITY /// Whether the GPS is on. var/tracking = TRUE /// The tag that is visible to other GPSes. @@ -56,15 +57,9 @@ GLOBAL_LIST_EMPTY(GPS_list) update_icon(UPDATE_OVERLAYS) addtimer(CALLBACK(src, PROC_REF(reboot)), EMP_DISABLE_TIME) -/obj/item/gps/AltClick(mob/living/user) - if(!Adjacent(user)) - return - if(!iscarbon(usr) && !isrobot(usr)) - return - if(user.incapacitated() || HAS_TRAIT(user, TRAIT_HANDS_BLOCKED)) - to_chat(user, "You can't do that right now!") - return +/obj/item/gps/click_alt(mob/living/user) toggle_gps(user) + return CLICK_ACTION_SUCCESS /obj/item/gps/proc/toggle_gps(mob/living/user) if(emped) diff --git a/code/modules/vehicle/ridden.dm b/code/modules/vehicle/ridden.dm index bb29b619179..8756ed10cad 100644 --- a/code/modules/vehicle/ridden.dm +++ b/code/modules/vehicle/ridden.dm @@ -40,16 +40,17 @@ inserted_key = I return ATTACK_CHAIN_PROCEED -/obj/vehicle/ridden/AltClick(mob/user) +/obj/vehicle/ridden/click_alt(mob/user) if(!inserted_key) - return + return NONE if(!is_occupant(user)) to_chat(user, span_warning("You must be riding the [src] to remove [src]'s key!")) - return + return CLICK_ACTION_BLOCKING to_chat(user, span_notice("You remove \the [inserted_key] from \the [src].")) inserted_key.forceMove_turf() user.put_in_hands(inserted_key) inserted_key = null + return CLICK_ACTION_SUCCESS /obj/vehicle/ridden/user_buckle_mob(mob/living/M, mob/user, check_loc = TRUE) if(!in_range(user, src) || !in_range(M, src)) diff --git a/paradise.dme b/paradise.dme index a4f1a64703f..557864d2d87 100644 --- a/paradise.dme +++ b/paradise.dme @@ -45,6 +45,7 @@ #include "code\__DEFINES\cargo_quests.dm" #include "code\__DEFINES\chat.dm" #include "code\__DEFINES\chat_box_defines.dm" +#include "code\__DEFINES\click.dm" #include "code\__DEFINES\clockwork.dm" #include "code\__DEFINES\clothing.dm" #include "code\__DEFINES\colors.dm" @@ -220,6 +221,7 @@ #include "code\__HELPERS\unique_ids.dm" #include "code\__HELPERS\unsorted.dm" #include "code\__HELPERS\verb_helpers.dm" +#include "code\__HELPERS\view.dm" #include "code\__HELPERS\visual_effects.dm" #include "code\__HELPERS\data_struct\priority_queue.dm" #include "code\__HELPERS\data_struct\queue.dm" @@ -263,6 +265,7 @@ #include "code\_onclick\adjacent.dm" #include "code\_onclick\ai.dm" #include "code\_onclick\click.dm" +#include "code\_onclick\click_alt.dm" #include "code\_onclick\click_override.dm" #include "code\_onclick\cogscarab.dm" #include "code\_onclick\cyborg.dm" diff --git a/tgui/packages/tgui/components/Input.js b/tgui/packages/tgui/components/Input.js index e7355907a4f..a7b29c2418d 100644 --- a/tgui/packages/tgui/components/Input.js +++ b/tgui/packages/tgui/components/Input.js @@ -142,6 +142,7 @@ export class Input extends Component {
.
{multiline ? (