diff --git a/code/game/machinery/washing_machine.dm b/code/game/machinery/washing_machine.dm index a15e3a6a726..d470bdcaf28 100644 --- a/code/game/machinery/washing_machine.dm +++ b/code/game/machinery/washing_machine.dm @@ -256,14 +256,16 @@ if(.) return washer.operable() && !(washer.state & WASHER_STATE_RUNNING) -/decl/interaction_handler/start_washer/invoked(obj/machinery/washing_machine/washer, mob/user) +/decl/interaction_handler/start_washer/invoked(atom/target, mob/user, obj/item/prop) + var/obj/machinery/washing_machine/washer = target return washer.start_washing(user) /decl/interaction_handler/toggle_open/washing_machine name = "Toggle detergent port" expected_target_type = /obj/machinery/washing_machine -/decl/interaction_handler/toggle_open/washing_machine/invoked(obj/machinery/washing_machine/washer, mob/user) +/decl/interaction_handler/toggle_open/washing_machine/invoked(atom/target, mob/user, obj/item/prop) + var/obj/machinery/washing_machine/washer = target return washer.toggle_detergent_port(user) /obj/machinery/washing_machine/on_update_icon() diff --git a/code/game/objects/items/blades/folding.dm b/code/game/objects/items/blades/folding.dm index d458ebfe5ae..69f2de5f8fa 100644 --- a/code/game/objects/items/blades/folding.dm +++ b/code/game/objects/items/blades/folding.dm @@ -31,7 +31,7 @@ var/decl/interaction_handler/folding_knife/interaction = GET_DECL(/decl/interaction_handler/folding_knife) if(!interaction.is_possible(src, user)) return FALSE - interaction.invoked(src, user) + interaction.invoked(src, user, user.get_active_held_item()) return TRUE /obj/item/bladed/folding/proc/set_open(new_state, mob/user) @@ -145,7 +145,7 @@ I.name = "Use as [tool_name]" .[tool_mode] = I -/decl/interaction_handler/folding_knife/invoked(atom/target, mob/user) +/decl/interaction_handler/folding_knife/invoked(atom/target, mob/user, obj/item/prop) var/obj/item/bladed/folding/folding_knife = target var/chosen_option = show_radial_menu(user, user, get_radial_choices(folding_knife), radius = 42, use_labels = RADIAL_LABELS_OFFSET) if(!chosen_option) diff --git a/code/game/objects/items/devices/gps.dm b/code/game/objects/items/devices/gps.dm index ec81f341725..c58b5bd7ae2 100644 --- a/code/game/objects/items/devices/gps.dm +++ b/code/game/objects/items/devices/gps.dm @@ -378,7 +378,7 @@ var/global/list/all_gps_units = list() name = "Toggle Tracking" expected_target_type = /obj/item/gps -/decl/interaction_handler/gps_toggle/invoked(atom/target, mob/user) +/decl/interaction_handler/gps_toggle/invoked(atom/target, mob/user, obj/item/prop) var/obj/item/gps/G = target G.toggle_tracking(user) diff --git a/code/game/objects/structures/doors/_door.dm b/code/game/objects/structures/doors/_door.dm index 00b477bf8ca..71c29e5142a 100644 --- a/code/game/objects/structures/doors/_door.dm +++ b/code/game/objects/structures/doors/_door.dm @@ -191,7 +191,7 @@ expected_target_type = /obj/structure/door interaction_flags = INTERACTION_NEEDS_PHYSICAL_INTERACTION | INTERACTION_NEEDS_TURF -/decl/interaction_handler/knock_on_door/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/knock_on_door/invoked(atom/target, mob/user, obj/item/prop) if(!istype(target) || !target.density) return FALSE user.do_attack_animation(src) diff --git a/code/game/objects/structures/extinguisher.dm b/code/game/objects/structures/extinguisher.dm index 6bccabb09f6..b2b2358d04f 100644 --- a/code/game/objects/structures/extinguisher.dm +++ b/code/game/objects/structures/extinguisher.dm @@ -78,7 +78,7 @@ name = "Open/Close" expected_target_type = /obj/structure/extinguisher_cabinet -/decl/interaction_handler/extinguisher_cabinet_open/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/extinguisher_cabinet_open/invoked(atom/target, mob/user, obj/item/prop) var/obj/structure/extinguisher_cabinet/C = target C.opened = !C.opened C.update_icon() diff --git a/code/game/objects/structures/fires.dm b/code/game/objects/structures/fires.dm index b74f5bcec1b..81a34f2fb54 100644 --- a/code/game/objects/structures/fires.dm +++ b/code/game/objects/structures/fires.dm @@ -509,7 +509,7 @@ name = "Adjust Draught" expected_target_type = /obj/structure/fire_source -/decl/interaction_handler/adjust_draught/invoked(atom/target, mob/user) +/decl/interaction_handler/adjust_draught/invoked(atom/target, mob/user, obj/item/prop) var/obj/structure/fire_source/fire = target if(fire.has_draught) fire.adjust_draught(user) diff --git a/code/game/turfs/walls/wall_natural_ramps.dm b/code/game/turfs/walls/wall_natural_ramps.dm index 14c7a779e59..7566bf7578f 100644 --- a/code/game/turfs/walls/wall_natural_ramps.dm +++ b/code/game/turfs/walls/wall_natural_ramps.dm @@ -47,24 +47,37 @@ if(!istype(support) || (destroying_self && support == src) || support.ramp_slope_direction) neighbor.dismantle_turf(ramp_update = FALSE) // This will only occur on ramps, so no need to propagate to other ramps. -// TODO: convert to alt interaction. -/turf/wall/natural/AltClick(mob/user) - - var/obj/item/P = user.get_active_held_item() - if(user.Adjacent(src) && IS_PICK(P) && HasAbove(z)) - - var/user_dir = get_dir(src, user) - if(!(user_dir in global.cardinal)) - to_chat(user, SPAN_WARNING("You must be standing at a cardinal angle to create a ramp.")) - return TRUE +/turf/wall/natural/get_alt_interactions(mob/user) + . = ..() + LAZYADD(., /decl/interaction_handler/drill_ramp) - var/turf/wall/natural/support = get_step(src, global.reverse_dir[user_dir]) - if(!istype(support) || support.ramp_slope_direction) - to_chat(user, SPAN_WARNING("You cannot cut a ramp into a wall with no additional walls behind it.")) - return TRUE +/decl/interaction_handler/drill_ramp + name = "Drill Ramp" + expected_target_type = /turf/wall/natural - if(P.do_tool_interaction(TOOL_PICK, user, src, 3 SECONDS, suffix_message = ", forming it into a ramp") && !ramp_slope_direction) - make_ramp(user, user_dir) +/decl/interaction_handler/drill_ramp/is_possible(atom/target, mob/user, obj/item/prop) + . = ..() + if(.) + if(!IS_PICK(prop)) + return FALSE + var/turf/wall/natural/wall = target + if(!HasAbove(wall.z)) + return FALSE + if(!user.Adjacent(target)) + return FALSE return TRUE - . = ..() +/decl/interaction_handler/drill_ramp/invoked(atom/target, mob/user, obj/item/prop) + var/turf/wall/natural/wall = target + var/user_dir = get_dir(wall, user) + if(!(user_dir in global.cardinal)) + to_chat(user, SPAN_WARNING("You must be standing at a cardinal angle to create a ramp.")) + return FALSE + var/turf/wall/natural/support = get_step(wall, global.reverse_dir[user_dir]) + if(!istype(support) || support.ramp_slope_direction) + to_chat(user, SPAN_WARNING("You cannot cut a ramp into a wall with no additional walls behind it.")) + return FALSE + if(prop.do_tool_interaction(TOOL_PICK, user, wall, 3 SECONDS, suffix_message = ", forming it into a ramp") && !wall.ramp_slope_direction) + wall.make_ramp(user, user_dir) + return TRUE + return FALSE diff --git a/code/modules/clothing/_clothing.dm b/code/modules/clothing/_clothing.dm index 0fb1d8773ab..a1a5d29d40f 100644 --- a/code/modules/clothing/_clothing.dm +++ b/code/modules/clothing/_clothing.dm @@ -437,7 +437,7 @@ name = "Set Sensors Level" expected_target_type = /obj/item/clothing -/decl/interaction_handler/clothing_set_sensors/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/clothing_set_sensors/invoked(atom/target, mob/user, obj/item/prop) var/obj/item/clothing/U = target U.set_sensors(user) diff --git a/code/modules/clothing/clothing_state/_clothing_state.dm b/code/modules/clothing/clothing_state/_clothing_state.dm index 3d602f27c0f..f2c25aa9e11 100644 --- a/code/modules/clothing/clothing_state/_clothing_state.dm +++ b/code/modules/clothing/clothing_state/_clothing_state.dm @@ -131,6 +131,6 @@ expected_target_type = /obj/item/clothing var/state_decl_type -/decl/interaction_handler/clothing_toggle/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/clothing_toggle/invoked(atom/target, mob/user, obj/item/prop) var/decl/clothing_state_modifier/modifier = GET_DECL(state_decl_type) call(target, modifier.toggle_verb)() diff --git a/code/modules/detectivework/microscope/_forensic_machine.dm b/code/modules/detectivework/microscope/_forensic_machine.dm index 55769742b70..4b2c2f14aae 100644 --- a/code/modules/detectivework/microscope/_forensic_machine.dm +++ b/code/modules/detectivework/microscope/_forensic_machine.dm @@ -121,6 +121,6 @@ name = "Remove Sample" expected_target_type = /obj/machinery/forensic -/decl/interaction_handler/forensics_remove_sample/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/forensics_remove_sample/invoked(atom/target, mob/user, obj/item/prop) var/obj/machinery/forensic/F = target F.remove_sample(usr) diff --git a/code/modules/hydroponics/trays/tray.dm b/code/modules/hydroponics/trays/tray.dm index 4c10d46cfa8..7139ff89c28 100644 --- a/code/modules/hydroponics/trays/tray.dm +++ b/code/modules/hydroponics/trays/tray.dm @@ -696,6 +696,6 @@ var/obj/machinery/portable_atmospherics/hydroponics/T = target return T.mechanical -/decl/interaction_handler/hydroponics_close_lid/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/hydroponics_close_lid/invoked(atom/target, mob/user, obj/item/prop) var/obj/machinery/portable_atmospherics/hydroponics/T = target T.close_lid(user) diff --git a/code/modules/interactions/_interactions.dm b/code/modules/interactions/_interactions.dm index fd9c2ec3696..ebdd06610dd 100644 --- a/code/modules/interactions/_interactions.dm +++ b/code/modules/interactions/_interactions.dm @@ -42,6 +42,6 @@ return TRUE -/decl/interaction_handler/proc/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/proc/invoked(atom/target, mob/user, obj/item/prop) SHOULD_CALL_PARENT(FALSE) PRINT_STACK_TRACE("Alt interaction handler called with no invoked logic defined: [type]") diff --git a/code/modules/mechs/equipment/engineering.dm b/code/modules/mechs/equipment/engineering.dm index 19da57c8c63..72bf68d6732 100644 --- a/code/modules/mechs/equipment/engineering.dm +++ b/code/modules/mechs/equipment/engineering.dm @@ -56,16 +56,22 @@ var/current_mode = 0 //0 barrier, 1 bubble var/shield_range = 2 -// TODO: convert to alt interaction. -/obj/item/mech_equipment/atmos_shields/AltClick(mob/user) - if (owner?.hatch_closed && ((user in owner.pilots) || user == owner)) - if (active) - to_chat(user, SPAN_WARNING("You cannot modify the projection mode while the shield is active.")) - else - current_mode = !current_mode - to_chat(user, SPAN_NOTICE("You set the shields to [current_mode ? "bubble" : "barrier"] mode.")) - return TRUE - return ..() +/obj/item/mech_equipment/atmos_shields/get_alt_interactions(mob/user) + . = ..() + LAZYADD(., /decl/interaction_handler/mech_equipment/adjust_atmos_shields) + +/decl/interaction_handler/mech_equipment/adjust_atmos_shields + name = "Adjust Atmos Shields" + expected_target_type = /obj/item/mech_equipment/atmos_shields + +/decl/interaction_handler/mech_equipment/adjust_atmos_shields/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/mech_equipment/atmos_shields/shields = target + if (shields.active) + to_chat(user, SPAN_WARNING("You cannot modify the projection mode while the shield is active.")) + else + shields.current_mode = !shields.current_mode + to_chat(user, SPAN_NOTICE("You set the shields to [shields.current_mode ? "bubble" : "barrier"] mode.")) + return TRUE /obj/effect/mech_shield name = "energy shield" diff --git a/code/modules/mechs/equipment/utility.dm b/code/modules/mechs/equipment/utility.dm index 6b8f00844be..7a68a78ec10 100644 --- a/code/modules/mechs/equipment/utility.dm +++ b/code/modules/mechs/equipment/utility.dm @@ -139,11 +139,9 @@ if(.) drop_carrying(user, TRUE) -/obj/item/mech_equipment/clamp/AltClick(mob/user) - if(owner?.hatch_closed) - drop_carrying(user, FALSE) - return TRUE - return ..() +/obj/item/mech_equipment/clamp/get_alt_interactions(mob/user) + . = ..() + LAZYADD(., /decl/interaction_handler/mech_equipment/clamp) /obj/item/mech_equipment/clamp/proc/drop_carrying(var/mob/user, var/choose_object) if(!length(carrying)) @@ -195,6 +193,14 @@ carrying -= load . = ..() +/decl/interaction_handler/mech_equipment/clamp + name = "Release Clamp" + expected_target_type = /obj/item/mech_equipment/clamp + +/decl/interaction_handler/mech_equipment/clamp/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/mech_equipment/clamp/clamp = target + clamp.drop_carrying(user, FALSE) + // A lot of this is copied from floodlights. /obj/item/mech_equipment/light name = "floodlight" @@ -620,13 +626,6 @@ else activate() -/obj/item/mech_equipment/ionjets/AltClick(mob/user) - if(owner?.hatch_closed && ((user in owner.pilots) || user == owner) && active) - stabilizers = !stabilizers - to_chat(user, SPAN_NOTICE("You toggle the stabilizers [stabilizers ? "on" : "off"]")) - return TRUE - return ..() - /obj/item/mech_equipment/ionjets/proc/activate() passive_power_use = activated_passive_power ion_trail.start() @@ -687,6 +686,26 @@ else to_chat(user, SPAN_WARNING("You cannot slide there!")) +/obj/item/mech_equipment/ionjets/get_alt_interactions(mob/user) + . = ..() + LAZYADD(., /decl/interaction_handler/mech_equipment/ionjets) + +/decl/interaction_handler/mech_equipment/ionjets + name = "Toggle Stabilizers" + expected_target_type = /obj/item/mech_equipment/ionjets + +/decl/interaction_handler/mech_equipment/ionjets/is_possible(atom/target, mob/user, obj/item/prop) + . = ..() + if(.) + var/obj/item/mech_equipment/ionjets/jets = target + return jets.active + +/decl/interaction_handler/mech_equipment/ionjets/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/mech_equipment/ionjets/jets = target + jets.stabilizers = !jets.stabilizers + to_chat(user, SPAN_NOTICE("You toggle the stabilizers [jets.stabilizers ? "on" : "off"]")) + return TRUE + //Exosuit camera /datum/extension/network_device/camera/mech expected_type = /obj/item/mech_equipment/camera diff --git a/code/modules/mechs/mech_interaction.dm b/code/modules/mechs/mech_interaction.dm index d74a1bd4c79..2b348948963 100644 --- a/code/modules/mechs/mech_interaction.dm +++ b/code/modules/mechs/mech_interaction.dm @@ -544,3 +544,18 @@ if(hardpoints[h] == I) return h return 0 + +/decl/interaction_handler/mech_equipment + abstract_type = /decl/interaction_handler/mech_equipment + expected_target_type = /obj/item/mech_equipment + interaction_flags = 0 // Mech gear is a bit special, see is_possible() below. + +/decl/interaction_handler/mech_equipment/is_possible(atom/target, mob/user, obj/item/prop) + . = ..() + if(.) + if(user.incapacitated()) + return FALSE + var/obj/item/mech_equipment/gear = target + if(!gear.owner) + return FALSE + return gear.owner.hatch_closed && ((user in gear.owner.pilots) || user == gear.owner) diff --git a/code/modules/mining/ore_box.dm b/code/modules/mining/ore_box.dm index c7ae5b9d18a..7c0adf71070 100644 --- a/code/modules/mining/ore_box.dm +++ b/code/modules/mining/ore_box.dm @@ -145,5 +145,6 @@ /decl/interaction_handler/empty/ore_box/is_possible(obj/structure/ore_box/target, mob/user, obj/item/prop) return ..() && target.total_ores > 0 -/decl/interaction_handler/empty/ore_box/invoked(obj/structure/ore_box/target, mob/user) - target.empty_box(user) \ No newline at end of file +/decl/interaction_handler/empty/ore_box/invoked(atom/target, mob/user, obj/item/prop) + var/obj/structure/ore_box/box = target + box.empty_box(user) diff --git a/code/modules/modular_computers/computers/modular_computer/interaction.dm b/code/modules/modular_computers/computers/modular_computer/interaction.dm index 1c50131c7d4..b219fec7dcf 100644 --- a/code/modules/modular_computers/computers/modular_computer/interaction.dm +++ b/code/modules/modular_computers/computers/modular_computer/interaction.dm @@ -168,8 +168,9 @@ /decl/interaction_handler/remove_pen/modular_computer/is_possible(obj/item/modular_computer/target, mob/user, obj/item/prop) return ..() && target.stores_pen && target.stored_pen -/decl/interaction_handler/remove_pen/modular_computer/invoked(obj/item/modular_computer/target, mob/user, obj/item/prop) - target.remove_pen() +/decl/interaction_handler/remove_pen/modular_computer/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/modular_computer/computer = target + computer.remove_pen() // // Emergency Shutdown @@ -187,8 +188,9 @@ var/datum/extension/assembly/modular_computer/assembly = get_extension(target, /datum/extension/assembly) return !isnull(assembly) && assembly.enabled -/decl/interaction_handler/emergency_shutdown/invoked(obj/item/modular_computer/target, mob/user, obj/item/prop) - target.emergency_shutdown() +/decl/interaction_handler/emergency_shutdown/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/modular_computer/computer = target + computer.emergency_shutdown() // // Remove Charge-stick diff --git a/code/modules/multiz/mobile_ladder.dm b/code/modules/multiz/mobile_ladder.dm index 2c385707af9..2eacd7a03ac 100644 --- a/code/modules/multiz/mobile_ladder.dm +++ b/code/modules/multiz/mobile_ladder.dm @@ -131,6 +131,6 @@ name = "Fold Ladder" expected_target_type = /obj/structure/ladder/mobile -/decl/interaction_handler/ladder_fold/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/ladder_fold/invoked(atom/target, mob/user, obj/item/prop) var/obj/structure/ladder/mobile/L L.fold(user) diff --git a/code/modules/paperwork/carbonpaper.dm b/code/modules/paperwork/carbonpaper.dm index ee2214e120c..72eb84cc491 100644 --- a/code/modules/paperwork/carbonpaper.dm +++ b/code/modules/paperwork/carbonpaper.dm @@ -57,5 +57,6 @@ name = "remove carbon-copy" expected_target_type = /obj/item/paper/carbon -/decl/interaction_handler/carbon_paper_remove/invoked(obj/item/paper/carbon/target, mob/user) - target.remove_copy(user) +/decl/interaction_handler/carbon_paper_remove/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/paper/carbon/paper = target + paper.remove_copy(user) diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index c8a617d5862..9227787900a 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -85,10 +85,6 @@ return ..() -/obj/item/clipboard/AltClick(mob/user) - if(stored_pen) - remove_pen(user) - /obj/item/clipboard/attack_self(mob/user) if(CanPhysicallyInteractWith(user, src)) interact(user) @@ -194,6 +190,27 @@ else close_browser(user, initial(name)) +/obj/item/clipboard/get_alt_interactions(mob/user) + . = ..() + if(stored_pen) + LAZYADD(., /decl/interaction_handler/clipboard_remove_pen) + +/decl/interaction_handler/clipboard_remove_pen + name = "Remove Pen" + expected_target_type = /obj/item/clipboard + +/decl/interaction_handler/clipboard_remove_pen/is_possible(atom/target, mob/user, obj/item/prop) + . = ..() + if(.) + var/obj/item/clipboard/clipboard = target + return !!clipboard.stored_pen + +/decl/interaction_handler/clipboard_remove_pen/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/clipboard/clipboard = target + if(clipboard.stored_pen) + clipboard.remove_pen(user) + +// Subtypes below. /obj/item/clipboard/ebony material = /decl/material/solid/organic/wood/ebony diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm index 93504c38d3f..317f2f48a88 100644 --- a/code/modules/paperwork/paper.dm +++ b/code/modules/paperwork/paper.dm @@ -619,7 +619,7 @@ var/global/datum/topic_state/default/paper_state/paper_topic_state = new abstract_type = /decl/interaction_handler/scroll expected_target_type = /obj/item/paper/scroll -/decl/interaction_handler/scroll/invoked(atom/target, mob/user) +/decl/interaction_handler/scroll/invoked(atom/target, mob/user, obj/item/prop) var/obj/item/paper/scroll/scroll = target // TODO: paper sound scroll.furled = !scroll.furled diff --git a/code/modules/paperwork/paper_bundle.dm b/code/modules/paperwork/paper_bundle.dm index ed92d76b0d8..49c5a2fbce1 100644 --- a/code/modules/paperwork/paper_bundle.dm +++ b/code/modules/paperwork/paper_bundle.dm @@ -516,8 +516,9 @@ name = "Rename Bundle" expected_target_type = /obj/item/paper_bundle -/decl/interaction_handler/rename/paper_bundle/invoked(obj/item/paper_bundle/target, mob/user) - target.rename() +/decl/interaction_handler/rename/paper_bundle/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/paper_bundle/bundle = target + bundle.rename() /////////////////////////////////////////////////////////////////////////// // Interaction Break @@ -526,9 +527,10 @@ name = "Unbundle" expected_target_type = /obj/item/paper_bundle -/decl/interaction_handler/unbundle/paper_bundle/invoked(obj/item/paper_bundle/target, mob/user) +/decl/interaction_handler/unbundle/paper_bundle/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/paper_bundle/bundle = target to_chat(user, SPAN_NOTICE("You loosen \the [target].")) - target.break_bundle(user) + bundle.break_bundle(user) #undef MAX_PHOTO_OVERLAYS #undef MAX_PAPER_UNDERLAYS diff --git a/code/modules/paperwork/paper_plane.dm b/code/modules/paperwork/paper_plane.dm index 265011dc8c3..a5b211bcd54 100644 --- a/code/modules/paperwork/paper_plane.dm +++ b/code/modules/paperwork/paper_plane.dm @@ -81,7 +81,7 @@ /decl/interaction_handler/make_paper_plane/is_possible(obj/item/paper/target, mob/user, obj/item/prop) return ..() && !target.is_crumpled -/decl/interaction_handler/make_paper_plane/invoked(obj/item/paper/target, mob/user) +/decl/interaction_handler/make_paper_plane/invoked(atom/target, mob/user, obj/item/prop) user.visible_message(SPAN_NOTICE("\The [user] folds \the [target] into a plane."), SPAN_NOTICE("You fold \the [target] into a plane.")) var/obj/item/paper_plane/PP = new user.try_unequip(target, PP) diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index 830e5295536..e526d22b499 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -161,7 +161,8 @@ /decl/interaction_handler/paper_bin_dump_contents/is_possible(var/obj/item/paper_bin/target, mob/user, obj/item/prop) return ..() && target.amount > 0 -/decl/interaction_handler/paper_bin_dump_contents/invoked(var/obj/item/paper_bin/bin, mob/user) +/decl/interaction_handler/paper_bin_dump_contents/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/paper_bin/bin = target to_chat(user, SPAN_NOTICE("You start emptying \the [bin]...")) if(do_after(user, 2 SECONDS) && !QDELETED(bin)) bin.dump_contents() diff --git a/code/modules/paperwork/papershredder.dm b/code/modules/paperwork/papershredder.dm index 2183e51c18b..1b349a050c5 100644 --- a/code/modules/paperwork/papershredder.dm +++ b/code/modules/paperwork/papershredder.dm @@ -197,8 +197,9 @@ /decl/interaction_handler/empty/paper_shredder/is_possible(obj/machinery/papershredder/target, mob/user, obj/item/prop) return ..() && !target.is_bin_empty() -/decl/interaction_handler/empty/paper_shredder/invoked(obj/machinery/papershredder/target, mob/user) - target.empty_bin(user) +/decl/interaction_handler/empty/paper_shredder/invoked(atom/target, mob/user, obj/item/prop) + var/obj/machinery/papershredder/shredder = target + shredder.empty_bin(user) ////////////////////////////////////////////////////////////////// // Shredded Paper diff --git a/code/modules/paperwork/photocopier.dm b/code/modules/paperwork/photocopier.dm index 01ffa0e2528..8120330ed10 100644 --- a/code/modules/paperwork/photocopier.dm +++ b/code/modules/paperwork/photocopier.dm @@ -272,10 +272,11 @@ /decl/interaction_handler/empty/photocopier_paper_bin/is_possible(obj/machinery/photocopier/target, mob/user, obj/item/prop) return (target.printer?.get_amount_paper() > 0) && ..() -/decl/interaction_handler/empty/photocopier_paper_bin/invoked(obj/machinery/photocopier/target, mob/user) - if(target.printer?.get_amount_paper() <= 0) +/decl/interaction_handler/empty/photocopier_paper_bin/invoked(atom/target, mob/user, obj/item/prop) + var/obj/machinery/photocopier/copier = target + if(copier.printer?.get_amount_paper() <= 0) return - var/obj/item/paper_bundle/B = target.printer?.remove_paper(user) + var/obj/item/paper_bundle/B = copier.printer?.remove_paper(user) if(B) user.put_in_hands(B) target.update_icon() @@ -291,5 +292,6 @@ /decl/interaction_handler/remove/photocopier_scanner_item/is_possible(obj/machinery/photocopier/target, mob/user, obj/item/prop) return target.scanner_item && ..() -/decl/interaction_handler/remove/photocopier_scanner_item/invoked(obj/machinery/photocopier/target, mob/user) - target.eject_item(user) +/decl/interaction_handler/remove/photocopier_scanner_item/invoked(atom/target, mob/user, obj/item/prop) + var/obj/machinery/photocopier/copier = target + copier.eject_item(user) diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index 5992e8ce9a1..b3dcfa7ade0 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -399,5 +399,6 @@ icon_state = "radial_eject" expected_target_type = /obj/item/camera -/decl/interaction_handler/camera_eject_film/invoked(var/obj/item/camera/target, mob/user) - return target.eject_film(user) +/decl/interaction_handler/camera_eject_film/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/camera/camera = target + camera.eject_film(user) diff --git a/code/modules/paperwork/printer.dm b/code/modules/paperwork/printer.dm index 0040dbdebcb..6365808ceaf 100644 --- a/code/modules/paperwork/printer.dm +++ b/code/modules/paperwork/printer.dm @@ -428,10 +428,11 @@ /decl/interaction_handler/empty/stock_parts_printer/is_possible(obj/item/stock_parts/printer/target, mob/user, obj/item/prop) return (target.get_amount_paper() > 0) && ..() -/decl/interaction_handler/empty/stock_parts_printer/invoked(obj/item/stock_parts/printer/target, mob/user) - if(target.get_amount_paper() <= 0) +/decl/interaction_handler/empty/stock_parts_printer/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/stock_parts/printer/printer = target + if(printer.get_amount_paper() <= 0) return - var/obj/item/paper_bundle/B = target.remove_paper(user) + var/obj/item/paper_bundle/B = printer.remove_paper(user) if(B) user.put_in_hands(B) target.update_icon() diff --git a/code/modules/projectiles/guns/projectile/revolver.dm b/code/modules/projectiles/guns/projectile/revolver.dm index f89750619e5..0f54520856d 100644 --- a/code/modules/projectiles/guns/projectile/revolver.dm +++ b/code/modules/projectiles/guns/projectile/revolver.dm @@ -75,6 +75,6 @@ name = "Spin Cylinder" expected_target_type = /obj/item/gun/projectile/revolver -/decl/interaction_handler/revolver_spin_cylinder/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/revolver_spin_cylinder/invoked(atom/target, mob/user, obj/item/prop) var/obj/item/gun/projectile/revolver/R = target R.spin_cylinder() diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index b93c6fe4e0d..5fe29c685d2 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -221,7 +221,7 @@ var/obj/item/chems/C = target return !!C.possible_transfer_amounts -/decl/interaction_handler/set_transfer/chems/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/set_transfer/chems/invoked(atom/target, mob/user, obj/item/prop) var/obj/item/chems/C = target C.set_amount_per_transfer_from_this() @@ -231,7 +231,7 @@ expected_target_type = /obj/item/chems interaction_flags = INTERACTION_NEEDS_INVENTORY | INTERACTION_NEEDS_PHYSICAL_INTERACTION -/decl/interaction_handler/empty/chems/invoked(obj/item/chems/target, mob/user) +/decl/interaction_handler/empty/chems/invoked(atom/target, mob/user, obj/item/prop) var/turf/T = get_turf(user) if(T) to_chat(user, SPAN_NOTICE("You empty \the [target] onto the floor.")) diff --git a/code/modules/reagents/reagent_containers/spray.dm b/code/modules/reagents/reagent_containers/spray.dm index 9fe221550de..2df686595f8 100644 --- a/code/modules/reagents/reagent_containers/spray.dm +++ b/code/modules/reagents/reagent_containers/spray.dm @@ -91,7 +91,7 @@ //If no safety, we just toggle the nozzle var/decl/interaction_handler/IH = GET_DECL(/decl/interaction_handler/next_spray_amount) if(IH.is_possible(src, user)) - IH.invoked(src, user, src) + IH.invoked(src, user, user.get_active_held_item()) return TRUE ///Whether the spray has a safety toggle @@ -125,12 +125,13 @@ if(.) return !isnull(target.possible_transfer_amounts) -/decl/interaction_handler/next_spray_amount/invoked(obj/item/chems/spray/target, mob/user) - if(!target.possible_transfer_amounts) +/decl/interaction_handler/next_spray_amount/invoked(atom/target, mob/user, obj/item/prop) + var/obj/item/chems/spray/spray = target + if(!spray.possible_transfer_amounts) return - target.amount_per_transfer_from_this = next_in_list(target.amount_per_transfer_from_this, cached_json_decode(target.possible_transfer_amounts)) - target.spray_particles = next_in_list(target.spray_particles, cached_json_decode(target.possible_particle_amounts)) - to_chat(user, SPAN_NOTICE("You adjusted the pressure nozzle. You'll now use [target.amount_per_transfer_from_this] units per spray.")) + spray.amount_per_transfer_from_this = next_in_list(spray.amount_per_transfer_from_this, cached_json_decode(spray.possible_transfer_amounts)) + spray.spray_particles = next_in_list(spray.spray_particles, cached_json_decode(spray.possible_particle_amounts)) + to_chat(user, SPAN_NOTICE("You adjusted the pressure nozzle. You'll now use [spray.amount_per_transfer_from_this] units per spray.")) //space cleaner /obj/item/chems/spray/cleaner diff --git a/code/modules/reagents/reagent_dispenser.dm b/code/modules/reagents/reagent_dispenser.dm index 2ffee62c2f1..2db1d8311d3 100644 --- a/code/modules/reagents/reagent_dispenser.dm +++ b/code/modules/reagents/reagent_dispenser.dm @@ -342,7 +342,7 @@ var/obj/structure/reagent_dispensers/R = target return !!R.possible_transfer_amounts -/decl/interaction_handler/set_transfer/reagent_dispenser/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/set_transfer/reagent_dispenser/invoked(atom/target, mob/user, obj/item/prop) var/obj/structure/reagent_dispensers/R = target R.set_amount_dispensed() @@ -351,7 +351,7 @@ name = "Toggle refilling cap" expected_target_type = /obj/structure/reagent_dispensers -/decl/interaction_handler/toggle_open/reagent_dispenser/invoked(var/obj/structure/reagent_dispensers/target, var/mob/user) +/decl/interaction_handler/toggle_open/reagent_dispenser/invoked(atom/target, mob/user, obj/item/prop) if(target.atom_flags & ATOM_FLAG_OPEN_CONTAINER) target.atom_flags &= ~ATOM_FLAG_OPEN_CONTAINER else diff --git a/code/modules/sealant_gun/sealant_injector.dm b/code/modules/sealant_gun/sealant_injector.dm index 7a04a9fd098..a3e89a44343 100644 --- a/code/modules/sealant_gun/sealant_injector.dm +++ b/code/modules/sealant_gun/sealant_injector.dm @@ -104,6 +104,6 @@ name = "Inject Sealant" expected_target_type = /obj/structure/sealant_injector -/decl/interaction_handler/sealant_try_inject/invoked(var/atom/target, var/mob/user) +/decl/interaction_handler/sealant_try_inject/invoked(atom/target, mob/user, obj/item/prop) var/obj/structure/sealant_injector/SI = target SI.try_inject(user)