Converts more attackby's to interactions (#93106)

## About The Pull Request
Converts the following:
- Medical Kiosk
- Implant case
- Flamethrower
- Chemical implant case
- Pappercutter

Also I've looked at some alt click procs and adjusted some of their
returns
This commit is contained in:
Xander3359
2025-10-12 22:40:42 -05:00
committed by GitHub
parent bae633bb56
commit bbe729aef7
20 changed files with 136 additions and 140 deletions
@@ -226,10 +226,10 @@
/obj/machinery/dna_infuser/click_alt(mob/user)
if(infusing)
balloon_alert(user, "not while it's on!")
return
return CLICK_ACTION_BLOCKING
if(!infusing_from)
balloon_alert(user, "no sample to eject!")
return
return CLICK_ACTION_BLOCKING
balloon_alert(user, "ejected sample")
infusing_from.forceMove(get_turf(src))
infusing_from = null
+33 -29
View File
@@ -10,8 +10,6 @@
/// Shows if the machine is being used for a reagent scan.
#define KIOSK_SCANNING_REAGENTS (1<<3)
/obj/machinery/medical_kiosk
name = "medical kiosk"
desc = "A freestanding medical kiosk, which can provide a wide range of medical analysis for diagnosis."
@@ -114,34 +112,40 @@
return board.custom_cost
/obj/machinery/medical_kiosk/attackby(obj/item/O, mob/user, list/modifiers, list/attack_modifiers)
if(default_deconstruction_screwdriver(user, "[base_icon_state]_open", "[base_icon_state]_off", O))
return
else if(default_deconstruction_crowbar(O))
return
/obj/machinery/medical_kiosk/screwdriver_act(mob/living/user, obj/item/tool)
if(default_deconstruction_screwdriver(user, "[base_icon_state]_open", "[base_icon_state]_off", tool))
return ITEM_INTERACT_SUCCESS
return ITEM_INTERACT_BLOCKING
if(istype(O, /obj/item/scanner_wand))
var/obj/item/scanner_wand/W = O
if(scanner_wand)
balloon_alert(user, "already has a wand!")
return
if(HAS_TRAIT(O, TRAIT_NODROP) || !user.transferItemToLoc(O, src))
balloon_alert(user, "stuck to your hand!")
return
user.visible_message(span_notice("[user] snaps [O] onto [src]!"))
balloon_alert(user, "wand returned")
//This will be the scanner returning scanner_wand's selected_target variable and assigning it to the altPatient var
if(W.selected_target)
var/datum/weakref/target_ref = WEAKREF(W.return_patient())
if(patient_ref != target_ref)
clearScans()
patient_ref = target_ref
user.visible_message(span_notice("[W.return_patient()] has been set as the current patient."))
W.selected_target = null
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
scanner_wand = O
return
return ..()
/obj/machinery/medical_kiosk/crowbar_act(mob/living/user, obj/item/tool)
if(default_deconstruction_crowbar(tool))
return ITEM_INTERACT_SUCCESS
return ITEM_INTERACT_BLOCKING
/obj/machinery/medical_kiosk/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!istype(tool, /obj/item/scanner_wand))
return NONE
var/obj/item/scanner_wand/wand = tool
if(scanner_wand)
balloon_alert(user, "already has a wand!")
return ITEM_INTERACT_BLOCKING
if(!user.transferItemToLoc(tool, src))
balloon_alert(user, "stuck to your hand!")
return ITEM_INTERACT_BLOCKING
user.visible_message(span_notice("[user] snaps [tool] onto [src]!"))
balloon_alert(user, "wand returned")
//This will be the scanner returning scanner_wand's selected_target variable and assigning it to the altPatient var
if(wand.selected_target)
var/datum/weakref/target_ref = WEAKREF(wand.return_patient())
if(patient_ref != target_ref)
clearScans()
patient_ref = target_ref
user.visible_message(span_notice("[wand.return_patient()] has been set as the current patient."))
wand.selected_target = null
playsound(src, 'sound/machines/click.ogg', 50, TRUE)
scanner_wand = tool
return ITEM_INTERACT_SUCCESS
/obj/machinery/medical_kiosk/attack_hand_secondary(mob/user, list/modifiers)
. = ..()
+11 -11
View File
@@ -778,6 +778,9 @@
/obj/item/card/id/click_alt(mob/living/user)
if(!alt_click_can_use_id(user))
return NONE
if (registered_account.being_dumped)
registered_account.bank_card_talk(span_warning("内部服务器错误"), TRUE)
return CLICK_ACTION_SUCCESS
if(registered_account.account_debt)
var/choice = tgui_alert(user, "Choose An Action", "Bank Account", list("Withdraw", "Pay Debt"))
if(!choice || QDELETED(user) || QDELETED(src) || !alt_click_can_use_id(user) || loc != user)
@@ -785,9 +788,6 @@
if(choice == "Pay Debt")
pay_debt(user)
return CLICK_ACTION_SUCCESS
if (registered_account.being_dumped)
registered_account.bank_card_talk(span_warning("内部服务器错误"), TRUE)
return CLICK_ACTION_SUCCESS
if(loc != user)
to_chat(user, span_warning("You must be holding the ID to continue!"))
return CLICK_ACTION_BLOCKING
@@ -803,17 +803,17 @@
return CLICK_ACTION_BLOCKING
if(!alt_click_can_use_id(user))
return CLICK_ACTION_BLOCKING
if(registered_account.adjust_money(-amount_to_remove, "System: Withdrawal"))
var/obj/item/holochip/holochip = new (user.drop_location(), amount_to_remove)
user.put_in_hands(holochip)
to_chat(user, span_notice("You withdraw [amount_to_remove] credits into a holochip."))
SSblackbox.record_feedback("amount", "credits_removed", amount_to_remove)
log_econ("[amount_to_remove] credits were removed from [src] owned by [src.registered_name]")
return CLICK_ACTION_SUCCESS
else
if(!registered_account.adjust_money(-amount_to_remove, "System: Withdrawal"))
var/difference = amount_to_remove - registered_account.account_balance
registered_account.bank_card_talk(span_warning("ERROR: The linked account requires [difference] more credit\s to perform that withdrawal."), TRUE)
return CLICK_ACTION_BLOCKING
var/obj/item/holochip/holochip = new (user.drop_location(), amount_to_remove)
user.put_in_hands(holochip)
to_chat(user, span_notice("You withdraw [amount_to_remove] credits into a holochip."))
SSblackbox.record_feedback("amount", "credits_removed", amount_to_remove)
log_econ("[amount_to_remove] credits were removed from [src] owned by [registered_name]")
return CLICK_ACTION_SUCCESS
/obj/item/card/id/click_alt_secondary(mob/user)
if(!alt_click_can_use_id(user))
+4 -7
View File
@@ -809,6 +809,10 @@
)
register_context()
register_item_context()
// If default crayon red colour, pick a more fun spraycan colour
if(!paint_color)
set_painting_tool_color(pick(COLOR_CRAYON_RED, COLOR_CRAYON_ORANGE, COLOR_CRAYON_YELLOW, COLOR_CRAYON_GREEN, COLOR_CRAYON_BLUE, COLOR_CRAYON_PURPLE))
refill()
/obj/item/toy/crayon/spraycan/add_context(atom/source, list/context, obj/item/held_item, mob/living/user)
. = ..()
@@ -859,13 +863,6 @@
reagents.trans_to(user, used, volume_multiplier, transferred_by = user, methods = VAPOR)
return OXYLOSS
/obj/item/toy/crayon/spraycan/Initialize(mapload)
. = ..()
// If default crayon red colour, pick a more fun spraycan colour
if(!paint_color)
set_painting_tool_color(pick(COLOR_CRAYON_RED, COLOR_CRAYON_ORANGE, COLOR_CRAYON_YELLOW, COLOR_CRAYON_GREEN, COLOR_CRAYON_BLUE, COLOR_CRAYON_PURPLE))
refill()
/obj/item/toy/crayon/spraycan/examine(mob/user)
. = ..()
if(charges != INFINITE_CHARGES)
@@ -41,7 +41,7 @@
/obj/item/desynchronizer/click_alt(mob/living/user)
var/new_duration = tgui_input_number(user, "Set the duration", "Desynchronizer", duration / 10, max_duration, 5)
if(!new_duration || QDELETED(user) || QDELETED(src) || !usr.can_perform_action(src, NEED_DEXTERITY))
if(!new_duration || QDELETED(user) || QDELETED(src) || !user.can_perform_action(src, NEED_DEXTERITY))
return CLICK_ACTION_BLOCKING
duration = new_duration
to_chat(user, span_notice("You set the duration to [DisplayTimeText(duration)]."))
@@ -112,9 +112,9 @@
/obj/item/geiger_counter/click_alt(mob/living/user)
if(!scanning)
to_chat(usr, span_warning("[src] must be on to reset its radiation level!"))
to_chat(user, span_warning("[src] must be on to reset its radiation level!"))
return CLICK_ACTION_BLOCKING
to_chat(usr, span_notice("You flush [src]'s radiation counts, resetting it to normal."))
to_chat(user, span_notice("You flush [src]'s radiation counts, resetting it to normal."))
last_perceived_radiation_danger = null
update_appearance(UPDATE_ICON)
return CLICK_ACTION_SUCCESS
@@ -45,9 +45,10 @@
/obj/item/quantum_keycard/click_alt(mob/living/user)
to_chat(user, span_notice("You start pressing [src]'s unlink button..."))
if(do_after(user, 4 SECONDS, target = src))
to_chat(user, span_notice("The keycard beeps twice and disconnects the quantum link."))
set_pad()
if(!do_after(user, 4 SECONDS, target = src))
return CLICK_ACTION_BLOCKING
to_chat(user, span_notice("The keycard beeps twice and disconnects the quantum link."))
set_pad()
return CLICK_ACTION_SUCCESS
/obj/item/quantum_keycard/proc/set_pad(obj/machinery/quantumpad/new_pad)
@@ -21,13 +21,13 @@
throw_range = 7
custom_materials = list(/datum/material/iron=SMALL_MATERIAL_AMOUNT *2)
interaction_flags_click = NEED_LITERACY|NEED_LIGHT|ALLOW_RESTING
custom_price = PAYCHECK_COMMAND
/// Verbose/condensed
var/mode = SCANNER_VERBOSE
/// HEALTH/WOUND
var/scanmode = SCANMODE_HEALTH
/// Advanced health analyzer
var/advanced = FALSE
custom_price = PAYCHECK_COMMAND
/// If this analyzer will give a bonus to wound treatments apon woundscan.
var/give_wound_treatment_bonus = FALSE
var/last_scan_text
@@ -190,7 +190,7 @@
render_list += "<span class='alert ml-1'>Fatigue level: [target.getStaminaLoss()]%.</span><br>"
else
render_list += "<span class='alert ml-1'>Subject appears to be suffering from fatigue.</span><br>"
// Check for brain - both organic (carbon) and synthetic (cyborg MMI)
var/has_brain = FALSE
if(target.get_organ_slot(ORGAN_SLOT_BRAIN))
@@ -199,7 +199,7 @@
var/mob/living/silicon/robot/cyborg_target = target
if(cyborg_target.mmi?.brain)
has_brain = TRUE
if(!has_brain) // kept exclusively for soul purposes
render_list += "<span class='alert ml-1'>Subject lacks a brain.</span><br>"
+27 -25
View File
@@ -25,7 +25,9 @@
var/lit = FALSE //on or off
var/operating = FALSE//cooldown
var/obj/item/weldingtool/weldtool = null
/// The igniter stored in the flamethrower
var/obj/item/assembly/igniter/igniter = null
/// The plasma tank that we shoot gas from
var/obj/item/tank/internals/plasma/ptank = null
var/warned_admins = FALSE //for the message_admins() when lit
//variables for prebuilt flamethrowers
@@ -94,9 +96,9 @@
return ITEM_INTERACT_SUCCESS
/obj/item/flamethrower/wrench_act(mob/living/user, obj/item/tool)
. = TRUE
. = ITEM_INTERACT_SUCCESS
if(status)
return FALSE
return ITEM_INTERACT_BLOCKING
tool.play_tool_sound(src)
var/turf/T = get_turf(src)
if(weldtool)
@@ -119,34 +121,34 @@
update_appearance()
return TRUE
/obj/item/flamethrower/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers)
if(isigniter(W))
var/obj/item/assembly/igniter/I = W
if(I.secured)
return
/obj/item/flamethrower/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(isigniter(tool))
var/obj/item/assembly/igniter/inserting_igniter = tool
if(inserting_igniter.secured)
return ITEM_INTERACT_BLOCKING
if(igniter)
return
if(!user.transferItemToLoc(W, src))
return
igniter = I
return ITEM_INTERACT_BLOCKING
if(!user.transferItemToLoc(tool, src))
return ITEM_INTERACT_BLOCKING
igniter = inserting_igniter
update_appearance()
return
else if(istype(W, /obj/item/tank/internals/plasma))
balloon_alert(user, "attached")
return ITEM_INTERACT_SUCCESS
if(istype(tool, /obj/item/tank/internals/plasma))
if(ptank)
if(user.transferItemToLoc(W,src))
ptank.forceMove(get_turf(src))
ptank = W
to_chat(user, span_notice("You swap the plasma tank in [src]!"))
return
if(!user.transferItemToLoc(W, src))
return
ptank = W
if(!user.transferItemToLoc(tool, src))
return ITEM_INTERACT_BLOCKING
ptank.forceMove(get_turf(src))
ptank = tool
to_chat(user, span_notice("You swap the plasma tank in [src]!"))
return ITEM_INTERACT_SUCCESS
if(!user.transferItemToLoc(tool, src))
return ITEM_INTERACT_BLOCKING
ptank = tool
update_appearance()
return
return ITEM_INTERACT_SUCCESS
else
return ..()
return NONE
/obj/item/flamethrower/return_analyzable_air()
if(ptank)
@@ -95,9 +95,7 @@
desc = "A glass case containing a remote chemical implant."
imp_type = /obj/item/implant/chem
/obj/item/implantcase/chem/attackby(obj/item/W, mob/user, list/modifiers, list/attack_modifiers)
if(istype(W, /obj/item/reagent_containers/syringe) && imp)
W.interact_with_atom(imp, user, modifiers)
return TRUE
else
return ..()
/obj/item/implantcase/chem/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(!istype(tool, /obj/item/reagent_containers/syringe) && imp)
return NONE
return tool.interact_with_atom(imp, user, modifiers)
+7 -5
View File
@@ -462,11 +462,13 @@
var/datum/action/innate/origami/origami_action = locate() in user.actions
if(origami_action?.active) //Origami masters can fold water
make_plane(user, /obj/item/paperplane/syndicate)
else if(do_after(user, 1 SECONDS, target = src, progress=TRUE))
var/turf/open/target = get_turf(src)
target.MakeSlippery(TURF_WET_WATER, min_wet_time = 10 SECONDS, wet_time_to_add = 5 SECONDS)
to_chat(user, span_notice("As you try to fold [src] into the shape of a plane, it disintegrates into water!"))
qdel(src)
return CLICK_ACTION_SUCCESS
if(!do_after(user, 1 SECONDS, target = src, progress=TRUE))
return CLICK_ACTION_BLOCKING
var/turf/open/target = get_turf(src)
target.MakeSlippery(TURF_WET_WATER, min_wet_time = 10 SECONDS, wet_time_to_add = 5 SECONDS)
to_chat(user, span_notice("As you try to fold [src] into the shape of a plane, it disintegrates into water!"))
qdel(src)
return CLICK_ACTION_SUCCESS
#undef ENERGY_TO_SPEAK
+6 -6
View File
@@ -599,13 +599,13 @@
. += span_notice("Alt-click it to quickly draw the blade.")
/obj/item/storage/belt/sheath/click_alt(mob/user)
if(length(contents))
var/obj/item/I = contents[1]
user.visible_message(span_notice("[user] takes [I] out of [src]."), span_notice("You take [I] out of [src]."))
user.put_in_hands(I)
update_appearance()
else
if(!length(contents))
balloon_alert(user, "it's empty!")
return CLICK_ACTION_BLOCKING
var/obj/item/stored_item = contents[1]
user.visible_message(span_notice("[user] takes [stored_item] out of [src]."), span_notice("You take [stored_item] out of [src]."))
user.put_in_hands(stored_item)
update_appearance()
return CLICK_ACTION_SUCCESS
/obj/item/storage/belt/sheath/update_icon_state()
+6 -6
View File
@@ -10,13 +10,13 @@
/obj/structure/sacrificealtar/click_alt(mob/living/user)
if(!has_buckled_mobs())
return CLICK_ACTION_BLOCKING
var/mob/living/L = locate() in buckled_mobs
if(!L)
var/mob/living/buckled_mob = locate() in buckled_mobs
if(!buckled_mob)
return CLICK_ACTION_BLOCKING
to_chat(user, span_notice("Invoking the sacred ritual, you sacrifice [L]."))
L.investigate_log("has been sacrificially gibbed on an altar.", INVESTIGATE_DEATHS)
L.gib(DROP_ALL_REMAINS)
message_admins("[ADMIN_LOOKUPFLW(user)] has sacrificed [key_name_admin(L)] on the sacrificial altar at [AREACOORD(src)].")
to_chat(user, span_notice("Invoking the sacred ritual, you sacrifice [buckled_mob]."))
buckled_mob.investigate_log("has been sacrificially gibbed on an altar.", INVESTIGATE_DEATHS)
buckled_mob.gib(DROP_ALL_REMAINS)
message_admins("[ADMIN_LOOKUPFLW(user)] has sacrificed [key_name_admin(buckled_mob)] on the sacrificial altar at [AREACOORD(src)].")
return CLICK_ACTION_SUCCESS
/obj/structure/healingfountain
@@ -78,7 +78,6 @@
update_appearance(UPDATE_ICON)
/obj/structure/toiletbong/wrench_act(mob/living/user, obj/item/tool)
..()
default_unfasten_wrench(user, tool)
return ITEM_INTERACT_SUCCESS
@@ -17,7 +17,6 @@
..()
update_appearance()
/obj/machinery/atmospherics/components/unary/click_alt(mob/living/beno)
beno.handle_ventcrawl(src)
return CLICK_ACTION_SUCCESS
@@ -123,8 +123,8 @@
return CONTEXTUAL_SCREENTIP_SET
/obj/item/clothing/head/helmet/space/plasmaman/click_alt(mob/user)
if(user.can_perform_action(src))
adjust_visor(user)
adjust_visor(user)
return CLICK_ACTION_SUCCESS
/obj/item/clothing/head/helmet/space/plasmaman/ui_action_click(mob/user, action)
if(istype(action, /datum/action/item_action/toggle_welding_screen))
+1 -2
View File
@@ -7,14 +7,13 @@
abstract_type = /obj/item/clothing/under
body_parts_covered = CHEST|GROIN|LEGS|ARMS
slot_flags = ITEM_SLOT_ICLOTHING
interaction_flags_click = NEED_DEXTERITY
interaction_flags_click = NEED_DEXTERITY|ALLOW_RESTING
armor_type = /datum/armor/clothing_under
supports_variations_flags = CLOTHING_DIGITIGRADE_MASK
equip_sound = 'sound/items/equip/jumpsuit_equip.ogg'
drop_sound = 'sound/items/handling/cloth/cloth_drop1.ogg'
pickup_sound = 'sound/items/handling/cloth/cloth_pickup1.ogg'
limb_integrity = 30
interaction_flags_click = ALLOW_RESTING
/// Has this undersuit been freshly laundered and, as such, imparts a mood bonus for wearing
var/freshly_laundered = FALSE
@@ -60,9 +60,7 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sort_list(list(
/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(isnull(input_color))
return CLICK_ACTION_BLOCKING
if(!user.can_perform_action(src))
if(isnull(input_color) || !user.can_perform_action(src))
return CLICK_ACTION_BLOCKING
picked_color = input_color
update_appearance()
@@ -154,15 +152,12 @@ GLOBAL_LIST_INIT(marker_beacon_colors, sort_list(list(
/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(isnull(input_color))
if(isnull(input_color) || !user.can_perform_action(src))
return CLICK_ACTION_BLOCKING
if(!user.can_perform_action(src))
return NONE
picked_color = input_color
update_appearance()
return CLICK_ACTION_SUCCESS
/* Preset marker beacon types, for mapping */
// Set the icon_state here to make it clear for mappers.
+1 -3
View File
@@ -77,10 +77,8 @@ GLOBAL_VAR(posibrain_notify_cooldown)
/obj/item/mmi/posibrain/click_alt(mob/living/user)
var/input_seed = tgui_input_text(user, "Enter a personality seed", "Enter seed", ask_role, max_length = MAX_NAME_LEN)
if(isnull(input_seed))
if(isnull(input_seed) || !user.can_perform_action(src))
return CLICK_ACTION_BLOCKING
if(!user.can_perform_action(src))
return
to_chat(user, span_notice("You set the personality seed to \"[input_seed]\"."))
ask_role = input_seed
update_appearance()
+20 -18
View File
@@ -104,16 +104,16 @@
/obj/item/papercutter/screwdriver_act(mob/living/user, obj/item/tool)
if(!stored_blade && !blade_secured)
balloon_alert(user, "no blade!")
return
return ITEM_INTERACT_BLOCKING
tool.play_tool_sound(src)
balloon_alert(user, "[blade_secured ? "un" : ""]secured")
blade_secured = !blade_secured
return ITEM_INTERACT_SUCCESS
/obj/item/papercutter/attackby(obj/item/inserted_item, mob/user, list/modifiers, list/attack_modifiers)
if(istype(inserted_item, /obj/item/paper))
if(is_type_in_list(inserted_item, list(
/obj/item/papercutter/item_interaction(mob/living/user, obj/item/tool, list/modifiers)
if(istype(tool, /obj/item/paper))
if(is_type_in_list(tool, list(
/obj/item/paper/fake_report,
/obj/item/paper/holy_writ,
/obj/item/paper/pamphlet,
@@ -121,29 +121,31 @@
/obj/item/paper/report,
)))
balloon_alert(user, "won't fit!")
return
return ITEM_INTERACT_BLOCKING
if(stored_paper)
balloon_alert(user, "already paper inside!")
return
if(!user.transferItemToLoc(inserted_item, src))
return
return ITEM_INTERACT_BLOCKING
if(!user.transferItemToLoc(tool, src))
return ITEM_INTERACT_BLOCKING
playsound(loc, SFX_PAGE_TURN, 60, TRUE)
balloon_alert(user, "paper inserted")
stored_paper = inserted_item
stored_paper = tool
update_appearance()
return ITEM_INTERACT_SUCCESS
if(istype(inserted_item, /obj/item/hatchet/cutterblade))
if(istype(tool, /obj/item/hatchet/cutterblade))
if(stored_blade)
balloon_alert(user, "already a blade inside!")
return
if(!user.transferItemToLoc(inserted_item, src))
return
return ITEM_INTERACT_BLOCKING
if(!user.transferItemToLoc(tool, src))
return ITEM_INTERACT_BLOCKING
balloon_alert(user, "blade inserted")
inserted_item.forceMove(src)
stored_blade = inserted_item
tool.forceMove(src)
stored_blade = tool
update_appearance()
return ITEM_INTERACT_SUCCESS
update_appearance()
return ..()
return NONE
/obj/item/papercutter/click_alt(mob/user)
// can only remove one at a time; paper goes first, as its most likely what players will want to be taking out