From 47be0bffc2e374e7a638f30fd781f36eab64ffb5 Mon Sep 17 00:00:00 2001 From: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Date: Fri, 14 Jun 2024 01:59:45 +0530 Subject: [PATCH] Ctrl click refactor (#83784) ## About The Pull Request Same idea as #82656 but for ctrl click & ctrl shift click cause why not - Does your signal & `can_perform_action()` checks using `interaction_flags_click` flags before delegating the event down to `ctrl_click()` proc. - The one new change now is that `ctrl_click()` proc is now blocking, meaning returning `CLICK_ACTION_SUCCESS` or `CLICK_ACTION_BLOCKING` will stop the object from getting grabbed/pulled. So remember to return these values if you want to stop the grab action or return `NONE` if you want to process the click but still want the object to get grabbed as well ## Changelog :cl: refactor: Ctrl click & Ctrl shift click has been refactored. Please report bugs on GitHub /:cl: --- .../signals/signals_mob/signals_mob_main.dm | 4 +- .../dcs/signals/signals_xeno_control.dm | 6 - code/_onclick/click.dm | 52 -------- code/_onclick/click_ctrl.dm | 122 ++++++++++++++++++ code/_onclick/cyborg.dm | 6 +- code/datums/components/food_storage.dm | 6 +- code/game/atom/_atom.dm | 2 +- code/game/objects/items.dm | 12 ++ .../objects/items/devices/pressureplates.dm | 7 +- code/game/objects/items/his_grace.dm | 5 +- code/game/objects/items/inspector.dm | 8 +- code/game/objects/items/storage/bags.dm | 5 +- .../antagonists/heretic/items/keyring.dm | 6 +- .../components/binary_devices/passive_gate.dm | 7 +- .../binary_devices/pressure_valve.dm | 7 +- .../components/binary_devices/pump.dm | 7 +- .../binary_devices/temperature_gate.dm | 7 +- .../binary_devices/temperature_pump.dm | 7 +- .../components/binary_devices/volume_pump.dm | 5 +- .../gas_recipe_machines/crystallizer.dm | 10 +- .../components/trinary_devices/filter.dm | 7 +- .../components/trinary_devices/mixer.dm | 7 +- .../unary_devices/bluespace_sender.dm | 10 +- .../components/unary_devices/cryo.dm | 7 +- .../unary_devices/outlet_injector.dm | 7 +- .../components/unary_devices/thermomachine.dm | 11 +- code/modules/basketball/hoop.dm | 12 +- code/modules/cargo/universal_scanner.dm | 5 +- code/modules/clothing/shoes/clown.dm | 7 +- .../clothing/spacesuits/_spacesuits.dm | 13 +- code/modules/clothing/under/_under.dm | 8 +- .../food_and_drinks/machinery/microwave.dm | 11 +- code/modules/hydroponics/hydroponics.dm | 16 +-- code/modules/mob/dead/observer/observer.dm | 4 +- code/modules/mob/living/carbon/carbon.dm | 3 +- .../computers/item/computer.dm | 5 +- .../modular_computers/computers/item/pda.dm | 7 +- code/modules/power/cable.dm | 3 +- .../machinery/portable_chem_mixer.dm | 3 +- .../reagents/reagent_containers/misc.dm | 3 +- code/modules/recycling/sortingmachinery.dm | 4 +- .../research/xenobiology/xenobio_camera.dm | 67 +++++----- code/modules/transport/tram/tram_remote.dm | 3 +- tgstation.dme | 1 + 44 files changed, 299 insertions(+), 216 deletions(-) create mode 100644 code/_onclick/click_ctrl.dm diff --git a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm index 17356199671..8ada1c30be3 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm @@ -185,8 +185,10 @@ #define COMSIG_MOB_ATTACK_RANGED "mob_attack_ranged" ///from base of mob/ranged_secondary_attack(): (atom/target, modifiers) #define COMSIG_MOB_ATTACK_RANGED_SECONDARY "mob_attack_ranged_secondary" -///From base of atom/ctrl_click(): (atom/A) +///From base of /mob/base_click_ctrl: (atom/A) #define COMSIG_MOB_CTRL_CLICKED "mob_ctrl_clicked" +///From base of /mob/base_click_ctrl_shift: (atom/A) +#define COMSIG_MOB_CTRL_SHIFT_CLICKED "mob_ctrl_shift_clicked" ///From base of mob/update_movespeed():area #define COMSIG_MOB_MOVESPEED_UPDATED "mob_update_movespeed" /// From /atom/movable/screen/zone_sel/proc/set_selected_zone. diff --git a/code/__DEFINES/dcs/signals/signals_xeno_control.dm b/code/__DEFINES/dcs/signals/signals_xeno_control.dm index 595f44f4f91..c67756a64f3 100644 --- a/code/__DEFINES/dcs/signals/signals_xeno_control.dm +++ b/code/__DEFINES/dcs/signals/signals_xeno_control.dm @@ -1,14 +1,8 @@ //Xenobio hotkeys -///from slime CtrlClickOn(): (/mob) -#define COMSIG_XENO_SLIME_CLICK_CTRL "xeno_slime_click_ctrl" ///from slime AltClickOn(): (/mob) #define COMSIG_XENO_SLIME_CLICK_ALT "xeno_slime_click_alt" ///from slime ShiftClickOn(): (/mob) #define COMSIG_XENO_SLIME_CLICK_SHIFT "xeno_slime_click_shift" ///from turf ShiftClickOn(): (/mob) #define COMSIG_XENO_TURF_CLICK_SHIFT "xeno_turf_click_shift" -///from turf AltClickOn(): (/mob) -#define COMSIG_XENO_TURF_CLICK_CTRL "xeno_turf_click_alt" -///from monkey CtrlClickOn(): (/mob) -#define COMSIG_XENO_MONKEY_CLICK_CTRL "xeno_monkey_click_ctrl" diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 0caa2fff50f..4dde5a7f04a 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -341,65 +341,13 @@ if(user.client && (user.client.eye == user || user.client.eye == user.loc || flags & COMPONENT_ALLOW_EXAMINATE)) user.examinate(src) -/** - * Ctrl click - * For most objects, pull - */ -/mob/proc/CtrlClickOn(atom/A) - A.CtrlClick(src) - return - -/atom/proc/CtrlClick(mob/user) - SEND_SIGNAL(src, COMSIG_CLICK_CTRL, user) - SEND_SIGNAL(user, COMSIG_MOB_CTRL_CLICKED, src) - - var/mob/living/ML = user - if(istype(ML)) - ML.pulled(src) - if(!can_interact(user)) - return FALSE - -/mob/living/CtrlClick(mob/living/user) - if(!isliving(user) || !user.CanReach(src) || user.incapacitated()) - return ..() - - if(world.time < user.next_move) - return FALSE - - if(user.grab(src)) - user.changeNext_move(CLICK_CD_MELEE) - return TRUE - - return ..() - -/mob/proc/CtrlMiddleClickOn(atom/A) - if(check_rights_for(client, R_ADMIN)) - client.toggle_tag_datum(A) - else - A.CtrlClick(src) - return - /mob/proc/TurfAdjacent(turf/tile) return tile.Adjacent(src) -/** - * Control+Shift click - * Unused except for AI - */ -/mob/proc/CtrlShiftClickOn(atom/A) - A.CtrlShiftClick(src) - return - /mob/proc/ShiftMiddleClickOn(atom/A) src.pointed(A) return -/atom/proc/CtrlShiftClick(mob/user) - if(!can_interact(user)) - return FALSE - SEND_SIGNAL(src, COMSIG_CLICK_CTRL_SHIFT, user) - return - /* Misc helpers face_atom: turns the mob towards what you clicked on diff --git a/code/_onclick/click_ctrl.dm b/code/_onclick/click_ctrl.dm new file mode 100644 index 00000000000..bb0491b2bb9 --- /dev/null +++ b/code/_onclick/click_ctrl.dm @@ -0,0 +1,122 @@ +/** + * Ctrl click + */ +/mob/proc/CtrlClickOn(atom/A) + base_click_ctrl(A) + +/** + * ### Base proc for ctrl click interaction left click. + * + * If you wish to add custom `click_ctrl` behavior for a single type, use that proc. + */ +/mob/proc/base_click_ctrl(atom/target) + SHOULD_NOT_OVERRIDE(TRUE) + + // Check if they've hooked in to prevent src from ctrl clicking anything + if(SEND_SIGNAL(src, COMSIG_MOB_CTRL_CLICKED, target) & COMSIG_MOB_CANCEL_CLICKON) + return TRUE + + // If it has a signal handler that returns a click action, done. + if(SEND_SIGNAL(target, COMSIG_CLICK_CTRL, src) & CLICK_ACTION_ANY) + return TRUE + + var/can_use_click_action = FALSE + if(isturf(target)) + // Turfs are special because they can't be used with can_perform_action + can_use_click_action = can_perform_turf_action(target) + else + can_use_click_action = can_perform_action(target, target.interaction_flags_click | SILENT_ADJACENCY) + if(!can_use_click_action) + return TRUE + + // If it has a custom click_alt that returns success/block, done. + return target.click_ctrl(src) & CLICK_ACTION_ANY + +/** + * Ctrl click + * For most objects, pull + */ +/mob/living/base_click_ctrl(atom/target) + SHOULD_NOT_OVERRIDE(TRUE) + + . = ..() + if(. || world.time < next_move || !CanReach(target)) + return + + . = TRUE + if(grab(target)) + changeNext_move(CLICK_CD_MELEE) + return + pulled(target) + +/** + * Ctrl mouse wheel click + * Except for tagging datumns same as control click + */ +/mob/proc/CtrlMiddleClickOn(atom/A) + if(check_rights_for(client, R_ADMIN)) + client.toggle_tag_datum(A) + return + CtrlClickOn(A) + +/** + * ## Custom ctrl click interaction + * Override this to change default ctrl 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 ctrl click behavior to occur thereafter. + * + * Returning any value besides NONE will stop the attack chain and thus stop the object from getting pulled/grabbed + **/ +/atom/proc/click_ctrl(mob/user) + SHOULD_CALL_PARENT(FALSE) + return NONE + + +/** + * Control+Shift click + * Unused except for AI + */ +/mob/proc/CtrlShiftClickOn(atom/A) + base_click_ctrl_shift(A) + +/** + * ### Base proc for ctrl shift click interaction left click. + * + * If you wish to add custom `click_ctrl_shift` behavior for a single type, use that proc. + */ +/mob/proc/base_click_ctrl_shift(atom/target) + SHOULD_NOT_OVERRIDE(TRUE) + + // Check if they've hooked in to prevent src from ctrl clicking anything + if(SEND_SIGNAL(src, COMSIG_MOB_CTRL_SHIFT_CLICKED, target) & COMSIG_MOB_CANCEL_CLICKON) + return + + // If it has a signal handler that returns a click action, done. + if(SEND_SIGNAL(target, COMSIG_CLICK_CTRL_SHIFT, src) & CLICK_ACTION_ANY) + return + + var/can_use_click_action = FALSE + if(isturf(target)) + // Turfs are special because they can't be used with can_perform_action + can_use_click_action = can_perform_turf_action(target) + else + can_use_click_action = can_perform_action(target, target.interaction_flags_click | SILENT_ADJACENCY) + if(!can_use_click_action) + return + + // Proceed with ctrl shift click + target.click_ctrl_shift(src) + +/** + * ## Custom ctrl shift click interaction + * + * ### Guard clauses + * Consider adding `interaction_flags_click` before adding unique guard clauses. + **/ +/atom/proc/click_ctrl_shift(mob/user) + SHOULD_CALL_PARENT(FALSE) + return NONE diff --git a/code/_onclick/cyborg.dm b/code/_onclick/cyborg.dm index 026376a9af5..4e9777ae9cd 100644 --- a/code/_onclick/cyborg.dm +++ b/code/_onclick/cyborg.dm @@ -97,9 +97,8 @@ /mob/living/silicon/robot/CtrlClickOn(atom/target) target.BorgCtrlClick(src) - /atom/proc/BorgCtrlShiftClick(mob/living/silicon/robot/user) //forward to human click if not overridden - CtrlShiftClick(user) + user.base_click_ctrl_shift(src) /obj/machinery/door/airlock/BorgCtrlShiftClick(mob/living/silicon/robot/user) // Sets/Unsets Emergency Access Override Forwards to AI code. if(get_dist(src, user) <= user.interaction_range && !(user.control_disabled)) @@ -116,9 +115,8 @@ else ..() - /atom/proc/BorgCtrlClick(mob/living/silicon/robot/user) //forward to human click if not overridden - CtrlClick(user) + user.base_click_ctrl(src) /obj/machinery/door/airlock/BorgCtrlClick(mob/living/silicon/robot/user) // Bolts doors. Forwards to AI code. if(get_dist(src, user) <= user.interaction_range && !(user.control_disabled)) diff --git a/code/datums/components/food_storage.dm b/code/datums/components/food_storage.dm index cb1008f88f0..873c1646adb 100644 --- a/code/datums/components/food_storage.dm +++ b/code/datums/components/food_storage.dm @@ -90,16 +90,16 @@ var/atom/food = parent if(QDELETED(stored_item)) - return + return CLICK_ACTION_BLOCKING if(!food.can_interact(user)) - return + return CLICK_ACTION_BLOCKING user.visible_message(span_notice("[user.name] begins tearing at \the [parent]."), \ span_notice("You start to rip into \the [parent].")) INVOKE_ASYNC(src, PROC_REF(begin_remove_item), user) - return COMPONENT_CANCEL_ATTACK_CHAIN + return CLICK_ACTION_SUCCESS /** Inserts the item into the food, after a do_after. * diff --git a/code/game/atom/_atom.dm b/code/game/atom/_atom.dm index ab4da3f2f77..9eaec1b4837 100644 --- a/code/game/atom/_atom.dm +++ b/code/game/atom/_atom.dm @@ -136,7 +136,7 @@ ///whether ghosts can see screentips on it var/ghost_screentips = FALSE - /// Flags to check for in can_perform_action. Used in alt-click checks + /// Flags to check for in can_perform_action. Used in alt-click & ctrl-click checks var/interaction_flags_click = NONE /// Flags to check for in can_perform_action for mouse drag & drop checks. To bypass checks see interaction_flags_atom mouse drop flags var/interaction_flags_mouse_drop = NONE diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 1e5d8ab4a66..79dd9d7e6ed 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -296,6 +296,18 @@ context[SCREENTIP_CONTEXT_ALT_LMB] = "Reskin" return CONTEXTUAL_SCREENTIP_SET +/obj/item/click_ctrl(mob/user) + SHOULD_NOT_OVERRIDE(TRUE) + + //If the item is on the ground & not anchored we allow the player to drag it + . = item_ctrl_click(user) + if(. & CLICK_ACTION_ANY) + return (isturf(loc) && !anchored) ? NONE : . //allow the object to get dragged on the floor + +/// Subtypes only override this proc for ctrl click purposes. obeys same principles as ctrl_click() +/obj/item/proc/item_ctrl_click(mob/user) + SHOULD_CALL_PARENT(FALSE) + return NONE /// Called when an action associated with our item is deleted /obj/item/proc/on_action_deleted(datum/source) diff --git a/code/game/objects/items/devices/pressureplates.dm b/code/game/objects/items/devices/pressureplates.dm index 1b6a5ee6db7..18bb026745a 100644 --- a/code/game/objects/items/devices/pressureplates.dm +++ b/code/game/objects/items/devices/pressureplates.dm @@ -75,15 +75,16 @@ sigdev = null return ..() -/obj/item/pressure_plate/CtrlClick(mob/user) +/obj/item/pressure_plate/item_ctrl_click(mob/user) if(protected) to_chat(user, span_warning("You can't quite seem to turn this pressure plate off...")) - return + return CLICK_ACTION_BLOCKING active = !active - if (active == TRUE) + if (active) to_chat(user, span_notice("You turn [src] on.")) else to_chat(user, span_notice("You turn [src] off.")) + return CLICK_ACTION_SUCCESS ///Called from COMSIG_OBJ_HIDE to toggle the active part, because yeah im not making a special exception on the element to support it /obj/item/pressure_plate/proc/ToggleActive(datum/source, underfloor_accessibility) diff --git a/code/game/objects/items/his_grace.dm b/code/game/objects/items/his_grace.dm index 83af88f003b..d1e128c0b5b 100644 --- a/code/game/objects/items/his_grace.dm +++ b/code/game/objects/items/his_grace.dm @@ -65,8 +65,9 @@ else ..() -/obj/item/his_grace/CtrlClick(mob/user) //you can't pull his grace - return +/obj/item/his_grace/item_ctrl_click(mob/user) + //you can't pull his grace + return NONE /obj/item/his_grace/examine(mob/user) . = ..() diff --git a/code/game/objects/items/inspector.dm b/code/game/objects/items/inspector.dm index ab5db9b65ce..fec567071fc 100644 --- a/code/game/objects/items/inspector.dm +++ b/code/game/objects/items/inspector.dm @@ -17,6 +17,7 @@ righthand_file = 'icons/mob/inhands/items/devices_righthand.dmi' throwforce = 0 w_class = WEIGHT_CLASS_TINY + interaction_flags_click = NEED_DEXTERITY throw_range = 1 throw_speed = 1 ///How long it takes to print on time each mode, ordered NORMAL, FAST, HONK @@ -71,14 +72,15 @@ return return ..() -/obj/item/inspector/CtrlClick(mob/living/user) - if(!user.can_perform_action(src, NEED_DEXTERITY) || !cell_cover_open || !cell) - return ..() +/obj/item/inspector/item_ctrl_click(mob/user) + if(!cell_cover_open || !cell) + return CLICK_ACTION_BLOCKING user.visible_message(span_notice("[user] removes \the [cell] from [src]!"), \ span_notice("You remove [cell].")) cell.add_fingerprint(user) user.put_in_hands(cell) cell = null + return CLICK_ACTION_SUCCESS /obj/item/inspector/examine(mob/user) . = ..() diff --git a/code/game/objects/items/storage/bags.dm b/code/game/objects/items/storage/bags.dm index d7164988ddb..e3636876189 100644 --- a/code/game/objects/items/storage/bags.dm +++ b/code/game/objects/items/storage/bags.dm @@ -273,11 +273,10 @@ . = ..() . += span_notice("Ctrl-click to activate seed extraction.") -/obj/item/storage/bag/plants/portaseeder/CtrlClick(mob/user) - if(user.incapacitated()) - return +/obj/item/storage/bag/plants/portaseeder/item_ctrl_click(mob/user) for(var/obj/item/plant in contents) seedify(plant, 1) + return CLICK_ACTION_SUCCESS // ----------------------------- // Sheet Snatcher diff --git a/code/modules/antagonists/heretic/items/keyring.dm b/code/modules/antagonists/heretic/items/keyring.dm index e1768b0fed3..dc1291bc034 100644 --- a/code/modules/antagonists/heretic/items/keyring.dm +++ b/code/modules/antagonists/heretic/items/keyring.dm @@ -118,12 +118,12 @@ var/obj/item/card/id/card = fused_ids[cardname] shapeshift(card) -/obj/item/card/id/advanced/heretic/CtrlClick(mob/user) - . = ..() +/obj/item/card/id/advanced/heretic/item_ctrl_click(mob/user) if(!IS_HERETIC(user)) - return + return CLICK_ACTION_BLOCKING inverted = !inverted balloon_alert(user, "[inverted ? "now" : "no longer"] creating inverted rifts") + return CLICK_ACTION_SUCCESS ///Changes our appearance to the passed ID card /obj/item/card/id/advanced/heretic/proc/shapeshift(obj/item/card/id/advanced/card) 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 fe6f9423b43..572e910d3fe 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -30,13 +30,14 @@ Passive gate is similar to the regular pump except: context[SCREENTIP_CONTEXT_ALT_LMB] = "Maximize target pressure" return CONTEXTUAL_SCREENTIP_SET -/obj/machinery/atmospherics/components/binary/passive_gate/CtrlClick(mob/user) - if(can_interact(user)) +/obj/machinery/atmospherics/components/binary/passive_gate/click_ctrl(mob/user) + if(is_operational) on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/atmospherics/components/binary/passive_gate/click_alt(mob/user) if(target_pressure == MAX_OUTPUT_PRESSURE) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm index c3313322135..399feff1214 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm @@ -22,13 +22,14 @@ context[SCREENTIP_CONTEXT_ALT_LMB] = "Maximize target pressure" return CONTEXTUAL_SCREENTIP_SET -/obj/machinery/atmospherics/components/binary/pressure_valve/CtrlClick(mob/user) - if(can_interact(user)) +/obj/machinery/atmospherics/components/binary/pressure_valve/click_ctrl(mob/user) + if(is_operational) on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/atmospherics/components/binary/pressure_valve/click_alt(mob/user) if(target_pressure == MAX_OUTPUT_PRESSURE) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 035f3a0f996..63ba340f27f 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -35,13 +35,14 @@ context[SCREENTIP_CONTEXT_ALT_LMB] = "Maximize target pressure" return CONTEXTUAL_SCREENTIP_SET -/obj/machinery/atmospherics/components/binary/pump/CtrlClick(mob/user) - if(can_interact(user)) +/obj/machinery/atmospherics/components/binary/pump/click_ctrl(mob/user) + if(is_operational) set_on(!on) balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/atmospherics/components/binary/pump/click_alt(mob/user) if(target_pressure == MAX_OUTPUT_PRESSURE) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm index d1202dbec94..b5a3740245a 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/temperature_gate.dm @@ -27,13 +27,14 @@ context[SCREENTIP_CONTEXT_ALT_LMB] = "Maximize target temperature" return CONTEXTUAL_SCREENTIP_SET -/obj/machinery/atmospherics/components/binary/temperature_gate/CtrlClick(mob/user) - if(can_interact(user)) +/obj/machinery/atmospherics/components/binary/temperature_gate/click_ctrl(mob/user) + if(is_operational) on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/atmospherics/components/binary/temperature_gate/click_alt(mob/user) if(target_temperature == max_temperature) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm index 2615b964ed8..3976e8db750 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm @@ -22,13 +22,14 @@ context[SCREENTIP_CONTEXT_ALT_LMB] = "Maximize transfer rate" return CONTEXTUAL_SCREENTIP_SET -/obj/machinery/atmospherics/components/binary/temperature_pump/CtrlClick(mob/user) - if(can_interact(user)) +/obj/machinery/atmospherics/components/binary/temperature_pump/click_ctrl(mob/user) + if(is_operational) on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/atmospherics/components/binary/temperature_pump/click_alt(mob/user) if(heat_transfer_rate == max_heat_transfer_rate) 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 41dc549b858..ae8965ae056 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -33,13 +33,14 @@ )) register_context() -/obj/machinery/atmospherics/components/binary/volume_pump/CtrlClick(mob/user) +/obj/machinery/atmospherics/components/binary/volume_pump/click_ctrl(mob/user) if(can_interact(user)) set_on(!on) balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/atmospherics/components/binary/volume_pump/click_alt(mob/user) if(transfer_rate == MAX_TRANSFER_RATE) diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm index 98915686749..f0482c210a6 100644 --- a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm +++ b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm @@ -88,17 +88,17 @@ else icon_state = "[base_icon_state]-off" -/obj/machinery/atmospherics/components/binary/crystallizer/CtrlClick(mob/living/user) - if(!can_interact(user)) - return +/obj/machinery/atmospherics/components/binary/crystallizer/click_ctrl(mob/user) + if(!is_operational) + return CLICK_ACTION_BLOCKING if(panel_open) balloon_alert(user, "close panel!") - return + return CLICK_ACTION_BLOCKING on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_icon() - return ..() + return CLICK_ACTION_SUCCESS ///Checks if the reaction temperature is inside the range of temperature + a little deviation /obj/machinery/atmospherics/components/binary/crystallizer/proc/check_temp_requirements() diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index c6b4bd43be4..25217de538c 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -24,13 +24,14 @@ context[SCREENTIP_CONTEXT_ALT_LMB] = "Maximize transfer rate" return CONTEXTUAL_SCREENTIP_SET -/obj/machinery/atmospherics/components/trinary/filter/CtrlClick(mob/user) - if(can_interact(user)) +/obj/machinery/atmospherics/components/trinary/filter/click_ctrl(mob/user) + if(is_operational) on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/atmospherics/components/trinary/filter/click_alt(mob/user) if(transfer_rate == MAX_TRANSFER_RATE) diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index f832adcb4ea..12a3c797160 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -27,13 +27,14 @@ context[SCREENTIP_CONTEXT_ALT_LMB] = "Maximize target pressure" return CONTEXTUAL_SCREENTIP_SET -/obj/machinery/atmospherics/components/trinary/mixer/CtrlClick(mob/user) - if(can_interact(user)) +/obj/machinery/atmospherics/components/trinary/mixer/click_ctrl(mob/user) + if(is_operational) on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/atmospherics/components/trinary/mixer/click_alt(mob/user) if(target_pressure == MAX_OUTPUT_PRESSURE) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm b/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm index 7d2efbd9321..6957389c351 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm @@ -149,16 +149,14 @@ GLOBAL_LIST_EMPTY_TYPED(bluespace_senders, /obj/machinery/atmospherics/component update_appearance() return TRUE -/obj/machinery/atmospherics/components/unary/bluespace_sender/CtrlClick(mob/living/user) - if(!panel_open) - if(!can_interact(user)) - return +/obj/machinery/atmospherics/components/unary/bluespace_sender/click_ctrl(mob/user) + if(!panel_open && is_operational) on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return - . = ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/atmospherics/components/unary/bluespace_sender/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index d81cd2bc537..1435816499f 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -635,11 +635,12 @@ return FALSE return ..() -/obj/machinery/cryo_cell/CtrlClick(mob/user) - if(can_interact(user) && !state_open) +/obj/machinery/cryo_cell/click_ctrl(mob/user) + if(is_operational && !state_open) set_on(!on) balloon_alert(user, "turned [on ? "on" : "off"]") - return ..() + return CLICK_ACTION_SUCCESS + return CLICK_ACTION_BLOCKING /obj/machinery/cryo_cell/click_alt(mob/user) //Required so players don't close the cryo on themselves without a doctor's help diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index 771301b60e4..3f87ca671fd 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -54,13 +54,14 @@ multi_tool.set_buffer(src) return ITEM_INTERACT_SUCCESS -/obj/machinery/atmospherics/components/unary/outlet_injector/CtrlClick(mob/user) - if(can_interact(user)) +/obj/machinery/atmospherics/components/unary/outlet_injector/click_ctrl(mob/user) + if(is_operational) on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() - return ..() + return CLICK_ACTION_BLOCKING + return CLICK_ACTION_SUCCESS /obj/machinery/atmospherics/components/unary/outlet_injector/click_alt(mob/user) if(volume_rate == MAX_TRANSFER_RATE) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index 01def672bf7..2fe1a8e430f 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -313,19 +313,20 @@ update_appearance() -/obj/machinery/atmospherics/components/unary/thermomachine/CtrlClick(mob/living/user) +/obj/machinery/atmospherics/components/unary/thermomachine/click_ctrl(mob/user) if(!anchored) - return ..() + return NONE if(panel_open) balloon_alert(user, "close panel!") - return - if(!can_interact(user)) - return + return CLICK_ACTION_BLOCKING + if(!is_operational) + return CLICK_ACTION_BLOCKING on = !on balloon_alert(user, "turned [on ? "on" : "off"]") investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS) update_appearance() + return CLICK_ACTION_SUCCESS /obj/machinery/atmospherics/components/unary/thermomachine/update_layer() return diff --git a/code/modules/basketball/hoop.dm b/code/modules/basketball/hoop.dm index b26fa462b09..72669df017d 100644 --- a/code/modules/basketball/hoop.dm +++ b/code/modules/basketball/hoop.dm @@ -17,6 +17,7 @@ anchored = TRUE density = TRUE layer = ABOVE_MOB_LAYER + interaction_flags_click = NEED_DEXTERITY | NEED_HANDS | FORBID_TELEKINESIS_REACH /// Keeps track of the total points scored var/total_score = 0 /// The chance to score a ball into the hoop based on distance @@ -133,16 +134,13 @@ baller.adjustStaminaLoss(STAMINA_COST_DUNKING_MOB) baller.stop_pulling() -/obj/structure/hoop/CtrlClick(mob/living/user) - if(!user.can_perform_action(src, NEED_DEXTERITY|FORBID_TELEKINESIS_REACH|NEED_HANDS)) - return - +/obj/structure/hoop/click_ctrl(mob/user) user.balloon_alert_to_viewers("resetting score...") playsound(src, 'sound/machines/locktoggle.ogg', 50, TRUE) if(do_after(user, 5 SECONDS, target = src)) total_score = 0 update_appearance() - return ..() + return CLICK_ACTION_SUCCESS /obj/structure/hoop/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum) if(!isitem(AM)) @@ -182,8 +180,8 @@ return NONE // No resetting the score for minigame hoops -/obj/structure/hoop/minigame/CtrlClick(mob/living/user) - return +/obj/structure/hoop/minigame/click_ctrl(mob/user) + return CLICK_ACTION_BLOCKING /obj/structure/hoop/minigame/score(obj/item/toy/basketball/ball, mob/living/baller, points) var/is_team_hoop = !(baller.ckey in team_ckeys) diff --git a/code/modules/cargo/universal_scanner.dm b/code/modules/cargo/universal_scanner.dm index 434162a36d9..fdcbc9ba2bb 100644 --- a/code/modules/cargo/universal_scanner.dm +++ b/code/modules/cargo/universal_scanner.dm @@ -122,11 +122,12 @@ new_custom_price = chosen_price to_chat(user, span_notice("[src] will now give things a [new_custom_price] cr tag.")) -/obj/item/universal_scanner/CtrlClick(mob/user) - . = ..() +/obj/item/universal_scanner/item_ctrl_click(mob/user) + . = CLICK_ACTION_BLOCKING if(scanning_mode == SCAN_SALES_TAG) payments_acc = null to_chat(user, span_notice("You clear the registered account.")) + return CLICK_ACTION_SUCCESS /obj/item/universal_scanner/click_alt(mob/user) if(!scanning_mode == SCAN_SALES_TAG) diff --git a/code/modules/clothing/shoes/clown.dm b/code/modules/clothing/shoes/clown.dm index 76395a56efd..699d6fa627b 100644 --- a/code/modules/clothing/shoes/clown.dm +++ b/code/modules/clothing/shoes/clown.dm @@ -30,18 +30,19 @@ if(is_clown_job(user.mind?.assigned_role)) user.clear_mood_event("clownshoes") -/obj/item/clothing/shoes/clown_shoes/CtrlClick(mob/living/user) +/obj/item/clothing/shoes/clown_shoes/item_ctrl_click(mob/user) if(!isliving(user)) - return + return CLICK_ACTION_BLOCKING if(user.get_active_held_item() != src) to_chat(user, span_warning("You must hold the [src] in your hand to do this!")) - return + return CLICK_ACTION_BLOCKING if (!enabled_waddle) to_chat(user, span_notice("You switch off the waddle dampeners!")) enabled_waddle = TRUE else to_chat(user, span_notice("You switch on the waddle dampeners!")) enabled_waddle = FALSE + return CLICK_ACTION_SUCCESS /obj/item/clothing/shoes/clown_shoes/jester name = "jester shoes" diff --git a/code/modules/clothing/spacesuits/_spacesuits.dm b/code/modules/clothing/spacesuits/_spacesuits.dm index bb8ee57b15c..a30156abe1f 100644 --- a/code/modules/clothing/spacesuits/_spacesuits.dm +++ b/code/modules/clothing/spacesuits/_spacesuits.dm @@ -13,7 +13,7 @@ clothing_flags = STOPSPRESSUREDAMAGE | THICKMATERIAL | SNUG_FIT | STACKABLE_HELMET_EXEMPT | HEADINTERNALS armor_type = /datum/armor/helmet_space flags_inv = HIDEMASK|HIDEEARS|HIDEEYES|HIDEFACE|HIDEHAIR|HIDEFACIALHAIR|HIDESNOUT - + interaction_flags_click = NEED_DEXTERITY cold_protection = HEAD min_cold_protection_temperature = SPACE_HELM_MIN_TEMP_PROTECT heat_protection = HEAD @@ -201,12 +201,11 @@ return CLICK_ACTION_SUCCESS /// Remove the cell whent he cover is open on CTRL+Click -/obj/item/clothing/suit/space/CtrlClick(mob/living/user) - if(user.can_perform_action(src, NEED_DEXTERITY)) - if(cell_cover_open && cell) - remove_cell(user) - return - return ..() +/obj/item/clothing/suit/space/item_ctrl_click(mob/user) + . = CLICK_ACTION_BLOCKING + if(cell_cover_open && cell) + remove_cell(user) + return CLICK_ACTION_SUCCESS // Remove the cell when using the suit on its self /obj/item/clothing/suit/space/attack_self(mob/user) diff --git a/code/modules/clothing/under/_under.dm b/code/modules/clothing/under/_under.dm index 40f8068aef5..2168177abcb 100644 --- a/code/modules/clothing/under/_under.dm +++ b/code/modules/clothing/under/_under.dm @@ -339,15 +339,13 @@ if(H.w_uniform == src) H.update_suit_sensors() -/obj/item/clothing/under/CtrlClick(mob/user) - . = ..() - if(.) - return +/obj/item/clothing/under/item_ctrl_click(mob/user) if(!can_toggle_sensors(user)) - return + return CLICK_ACTION_BLOCKING sensor_mode = SENSOR_COORDS balloon_alert(user, "set to tracking") + return CLICK_ACTION_SUCCESS /// Checks if the toggler is allowed to toggle suit sensors currently /obj/item/clothing/under/proc/can_toggle_sensors(mob/toggler) diff --git a/code/modules/food_and_drinks/machinery/microwave.dm b/code/modules/food_and_drinks/machinery/microwave.dm index 0f1be89410a..0cb98677234 100644 --- a/code/modules/food_and_drinks/machinery/microwave.dm +++ b/code/modules/food_and_drinks/machinery/microwave.dm @@ -479,13 +479,18 @@ visible_message(span_notice("[user] sets \the [src] to [vampire_charging_enabled ? "charge" : "cook"]."), blind_message = span_notice("You hear \the [src] make an informative beep!")) return CLICK_ACTION_SUCCESS -/obj/machinery/microwave/CtrlClick(mob/user) - . = ..() - if(user.can_perform_action(src) && cell_powered && !isnull(cell) && anchored) +/obj/machinery/microwave/click_ctrl(mob/user) + if(!anchored) + return NONE + + if(cell_powered && !isnull(cell)) user.put_in_hands(cell) balloon_alert(user, "removed cell") cell = null update_appearance() + return CLICK_ACTION_SUCCESS + + return CLICK_ACTION_BLOCKING /obj/machinery/microwave/ui_interact(mob/user) . = ..() diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 9b23f0b25b0..3f47982e16e 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -9,6 +9,7 @@ pixel_z = 8 obj_flags = CAN_BE_HIT | UNIQUE_RENAME circuit = /obj/item/circuitboard/machine/hydroponics + interaction_flags_click = FORBID_TELEKINESIS_REACH use_power = NO_POWER_USE ///The amount of water in the tray (max 100) var/waterlevel = 0 @@ -1086,19 +1087,16 @@ if(user) user.examinate(src) -/obj/machinery/hydroponics/CtrlClick(mob/user) - . = ..() - if(!user.can_perform_action(src, FORBID_TELEKINESIS_REACH)) - return +/obj/machinery/hydroponics/click_ctrl(mob/user) if(!powered()) to_chat(user, span_warning("[name] has no power.")) update_use_power(NO_POWER_USE) - return + return CLICK_ACTION_BLOCKING if(!anchored) - return + return CLICK_ACTION_BLOCKING set_self_sustaining(!self_sustaining) to_chat(user, span_notice("You [self_sustaining ? "activate" : "deactivated"] [src]'s autogrow function[self_sustaining ? ", maintaining the tray's health while using high amounts of power" : ""].")) - + return CLICK_ACTION_SUCCESS /obj/machinery/hydroponics/attack_hand_secondary(mob/user, list/modifiers) . = ..() @@ -1184,8 +1182,8 @@ deconstruct(disassembled = TRUE) return SECONDARY_ATTACK_CANCEL_ATTACK_CHAIN -/obj/machinery/hydroponics/soil/CtrlClick(mob/user) - return //Soil has no electricity. +/obj/machinery/hydroponics/soil/click_ctrl(mob/user) + return CLICK_ACTION_BLOCKING //Soil has no electricity. /obj/machinery/hydroponics/soil/on_deconstruction(disassembled) new /obj/item/stack/ore/glass(drop_location(), 3) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index f90cda94563..556a959e4f8 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -983,8 +983,8 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp game = create_mafia_game() game.ui_interact(usr) -/mob/dead/observer/CtrlShiftClick(mob/user) - if(isobserver(user) && check_rights(R_SPAWN)) +/mob/dead/observer/CtrlShiftClickOn(atom/target) + if(check_rights(R_SPAWN)) change_mob_type(/mob/living/carbon/human , null, null, TRUE) //always delmob, ghosts shouldn't be left lingering /mob/dead/observer/examine(mob/user) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index 97470f30d12..539dfd64ce3 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -33,8 +33,7 @@ return ITEM_INTERACT_SUCCESS return . -/mob/living/carbon/CtrlShiftClick(mob/user) - ..() +/mob/living/carbon/click_ctrl_shift(mob/user) if(iscarbon(user)) var/mob/living/carbon/carbon_user = user carbon_user.give(src) diff --git a/code/modules/modular_computers/computers/item/computer.dm b/code/modules/modular_computers/computers/item/computer.dm index a490af9be8d..0e2071a84b9 100644 --- a/code/modules/modular_computers/computers/item/computer.dm +++ b/code/modules/modular_computers/computers/item/computer.dm @@ -472,10 +472,7 @@ update_appearance(UPDATE_ICON) return ..() -/obj/item/modular_computer/CtrlShiftClick(mob/user) - . = ..() - if(.) - return +/obj/item/modular_computer/click_ctrl_shift(mob/user) if(!inserted_disk) return user.put_in_hands(inserted_disk) diff --git a/code/modules/modular_computers/computers/item/pda.dm b/code/modules/modular_computers/computers/item/pda.dm index 8935161089b..ec0d4a94e2b 100644 --- a/code/modules/modular_computers/computers/item/pda.dm +++ b/code/modules/modular_computers/computers/item/pda.dm @@ -158,12 +158,9 @@ playsound(src, 'sound/machines/pda_button1.ogg', 50, TRUE) -/obj/item/modular_computer/pda/CtrlClick(mob/user) - . = ..() - if(.) - return - +/obj/item/modular_computer/pda/item_ctrl_click(mob/user) remove_pen(user) + return CLICK_ACTION_SUCCESS ///Finds how hard it is to send a virus to this tablet, checking all programs downloaded. /obj/item/modular_computer/pda/proc/get_detomatix_difficulty() diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index ee2a20eb788..e55442f31fd 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -758,9 +758,10 @@ GLOBAL_LIST(hub_radial_layer_list) C.deconstruct() // remove adversary cable auto_propagate_cut_cable(src) // update the powernets -/obj/structure/cable/multilayer/CtrlClick(mob/living/user) +/obj/structure/cable/multilayer/click_ctrl(mob/user) to_chat(user, span_warning("You push the reset button.")) addtimer(CALLBACK(src, PROC_REF(Reload)), 10, TIMER_UNIQUE) //spam protect + return CLICK_ACTION_SUCCESS // This is a mapping aid. In order for this to be placed on a map and function, all three layers need to have their nodes active /obj/structure/cable/multilayer/connected diff --git a/code/modules/reagents/chemistry/machinery/portable_chem_mixer.dm b/code/modules/reagents/chemistry/machinery/portable_chem_mixer.dm index 5396839e13d..016e55012c5 100644 --- a/code/modules/reagents/chemistry/machinery/portable_chem_mixer.dm +++ b/code/modules/reagents/chemistry/machinery/portable_chem_mixer.dm @@ -260,7 +260,7 @@ update_appearance() return CLICK_ACTION_SUCCESS -/obj/item/storage/portable_chem_mixer/CtrlClick(mob/living/user) +/obj/item/storage/portable_chem_mixer/item_ctrl_click(mob/user) if(atom_storage.locked == STORAGE_FULLY_LOCKED) atom_storage.locked = STORAGE_NOT_LOCKED replace_beaker(user) @@ -270,3 +270,4 @@ atom_storage.hide_contents(usr) update_appearance() + return CLICK_ACTION_SUCCESS diff --git a/code/modules/reagents/reagent_containers/misc.dm b/code/modules/reagents/reagent_containers/misc.dm index 40be7c5f43d..f7152204f9e 100644 --- a/code/modules/reagents/reagent_containers/misc.dm +++ b/code/modules/reagents/reagent_containers/misc.dm @@ -50,13 +50,14 @@ STOP_PROCESSING(SSobj, src) . = ..() -/obj/item/reagent_containers/cup/maunamug/CtrlClick(mob/living/user) +/obj/item/reagent_containers/cup/maunamug/item_ctrl_click(mob/user) if(on) change_power_status(FALSE) else if(!cell || cell.charge <= 0) return FALSE //No power, so don't turn on change_power_status(TRUE) + return CLICK_ACTION_SUCCESS /obj/item/reagent_containers/cup/maunamug/proc/change_power_status(status) on = status diff --git a/code/modules/recycling/sortingmachinery.dm b/code/modules/recycling/sortingmachinery.dm index 59b3d13c342..f02bfff4a09 100644 --- a/code/modules/recycling/sortingmachinery.dm +++ b/code/modules/recycling/sortingmachinery.dm @@ -395,10 +395,10 @@ new_barcode.cut_multiplier = cut_multiplier // Also the registered percent cut. user.put_in_hands(new_barcode) -/obj/item/sales_tagger/CtrlClick(mob/user) - . = ..() +/obj/item/sales_tagger/item_ctrl_click(mob/user) payments_acc = null to_chat(user, span_notice("You clear the registered account.")) + return CLICK_ACTION_SUCCESS /obj/item/sales_tagger/click_alt(mob/user) var/potential_cut = input("How much would you like to pay out to the registered card?","Percentage Profit ([round(cut_min*100)]% - [round(cut_max*100)]%)") as num|null diff --git a/code/modules/research/xenobiology/xenobio_camera.dm b/code/modules/research/xenobiology/xenobio_camera.dm index 9724bd776d8..ea4ef0e9b7e 100644 --- a/code/modules/research/xenobiology/xenobio_camera.dm +++ b/code/modules/research/xenobiology/xenobio_camera.dm @@ -92,17 +92,13 @@ /obj/machinery/computer/camera_advanced/xenobio/GrantActions(mob/living/user) ..() - RegisterSignal(user, COMSIG_XENO_SLIME_CLICK_CTRL, PROC_REF(XenoSlimeClickCtrl)) - RegisterSignal(user, COMSIG_XENO_TURF_CLICK_CTRL, PROC_REF(XenoTurfClickCtrl)) - RegisterSignal(user, COMSIG_XENO_MONKEY_CLICK_CTRL, PROC_REF(XenoMonkeyClickCtrl)) + RegisterSignal(user, COMSIG_MOB_CTRL_CLICKED, PROC_REF(XenoClickCtrl)) RegisterSignal(user, COMSIG_XENO_SLIME_CLICK_ALT, PROC_REF(XenoSlimeClickAlt)) RegisterSignal(user, COMSIG_XENO_SLIME_CLICK_SHIFT, PROC_REF(XenoSlimeClickShift)) RegisterSignal(user, COMSIG_XENO_TURF_CLICK_SHIFT, PROC_REF(XenoTurfClickShift)) /obj/machinery/computer/camera_advanced/xenobio/remove_eye_control(mob/living/user) - UnregisterSignal(user, COMSIG_XENO_SLIME_CLICK_CTRL) - UnregisterSignal(user, COMSIG_XENO_TURF_CLICK_CTRL) - UnregisterSignal(user, COMSIG_XENO_MONKEY_CLICK_CTRL) + UnregisterSignal(user, COMSIG_MOB_CTRL_CLICKED) UnregisterSignal(user, COMSIG_XENO_SLIME_CLICK_ALT) UnregisterSignal(user, COMSIG_XENO_SLIME_CLICK_SHIFT) UnregisterSignal(user, COMSIG_XENO_TURF_CLICK_SHIFT) @@ -372,30 +368,6 @@ Due to keyboard shortcuts, the second one is not necessarily the remote eye's lo SEND_SIGNAL(user, COMSIG_XENO_TURF_CLICK_SHIFT, src) ..() -/mob/living/basic/slime/CtrlClick(mob/user) - SEND_SIGNAL(user, COMSIG_XENO_SLIME_CLICK_CTRL, src) - ..() - -/mob/living/carbon/human/species/monkey/CtrlClick(mob/user) - SEND_SIGNAL(user, COMSIG_XENO_MONKEY_CLICK_CTRL, src) - ..() - -/turf/open/CtrlClick(mob/user) - SEND_SIGNAL(user, COMSIG_XENO_TURF_CLICK_CTRL, src) - ..() - -/// Scans the target slime -/obj/machinery/computer/camera_advanced/xenobio/proc/XenoSlimeClickCtrl(mob/living/user, mob/living/basic/slime/target_slime) - SIGNAL_HANDLER - - var/mob/camera/ai_eye/remote/xenobio/remote_eye = user.remote_control - var/obj/machinery/computer/camera_advanced/xenobio/xeno_console = remote_eye.origin - - if(!xeno_console.validate_area(user, remote_eye, target_slime.loc)) - return - - slime_scan(target_slime, user) - ///Feeds a stored potion to a slime /obj/machinery/computer/camera_advanced/xenobio/proc/XenoSlimeClickAlt(mob/living/user, mob/living/basic/slime/target_slime) SIGNAL_HANDLER @@ -437,9 +409,22 @@ Due to keyboard shortcuts, the second one is not necessarily the remote eye's lo slime_place(target_turf) +/obj/machinery/computer/camera_advanced/xenobio/proc/XenoClickCtrl(mob/living/user, atom/target) + SIGNAL_HANDLER + + if(isopenturf(target)) + XenoTurfClickCtrl(user, target) + else if(ismonkey(target)) + XenoMonkeyClickCtrl(user, target) + else if(isslime(target)) + XenoSlimeClickCtrl(user, target) + + return COMSIG_MOB_CANCEL_CLICKON + ///Places a monkey from the internal storage /obj/machinery/computer/camera_advanced/xenobio/proc/XenoTurfClickCtrl(mob/living/user, turf/open/target_turf) - SIGNAL_HANDLER + if(!isopenturf(target_turf)) + return var/mob/camera/ai_eye/remote/xenobio/remote_eye = user.remote_control var/obj/machinery/computer/camera_advanced/xenobio/xeno_console = remote_eye.origin @@ -451,18 +436,30 @@ Due to keyboard shortcuts, the second one is not necessarily the remote eye's lo ///Picks up a dead monkey for recycling /obj/machinery/computer/camera_advanced/xenobio/proc/XenoMonkeyClickCtrl(mob/living/user, mob/living/carbon/human/target_mob) - SIGNAL_HANDLER if(!ismonkey(target_mob)) return var/mob/camera/ai_eye/remote/xenobio/remote_eye = user.remote_control var/obj/machinery/computer/camera_advanced/xenobio/xeno_console = remote_eye.origin - if(!xeno_console.validate_area(user, remote_eye, target_mob.loc)) - return - if(!xeno_console.connected_recycler) to_chat(user, span_warning("There is no connected monkey recycler. Use a multitool to link one.")) return + if(!xeno_console.validate_area(user, remote_eye, target_mob.loc)) + return + xeno_console.monkey_recycle(user, target_mob) + +/// Scans the target slime +/obj/machinery/computer/camera_advanced/xenobio/proc/XenoSlimeClickCtrl(mob/living/user, mob/living/basic/slime/target_slime) + if(!isslime(target_slime)) + return + + var/mob/camera/ai_eye/remote/xenobio/remote_eye = user.remote_control + var/obj/machinery/computer/camera_advanced/xenobio/xeno_console = remote_eye.origin + + if(!xeno_console.validate_area(user, remote_eye, target_slime.loc)) + return + + slime_scan(target_slime, user) diff --git a/code/modules/transport/tram/tram_remote.dm b/code/modules/transport/tram/tram_remote.dm index 3a45ec4e665..65c2cff8727 100644 --- a/code/modules/transport/tram/tram_remote.dm +++ b/code/modules/transport/tram/tram_remote.dm @@ -45,7 +45,7 @@ to_chat(user, span_notice("You change the platform ID on [src] to [selected_platform].")) ///set safety bypass -/obj/item/assembly/control/transport/remote/CtrlClick(mob/user) +/obj/item/assembly/control/transport/remote/item_ctrl_click(mob/user) switch(options) if(!RAPID_MODE) options |= RAPID_MODE @@ -53,6 +53,7 @@ options &= ~RAPID_MODE update_appearance() balloon_alert(user, "mode: [options ? "fast" : "safe"]") + return CLICK_ACTION_SUCCESS /obj/item/assembly/control/transport/remote/examine(mob/user) . = ..() diff --git a/tgstation.dme b/tgstation.dme index 2196f0559dd..c1edbfe6146 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -556,6 +556,7 @@ #include "code\_onclick\ai.dm" #include "code\_onclick\click.dm" #include "code\_onclick\click_alt.dm" +#include "code\_onclick\click_ctrl.dm" #include "code\_onclick\cyborg.dm" #include "code\_onclick\drag_drop.dm" #include "code\_onclick\item_attack.dm"