From df014f9bc07c6a65cab1c41bffc4b2a023dfbf22 Mon Sep 17 00:00:00 2001 From: Fluffy <65877598+FluffyGhoster@users.noreply.github.com> Date: Thu, 26 Dec 2024 15:26:32 +0100 Subject: [PATCH] Mouse drop refactor (#20256) Refactored mousedrag procs, added signals, some safeguards, did some cleanups around, renamed them to make a little more sense. Mostly put in line with TG's code. Fast clicking and releasing with a drag, depending on the grace period and how fast it is done, can be counted as clicks, to aid in combat scenarios where you spamclick. --- aurorastation.dme | 3 + .../signals_atom/signals_atom_mouse.dm | 11 ++ .../signals/signals_mob/signals_mob_main.dm | 6 + code/__DEFINES/interaction_flags.dm | 10 ++ code/__HELPERS/screen_objs.dm | 115 +++++++++++++++++ code/_onclick/drag_drop.dm | 122 +++++++++++++++++- code/_onclick/hud/ability_screen_objects.dm | 10 +- code/_onclick/hud/movable_screen_objects.dm | 2 +- code/_onclick/hud/screen_objects.dm | 4 + code/_onclick/hud/spell_screen_objects.dm | 2 +- code/game/atom/_atom.dm | 2 + code/game/gamemodes/cult/structures/pylon.dm | 6 +- code/game/machinery/OpTable.dm | 8 +- code/game/machinery/Sleeper.dm | 4 +- code/game/machinery/body_scanner.dm | 6 +- code/game/machinery/cryo.dm | 6 +- code/game/machinery/cryopod.dm | 6 +- code/game/machinery/iv_drip.dm | 38 +++--- code/game/machinery/mecha_fabricator.dm | 4 +- code/game/machinery/pipe/pipe_dispenser.dm | 4 +- code/game/machinery/rechargestation.dm | 24 ++-- code/game/machinery/stasis_cage.dm | 9 +- code/game/machinery/suit_cycler.dm | 4 +- code/game/objects/buckling.dm | 6 +- code/game/objects/items.dm | 2 +- code/game/objects/items/airbubble.dm | 20 +-- code/game/objects/items/bodybag.dm | 6 +- code/game/objects/items/camping.dm | 16 +-- code/game/objects/items/defib.dm | 8 +- .../game/objects/items/devices/memorywiper.dm | 12 +- .../objects/items/devices/slide_projector.dm | 10 +- code/game/objects/items/glassjar.dm | 8 +- code/game/objects/items/science_sampler.dm | 6 +- code/game/objects/items/spirit_board.dm | 10 +- .../objects/items/weapons/chaplain_items.dm | 10 +- .../items/weapons/storage/laundry_basket.dm | 4 +- .../objects/items/weapons/storage/secure.dm | 4 +- .../objects/items/weapons/storage/storage.dm | 34 ++--- .../objects/items/weapons/surgery_tools.dm | 15 ++- code/game/objects/items/weapons/traps.dm | 28 ++-- code/game/objects/structures.dm | 6 +- code/game/objects/structures/bedsheet_bin.dm | 15 ++- .../structures/crates_lockers/closets.dm | 6 +- .../crates_lockers/closets/gimmick.dm | 2 +- .../crates_lockers/closets/secure/personal.dm | 2 +- .../crates_lockers/closets/statue.dm | 2 +- .../structures/crates_lockers/crates.dm | 6 +- .../objects/structures/fireaxe_cabinet.dm | 16 +-- code/game/objects/structures/janicart.dm | 4 +- code/game/objects/structures/morgue.dm | 4 +- .../structures/stool_bed_chair_nest/bed.dm | 22 ++-- .../structures/stool_bed_chair_nest/chairs.dm | 4 +- .../structures/stool_bed_chair_nest/stools.dm | 27 ++-- code/game/objects/structures/trash_pile.dm | 2 +- code/game/objects/structures/urban.dm | 4 +- code/modules/battlemonsters/items/core.dm | 15 ++- code/modules/battlemonsters/items/deck.dm | 8 +- code/modules/client/client_defines.dm | 4 + code/modules/client/client_procs.dm | 21 ++- code/modules/clothing/clothing_accessories.dm | 30 ++--- code/modules/clothing/head/helmet.dm | 6 +- .../spacesuits/rig/modules/storage.dm | 4 +- code/modules/clothing/suits/armor.dm | 8 +- code/modules/clothing/suits/storage.dm | 6 +- .../clothing/under/accessories/storage.dm | 6 +- .../machinery/cooking_machines/container.dm | 10 +- code/modules/cooking/machinery/gibber.dm | 4 +- code/modules/customitems/item_defines.dm | 27 ++-- .../detectivework/microscope/microscope.dm | 6 +- .../detectivework/tools/evidencebag.dm | 32 ++--- .../detectivework/tools/sample_kits.dm | 4 +- code/modules/games/cards.dm | 19 +-- code/modules/heavy_vehicle/components/body.dm | 4 +- .../heavy_vehicle/interface/screen_objects.dm | 5 +- .../modules/heavy_vehicle/mech_interaction.dm | 14 +- .../mob/abstract/ghost/observer/observer.dm | 11 +- .../carbon/alien/diona/diona_attacks.dm | 4 +- code/modules/mob/living/carbon/human/human.dm | 8 +- .../living/carbon/slime/slime_extractor.dm | 6 +- code/modules/mob/living/silicon/pai/pai.dm | 10 +- .../silicon/robot/drone/drone_abilities.dm | 4 +- .../mob/living/simple_animal/simple_animal.dm | 6 +- code/modules/mob/mob.dm | 19 ++- code/modules/mob/mob_grab.dm | 3 +- .../computers/modular_computer/interaction.dm | 10 +- .../computers/subtypes/dev_wristbound.dm | 30 ++--- code/modules/multiz/hoist.dm | 19 +-- code/modules/paperwork/clipboard.dm | 12 +- code/modules/paperwork/paperbin.dm | 16 +-- code/modules/paperwork/photography.dm | 20 +-- code/modules/paperwork/typewriter.dm | 15 ++- .../fusion/fuel_assembly/fuel_compressor.dm | 4 +- code/modules/projectiles/guns/energy.dm | 2 +- code/modules/reagents/Chemistry-Machinery.dm | 4 +- code/modules/reagents/reagent_containers.dm | 2 +- .../reagents/reagent_containers/blood_pack.dm | 14 +- .../reagent_containers/food/drinks/yoke.dm | 9 +- .../food/snacks/cultural/human.dm | 10 +- .../reagent_containers/food/snacks/mexican.dm | 10 +- code/modules/recycling/disposal.dm | 8 +- .../tools/anomaly_container.dm | 2 +- code/modules/tables/interactions.dm | 16 +-- code/modules/vehicles/animal.dm | 22 ++-- code/modules/vehicles/bike.dm | 10 +- code/modules/vehicles/droppod.dm | 4 +- code/modules/vehicles/train.dm | 10 +- code/modules/vehicles/unicycle.dm | 6 +- .../fluffyghost_updatemousedrag.yml | 59 +++++++++ 108 files changed, 860 insertions(+), 485 deletions(-) create mode 100644 code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm create mode 100644 code/__DEFINES/interaction_flags.dm create mode 100644 code/__HELPERS/screen_objs.dm create mode 100644 html/changelogs/fluffyghost_updatemousedrag.yml diff --git a/aurorastation.dme b/aurorastation.dme index edd440f49f9..0a3735b9ec5 100644 --- a/aurorastation.dme +++ b/aurorastation.dme @@ -76,6 +76,7 @@ #include "code\__DEFINES\icon_layering.dm" #include "code\__DEFINES\icon_smoothing.dm" #include "code\__DEFINES\important_recursive_contents.dm" +#include "code\__DEFINES\interaction_flags.dm" #include "code\__DEFINES\inventory.dm" #include "code\__DEFINES\is_helpers.dm" #include "code\__DEFINES\items_clothing.dm" @@ -173,6 +174,7 @@ #include "code\__DEFINES\dcs\signals\signals_weather.dm" #include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_attack.dm" #include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_main.dm" +#include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_mouse.dm" #include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_movable.dm" #include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_movement.dm" #include "code\__DEFINES\dcs\signals\signals_atom\signals_atom_x_act.dm" @@ -210,6 +212,7 @@ #include "code\__HELPERS\qdel.dm" #include "code\__HELPERS\ref.dm" #include "code\__HELPERS\sanitize_values.dm" +#include "code\__HELPERS\screen_objs.dm" #include "code\__HELPERS\shell.dm" #include "code\__HELPERS\smart_token_bucket.dm" #include "code\__HELPERS\spatial_info.dm" diff --git a/code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm new file mode 100644 index 00000000000..267af1377e5 --- /dev/null +++ b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_mouse.dm @@ -0,0 +1,11 @@ +// mouse signals. Format: +// When the signal is called: (signal arguments) +// All signals send the source datum of the signal as the first argument + + +///from base of atom/MouseDrop(): (/atom/over, /mob/user) +#define COMSIG_MOUSEDROP_ONTO "mousedrop_onto" + #define COMPONENT_CANCEL_MOUSEDROP_ONTO (1<<0) +///from base of atom/handle_mouse_drop_receive: (/atom/from, /mob/user) +#define COMSIG_MOUSEDROPPED_ONTO "mousedropped_onto" + #define COMPONENT_CANCEL_MOUSEDROPPED_ONTO (1<<0) 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 06f96a6157b..bc24ffed6d0 100644 --- a/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm +++ b/code/__DEFINES/dcs/signals/signals_mob/signals_mob_main.dm @@ -12,6 +12,12 @@ /// The arugment of move_args which dictates our movement direction #define MOVE_ARG_DIRECTION 2 +//from base of client/MouseDown(): (/client, object, location, control, params) +#define COMSIG_CLIENT_MOUSEDOWN "client_mousedown" +//from base of client/MouseUp(): (/client, object, location, control, params) +#define COMSIG_CLIENT_MOUSEUP "client_mouseup" + #define COMPONENT_CLIENT_MOUSEUP_INTERCEPT (1<<0) + ///from base of /obj/item/attack(): (mob/M, mob/user) #define COMSIG_MOB_ITEM_ATTACK "mob_item_attack" diff --git a/code/__DEFINES/interaction_flags.dm b/code/__DEFINES/interaction_flags.dm new file mode 100644 index 00000000000..77cc5e0a394 --- /dev/null +++ b/code/__DEFINES/interaction_flags.dm @@ -0,0 +1,10 @@ +/* + AURORA NOTE: INTERACT_ATOM_MOUSEDROP_IGNORE_USABILITY is not implemented at the moment, it's kept only to keep the INTERACT_ATOM_MOUSEDROP_IGNORE_CHECKS the same +*/ + +/// Bypass all adjacency checks for mouse drop +#define INTERACT_ATOM_MOUSEDROP_IGNORE_ADJACENT (1<<11) +/// Bypass all can_perform_action checks for mouse drop +#define INTERACT_ATOM_MOUSEDROP_IGNORE_USABILITY (1<<12) +/// Bypass all adjacency and other checks for mouse drop +#define INTERACT_ATOM_MOUSEDROP_IGNORE_CHECKS (INTERACT_ATOM_MOUSEDROP_IGNORE_ADJACENT | INTERACT_ATOM_MOUSEDROP_IGNORE_USABILITY) diff --git a/code/__HELPERS/screen_objs.dm b/code/__HELPERS/screen_objs.dm new file mode 100644 index 00000000000..00f6bd41570 --- /dev/null +++ b/code/__HELPERS/screen_objs.dm @@ -0,0 +1,115 @@ +/// Takes a screen loc string in the format +/// "+-left-offset:+-pixel,+-bottom-offset:+-pixel" +/// Where the :pixel is optional, and returns +/// A list in the format (x_offset, y_offset) +/// We require context to get info out of screen locs that contain relative info, so NORTH, SOUTH, etc +/proc/screen_loc_to_offset(screen_loc, view) + if(!screen_loc) + return list(64, 64) + var/list/view_size = view_to_pixels(view) + var/x = 0 + var/y = 0 + // Time to parse for directional relative offsets + if(findtext(screen_loc, "EAST")) // If you're starting from the east, we start from the east too + x += view_size[1] + if(findtext(screen_loc, "WEST")) // HHHHHHHHHHHHHHHHHHHHHH WEST is technically a 1 tile offset from the start. Shoot me please + x += ICON_SIZE_X + if(findtext(screen_loc, "NORTH")) + y += view_size[2] + if(findtext(screen_loc, "SOUTH")) + y += ICON_SIZE_Y + + var/list/x_and_y = splittext(screen_loc, ",") + + var/list/x_pack = splittext(x_and_y[1], ":") + var/list/y_pack = splittext(x_and_y[2], ":") + + var/x_coord = x_pack[1] + var/y_coord = y_pack[1] + + if (findtext(x_coord, "CENTER")) + x += view_size[1] / 2 + + if (findtext(y_coord, "CENTER")) + y += view_size[2] / 2 + + x_coord = text2num(cut_relative_direction(x_coord)) + y_coord = text2num(cut_relative_direction(y_coord)) + + x += x_coord * ICON_SIZE_X + y += y_coord * ICON_SIZE_Y + + if(length(x_pack) > 1) + x += text2num(x_pack[2]) + if(length(y_pack) > 1) + y += text2num(y_pack[2]) + return list(x, y) + +/// Takes a list in the form (x_offset, y_offset) +/// And converts it to a screen loc string +/// Accepts an optional view string/size to force the screen_loc around, so it can't go out of scope +/proc/offset_to_screen_loc(x_offset, y_offset, view = null) + if(view) + var/list/view_bounds = view_to_pixels(view) + x_offset = clamp(x_offset, ICON_SIZE_X, view_bounds[1]) + y_offset = clamp(y_offset, ICON_SIZE_Y, view_bounds[2]) + + // Round with no argument is floor, so we get the non pixel offset here + var/x = round(x_offset / ICON_SIZE_X) + var/pixel_x = x_offset % ICON_SIZE_X + var/y = round(y_offset / ICON_SIZE_Y) + var/pixel_y = y_offset % ICON_SIZE_Y + + var/list/generated_loc = list() + generated_loc += "[x]" + if(pixel_x) + generated_loc += ":[pixel_x]" + generated_loc += ",[y]" + if(pixel_y) + generated_loc += ":[pixel_y]" + return jointext(generated_loc, "") + +/** + * Returns a valid location to place a screen object without overflowing the viewport + * + * * target: The target location as a purely number based screen_loc string "+-left-offset:+-pixel,+-bottom-offset:+-pixel" + * * target_offset: The amount we want to offset the target location by. We explictly don't care about direction here, we will try all 4 + * * view: The view variable of the client we're doing this for. We use this to get the size of the screen + * + * Returns a screen loc representing the valid location +**/ +/proc/get_valid_screen_location(target_loc, target_offset, view) + var/list/offsets = screen_loc_to_offset(target_loc) + var/base_x = offsets[1] + var/base_y = offsets[2] + + var/list/view_size = view_to_pixels(view) + + // Bias to the right, down, left, and then finally up + if(base_x + target_offset < view_size[1]) + return offset_to_screen_loc(base_x + target_offset, base_y, view) + if(base_y - target_offset > ICON_SIZE_Y) + return offset_to_screen_loc(base_x, base_y - target_offset, view) + if(base_x - target_offset > ICON_SIZE_X) + return offset_to_screen_loc(base_x - target_offset, base_y, view) + if(base_y + target_offset < view_size[2]) + return offset_to_screen_loc(base_x, base_y + target_offset, view) + stack_trace("You passed in a scren location {[target_loc]} and offset {[target_offset]} that can't be fit in the viewport Width {[view_size[1]]}, Height {[view_size[2]]}. what did you do lad") + return null // The fuck did you do lad + +/// Takes a screen_loc string and cut out any directions like NORTH or SOUTH +/proc/cut_relative_direction(fragment) + var/static/regex/regex = regex(@"([A-Z])\w+", "g") + return regex.Replace(fragment, "") + +/// Returns a screen_loc format for a tiling screen objects from start and end positions. Start should be bottom left corner, and end top right corner. +/proc/spanning_screen_loc(start_px, start_py, end_px, end_py) + var/starting_tile_x = round(start_px / ICON_SIZE_X) + start_px -= starting_tile_x * ICON_SIZE_X + var/starting_tile_y = round(start_py/ ICON_SIZE_Y) + start_py -= starting_tile_y * ICON_SIZE_Y + var/ending_tile_x = round(end_px / ICON_SIZE_X) + end_px -= ending_tile_x * ICON_SIZE_X + var/ending_tile_y = round(end_py / ICON_SIZE_Y) + end_py -= ending_tile_y * ICON_SIZE_Y + return "[starting_tile_x]:[start_px],[starting_tile_y]:[start_py] to [ending_tile_x]:[end_px],[ending_tile_y]:[end_py]" diff --git a/code/_onclick/drag_drop.dm b/code/_onclick/drag_drop.dm index c33cdbe9bbf..bfeed0000f6 100644 --- a/code/_onclick/drag_drop.dm +++ b/code/_onclick/drag_drop.dm @@ -2,17 +2,127 @@ MouseDrop: Called on the atom you're dragging. In a lot of circumstances we want to use the - recieving object instead, so that's the default action. This allows you to drag + receiving object instead, so that's the default action. This allows you to drag almost anything into a trash can. */ /atom/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params) + SHOULD_NOT_OVERRIDE(TRUE) + if(!usr || !over) return - if(!Adjacent(usr) || !over.Adjacent(usr)) - return // should stop you from dragging through windows - over.MouseDrop_T(src, usr, params) + var/proximity_check = usr.client.check_drag_proximity(src, over, src_location, over_location, src_control, over_control, params) + if(proximity_check) + return proximity_check + + base_mouse_drop_handler(over, src_location, over_location, params) + +/** + * Called when all sanity checks for mouse dropping have passed. Handles adjacency & other sanity checks before delegating the event + * down to lower level handlers. Do not override unless you are trying to create hud & screen elements which do not require proximity + * or other checks + */ +/atom/proc/base_mouse_drop_handler(atom/over, src_location, over_location, params) + PROTECTED_PROC(TRUE) + SHOULD_NOT_OVERRIDE(TRUE) + + var/mob/user = usr + + if(SEND_SIGNAL(src, COMSIG_MOUSEDROP_ONTO, over, user) & COMPONENT_CANCEL_MOUSEDROP_ONTO) + return + + if(SEND_SIGNAL(over, COMSIG_MOUSEDROPPED_ONTO, src, user, params) & COMPONENT_CANCEL_MOUSEDROPPED_ONTO) + return + + // only if both dragged object & receiver agree to do checks do we proceed + var/combined_atom_flags = interaction_flags_atom | over.interaction_flags_atom + if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_CHECKS)) + //Check for adjacency + // In TG it's `if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_ADJACENT) && (!CanReach(user) || !over.CanReach(user)))` but i'm not recreating those procs now + if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_ADJACENT) && (!Adjacent(user) || !over.Adjacent(user))) + return // should stop you from dragging through windows + + // NOT IMPLEMENTED IN AURORA + // if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_USABILITY)) + // //Bypass adjacency cause we already checked for it above + // if(!user.can_perform_action(src, interaction_flags_mouse_drop | over.interaction_flags_mouse_drop | BYPASS_ADJACENCY)) + // return // is the mob not able to drag the object with both sides conditions applied + + mouse_drop_dragged(over, user, src_location, over_location, params) + + over.mouse_drop_receive(src, user, params) + +/// The proc that should be overridden by subtypes to handle mouse drop. Called on the atom being dragged +/atom/proc/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + PROTECTED_PROC(TRUE) -///Receive a mousedrop -/atom/proc/MouseDrop_T(atom/dropping, mob/user, params) return + +/// The proc that should be overridden by subtypes to handle mouse drop. Called on the atom receiving a dragged object +/atom/proc/mouse_drop_receive(atom/dropped, mob/user, params) + PROTECTED_PROC(TRUE) + + return + +/// Handles treating drags as clicks if they're within some conditions +/// Does some other stuff adjacent to trying to figure out what the user actually "wanted" to click +/// Returns TRUE if it caused a click, FALSE otherwise +/client/proc/check_drag_proximity(atom/dragging, atom/over, src_location, over_location, src_control, over_control, params) + // We will swap which thing we're trying to check for clickability based off the type + // Assertion is if you drag a turf to anything else, you really just wanted to click the anything else + // And slightly misseed. I'm not interested in making this game pixel percise, so if it fits our other requirements + // Lets just let that through yeah? + var/atom/attempt_click = dragging + var/atom/click_from = over + var/location_to_use = src_location + var/control_to_use = src_control + if(isturf(attempt_click) && !isturf(over)) + // swapppp + attempt_click = over + click_from = dragging + location_to_use = over_location + control_to_use = over_control + + if(is_drag_clickable(attempt_click, click_from, params)) + Click(attempt_click, location_to_use, control_to_use, params) + return TRUE + return FALSE + +/// Distance in pixels that we consider "acceptable" from the initial click to the release +/// Note: this does not account for the position of the object, just where it is on the screen +#define LENIENCY_DISTANCE 16 +/// Accepted time in seconds between the initial click and drag release +/// Go higher then this and we just don't care anymore +#define LENIENCY_TIME (0.1 SECONDS) + +/// Does the logic for checking if a drag counts as a click or not +/// Returns true if it does, false otherwise +/client/proc/is_drag_clickable(atom/dragging, atom/over, params) + if(dragging == over) + return TRUE + if(world.time - drag_start > LENIENCY_TIME) // Time's up bestie + return FALSE + if(!get_turf(dragging)) // If it isn't in the world, drop it. This is for things that can move, and we assume hud elements will not have this problem + return FALSE + // Basically, are you trying to buckle someone down, or drag them onto you? + // If so, we know you must be right about what you want + if(ismovable(over)) + var/atom/movable/over_movable = over + // The buckle bit will cover most mobs, for stupid reasons. still useful here tho + if(over_movable.can_be_buckled || over_movable == eye) + return FALSE + + var/list/modifiers = params2list(params) + var/list/old_offsets = screen_loc_to_offset(LAZYACCESS(drag_details, SCREEN_LOC), view) + var/list/new_offsets = screen_loc_to_offset(LAZYACCESS(modifiers, SCREEN_LOC), view) + + var/distance = sqrt(((old_offsets[1] - new_offsets[1]) ** 2) + ((old_offsets[2] - new_offsets[2]) ** 2)) + if(distance > LENIENCY_DISTANCE) + return FALSE + + return TRUE + + +/* + MOUSE UP AND MOUSE DOWN AREN'T HERE BUT IN code\modules\client\client_procs.dm +*/ diff --git a/code/_onclick/hud/ability_screen_objects.dm b/code/_onclick/hud/ability_screen_objects.dm index e55deb79ff0..03715dfb34b 100644 --- a/code/_onclick/hud/ability_screen_objects.dm +++ b/code/_onclick/hud/ability_screen_objects.dm @@ -32,7 +32,7 @@ . = ..() -/atom/movable/screen/movable/ability_master/MouseDrop() +/atom/movable/screen/movable/ability_master/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if(showing) return @@ -189,11 +189,11 @@ activate() -/atom/movable/screen/ability/MouseDrop(var/atom/A) - if(!A || A == src) +/atom/movable/screen/ability/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(!over || over == src) return - if(istype(A, /atom/movable/screen/ability)) - var/atom/movable/screen/ability/ability = A + if(istype(over, /atom/movable/screen/ability)) + var/atom/movable/screen/ability/ability = over if(ability.ability_master && ability.ability_master == src.ability_master) ability_master.ability_objects.Swap(src.index, ability.index) ability_master.toggle_open(2) // To update the UI. diff --git a/code/_onclick/hud/movable_screen_objects.dm b/code/_onclick/hud/movable_screen_objects.dm index ef0e401edf1..f64267d8303 100644 --- a/code/_onclick/hud/movable_screen_objects.dm +++ b/code/_onclick/hud/movable_screen_objects.dm @@ -19,7 +19,7 @@ snap2grid = TRUE -/atom/movable/screen/movable/MouseDrop(over_object, src_location, over_location, src_control, over_control, params) +/atom/movable/screen/movable/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) var/list/PM = params2list(params) //No screen-loc information? abort. diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index e79cd0da271..2a4e9390889 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -27,6 +27,10 @@ hud = null . = ..() +///Screen elements are always on top of the players screen and don't move so yes they are adjacent +/atom/movable/screen/Adjacent(atom/neighbor, atom/target, atom/movable/mover) + return TRUE + /** * Handles the deletion of the HUD this screen is associated to */ diff --git a/code/_onclick/hud/spell_screen_objects.dm b/code/_onclick/hud/spell_screen_objects.dm index 14707e7cd47..4dc17f170ad 100644 --- a/code/_onclick/hud/spell_screen_objects.dm +++ b/code/_onclick/hud/spell_screen_objects.dm @@ -24,7 +24,7 @@ . = ..() -/atom/movable/screen/movable/spell_master/MouseDrop() +/atom/movable/screen/movable/spell_master/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if(showing) return diff --git a/code/game/atom/_atom.dm b/code/game/atom/_atom.dm index c30006cc799..c9e4dae3435 100644 --- a/code/game/atom/_atom.dm +++ b/code/game/atom/_atom.dm @@ -12,6 +12,8 @@ ///First atom flags var var/flags_1 = NONE + ///Intearaction flags + var/interaction_flags_atom = NONE var/flags_ricochet = NONE diff --git a/code/game/gamemodes/cult/structures/pylon.dm b/code/game/gamemodes/cult/structures/pylon.dm index 8d30aac1ebc..1243ec79783 100644 --- a/code/game/gamemodes/cult/structures/pylon.dm +++ b/code/game/gamemodes/cult/structures/pylon.dm @@ -391,9 +391,9 @@ attackpylon(user, attacking_item.force, attacking_item) //Mousedrop so that constructs can drag rats out of maintenance to make turrets -/obj/structure/cult/pylon/MouseDrop_T(atom/dropping, mob/user) - if(istype(dropping, /mob/living)) - present_sacrifice(user, dropping) +/obj/structure/cult/pylon/mouse_drop_receive(atom/dropped, mob/user, params) + if(istype(dropped, /mob/living)) + present_sacrifice(user, dropped) return return ..() diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index b42d69a3bb0..c94689230bc 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -260,11 +260,11 @@ return TRUE -/obj/machinery/optable/MouseDrop_T(atom/dropping, mob/user) - if(istype(dropping, /obj/item)) - user.drop_from_inventory(dropping, get_turf(src)) +/obj/machinery/optable/mouse_drop_receive(atom/dropped, mob/user, params) + if(istype(dropped, /obj/item)) + user.drop_from_inventory(dropped, get_turf(src)) - var/mob/living/carbon/patient = dropping + var/mob/living/carbon/patient = dropped //No point if it's not a possible patient if(!istype(patient)) return diff --git a/code/game/machinery/Sleeper.dm b/code/game/machinery/Sleeper.dm index 000bc0ae13d..d9db5bd813a 100644 --- a/code/game/machinery/Sleeper.dm +++ b/code/game/machinery/Sleeper.dm @@ -277,8 +277,8 @@ else if(default_part_replacement(user, attacking_item)) return TRUE -/obj/machinery/sleeper/MouseDrop_T(atom/dropping, mob/user) - var/mob/target = dropping +/obj/machinery/sleeper/mouse_drop_receive(atom/dropped, mob/user, params) + var/mob/target = dropped if(!istype(target)) return diff --git a/code/game/machinery/body_scanner.dm b/code/game/machinery/body_scanner.dm index 27987b30a27..da9a7da187b 100644 --- a/code/game/machinery/body_scanner.dm +++ b/code/game/machinery/body_scanner.dm @@ -168,18 +168,18 @@ qdel(G) return TRUE -/obj/machinery/bodyscanner/MouseDrop_T(atom/dropping, mob/user) +/obj/machinery/bodyscanner/mouse_drop_receive(atom/dropped, mob/user, params) if(!istype(user)) return - if(!ismob(dropping)) + if(!ismob(dropped)) return if (occupant) to_chat(user, SPAN_NOTICE("The scanner is already occupied!")) return - var/mob/living/L = dropping + var/mob/living/L = dropped var/bucklestatus = L.bucklecheck(user) if (!bucklestatus) return diff --git a/code/game/machinery/cryo.dm b/code/game/machinery/cryo.dm index 3d887db2976..04eecdd6d9b 100644 --- a/code/game/machinery/cryo.dm +++ b/code/game/machinery/cryo.dm @@ -277,12 +277,12 @@ return TRUE -/obj/machinery/atmospherics/unary/cryo_cell/MouseDrop_T(atom/dropping, mob/user) +/obj/machinery/atmospherics/unary/cryo_cell/mouse_drop_receive(atom/dropped, mob/user, params) if(!istype(user)) return - if(!ismob(dropping)) + if(!ismob(dropped)) return - var/mob/living/L = dropping + var/mob/living/L = dropped for(var/mob/living/carbon/slime/M in range(1,L)) if(M.victim == L) to_chat(usr, SPAN_WARNING("[L.name] will not fit into the cryo because they have a slime latched onto their head.")) diff --git a/code/game/machinery/cryopod.dm b/code/game/machinery/cryopod.dm index 3f0240a81ee..c23aaa0e065 100644 --- a/code/game/machinery/cryopod.dm +++ b/code/game/machinery/cryopod.dm @@ -408,14 +408,14 @@ go_in(user, M) return TRUE -/obj/machinery/cryopod/MouseDrop_T(atom/dropping, mob/user) +/obj/machinery/cryopod/mouse_drop_receive(atom/dropped, mob/user, params) if(!istype(user, /mob/living)) return - if(!check_occupant_allowed(dropping)) + if(!check_occupant_allowed(dropped)) return - var/mob/living/M = dropping + var/mob/living/M = dropped if(istype(M)) go_in(user, M) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 6de638fb38a..58e91c9c29f 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -276,31 +276,31 @@ if(attached.take_blood(beaker, amount)) update_icon() -/obj/machinery/iv_drip/MouseDrop(over_object, src_location, over_location) +/obj/machinery/iv_drip/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) ..() - if(use_check_and_message(usr)) + if(use_check_and_message(user)) return - if(isDrone(usr)) + if(isDrone(user)) return - if(in_range(src, usr) && ishuman(over_object) && in_range(over_object, src)) + if(in_range(src, user) && ishuman(over) && in_range(over, src)) var/list/options = list( "IV drip" = image('icons/mob/screen/radial.dmi', "iv_drip"), "Breath mask" = image('icons/mob/screen/radial.dmi', "iv_mask")) - var/chosen_action = show_radial_menu(usr, src, options, require_near = TRUE, radius = 42, tooltips = TRUE) + var/chosen_action = show_radial_menu(user, src, options, require_near = TRUE, radius = 42, tooltips = TRUE) if(!chosen_action) return switch(chosen_action) if("IV drip") if(attached) - visible_message("[usr] detaches \the [src] from [attached]'s [vein.name].") + visible_message("[user] detaches \the [src] from [attached]'s [vein.name].") vein = null attached = null blood_message_sent = FALSE update_icon() return - attached = over_object - vein = attached.get_organ(usr.zone_sel.selecting) - var/checking = attached.can_inject(usr, TRUE, usr.zone_sel.selecting, armor_check) + attached = over + vein = attached.get_organ(user.zone_sel.selecting) + var/checking = attached.can_inject(user, TRUE, user.zone_sel.selecting, armor_check) if(!checking) attached = null vein = null @@ -308,42 +308,42 @@ if(armor_check) var/attach_time = attach_delay attach_time *= checking - if(!do_mob(usr, attached, attach_time)) - to_chat(usr, SPAN_DANGER("Failed to insert \the [src]. You and [attached] must stay still!")) + if(!do_mob(user, attached, attach_time)) + to_chat(user, SPAN_DANGER("Failed to insert \the [src]. You and [attached] must stay still!")) attached = null vein = null return - visible_message("[usr][armor_check ? "" : " swiftly"] inserts \the [src] in \the [attached]'s [vein.name].") + visible_message("[user][armor_check ? "" : " swiftly"] inserts \the [src] in \the [attached]'s [vein.name].") update_icon() return if("Breath mask") if(!breath_mask) - to_chat(usr, SPAN_NOTICE("There is no breath mask installed into \the [src]!")) + to_chat(user, SPAN_NOTICE("There is no breath mask installed into \the [src]!")) return if(breather) visible_message("[usr] removes [breather]'s mask.[valve_open ? " \The [tank]'s valve automatically closes." : ""]") breath_mask_rip() return - breather = over_object + breather = over if(!breather.organs_by_name[BP_HEAD]) - to_chat(usr, SPAN_WARNING("\The [breather] doesn't have a head!")) + to_chat(user, SPAN_WARNING("\The [breather] doesn't have a head!")) breather = null return if(!breather.check_has_mouth()) - to_chat(usr, SPAN_WARNING("\The [breather] doesn't have a mouth!")) + to_chat(user, SPAN_WARNING("\The [breather] doesn't have a mouth!")) breather = null return if(breather.head && (breather.head.body_parts_covered & FACE)) - to_chat(usr, SPAN_WARNING("You must remove \the [breather]'s [breather.head] first!")) + to_chat(user, SPAN_WARNING("You must remove \the [breather]'s [breather.head] first!")) breather = null return if(breather.wear_mask) - to_chat(usr, SPAN_WARNING("You must remove \the [breather]'s [breather.wear_mask] first!")) + to_chat(user, SPAN_WARNING("You must remove \the [breather]'s [breather.wear_mask] first!")) breather = null return if(tank) tank_on() - visible_message("[usr] secures the mask over \the [breather]'s face.") + visible_message("[user] secures the mask over \the [breather]'s face.") playsound(breather, 'sound/effects/buckle.ogg', 50, extrarange = SILENCED_SOUND_EXTRARANGE) breath_mask.forceMove(breather.loc) breather.equip_to_slot(breath_mask, slot_wear_mask) diff --git a/code/game/machinery/mecha_fabricator.dm b/code/game/machinery/mecha_fabricator.dm index 89266ab8725..7d35db07003 100644 --- a/code/game/machinery/mecha_fabricator.dm +++ b/code/game/machinery/mecha_fabricator.dm @@ -202,8 +202,8 @@ to_chat(user, SPAN_NOTICE("\The [src] cannot hold more [sname].")) return TRUE -/obj/machinery/mecha_part_fabricator/MouseDrop_T(atom/dropping, mob/user) - var/mob/living/carbon/human/target = dropping +/obj/machinery/mecha_part_fabricator/mouse_drop_receive(atom/dropped, mob/user, params) + var/mob/living/carbon/human/target = dropped if (!istype(target) || target.buckled_to || get_dist(user, src) > 1 || get_dist(user, target) > 1 || user.stat || istype(user, /mob/living/silicon/ai)) return if(target == user) diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm index bfffc8a63e4..bc42470c8f0 100644 --- a/code/game/machinery/pipe/pipe_dispenser.dm +++ b/code/game/machinery/pipe/pipe_dispenser.dm @@ -152,8 +152,8 @@ window_id = "disposaldispenser" //Allow you to drag-drop disposal pipes into it -/obj/machinery/pipedispenser/disposal/MouseDrop_T(atom/dropping, mob/user) - var/obj/structure/disposalconstruct/pipe = dropping +/obj/machinery/pipedispenser/disposal/mouse_drop_receive(atom/dropped, mob/user, params) + var/obj/structure/disposalconstruct/pipe = dropped if(!istype(pipe) || pipe.anchored || use_check_and_message(user)) return diff --git a/code/game/machinery/rechargestation.dm b/code/game/machinery/rechargestation.dm index 33286dd1303..1ff3dc26cd6 100644 --- a/code/game/machinery/rechargestation.dm +++ b/code/game/machinery/rechargestation.dm @@ -299,30 +299,30 @@ to_chat(usr, SPAN_DANGER("Cancelled loading [R] into the charger. You and [R] must stay still!")) return -/obj/machinery/recharge_station/MouseDrop_T(atom/dropping, mob/user) - if (istype(dropping, /mob/living/silicon/robot)) - var/mob/living/silicon/robot/R = dropping +/obj/machinery/recharge_station/mouse_drop_receive(atom/dropped, mob/user, params) + if (istype(dropped, /mob/living/silicon/robot)) + var/mob/living/silicon/robot/R = dropped if (!user.Adjacent(R) || !Adjacent(user)) - to_chat(user, SPAN_DANGER("You need to get closer if you want to put [dropping] into that charger!")) + to_chat(user, SPAN_DANGER("You need to get closer if you want to put [dropped] into that charger!")) return user.face_atom(src) - user.visible_message(SPAN_DANGER("[user] starts hauling [dropping] into the recharging unit!"), - SPAN_DANGER("You start hauling and pushing [dropping] into the recharger. This might take a while..."), "You hear heaving and straining") + user.visible_message(SPAN_DANGER("[user] starts hauling [dropped] into the recharging unit!"), + SPAN_DANGER("You start hauling and pushing [dropped] into the recharger. This might take a while..."), "You hear heaving and straining") if (do_mob(user, R, R.mob_size*10, needhand = 1)) if (go_in(R)) - user.visible_message(SPAN_NOTICE("After a great effort, [user] manages to get [dropping] into the recharging unit!")) + user.visible_message(SPAN_NOTICE("After a great effort, [user] manages to get [dropped] into the recharging unit!")) return 1 else - to_chat(user, SPAN_DANGER("Failed loading [dropping] into the charger. Please ensure that [dropping] has a power cell and is not buckled down, and that the charger is functioning.")) + to_chat(user, SPAN_DANGER("Failed loading [dropped] into the charger. Please ensure that [dropped] has a power cell and is not buckled down, and that the charger is functioning.")) else - to_chat(user, SPAN_DANGER("Cancelled loading [dropping] into the charger. You and [dropping] must stay still!")) + to_chat(user, SPAN_DANGER("Cancelled loading [dropped] into the charger. You and [dropped] must stay still!")) return - else if(isipc(dropping)) // IPCs don't take as long - var/mob/living/carbon/human/machine/R = dropping + else if(isipc(dropped)) // IPCs don't take as long + var/mob/living/carbon/human/machine/R = dropped if(!user.Adjacent(R) || !Adjacent(user)) - to_chat(user, SPAN_DANGER("You need to get closer if you want to put [dropping] into that charger!")) + to_chat(user, SPAN_DANGER("You need to get closer if you want to put [dropped] into that charger!")) return var/bucklestatus = R.bucklecheck(user) diff --git a/code/game/machinery/stasis_cage.dm b/code/game/machinery/stasis_cage.dm index 0db1961ab31..6566432ff7a 100644 --- a/code/game/machinery/stasis_cage.dm +++ b/code/game/machinery/stasis_cage.dm @@ -244,10 +244,13 @@ else icon_state = initial(icon_state) -/obj/machinery/stasis_cage/MouseDrop_T(mob/target, mob/user) - if (!isanimal(target) && safety) - to_chat(user, SPAN_WARNING("\The [src] smartly refuses \the [target].")) +/obj/machinery/stasis_cage/mouse_drop_receive(atom/dropped, mob/user, params) + if (!isanimal(dropped) && safety) + to_chat(user, SPAN_WARNING("\The [src] smartly refuses \the [dropped].")) return + + var/mob/living/simple_animal/target = dropped + if (!allowed(user)) to_chat(user, SPAN_NOTICE("\The [src] blinks, refusing access.")) return diff --git a/code/game/machinery/suit_cycler.dm b/code/game/machinery/suit_cycler.dm index 4a191047a6c..6253a2f5915 100644 --- a/code/game/machinery/suit_cycler.dm +++ b/code/game/machinery/suit_cycler.dm @@ -147,8 +147,8 @@ eject_occupant(user) -/obj/machinery/suit_cycler/MouseDrop_T(atom/dropping, mob/user) - var/mob/living/M = dropping +/obj/machinery/suit_cycler/mouse_drop_receive(atom/dropped, mob/user, params) + var/mob/living/M = dropped if(use_check_and_message(user)) return if(!istype(M)) diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index 1bf2e09d833..aa5db102b9a 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -3,10 +3,10 @@ if(buckled) user_unbuckle(user) -/obj/MouseDrop_T(atom/dropping, mob/user) +/obj/mouse_drop_receive(atom/dropped, mob/user, params) . = ..() - if(is_type_in_list(dropping, can_buckle)) - user_buckle(dropping, user) + if(is_type_in_list(dropped, can_buckle)) + user_buckle(dropped, user) /** * Buckles an `/atom/movable` to this obj, performed by a `/mob` diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 027b4a6dfd3..c3fb863729f 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -1327,7 +1327,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out. else apply_outline(L) //if the player's alive and well we send the command with no color set, so it uses the theme's color -/obj/item/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params) +/obj/item/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() remove_outline() diff --git a/code/game/objects/items/airbubble.dm b/code/game/objects/items/airbubble.dm index a6f72de028a..bf1c7060c22 100644 --- a/code/game/objects/items/airbubble.dm +++ b/code/game/objects/items/airbubble.dm @@ -185,22 +185,22 @@ return 1 // Fold the bubble, transfering properties. -/obj/structure/closet/airbubble/MouseDrop(over_object, src_location, over_location) - if((!zipped || ripped )&& (over_object == usr && (in_range(src, usr) || usr.contents.Find(src)))) - if(!ishuman(usr)) return +/obj/structure/closet/airbubble/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if((!zipped || ripped )&& (over == user && (in_range(src, user) || user.contents.Find(src)))) + if(!ishuman(user)) return if(opened) return 0 if(contents.len > 1) return 0 if(cell) - to_chat(usr, SPAN_WARNING("[src] can not be folded with [cell] attached to it.")) + to_chat(user, SPAN_WARNING("[src] can not be folded with [cell] attached to it.")) return - usr.visible_message( - SPAN_WARNING("[usr] begins folding up the [src.name]."), + user.visible_message( + SPAN_WARNING("[user] begins folding up the [src.name]."), SPAN_NOTICE("You begin folding up the [src.name].") ) - if (!do_after(usr, 0.45 SECONDS)) + if (!do_after(user, 0.45 SECONDS)) return - usr.visible_message( - SPAN_WARNING("[usr] folds up the [src.name].") , + user.visible_message( + SPAN_WARNING("[user] folds up the [src.name].") , SPAN_NOTICE("You fold up the [src.name].") ) var/obj/item/airbubble/bag @@ -420,7 +420,7 @@ if(opened) if(istype(attacking_item, /obj/item/grab)) var/obj/item/grab/G = attacking_item - MouseDrop_T(G.affecting, user) + mouse_drop_receive(G.affecting, user) return FALSE if(!attacking_item.dropsafety()) return FALSE diff --git a/code/game/objects/items/bodybag.dm b/code/game/objects/items/bodybag.dm index f8c9d66801a..8adebede50e 100644 --- a/code/game/objects/items/bodybag.dm +++ b/code/game/objects/items/bodybag.dm @@ -121,10 +121,10 @@ ..() slowdown = initial(slowdown) -/obj/structure/closet/body_bag/MouseDrop(over_object, src_location, over_location) +/obj/structure/closet/body_bag/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) ..() - if((over_object == usr && (in_range(src, usr) || usr.contents.Find(src)))) - fold(usr) + if((over == user && (in_range(src, user) || user.contents.Find(src)))) + fold(user) /obj/structure/closet/body_bag/proc/fold(var/user) if(!(ishuman(user))) diff --git a/code/game/objects/items/camping.dm b/code/game/objects/items/camping.dm index 79aec26c390..ccf96f6e27a 100644 --- a/code/game/objects/items/camping.dm +++ b/code/game/objects/items/camping.dm @@ -152,7 +152,7 @@ QDEL_NULL(my_tent) return ..() -/obj/item/tent/MouseDrop(over_object, src_location, over_location) +/obj/item/tent/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() if(use_check(usr) || !Adjacent(usr)) return @@ -254,7 +254,7 @@ return !density return TRUE -/obj/structure/component/tent_canvas/MouseDrop(over_object, src_location, over_location) +/obj/structure/component/tent_canvas/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) ..() if(use_check(usr, USE_ALLOW_NON_ADJACENT) || (get_dist(usr, src) > 1)) // use_check() can't check for adjacency due to density issues, so we check range as well return @@ -328,7 +328,7 @@ if(istype(T)) unroll(T, user) -/obj/item/sleeping_bag/MouseDrop(over_object, src_location, over_location) +/obj/item/sleeping_bag/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() if(use_check(usr) || !Adjacent(usr)) return @@ -374,7 +374,7 @@ buckled.update_icon() . = ..() -/obj/structure/bed/sleeping_bag/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params) +/obj/structure/bed/sleeping_bag/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() if(use_check(usr) || !Adjacent(usr)) return @@ -426,14 +426,14 @@ /obj/structure/table/rack/folding_table/dismantle(obj/item/wrench/W, mob/user) return FALSE -/obj/structure/table/rack/folding_table/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params) +/obj/structure/table/rack/folding_table/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() - if(use_check(usr) || !Adjacent(usr)) + if(use_check(user) || !Adjacent(user)) return - if(!ishuman(usr) && (!isrobot(usr) || isDrone(usr))) //Humans and borgs can collapse, but not drones + if(!ishuman(user) && (!isrobot(user) || isDrone(user))) //Humans and borgs can collapse, but not drones return new /obj/item/material/folding_table(get_turf(src)) - usr.visible_message(SPAN_NOTICE("\The [usr] collapses \the [src].")) + user.visible_message(SPAN_NOTICE("\The [user] collapses \the [src].")) qdel(src) /obj/item/material/stool/chair/folding/camping diff --git a/code/game/objects/items/defib.dm b/code/game/objects/items/defib.dm index 18a19c86e85..f7cdfc8d0d8 100644 --- a/code/game/objects/items/defib.dm +++ b/code/game/objects/items/defib.dm @@ -98,7 +98,7 @@ to_chat(user, SPAN_WARNING("You need a free hand to hold the paddles!")) update_icon() //success -/obj/item/defibrillator/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params) +/obj/item/defibrillator/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() if(ismob(loc) && slot_flags) var/mob/M = src.loc @@ -106,11 +106,11 @@ return if(!M.unEquip(src)) return - add_fingerprint(usr) + add_fingerprint(user) M.put_in_active_hand(src) else - if(ishuman(usr)) - var/mob/living/carbon/human/H = usr + if(ishuman(user)) + var/mob/living/carbon/human/H = user if(Adjacent(H)) if(!H.put_in_active_hand(paddles)) to_chat(H, SPAN_WARNING("You need a free hand to take out the paddles!")) diff --git a/code/game/objects/items/devices/memorywiper.dm b/code/game/objects/items/devices/memorywiper.dm index c0e30b07f80..8a6abd4431e 100644 --- a/code/game/objects/items/devices/memorywiper.dm +++ b/code/game/objects/items/devices/memorywiper.dm @@ -45,11 +45,11 @@ else icon_state = initial(icon_state) -/obj/item/device/memorywiper/MouseDrop(over_object, src_location, over_location) +/obj/item/device/memorywiper/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) ..() if(use_check_and_message(usr)) return - if(in_range(src, usr) && isipc(over_object) && in_range(over_object, src)) + if(in_range(src, usr) && isipc(over) && in_range(over, src)) if(attached) if(attached == usr) to_chat(usr, "You unplug \the [src] from your maintenace port.") @@ -58,13 +58,13 @@ unplug() return else - if(over_object == usr) - plug(over_object) + if(over == usr) + plug(over) to_chat(usr, "You plug \the [src] into your maintenace port.") else - visible_message("[usr] begins hunting for the maintenance port on \the [over_object]'s chassis.") // The age old question of "where do I put it in!?" + visible_message("[usr] begins hunting for the maintenance port on \the [over]'s chassis.") // The age old question of "where do I put it in!?" if(do_after(usr, 5 SECONDS)) - plug(over_object) + plug(over) visible_message("[usr] plugs \the [src] into \the [attached]'s maintenance port.") /obj/item/device/memorywiper/attack_hand(user as mob) diff --git a/code/game/objects/items/devices/slide_projector.dm b/code/game/objects/items/devices/slide_projector.dm index 1d02decfa66..d18c6a864ab 100644 --- a/code/game/objects/items/devices/slide_projector.dm +++ b/code/game/objects/items/devices/slide_projector.dm @@ -41,17 +41,17 @@ return project_at(get_turf(target)) -/obj/item/storage/slide_projector/MouseDrop(atom/over) - if(use_check_and_message(usr)) +/obj/item/storage/slide_projector/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(use_check_and_message(user)) return - if(over == usr) - interact(usr) + if(over == user) + interact(user) return var/turf/T = get_turf(over) if(istype(T)) - afterattack(over, usr) + afterattack(over, user) /obj/item/storage/slide_projector/proc/set_slide(obj/item/new_slide) current_slide = new_slide diff --git a/code/game/objects/items/glassjar.dm b/code/game/objects/items/glassjar.dm index e3a0197ca5f..6035e09e342 100644 --- a/code/game/objects/items/glassjar.dm +++ b/code/game/objects/items/glassjar.dm @@ -101,14 +101,14 @@ update_icon() return -/obj/item/glass_jar/MouseDrop(atom/over) - if(usr != over || use_check_and_message(usr)) +/obj/item/glass_jar/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(user != over || use_check_and_message(user)) return if(length(contained)) switch(contains) if(JAR_GUMBALL) - release(contained[1], usr) - usr.put_in_hands(contained[1]) + release(contained[1], user) + user.put_in_hands(contained[1]) contained -= contained[1] /obj/item/glass_jar/attackby(obj/item/attacking_item, mob/user) diff --git a/code/game/objects/items/science_sampler.dm b/code/game/objects/items/science_sampler.dm index 63c16bb9ca6..c54c5178645 100644 --- a/code/game/objects/items/science_sampler.dm +++ b/code/game/objects/items/science_sampler.dm @@ -243,9 +243,9 @@ /obj/machinery/centrifuge/AltClick() remove_sample(usr) -/obj/machinery/centrifuge/MouseDrop(var/atom/other) - if(usr == other) - remove_sample(usr) +/obj/machinery/centrifuge/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(user == over) + remove_sample(user) else return ..() diff --git a/code/game/objects/items/spirit_board.dm b/code/game/objects/items/spirit_board.dm index 945b5e2fcd9..9fe32ac7ecf 100644 --- a/code/game/objects/items/spirit_board.dm +++ b/code/game/objects/items/spirit_board.dm @@ -17,11 +17,11 @@ else spirit_board_pick_letter(user) -/obj/item/spirit_board/MouseDrop(mob/user as mob) - if((user == usr && (!use_check(user))) && (user.contents.Find(src) || in_range(src, user))) - if(ishuman(usr)) - forceMove(get_turf(usr)) - usr.put_in_hands(src) +/obj/item/spirit_board/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if((over == user && (!use_check(over))) && (over.contents.Find(src) || in_range(src, over))) + if(ishuman(user)) + forceMove(get_turf(user)) + user.put_in_hands(src) /obj/item/spirit_board/attack_ghost(var/mob/abstract/ghost/user) spirit_board_pick_letter(user) diff --git a/code/game/objects/items/weapons/chaplain_items.dm b/code/game/objects/items/weapons/chaplain_items.dm index 1ab12e328bb..b3c48e14dbb 100644 --- a/code/game/objects/items/weapons/chaplain_items.dm +++ b/code/game/objects/items/weapons/chaplain_items.dm @@ -477,12 +477,12 @@ else open(user) -/obj/item/storage/altar/MouseDrop(mob/user as mob) - if(use_check_and_message(user)) +/obj/item/storage/altar/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(use_check_and_message(over)) return - if(ishuman(user)) - forceMove(get_turf(usr)) - usr.put_in_hands(src) + if(ishuman(over)) + forceMove(get_turf(user)) + user.put_in_hands(src) /obj/item/storage/altar/kraszar name = "\improper Kraszar altar" diff --git a/code/game/objects/items/weapons/storage/laundry_basket.dm b/code/game/objects/items/weapons/storage/laundry_basket.dm index d017c01ce59..988d65ece6b 100644 --- a/code/game/objects/items/weapons/storage/laundry_basket.dm +++ b/code/game/objects/items/weapons/storage/laundry_basket.dm @@ -58,8 +58,8 @@ return -/obj/item/storage/laundry_basket/MouseDrop(obj/over_object as obj) - if(over_object == usr) +/obj/item/storage/laundry_basket/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(over == user) return else return ..() diff --git a/code/game/objects/items/weapons/storage/secure.dm b/code/game/objects/items/weapons/storage/secure.dm index 9bda2e9b305..58d7a734424 100644 --- a/code/game/objects/items/weapons/storage/secure.dm +++ b/code/game/objects/items/weapons/storage/secure.dm @@ -70,9 +70,9 @@ ABSTRACT_TYPE(/obj/item/storage/secure) ..() -/obj/item/storage/secure/MouseDrop(over_object, src_location, over_location) +/obj/item/storage/secure/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if (locked) - src.add_fingerprint(usr) + src.add_fingerprint(user) return ..() diff --git a/code/game/objects/items/weapons/storage/storage.dm b/code/game/objects/items/weapons/storage/storage.dm index c5789d13a3a..8ef997e095f 100644 --- a/code/game/objects/items/weapons/storage/storage.dm +++ b/code/game/objects/items/weapons/storage/storage.dm @@ -202,40 +202,40 @@ if(isghost(user)) . += "It contains: [counting_english_list(contents)]" -/obj/item/storage/MouseDrop(obj/over_object) +/obj/item/storage/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() if(!canremove) return - if(!over_object || over_object == src) + if(!over || over == src) return - if(istype(over_object, /atom/movable/screen/inventory)) - var/atom/movable/screen/inventory/S = over_object + if(istype(over, /atom/movable/screen/inventory)) + var/atom/movable/screen/inventory/S = over if(S.slot_id == src.equip_slot) return - if(ishuman(usr) || issmall(usr)) //so monkeys can take off their backpacks -- Urist - if(over_object == usr && Adjacent(usr)) // this must come before the screen objects only block - src.open(usr) + if(ishuman(user) || issmall(user)) //so monkeys can take off their backpacks -- Urist + if(over == user && Adjacent(user)) // this must come before the screen objects only block + src.open(user) return - if(!(istype(over_object, /atom/movable/screen))) + if(!(istype(over, /atom/movable/screen))) return ..() //makes sure that the storage is equipped, so that we can't drag it into our hand from miles away. //there's got to be a better way of doing this. - if(!(src.loc == usr) || (src.loc && src.loc.loc == usr)) + if(!(src.loc == user) || (src.loc && src.loc.loc == user)) return - if(use_check_and_message(usr)) + if(use_check_and_message(user)) return - if((src.loc == usr) && !usr.unEquip(src)) + if((src.loc == user) && !user.unEquip(src)) return - switch(over_object.name) + switch(over.name) if("right hand") - usr.u_equip(src) - usr.equip_to_slot_if_possible(src, slot_r_hand) + user.u_equip(src) + user.equip_to_slot_if_possible(src, slot_r_hand) if("left hand") - usr.u_equip(src) - usr.equip_to_slot_if_possible(src, slot_l_hand) - src.add_fingerprint(usr) + user.u_equip(src) + user.equip_to_slot_if_possible(src, slot_l_hand) + src.add_fingerprint(user) /obj/item/storage/AltClick(var/mob/usr) if(!canremove) diff --git a/code/game/objects/items/weapons/surgery_tools.dm b/code/game/objects/items/weapons/surgery_tools.dm index 89d218c1b3e..41a0d761f07 100644 --- a/code/game/objects/items/weapons/surgery_tools.dm +++ b/code/game/objects/items/weapons/surgery_tools.dm @@ -267,23 +267,24 @@ if(ishuman(user)) src.open(user) -/obj/item/storage/box/fancy/tray/MouseDrop(mob/user as mob) - if((user && (!use_check(user))) && (user.contents.Find(src) || in_range(src, user))) - if(ishuman(user) && !user.get_active_hand()) +/obj/item/storage/box/fancy/tray/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if((over && (!use_check(over))) && (over.contents.Find(src) || in_range(src, over))) + var/mob/dropped_onto_mob = over + if(ishuman(dropped_onto_mob) && !dropped_onto_mob.get_active_hand()) var/mob/living/carbon/human/H = user var/obj/item/organ/external/temp = H.organs_by_name[BP_R_HAND] if (H.hand) temp = H.organs_by_name[BP_L_HAND] if(temp && !temp.is_usable()) - to_chat(user, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) + to_chat(H, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) return - to_chat(user, SPAN_NOTICE("You pick up the [src].")) + to_chat(H, SPAN_NOTICE("You pick up the [src].")) pixel_x = 0 pixel_y = 0 - forceMove(get_turf(user)) - user.put_in_hands(src) + forceMove(get_turf(H)) + H.put_in_hands(src) return diff --git a/code/game/objects/items/weapons/traps.dm b/code/game/objects/items/weapons/traps.dm index 291d2fc7a9e..3e10ff8f000 100644 --- a/code/game/objects/items/weapons/traps.dm +++ b/code/game/objects/items/weapons/traps.dm @@ -398,8 +398,8 @@ return SPAN_NOTICE("You can secure the trap by using a screwdriver on it. This will anchor it to the floor, and ready it for deployment.") return SPAN_NOTICE("You can unsecure the trap by using a screwdriver on it. This will unanchor it from the floor, allowing it to be moved.") -/obj/item/trap/animal/MouseDrop_T(atom/dropping, mob/user) - var/mob/living/capturing_mob = dropping +/obj/item/trap/animal/mouse_drop_receive(atom/dropped, mob/user, params) + var/mob/living/capturing_mob = dropped if(!istype(capturing_mob)) return @@ -704,16 +704,16 @@ user.forceMove(loc) user.visible_message("[SPAN_BOLD("[user]")] successfully moves around \the [src] without triggering it.", SPAN_NOTICE("You successfully move around \the [src] without triggering it.")) -/obj/item/trap/animal/MouseDrop(over_object, src_location, over_location) - if(!isliving(usr) || !src.Adjacent(usr)) +/obj/item/trap/animal/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(!isliving(user) || !src.Adjacent(user)) return if(captured) - pass_without_trace(usr) // It's full + pass_without_trace(user) // It's full return - else if(iscarbon(usr)) - pass_without_trace(usr) + else if(iscarbon(user)) + pass_without_trace(user) return return ..() @@ -827,25 +827,25 @@ else ..() -/obj/item/trap/animal/large/MouseDrop(over_object, src_location, over_location) +/obj/item/trap/animal/large/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if(captured) - to_chat(usr, SPAN_WARNING("The trap door's down, you can't get through there!")) + to_chat(user, SPAN_WARNING("The trap door's down, you can't get through there!")) return - if(!src.Adjacent(usr)) + if(!src.Adjacent(user)) return - if(!ishuman(usr)) + if(!ishuman(user)) ..() return var/trigger_chance = 0 - if(usr.a_intent == I_HELP) + if(user.a_intent == I_HELP) trigger_chance = 100 - else if(usr.a_intent != I_HURT) + else if(user.a_intent != I_HURT) trigger_chance = 50 - pass_without_trace(usr, trigger_chance) + pass_without_trace(user, trigger_chance) /obj/item/trap/animal/large/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(deployed) diff --git a/code/game/objects/structures.dm b/code/game/objects/structures.dm index 862f0d0f58c..bc5f300585b 100644 --- a/code/game/objects/structures.dm +++ b/code/game/objects/structures.dm @@ -102,11 +102,11 @@ return TRUE return FALSE -/obj/structure/MouseDrop_T(mob/target, mob/user) +/obj/structure/mouse_drop_receive(atom/dropped, mob/user, params) var/mob/living/H = user - if(istype(H) && can_climb(H) && target == user) - do_climb(target) + if(istype(H) && can_climb(H) && dropped == user) + do_climb(dropped) else return ..() diff --git a/code/game/objects/structures/bedsheet_bin.dm b/code/game/objects/structures/bedsheet_bin.dm index 9f6726c7f2a..b6e844621a5 100644 --- a/code/game/objects/structures/bedsheet_bin.dm +++ b/code/game/objects/structures/bedsheet_bin.dm @@ -73,20 +73,21 @@ LINEN BINS ..() add_fingerprint(user) -/obj/item/bedsheet/MouseDrop(mob/user) - if((user && (!use_check(user))) && (user.contents.Find(src) || in_range(src, user))) - if(!istype(user, /mob/living/carbon/slime) && !istype(user, /mob/living/simple_animal)) - if( !user.get_active_hand() ) //if active hand is empty +/obj/item/bedsheet/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if((over && (!use_check(over))) && (over.contents.Find(src) || in_range(src, over))) + if(!istype(over, /mob/living/carbon/slime) && !istype(over, /mob/living/simple_animal)) + var/mob/mouse_dropped_over = over + if( !mouse_dropped_over.get_active_hand() ) //if active hand is empty var/mob/living/carbon/human/H = user var/obj/item/organ/external/temp = H.organs_by_name["r_hand"] if (H.hand) temp = H.organs_by_name["l_hand"] if(temp && !temp.is_usable()) - to_chat(user, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) + to_chat(H, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) return - to_chat(user, SPAN_NOTICE("You pick up \the [src].")) - user.put_in_hands(src) + to_chat(H, SPAN_NOTICE("You pick up \the [src].")) + H.put_in_hands(src) return /obj/item/bedsheet/update_icon() diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 6655094a9e6..e4bfeca45e5 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -348,7 +348,7 @@ if(opened) if(istype(attacking_item, /obj/item/grab)) var/obj/item/grab/G = attacking_item - MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet + mouse_drop_receive(G.affecting, user) //act like they were dragged onto the closet return 0 if(attacking_item.isscrewdriver()) // Moved here so you can only detach linked teleporters when the door is open. So you can like unscrew and bolt the locker normally in most circumstances. if(linked_teleporter) @@ -516,8 +516,8 @@ . = opened -/obj/structure/closet/MouseDrop_T(atom/dropping, mob/user) - var/atom/movable/O = dropping +/obj/structure/closet/mouse_drop_receive(atom/dropped, mob/user, params) + var/atom/movable/screen/O = dropped if(istype(O, /atom/movable/screen)) //fix for HUD elements making their way into the world -Pete return if(O.loc == user) diff --git a/code/game/objects/structures/crates_lockers/closets/gimmick.dm b/code/game/objects/structures/crates_lockers/closets/gimmick.dm index 62655c68b3e..529f267a03e 100644 --- a/code/game/objects/structures/crates_lockers/closets/gimmick.dm +++ b/code/game/objects/structures/crates_lockers/closets/gimmick.dm @@ -14,7 +14,7 @@ if(opened) if(istype(attacking_item, /obj/item/grab)) var/obj/item/grab/G = attacking_item - MouseDrop_T(G.affecting, user) //act like they were dragged onto the closet + mouse_drop_receive(G.affecting, user) //act like they were dragged onto the closet return 0 if(!attacking_item.dropsafety()) return diff --git a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm index 5fb7611fe34..24acde2acc2 100644 --- a/code/game/objects/structures/crates_lockers/closets/secure/personal.dm +++ b/code/game/objects/structures/crates_lockers/closets/secure/personal.dm @@ -40,7 +40,7 @@ /obj/structure/closet/secure_closet/personal/attackby(obj/item/attacking_item, mob/user) if (opened) if (istype(attacking_item, /obj/item/grab)) - MouseDrop_T(attacking_item:affecting, user) //act like they were dragged onto the closet + mouse_drop_receive(attacking_item:affecting, user) //act like they were dragged onto the closet if(attacking_item) user.drop_from_inventory(attacking_item,loc) else diff --git a/code/game/objects/structures/crates_lockers/closets/statue.dm b/code/game/objects/structures/crates_lockers/closets/statue.dm index 522bb528e65..81862c864b6 100644 --- a/code/game/objects/structures/crates_lockers/closets/statue.dm +++ b/code/game/objects/structures/crates_lockers/closets/statue.dm @@ -151,7 +151,7 @@ visible_message(SPAN_DANGER("[user] strikes [src] with [attacking_item].")) check_health() -/obj/structure/closet/statue/MouseDrop_T() +/obj/structure/closet/statue/mouse_drop_receive(atom/dropped, mob/user, params) return /obj/structure/closet/statue/relaymove(mob/living/user, direction) diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index a272884f373..1487cde927b 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -146,9 +146,9 @@ pixel_y = -4 //For putting on tables -/obj/structure/closet/crate/MouseDrop(atom/over_object) - if (istype(over_object, /obj/structure/table)) - put_on_table(over_object, usr) +/obj/structure/closet/crate/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if (istype(over, /obj/structure/table)) + put_on_table(over, user) return TRUE else return ..() diff --git a/code/game/objects/structures/fireaxe_cabinet.dm b/code/game/objects/structures/fireaxe_cabinet.dm index 90490d2f187..a120ff2b96b 100644 --- a/code/game/objects/structures/fireaxe_cabinet.dm +++ b/code/game/objects/structures/fireaxe_cabinet.dm @@ -87,22 +87,22 @@ return toggle_open(user) -/obj/structure/fireaxecabinet/MouseDrop(over_object, src_location, over_location) - if(over_object == usr) - var/mob/user = over_object - if(!istype(user)) +/obj/structure/fireaxecabinet/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(over == user) + var/mob/mob_dropped_over = over + if(!istype(mob_dropped_over)) return if(!open) - to_chat(user, SPAN_NOTICE("\The [src] is closed.")) + to_chat(mob_dropped_over, SPAN_NOTICE("\The [src] is closed.")) return if(!fireaxe) - to_chat(user, SPAN_NOTICE("\The [src] is empty.")) + to_chat(mob_dropped_over, SPAN_NOTICE("\The [src] is empty.")) return - fireaxe.forceMove(get_turf(user)) - user.put_in_hands(fireaxe) + fireaxe.forceMove(get_turf(mob_dropped_over)) + mob_dropped_over.put_in_hands(fireaxe) fireaxe = null update_icon() diff --git a/code/game/objects/structures/janicart.dm b/code/game/objects/structures/janicart.dm index c759a41d19c..1b16bc8b8ba 100644 --- a/code/game/objects/structures/janicart.dm +++ b/code/game/objects/structures/janicart.dm @@ -99,8 +99,8 @@ //everything else is visible, so doesn't need to be mentioned -/obj/structure/janitorialcart/MouseDrop_T(atom/dropping, mob/user) - var/atom/movable/O = dropping +/obj/structure/janitorialcart/mouse_drop_receive(atom/dropped, mob/user, params) + var/atom/movable/O = dropped if (istype(O, /obj/structure/mopbucket) && !mybucket) O.forceMove(src) mybucket = O diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 1afe4d597c0..33e54a60e33 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -166,8 +166,8 @@ return return -/obj/structure/m_tray/MouseDrop_T(atom/dropping, mob/user) - var/atom/movable/O = dropping +/obj/structure/m_tray/mouse_drop_receive(atom/dropped, mob/user, params) + var/atom/movable/O = dropped if(!istype(O, /atom/movable) || O.anchored || get_dist(user, src) > 1 || get_dist(user, O) > 1 || user.contents.Find(src) || user.contents.Find(O)) return if(!ismob(O) && !istype(O, /obj/structure/closet/body_bag)) diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index 31238406d76..ae95746b45f 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -492,27 +492,27 @@ update_icon() STOP_PROCESSING(SSprocessing, src) -/obj/structure/bed/roller/MouseDrop(over_object, src_location, over_location) +/obj/structure/bed/roller/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) ..() - if(use_check(usr) || !Adjacent(usr)) + if(use_check(user) || !Adjacent(user)) return - if(!ishuman(usr) && (!isrobot(usr) || isDrone(usr))) //Humans and borgs can collapse, but not drones + if(!ishuman(user) && (!isrobot(user) || isDrone(user))) //Humans and borgs can collapse, but not drones return - if(over_object == buckled && beaker) + if(over == buckled && beaker) if(iv_attached) - detach_iv(buckled, usr) + detach_iv(buckled, user) else - attach_iv(buckled, usr) + attach_iv(buckled, user) return - if(usr != over_object && ishuman(over_object)) - if(user_buckle(over_object, usr)) - attach_iv(buckled, usr) + if(user != over && ishuman(over)) + if(user_buckle(over, user)) + attach_iv(buckled, user) return if(beaker) - remove_beaker(usr) + remove_beaker(user) return if(vitals) - remove_vitals(usr) + remove_vitals(user) return if(buckled) return diff --git a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm index 21d489b7baf..ee5d05ffdd4 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/chairs.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/chairs.dm @@ -41,8 +41,8 @@ if(buckled) buckled.set_dir(dir) -/obj/structure/bed/stool/chair/MouseDrop_T(atom/dropping, mob/user) - if(dropping == user && user.loc != loc && (REVERSE_DIR(dir) & angle2dir(get_angle(src, user)))) +/obj/structure/bed/stool/chair/mouse_drop_receive(atom/dropped, mob/user, params) + if(dropped == user && user.loc != loc && (REVERSE_DIR(dir) & angle2dir(get_angle(src, user)))) user.visible_message("[user] starts climbing over the back of \the [src]...", SPAN_NOTICE("You start climbing over the back of \the [src]...")) if(do_after(user, 2 SECONDS, do_flags = DO_UNIQUE)) user.forceMove(loc) diff --git a/code/game/objects/structures/stool_bed_chair_nest/stools.dm b/code/game/objects/structures/stool_bed_chair_nest/stools.dm index cabb087da6a..0154880de64 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/stools.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/stools.dm @@ -15,12 +15,12 @@ . = ..() can_buckle = FALSE // Some idiot decided can_buckle should be a list... -/obj/structure/bed/stool/MouseDrop(over_object, src_location, over_location) +/obj/structure/bed/stool/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() - if(over_object == usr && Adjacent(usr)) - if(!held_item || use_check_and_message(usr) || buckled || (anchored && padding_material)) // Make sure held_item = null if you don't want it to get picked up. + if(over == user && Adjacent(user)) + if(!held_item || use_check_and_message(user) || buckled || (anchored && padding_material)) // Make sure held_item = null if you don't want it to get picked up. return - usr.visible_message(SPAN_NOTICE("[usr] [withdraw_verb]s \the [src.name]."), SPAN_NOTICE("You [withdraw_verb] \the [src.name].")) + user.visible_message(SPAN_NOTICE("[user] [withdraw_verb]s \the [src.name]."), SPAN_NOTICE("You [withdraw_verb] \the [src.name].")) var/obj/item/material/stool/S = new held_item(src.loc, material.name, padding_material?.name, painted_colour) // Handles all the material code so you don't have to. TransferComponents(S) if(material_alteration & MATERIAL_ALTERATION_COLOR) // For snowflakes like wood chairs. @@ -33,8 +33,8 @@ S.blood_DNA |= blood_DNA // Transfer blood, if any. S.add_blood() S.dir = dir - S.add_fingerprint(usr) - usr.put_in_hands(S) + S.add_fingerprint(user) + user.put_in_hands(S) S.update_icon() qdel(src) @@ -197,19 +197,20 @@ /obj/item/material/stool/AltClick(mob/user) deploy(user) -/obj/item/material/stool/MouseDrop(mob/user) - if((user && (!use_check(user))) && (user.contents.Find(src)) || in_range(src, user)) - if(!istype(user, /mob/living/carbon/slime) && !istype(user, /mob/living/simple_animal)) - if( !user.get_active_hand() ) //if active hand is empty +/obj/item/material/stool/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if((over && (!use_check(over))) && (over.contents.Find(src)) || in_range(src, over)) + if(!istype(over, /mob/living/carbon/slime) && !istype(over, /mob/living/simple_animal)) + var/mob/mouse_dropped_over = over + if( !mouse_dropped_over.get_active_hand() ) //if active hand is empty var/mob/living/carbon/human/H = user var/obj/item/organ/external/temp = H.organs_by_name["r_hand"] if (H.hand) temp = H.organs_by_name["l_hand"] if(temp && !temp.is_usable()) - to_chat(user, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) + to_chat(H, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) return - to_chat(user, SPAN_NOTICE("You pick up \the [src].")) - user.put_in_hands(src) + to_chat(H, SPAN_NOTICE("You pick up \the [src].")) + H.put_in_hands(src) return /obj/item/material/stool/apply_hit_effect(mob/living/target, mob/living/user, var/hit_zone) diff --git a/code/game/objects/structures/trash_pile.dm b/code/game/objects/structures/trash_pile.dm index 75423ed56f3..e67ef2f9ce9 100644 --- a/code/game/objects/structures/trash_pile.dm +++ b/code/game/objects/structures/trash_pile.dm @@ -28,7 +28,7 @@ if(icon_state == initial(icon_state)) icon_state = pick(icon_states(icon) - icon_state) -/obj/structure/trash_pile/MouseDrop_T(atom/dropping, mob/user) +/obj/structure/trash_pile/mouse_drop_receive(atom/dropped, mob/user, params) if(!Adjacent(user) || use_check_and_message(user)) return user.visible_message("[user] starts climbing into \the [src]...", SPAN_NOTICE("You start climbing into \the [src]...")) diff --git a/code/game/objects/structures/urban.dm b/code/game/objects/structures/urban.dm index 8eb21e4efc3..8c0d18ff509 100644 --- a/code/game/objects/structures/urban.dm +++ b/code/game/objects/structures/urban.dm @@ -790,8 +790,8 @@ ABSTRACT_TYPE(/obj/structure/stairs/urban/road_ramp) /obj/item/storage/toolbox/cash_register_storage name = "cash compartment" -/obj/structure/cash_register/MouseDrop(atom/over) - if(usr == over && ishuman(over)) +/obj/structure/cash_register/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(user == over && ishuman(over)) var/mob/living/carbon/human/H = over storage_compartment.open(H) diff --git a/code/modules/battlemonsters/items/core.dm b/code/modules/battlemonsters/items/core.dm index 8777f550c32..f9d77ce3d05 100644 --- a/code/modules/battlemonsters/items/core.dm +++ b/code/modules/battlemonsters/items/core.dm @@ -18,17 +18,18 @@ update_icon() . = ..() -/obj/item/battle_monsters/MouseDrop(mob/user) //Dropping the card onto something else. - if(istype(user)) - user.put_in_active_hand(src) - src.pickup(user) +/obj/item/battle_monsters/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) //Dropping the card onto something else. + var/mob/mob_dropped_onto = over + if(istype(mob_dropped_onto)) + mob_dropped_onto.put_in_active_hand(src) + src.pickup(mob_dropped_onto) return . = ..() -/obj/item/battle_monsters/MouseDrop_T(atom/dropping, mob/user) //Dropping C onto the card - if(istype(dropping, /obj/item/battle_monsters)) - src.attackby(dropping,user) +/obj/item/battle_monsters/mouse_drop_receive(atom/dropped, mob/user, params) //Dropping C onto the card + if(istype(dropped, /obj/item/battle_monsters)) + src.attackby(dropped, user) return . = ..() diff --git a/code/modules/battlemonsters/items/deck.dm b/code/modules/battlemonsters/items/deck.dm index 9de070d1e92..454d1d09aed 100644 --- a/code/modules/battlemonsters/items/deck.dm +++ b/code/modules/battlemonsters/items/deck.dm @@ -65,11 +65,11 @@ update_icon() -/obj/item/battle_monsters/deck/MouseDrop_T(atom/dropping, mob/user) //Dropping C onto the card +/obj/item/battle_monsters/deck/mouse_drop_receive(atom/dropped, mob/user, params) //Dropping C onto the card - if(istype(dropping, /obj/item/battle_monsters/deck/)) + if(istype(dropped, /obj/item/battle_monsters/deck/)) - var/obj/item/battle_monsters/deck/added_deck = dropping + var/obj/item/battle_monsters/deck/added_deck = dropped stored_card_names += added_deck.stored_card_names user.visible_message(\ @@ -77,7 +77,7 @@ SPAN_NOTICE("You combine two decks together.")\ ) - qdel(dropping) + qdel(dropped) return . = ..() diff --git a/code/modules/client/client_defines.dm b/code/modules/client/client_defines.dm index 2721e4fde7b..0ccea4c2e11 100644 --- a/code/modules/client/client_defines.dm +++ b/code/modules/client/client_defines.dm @@ -85,3 +85,7 @@ var/list/spell_tabs = list() ///Our object window datum. It stores info about and handles behavior for the object tab var/datum/object_window_info/obj_window + ///When we started the currently active drag + var/drag_start = 0 + ///The params we were passed at the start of the drag, in list form + var/list/drag_details diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm index e52a23e7ce7..3d1648d0b7b 100644 --- a/code/modules/client/client_procs.dm +++ b/code/modules/client/client_procs.dm @@ -814,6 +814,12 @@ var/list/localhost_addresses = list( CRASH("Age check regex failed for [src.ckey]") /client/MouseDrag(src_object, over_object, src_location, over_location, src_control, over_control, params) + var/list/modifiers = params2list(params) + + if(!drag_start) // If we're just starting to drag + drag_start = world.time + drag_details = modifiers.Copy() + . = ..() if(over_object) @@ -831,7 +837,18 @@ var/list/localhost_addresses = list( CHECK_TICK -/client/MouseDown(object, location, control, params) +/client/MouseDrop(atom/src_object, atom/over_object, atom/src_location, atom/over_location, src_control, over_control, params) + SHOULD_NOT_OVERRIDE(TRUE) + + ..() + drag_start = 0 + drag_details = null + +/client/MouseDown(datum/object, location, control, params) + if(QDELETED(object)) //Yep, you can click on qdeleted things before they have time to nullspace. Fun. + return + SEND_SIGNAL(src, COMSIG_CLIENT_MOUSEDOWN, object, location, control, params) + var/obj/item/I = mob.get_active_hand() var/obj/O = object if(istype(I, /obj/item/gun) && !mob.in_throw_mode) @@ -893,6 +910,8 @@ var/list/localhost_addresses = list( sleep(G.fire_delay) /client/MouseUp(object, location, control, params) + if(SEND_SIGNAL(src, COMSIG_CLIENT_MOUSEUP, object, location, control, params) & COMPONENT_CLIENT_MOUSEUP_INTERCEPT) + src = src //This doesn't do shit, when you implement click interception change this autofire_aiming_at[1] = null /atom/proc/is_auto_clickable() diff --git a/code/modules/clothing/clothing_accessories.dm b/code/modules/clothing/clothing_accessories.dm index 1a4402de548..15a98a4c1c8 100644 --- a/code/modules/clothing/clothing_accessories.dm +++ b/code/modules/clothing/clothing_accessories.dm @@ -46,39 +46,39 @@ return return ..() -/obj/item/clothing/MouseDrop(var/obj/over_object) - if(ishuman(usr) || issmall(usr)) +/obj/item/clothing/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(ishuman(user) || issmall(user)) //makes sure that the clothing is equipped so that we can't drag it into our hand from miles away. - if(!(src.loc == usr)) + if(!(src.loc == user)) return - if(!over_object || over_object == src) + if(!over || over == src) return - if(istype(over_object, /atom/movable/screen/inventory)) - var/atom/movable/screen/inventory/S = over_object + if(istype(over, /atom/movable/screen/inventory)) + var/atom/movable/screen/inventory/S = over if(S.slot_id == src.equip_slot) return - if(use_check_and_message(usr)) + if(use_check_and_message(user)) return - if(!usr.canUnEquip(src)) + if(!user.canUnEquip(src)) return var/obj/item/clothing/C = src - usr.unEquip(C) + user.unEquip(C) - switch(over_object.name) + switch(over.name) if("right hand") if(istype(src, /obj/item/clothing/ears)) - C = check_two_ears(usr) - usr.equip_to_slot_if_possible(C, slot_r_hand) + C = check_two_ears(user) + user.equip_to_slot_if_possible(C, slot_r_hand) if("left hand") if(istype(src, /obj/item/clothing/ears)) - C = check_two_ears(usr) - usr.equip_to_slot_if_possible(C, slot_l_hand) - src.add_fingerprint(usr) + C = check_two_ears(user) + user.equip_to_slot_if_possible(C, slot_l_hand) + src.add_fingerprint(user) /obj/item/clothing/proc/check_two_ears(var/mob/user) // if you have to ask, it's earcode diff --git a/code/modules/clothing/head/helmet.dm b/code/modules/clothing/head/helmet.dm index ef2a49495b0..afea43ec338 100644 --- a/code/modules/clothing/head/helmet.dm +++ b/code/modules/clothing/head/helmet.dm @@ -55,10 +55,10 @@ return return ..(user) -/obj/item/clothing/head/helmet/MouseDrop(obj/over_object) - if(has_storage && !hold.handle_mousedrop(usr, over_object)) +/obj/item/clothing/head/helmet/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(has_storage && !hold.handle_mousedrop(user, over)) return - return ..(over_object) + return ..() /obj/item/clothing/head/helmet/handle_middle_mouse_click(mob/user) if(has_storage && Adjacent(user)) diff --git a/code/modules/clothing/spacesuits/rig/modules/storage.dm b/code/modules/clothing/spacesuits/rig/modules/storage.dm index 657dc12046e..75b6ac8118f 100644 --- a/code/modules/clothing/spacesuits/rig/modules/storage.dm +++ b/code/modules/clothing/spacesuits/rig/modules/storage.dm @@ -24,9 +24,9 @@ . = ..() -/obj/item/rig/MouseDrop(obj/over_object as obj) +/obj/item/rig/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) var/obj/item/rig_module/storage/storage = locate() in installed_modules - if(storage && !storage.pockets.handle_mousedrop(usr, over_object)) + if(storage && !storage.pockets.handle_mousedrop(user, over)) return return ..() diff --git a/code/modules/clothing/suits/armor.dm b/code/modules/clothing/suits/armor.dm index 1b7416a29ff..646acf1b186 100644 --- a/code/modules/clothing/suits/armor.dm +++ b/code/modules/clothing/suits/armor.dm @@ -38,12 +38,12 @@ else ..(user) -/obj/item/clothing/suit/armor/MouseDrop(obj/over_object as obj) +/obj/item/clothing/suit/armor/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if (pockets) - if (pockets.handle_mousedrop(usr, over_object)) - ..(over_object) + if (pockets.handle_mousedrop(user, over)) + ..() else - ..(over_object) + ..() /obj/item/clothing/suit/armor/attackby(obj/item/attacking_item, mob/user) ..() diff --git a/code/modules/clothing/suits/storage.dm b/code/modules/clothing/suits/storage.dm index d74b7c3e72a..3256ed7cdb4 100644 --- a/code/modules/clothing/suits/storage.dm +++ b/code/modules/clothing/suits/storage.dm @@ -17,9 +17,9 @@ if (pockets.handle_attack_hand(user)) ..(user) -/obj/item/clothing/suit/storage/MouseDrop(obj/over_object as obj) - if (pockets.handle_mousedrop(usr, over_object)) - ..(over_object) +/obj/item/clothing/suit/storage/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if (pockets.handle_mousedrop(user, over)) + ..() /obj/item/clothing/suit/storage/handle_middle_mouse_click(mob/user) if(Adjacent(user)) diff --git a/code/modules/clothing/under/accessories/storage.dm b/code/modules/clothing/under/accessories/storage.dm index 8d796a41939..a5854b77574 100644 --- a/code/modules/clothing/under/accessories/storage.dm +++ b/code/modules/clothing/under/accessories/storage.dm @@ -22,12 +22,12 @@ if (hold.handle_attack_hand(user)) //otherwise interact as a regular storage item ..(user) -/obj/item/clothing/accessory/storage/MouseDrop(obj/over_object as obj) +/obj/item/clothing/accessory/storage/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if (has_suit) return - if (hold.handle_mousedrop(usr, over_object)) - ..(over_object) + if (hold.handle_mousedrop(user, over)) + ..() /obj/item/clothing/accessory/storage/attackby(obj/item/attacking_item, mob/user) return hold.attackby(attacking_item, user) diff --git a/code/modules/cooking/machinery/cooking_machines/container.dm b/code/modules/cooking/machinery/cooking_machines/container.dm index 1098bfd7cba..580147fed13 100644 --- a/code/modules/cooking/machinery/cooking_machines/container.dm +++ b/code/modules/cooking/machinery/cooking_machines/container.dm @@ -301,8 +301,8 @@ if(length(contents) || reagents?.total_volume) . += SPAN_NOTICE("To attempt cooking: click and hold, then drag this onto your character.") -/obj/item/reagent_containers/cooking_container/board/MouseDrop(var/obj/over_obj) - if(over_obj != usr || use_check(usr)) +/obj/item/reagent_containers/cooking_container/board/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(over != user || use_check(user)) return ..() if(!(length(contents) || reagents?.total_volume)) return ..() @@ -329,12 +329,12 @@ R.forceMove(src) //Move everything from the buffer back to the container var/l = length(results) - if (l && usr) + if (l && user) var/name = results[1].name if (l > 1) - to_chat(usr, SPAN_NOTICE("You made some [pluralize_word(name, TRUE)]!")) + to_chat(user, SPAN_NOTICE("You made some [pluralize_word(name, TRUE)]!")) else - to_chat(usr, SPAN_NOTICE("You made [name]!")) + to_chat(user, SPAN_NOTICE("You made [name]!")) QDEL_NULL(temp) //delete buffer object return ..() diff --git a/code/modules/cooking/machinery/gibber.dm b/code/modules/cooking/machinery/gibber.dm index 9753d4e391e..3ed4e121513 100644 --- a/code/modules/cooking/machinery/gibber.dm +++ b/code/modules/cooking/machinery/gibber.dm @@ -107,10 +107,10 @@ do_hair_pull(user) -/obj/machinery/gibber/MouseDrop_T(atom/dropping, mob/user) +/obj/machinery/gibber/mouse_drop_receive(atom/dropped, mob/user, params) if(user.stat || user.restrained()) return - move_into_gibber(user, dropping) + move_into_gibber(user, dropped) /obj/machinery/gibber/proc/move_into_gibber(var/mob/user,var/mob/living/victim) diff --git a/code/modules/customitems/item_defines.dm b/code/modules/customitems/item_defines.dm index 029a7968892..7740c4db21c 100644 --- a/code/modules/customitems/item_defines.dm +++ b/code/modules/customitems/item_defines.dm @@ -425,21 +425,21 @@ All custom items with worn sprites must follow the contained sprite system: http else ..() -/obj/item/fluff/tokash_spear/MouseDrop(mob/user) - if((user == usr && (!(usr.restrained()) && (!(usr.stat) && (usr.contents.Find(src) || in_range(src, usr)))))) - if(!istype(usr, /mob/living/carbon/slime) && !istype(usr, /mob/living/simple_animal)) - if(!usr.get_active_hand()) // If active hand is empty. - var/mob/living/carbon/human/H = user +/obj/item/fluff/tokash_spear/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if((over == user && (!(user.restrained()) && (!(user.stat) && (user.contents.Find(src) || in_range(src, user)))))) + if(!istype(user, /mob/living/carbon/slime) && !istype(user, /mob/living/simple_animal)) + if(!user.get_active_hand()) // If active hand is empty. + var/mob/living/carbon/human/H = over var/obj/item/organ/external/temp = H.organs_by_name[BP_R_HAND] if(H.hand) temp = H.organs_by_name[BP_L_HAND] if(temp && !temp.is_usable()) - to_chat(user, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) + to_chat(H, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) return - to_chat(user, SPAN_NOTICE("You pick up \the [src].")) - user.put_in_hands(src) + to_chat(H, SPAN_NOTICE("You pick up \the [src].")) + H.put_in_hands(src) return /obj/item/fluff/tokash_spearhead @@ -830,11 +830,12 @@ All custom items with worn sprites must follow the contained sprite system: http to_chat(user, SPAN_NOTICE("You place \the [attacking_item] on \the [src].")) update_icon() -/obj/item/fluff/akinyi_stand/MouseDrop(mob/user as mob) - if((user == usr && (!use_check(user))) && (user.contents.Find(src) || in_range(src, user))) - if(ishuman(user)) - forceMove(get_turf(user)) - user.put_in_hands(src) +/obj/item/fluff/akinyi_stand/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if((over == user && (!use_check(over))) && (over.contents.Find(src) || in_range(src, over))) + if(ishuman(over)) + var/mob/living/carbon/human/H = over + forceMove(get_turf(H)) + H.put_in_hands(src) update_icon() /obj/item/fluff/akinyi_stand/attack_hand(mob/user) diff --git a/code/modules/detectivework/microscope/microscope.dm b/code/modules/detectivework/microscope/microscope.dm index e9f3097e5a0..8dd039f295d 100644 --- a/code/modules/detectivework/microscope/microscope.dm +++ b/code/modules/detectivework/microscope/microscope.dm @@ -174,9 +174,9 @@ /obj/machinery/microscope/AltClick() remove_sample(usr) -/obj/machinery/microscope/MouseDrop(var/atom/other) - if(usr == other) - remove_sample(usr) +/obj/machinery/microscope/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(over == user) + remove_sample(user) else return ..() diff --git a/code/modules/detectivework/tools/evidencebag.dm b/code/modules/detectivework/tools/evidencebag.dm index 78d961b15c1..0337611ea2d 100644 --- a/code/modules/detectivework/tools/evidencebag.dm +++ b/code/modules/detectivework/tools/evidencebag.dm @@ -15,32 +15,32 @@ . = ..() AddComponent(/datum/component/base_name, name) -/obj/item/evidencebag/MouseDrop(var/obj/item/I as obj) - if (!ishuman(usr)) +/obj/item/evidencebag/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + var/mob/living/carbon/human/human_user = user + var/obj/item/I = over + if(!istype(human_user) || !istype(I)) return - var/mob/living/carbon/human/user = usr - - if (!(user.l_hand == src || user.r_hand == src)) + if (!(human_user.l_hand == src || human_user.r_hand == src)) return //bag must be in your hands to use if (isturf(I.loc)) - if (!user.Adjacent(I)) + if (!human_user.Adjacent(I)) return else //If it isn't on the floor. Do some checks to see if it's in our hands or a box. Otherwise give up. if(istype(I.loc,/obj/item/storage)) //in a container. - var/sdepth = I.storage_depth(user) + var/sdepth = I.storage_depth(human_user) if (sdepth == -1 || sdepth > 1) return //too deeply nested to access var/obj/item/storage/U = I.loc - user.client.screen -= I + human_user.client.screen -= I U.contents.Remove(I) - else if(user.l_hand == I) //in a hand - user.drop_l_hand() - else if(user.r_hand == I) //in a hand - user.drop_r_hand() + else if(human_user.l_hand == I) //in a hand + human_user.drop_l_hand() + else if(human_user.r_hand == I) //in a hand + human_user.drop_r_hand() else return @@ -48,18 +48,18 @@ return if(istype(I, /obj/item/evidencebag)) - to_chat(user, SPAN_NOTICE("You find putting a plastic bag in another plastic bag to be slightly absurd and think better of it.")) + to_chat(human_user, SPAN_NOTICE("You find putting a plastic bag in another plastic bag to be slightly absurd and think better of it.")) return if(I.w_class > 3) - to_chat(user, SPAN_NOTICE("[I] won't fit in [src].")) + to_chat(human_user, SPAN_NOTICE("[I] won't fit in [src].")) return if(contents.len) - to_chat(user, SPAN_NOTICE("[src] already has something inside it.")) + to_chat(human_user, SPAN_NOTICE("[src] already has something inside it.")) return - user.visible_message("[user] puts \the [I] into \the [src].", SPAN_NOTICE("You put \the [I] inside \the [src]."),\ + human_user.visible_message("[human_user] puts \the [I] into \the [src].", SPAN_NOTICE("You put \the [I] inside \the [src]."),\ "You hear a rustle as someone puts something into a plastic bag.") store_item(I) diff --git a/code/modules/detectivework/tools/sample_kits.dm b/code/modules/detectivework/tools/sample_kits.dm index 0d3822b7a87..2285b55f331 100644 --- a/code/modules/detectivework/tools/sample_kits.dm +++ b/code/modules/detectivework/tools/sample_kits.dm @@ -189,10 +189,10 @@ return FALSE . = ..() -/obj/item/forensics/sample_kit/MouseDrop(atom/over) +/obj/item/forensics/sample_kit/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) var/mob/M = loc if(ismob(M) && (M.get_active_hand() == src || M.get_inactive_hand() == src)) - afterattack(over, usr, TRUE) + afterattack(over, user, TRUE) /obj/item/forensics/sample_kit/powder name = "fingerprint powder" diff --git a/code/modules/games/cards.dm b/code/modules/games/cards.dm index 809b9866acd..541bbb91d35 100644 --- a/code/modules/games/cards.dm +++ b/code/modules/games/cards.dm @@ -171,17 +171,20 @@ playsound(src.loc, 'sound/items/cardshuffle.ogg', 100, 1, -4) user.visible_message("\The [user] shuffles [src].") -/obj/item/deck/MouseDrop(atom/over) - if(!usr || !over) return - if(!Adjacent(usr) || !over.Adjacent(usr)) return // should stop you from dragging through windows +/obj/item/deck/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(!user || !over) + return + if(!Adjacent(user) || !over.Adjacent(user)) + return // should stop you from dragging through windows - if(!ishuman(over) || !(over in viewers(3))) return - - if(!cards.len) - to_chat(usr, SPAN_WARNING("There are no cards in the deck.")) + if(!ishuman(over) || !(over in viewers(3))) return - deal_at(usr, over) + if(!cards.len) + to_chat(user, SPAN_WARNING("There are no cards in the deck.")) + return + + deal_at(user, over) /obj/item/pack/ name = "card pack" diff --git a/code/modules/heavy_vehicle/components/body.dm b/code/modules/heavy_vehicle/components/body.dm index 1cb8591c364..dcfee399413 100644 --- a/code/modules/heavy_vehicle/components/body.dm +++ b/code/modules/heavy_vehicle/components/body.dm @@ -147,8 +147,8 @@ else return ..() -/obj/item/mech_component/chassis/MouseDrop_T(atom/dropping, mob/user) - var/obj/machinery/portable_atmospherics/canister/C = dropping +/obj/item/mech_component/chassis/mouse_drop_receive(atom/dropped, mob/user, params) + var/obj/machinery/portable_atmospherics/canister/C = dropped if(istype(C) && do_after(user, 5, src)) to_chat(user, SPAN_NOTICE("You install the canister into \the [src].")) if(air_supply) diff --git a/code/modules/heavy_vehicle/interface/screen_objects.dm b/code/modules/heavy_vehicle/interface/screen_objects.dm index 34d9338925d..eaf4a400e70 100644 --- a/code/modules/heavy_vehicle/interface/screen_objects.dm +++ b/code/modules/heavy_vehicle/interface/screen_objects.dm @@ -50,9 +50,10 @@ hardpoint_tag = null . = ..() -/atom/movable/screen/mecha/hardpoint/MouseDrop() +/atom/movable/screen/mecha/hardpoint/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) ..() - if(holding) holding.screen_loc = screen_loc + if(holding) + holding.screen_loc = screen_loc /atom/movable/screen/mecha/hardpoint/proc/update_system_info() // No point drawing it if we have no item to use or nobody to see it. diff --git a/code/modules/heavy_vehicle/mech_interaction.dm b/code/modules/heavy_vehicle/mech_interaction.dm index 5374e1e35de..0cc3676b6ff 100644 --- a/code/modules/heavy_vehicle/mech_interaction.dm +++ b/code/modules/heavy_vehicle/mech_interaction.dm @@ -1,19 +1,19 @@ -/mob/living/MouseDrop(atom/over) - if(usr == src && usr != over) +/mob/living/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(user == src && user != over) if(istype(over, /mob/living/heavy_vehicle)) - if(usr.mob_size >= MOB_SMALL && usr.mob_size <= 14) + if(user.mob_size >= MOB_SMALL && user.mob_size <= 14) var/mob/living/heavy_vehicle/M = over if(M.enter(src)) return else - to_chat(usr, SPAN_WARNING("You cannot pilot a mech of this size.")) + to_chat(user, SPAN_WARNING("You cannot pilot a mech of this size.")) return return ..() -/mob/living/heavy_vehicle/MouseDrop_T(atom/dropping, mob/user) - var/obj/machinery/portable_atmospherics/canister/C = dropping +/mob/living/heavy_vehicle/mouse_drop_receive(atom/dropped, mob/user, params) + var/obj/machinery/portable_atmospherics/canister/C = dropped if(istype(C)) - body.MouseDrop_T(dropping, user) + body.mouse_drop_receive(arglist(args)) else . = ..() /mob/living/heavy_vehicle/ClickOn(var/atom/A, params, var/mob/user) diff --git a/code/modules/mob/abstract/ghost/observer/observer.dm b/code/modules/mob/abstract/ghost/observer/observer.dm index be0cb2a65ff..0b0dec58d61 100644 --- a/code/modules/mob/abstract/ghost/observer/observer.dm +++ b/code/modules/mob/abstract/ghost/observer/observer.dm @@ -335,15 +335,16 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp to_chat(src, SPAN_WARNING("You are dead! You have no mind to store memory!")) //This is called when a ghost is drag clicked to something. -/mob/abstract/ghost/observer/MouseDrop(atom/over) - if(!usr || !over) return - if(isobserver(usr) && usr.client && isliving(over)) +/mob/abstract/ghost/observer/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(!user || !over) + return + if(isobserver(user) && user.client && isliving(over)) var/mob/living/M = over // If they an admin, see if control can be resolved. - if(usr.client.holder && usr.client.holder.cmd_ghost_drag(src,M)) + if(user.client.holder && user.client.holder.cmd_ghost_drag(src, M)) return // Otherwise, see if we can possess the target. - if(usr == src && try_possession(M)) + if(user == src && try_possession(M)) return if(istype(over, /obj/machinery/drone_fabricator)) var/obj/machinery/drone_fabricator/fab = over diff --git a/code/modules/mob/living/carbon/alien/diona/diona_attacks.dm b/code/modules/mob/living/carbon/alien/diona/diona_attacks.dm index 5055874374a..84896ea6de2 100644 --- a/code/modules/mob/living/carbon/alien/diona/diona_attacks.dm +++ b/code/modules/mob/living/carbon/alien/diona/diona_attacks.dm @@ -9,8 +9,8 @@ ..() //#TODO-MERGE: Test nymph hats -/mob/living/carbon/alien/diona/MouseDrop(atom/over_object) - var/mob/living/carbon/H = over_object +/mob/living/carbon/alien/diona/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + var/mob/living/carbon/H = over if(!istype(H) || !Adjacent(H)) return ..() if(H.a_intent == I_HELP) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 3c23265a81b..269f2a78d0e 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -1884,11 +1884,11 @@ return FALSE return TRUE -/mob/living/carbon/human/MouseDrop(var/atom/over_object) - if(ishuman(over_object)) - var/mob/living/carbon/human/H = over_object +/mob/living/carbon/human/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(ishuman(over)) + var/mob/living/carbon/human/H = over if(holder_type && istype(H) && H.a_intent == I_HELP && !H.lying && !issmall(H) && Adjacent(H)) - get_scooped(H, (usr == src)) + get_scooped(H, (user == src)) return return ..() diff --git a/code/modules/mob/living/carbon/slime/slime_extractor.dm b/code/modules/mob/living/carbon/slime/slime_extractor.dm index 34bb3538469..22224576dc5 100644 --- a/code/modules/mob/living/carbon/slime/slime_extractor.dm +++ b/code/modules/mob/living/carbon/slime/slime_extractor.dm @@ -62,12 +62,12 @@ if(default_part_replacement(user, attacking_item)) return -/obj/machinery/slime_extractor/MouseDrop_T(atom/dropping, mob/user) +/obj/machinery/slime_extractor/mouse_drop_receive(atom/dropped, mob/user, params) if(!Adjacent(user)) to_chat(user, SPAN_WARNING("You can't reach \the [src]!")) return - if(isslime(dropping)) - var/mob/living/carbon/slime/slimey = dropping + if(isslime(dropped)) + var/mob/living/carbon/slime/slimey = dropped if(length(extract_slimes) >= slime_limit) to_chat(user, SPAN_WARNING("\The [src] is fully loaded!")) return diff --git a/code/modules/mob/living/silicon/pai/pai.dm b/code/modules/mob/living/silicon/pai/pai.dm index 24c8759ae22..4223842188e 100644 --- a/code/modules/mob/living/silicon/pai/pai.dm +++ b/code/modules/mob/living/silicon/pai/pai.dm @@ -514,10 +514,12 @@ post_scoop() return H -/mob/living/silicon/pai/MouseDrop(atom/over_object) - var/mob/living/carbon/H = over_object - if(!istype(H) || !Adjacent(H)) return ..() - get_scooped(H, usr) +/mob/living/silicon/pai/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + var/mob/living/carbon/H = over + if(!istype(H) || !Adjacent(H)) + return ..() + + get_scooped(H, user) /mob/living/silicon/pai/start_pulling(var/atom/movable/AM) if(istype(AM,/obj/item)) diff --git a/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm b/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm index 06f42942eb7..902269b691b 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_abilities.dm @@ -19,8 +19,8 @@ to_chat(src, SPAN_NOTICE("\The [D] acknowledges your signal.")) D.flush_count = D.flush_every_ticks -/mob/living/silicon/robot/drone/MouseDrop(atom/over_object) - var/mob/living/carbon/H = over_object +/mob/living/silicon/robot/drone/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + var/mob/living/carbon/H = over if(!istype(H) || !Adjacent(H)) return ..() if(H.a_intent == "help") diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm index 3aaf471abd8..e99fd82b975 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -910,13 +910,13 @@ gib() /// For picking up small animals -/mob/living/simple_animal/MouseDrop(atom/over_object) +/mob/living/simple_animal/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if (holder_type)//we need a defined holder type in order for picking up to work - var/mob/living/carbon/H = over_object + var/mob/living/carbon/H = over if(!istype(H) || !Adjacent(H)) return ..() - get_scooped(H, usr) + get_scooped(H, user) return return ..() diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 0ec7edf8f61..14b02a4014d 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -698,13 +698,20 @@ return 1 return 0 -/mob/MouseDrop(mob/M as mob) +/mob/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) ..() - if(M != usr) return - if(usr == src) return - if(!Adjacent(usr)) return - if(istype(M,/mob/living/silicon/ai)) return - show_inv(usr) + var/mob/M = over + if(M != user) + return + if(user == src) + return + if(!Adjacent(user)) + return + + if(istype(M,/mob/living/silicon/ai)) + return + + show_inv(user) /mob/verb/stop_pulling() diff --git a/code/modules/mob/mob_grab.dm b/code/modules/mob/mob_grab.dm index 665a493e377..80148f0cefd 100644 --- a/code/modules/mob/mob_grab.dm +++ b/code/modules/mob/mob_grab.dm @@ -431,7 +431,8 @@ destroying = 1 // stops us calling qdel(src) on dropped() return ..() -/obj/item/grab/MouseDrop(mob/living/carbon/human/H) +/obj/item/grab/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + var/mob/living/carbon/human/H = affecting if(wielded || affecting.buckled_to || !istype(H) || assailant != H || H.get_active_hand() != src) return if(!ishuman(affecting)) diff --git a/code/modules/modular_computers/computers/modular_computer/interaction.dm b/code/modules/modular_computers/computers/modular_computer/interaction.dm index 62587d59408..3687434d7cb 100644 --- a/code/modules/modular_computers/computers/modular_computer/interaction.dm +++ b/code/modules/modular_computers/computers/modular_computer/interaction.dm @@ -323,13 +323,13 @@ return TRUE return ..() -/obj/item/modular_computer/MouseDrop(atom/over_object) - var/mob/M = usr +/obj/item/modular_computer/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + var/mob/M = user if(use_check_and_message(M)) return - if(istype(over_object, /obj/machinery/power/apc) && tesla_link) - return over_object.attackby(src, M) - if(!istype(over_object, /atom/movable/screen) && !(over_object == src)) + if(istype(over, /obj/machinery/power/apc) && tesla_link) + return over.attackby(src, M) + if(!istype(over, /atom/movable/screen) && !(over == src)) return attack_self(M) /obj/item/modular_computer/GetID() diff --git a/code/modules/modular_computers/computers/subtypes/dev_wristbound.dm b/code/modules/modular_computers/computers/subtypes/dev_wristbound.dm index ee6fb32a7a7..46dfae05060 100644 --- a/code/modules/modular_computers/computers/subtypes/dev_wristbound.dm +++ b/code/modules/modular_computers/computers/subtypes/dev_wristbound.dm @@ -25,31 +25,31 @@ return attack_self(user) ..() -/obj/item/modular_computer/handheld/wristbound/MouseDrop(obj/over_object) +/obj/item/modular_computer/handheld/wristbound/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if(!canremove) return - if(!over_object || over_object == src) + if(!over || over == src) return - if(istype(over_object, /atom/movable/screen/inventory)) - var/atom/movable/screen/inventory/S = over_object + if(istype(over, /atom/movable/screen/inventory)) + var/atom/movable/screen/inventory/S = over if(S.slot_id == equip_slot) return - if(ishuman(usr)) - if(!(istype(over_object, /atom/movable/screen))) + if(ishuman(user)) + if(!(istype(over, /atom/movable/screen))) return ..() - if(!(loc == usr) || (loc && loc.loc == usr)) + if(!(loc == user) || (loc && loc.loc == user)) return - if(use_check_and_message(usr)) + if(use_check_and_message(user)) return - if((loc == usr) && !usr.unEquip(src)) + if((loc == user) && !user.unEquip(src)) return - switch(over_object.name) + switch(over.name) if("right hand") - usr.u_equip(src) - usr.equip_to_slot_if_possible(src, slot_r_hand) + user.u_equip(src) + user.equip_to_slot_if_possible(src, slot_r_hand) if("left hand") - usr.u_equip(src) - usr.equip_to_slot_if_possible(src, slot_l_hand) - add_fingerprint(usr) + user.u_equip(src) + user.equip_to_slot_if_possible(src, slot_l_hand) + add_fingerprint(user) diff --git a/code/modules/multiz/hoist.dm b/code/modules/multiz/hoist.dm index 3de543b829e..ad69550c52a 100644 --- a/code/modules/multiz/hoist.dm +++ b/code/modules/multiz/hoist.dm @@ -34,8 +34,8 @@ user.visible_message(SPAN_NOTICE("[user] detaches \the [source_hoist.hoistee] from the hoist clamp."), SPAN_NOTICE("You detach \the [source_hoist.hoistee] from the hoist clamp."), SPAN_NOTICE("You hear something unclamp.")) source_hoist.release_hoistee() -/obj/effect/hoist_hook/MouseDrop_T(atom/dropping, mob/user) - var/atom/movable/AM = dropping +/obj/effect/hoist_hook/mouse_drop_receive(atom/dropped, mob/user, params) + var/atom/movable/AM = dropped if(!istype(AM)) return @@ -63,25 +63,26 @@ AM.anchored = TRUE source_hook.layer = AM.layer + 0.1 -/obj/effect/hoist_hook/MouseDrop(atom/dest) +/obj/effect/hoist_hook/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) ..() - if(!dest.Adjacent(usr)) return // carried over from the default proc + if(!over.Adjacent(user)) + return // carried over from the default proc - if(use_check_and_message(usr, USE_DISALLOW_SILICONS)) + if(use_check_and_message(user, USE_DISALLOW_SILICONS)) return if (!source_hoist.hoistee) return - if (!isturf(dest)) + if (!isturf(over)) return - if (!dest.Adjacent(source_hoist.hoistee)) + if (!over.Adjacent(source_hoist.hoistee)) return source_hoist.check_consistency() - var/turf/desturf = dest + var/turf/desturf = over source_hoist.hoistee.forceMove(desturf) - usr.visible_message(SPAN_NOTICE("[usr] detaches \the [source_hoist.hoistee] from the hoist clamp."), SPAN_NOTICE("You detach \the [source_hoist.hoistee] from the hoist clamp."), SPAN_NOTICE("You hear something unclamp.")) + user.visible_message(SPAN_NOTICE("[user] detaches \the [source_hoist.hoistee] from the hoist clamp."), SPAN_NOTICE("You detach \the [source_hoist.hoistee] from the hoist clamp."), SPAN_NOTICE("You hear something unclamp.")) source_hoist.release_hoistee() // This will handle mobs unbuckling themselves. diff --git a/code/modules/paperwork/clipboard.dm b/code/modules/paperwork/clipboard.dm index 90c37cf26ac..62d3b5f2cdc 100644 --- a/code/modules/paperwork/clipboard.dm +++ b/code/modules/paperwork/clipboard.dm @@ -19,14 +19,14 @@ . = ..() update_icon() -/obj/item/clipboard/MouseDrop(obj/over_object as obj) //Quick clipboard fix. -Agouri - if(ishuman(usr)) - var/mob/M = usr - if(!(istype(over_object, /atom/movable/screen) )) +/obj/item/clipboard/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(ishuman(user)) + var/mob/M = user + if(!(istype(over, /atom/movable/screen) )) return ..() if(!M.restrained() && !M.stat) - switch(over_object.name) + switch(over.name) if("right hand") M.u_equip(src) M.equip_to_slot_if_possible(src, slot_r_hand) @@ -34,7 +34,7 @@ M.u_equip(src) M.equip_to_slot_if_possible(src, slot_l_hand) - add_fingerprint(usr) + add_fingerprint(M) return /obj/item/clipboard/update_icon() diff --git a/code/modules/paperwork/paperbin.dm b/code/modules/paperwork/paperbin.dm index 5d742c2ee81..1e72e8c505e 100644 --- a/code/modules/paperwork/paperbin.dm +++ b/code/modules/paperwork/paperbin.dm @@ -14,21 +14,21 @@ var/list/papers = new/list() //List of papers put in the bin for reference. -/obj/item/paper_bin/MouseDrop(mob/user as mob) - if((user == usr && (!( usr.restrained() ) && (!( usr.stat ) && (usr.contents.Find(src) || in_range(src, usr)))))) - if(!istype(usr, /mob/living/carbon/slime) && !istype(usr, /mob/living/simple_animal)) - if( !usr.get_active_hand() ) //if active hand is empty - var/mob/living/carbon/human/H = user +/obj/item/paper_bin/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if((over == user && (!( user.restrained() ) && (!( user.stat ) && (user.contents.Find(src) || in_range(src, user)))))) + if(!istype(user, /mob/living/carbon/slime) && !istype(user, /mob/living/simple_animal)) + if( !user.get_active_hand() ) //if active hand is empty + var/mob/living/carbon/human/H = over var/obj/item/organ/external/temp = H.organs_by_name[BP_R_HAND] if (H.hand) temp = H.organs_by_name[BP_L_HAND] if(temp && !temp.is_usable()) - to_chat(user, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) + to_chat(H, SPAN_NOTICE("You try to move your [temp.name], but cannot!")) return - to_chat(user, SPAN_NOTICE("You pick up the [src].")) - user.put_in_hands(src) + to_chat(H, SPAN_NOTICE("You pick up the [src].")) + H.put_in_hands(src) return diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm index 9af03f2b15e..d63c0ca3d62 100644 --- a/code/modules/paperwork/photography.dm +++ b/code/modules/paperwork/photography.dm @@ -109,27 +109,27 @@ var/global/photo_count = 0 item_state = "briefcase" can_hold = list(/obj/item/photo) -/obj/item/storage/photo_album/MouseDrop(obj/over_object as obj) +/obj/item/storage/photo_album/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) - if((istype(usr, /mob/living/carbon/human))) - var/mob/M = usr - if(!( istype(over_object, /atom/movable/screen) )) + if((istype(user, /mob/living/carbon/human))) + var/mob/M = user + if(!( istype(over, /atom/movable/screen) )) return ..() playsound(loc, /singleton/sound_category/rustle_sound, 50, 1, -5) if((!( M.restrained() ) && !( M.stat ) && M.back == src)) - switch(over_object.name) + switch(over.name) if("right hand") M.u_equip(src) M.equip_to_slot_if_possible(src, slot_r_hand) if("left hand") M.u_equip(src) M.equip_to_slot_if_possible(src, slot_l_hand) - add_fingerprint(usr) + add_fingerprint(user) return - if(over_object == usr && in_range(src, usr) || usr.contents.Find(src)) - if(usr.s_active) - usr.s_active.close(usr) - show_to(usr) + if(over == user && in_range(src, user) || user.contents.Find(src)) + if(user.s_active) + user.s_active.close(user) + show_to(user) return return diff --git a/code/modules/paperwork/typewriter.dm b/code/modules/paperwork/typewriter.dm index 1dd6f343046..a1e9d45d230 100644 --- a/code/modules/paperwork/typewriter.dm +++ b/code/modules/paperwork/typewriter.dm @@ -55,15 +55,16 @@ else . = ..() -/obj/item/portable_typewriter/MouseDrop(mob/user as mob) - if(use_check_and_message(user)) +/obj/item/portable_typewriter/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + var/mob/mob_dropped_over = over + if(use_check_and_message(mob_dropped_over)) return - if(((user.contents.Find(src) || in_range(src, user)))) + if(((mob_dropped_over.contents.Find(src) || in_range(src, mob_dropped_over)))) if(isnull(stored_paper)) - to_chat(user, SPAN_ALERT("\The [src] has no paper fed for typing!")) + to_chat(mob_dropped_over, SPAN_ALERT("\The [src] has no paper fed for typing!")) else - stored_paper.attackby(pen, user) + stored_paper.attackby(pen, mob_dropped_over) return /obj/item/portable_typewriter/update_icon() @@ -179,8 +180,8 @@ to_chat(user, SPAN_ALERT("\The [src] is currently closed!")) return -/obj/item/typewriter_case/MouseDrop(mob/user as mob) - attack_self(user) +/obj/item/typewriter_case/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + attack_self(over) /obj/item/typewriter_case/attackby(obj/item/attacking_item, mob/user, params) if(istype(attacking_item, /obj/item/portable_typewriter)) diff --git a/code/modules/power/fusion/fuel_assembly/fuel_compressor.dm b/code/modules/power/fusion/fuel_assembly/fuel_compressor.dm index 7d9a3da4644..299d844995a 100644 --- a/code/modules/power/fusion/fuel_assembly/fuel_compressor.dm +++ b/code/modules/power/fusion/fuel_assembly/fuel_compressor.dm @@ -11,10 +11,10 @@ anchored = TRUE layer = 4 -/obj/machinery/fusion_fuel_compressor/MouseDrop_T(atom/dropping, mob/user) +/obj/machinery/fusion_fuel_compressor/mouse_drop_receive(atom/dropped, mob/user, params) if(user.incapacitated() || !user.Adjacent(src)) return - return do_fuel_compression(dropping, user) + return do_fuel_compression(dropped, user) /obj/machinery/fusion_fuel_compressor/attackby(obj/item/attacking_item, mob/user) return do_fuel_compression(attacking_item, user) || ..() diff --git a/code/modules/projectiles/guns/energy.dm b/code/modules/projectiles/guns/energy.dm index 68f0c705206..c417a866561 100644 --- a/code/modules/projectiles/guns/energy.dm +++ b/code/modules/projectiles/guns/energy.dm @@ -217,7 +217,7 @@ self_recharge = initial(self_recharge) use_external_power = initial(use_external_power) -/obj/item/gun/energy/MouseDrop(atom/over) +/obj/item/gun/energy/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm index e3cdea96f23..69b3000d567 100644 --- a/code/modules/reagents/Chemistry-Machinery.dm +++ b/code/modules/reagents/Chemistry-Machinery.dm @@ -578,8 +578,8 @@ updateUsrDialog() -/obj/machinery/reagentgrinder/MouseDrop_T(atom/dropping, mob/user) - var/mob/living/carbon/human/target = dropping +/obj/machinery/reagentgrinder/mouse_drop_receive(atom/dropped, mob/user, params) + var/mob/living/carbon/human/target = dropped if (!istype(target) || target.buckled_to || get_dist(user, src) > 1 || get_dist(user, target) > 1 || user.stat || istype(user, /mob/living/silicon/ai)) return if(target == user) diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index e07917b9e74..4c59231ee1c 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -282,7 +282,7 @@ feed_sound(user) return 1 -/obj/item/reagent_containers/MouseDrop(atom/over, src_location, over_location, src_control, over_control, params) +/obj/item/reagent_containers/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) . = ..() if(ishuman(over)) var/mob/living/carbon/human/H = over diff --git a/code/modules/reagents/reagent_containers/blood_pack.dm b/code/modules/reagents/reagent_containers/blood_pack.dm index 5c1ba8e909d..80d44089df7 100644 --- a/code/modules/reagents/reagent_containers/blood_pack.dm +++ b/code/modules/reagents/reagent_containers/blood_pack.dm @@ -97,20 +97,20 @@ else ..() -/obj/item/reagent_containers/blood/MouseDrop(over_object, src_location, over_location) +/obj/item/reagent_containers/blood/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if(!ismob(loc)) return var/turf/our_turf = get_turf(src) - var/turf/target_turf = get_turf(over_object) + var/turf/target_turf = get_turf(over) if(!our_turf.Adjacent(target_turf)) return if(attached_mob) remove_iv_mob() - else if(ishuman(over_object)) - visible_message(SPAN_WARNING("\The [usr] starts hooking \the [over_object] up to \the [src].")) - if(do_after(usr, 30)) - to_chat(usr, SPAN_NOTICE("You hook \the [over_object] up to \the [src].")) - attached_mob = WEAKREF(over_object) + else if(ishuman(over)) + visible_message(SPAN_WARNING("\The [user] starts hooking \the [over] up to \the [src].")) + if(do_after(user, 30)) + to_chat(user, SPAN_NOTICE("You hook \the [over] up to \the [src].")) + attached_mob = WEAKREF(over) START_PROCESSING(SSprocessing, src) update_icon() diff --git a/code/modules/reagents/reagent_containers/food/drinks/yoke.dm b/code/modules/reagents/reagent_containers/food/drinks/yoke.dm index 0ab4de7c908..cc699579d00 100644 --- a/code/modules/reagents/reagent_containers/food/drinks/yoke.dm +++ b/code/modules/reagents/reagent_containers/food/drinks/yoke.dm @@ -36,11 +36,12 @@ can.pixel_y = positions[2] underlays += can -/obj/item/storage/box/fancy/yoke/MouseDrop(mob/user) - if(use_check_and_message(user)) +/obj/item/storage/box/fancy/yoke/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + var/mob/mob_dropped_over = over + if(use_check_and_message(mob_dropped_over)) return - to_chat(user, SPAN_NOTICE("You pick up \the [src].")) - user.put_in_hands(src) + to_chat(mob_dropped_over, SPAN_NOTICE("You pick up \the [src].")) + mob_dropped_over.put_in_hands(src) /obj/item/storage/box/fancy/yoke/attack_hand(mob/user) if(!length(contents)) // no more cans, continue as normal diff --git a/code/modules/reagents/reagent_containers/food/snacks/cultural/human.dm b/code/modules/reagents/reagent_containers/food/snacks/cultural/human.dm index 896aebb0f0c..d084033327e 100644 --- a/code/modules/reagents/reagent_containers/food/snacks/cultural/human.dm +++ b/code/modules/reagents/reagent_containers/food/snacks/cultural/human.dm @@ -574,11 +574,13 @@ ABSTRACT_TYPE(/obj/item/reagent_containers/food/snacks/bowl) user.put_in_hands(waste) qdel(src) -/obj/item/reagent_containers/food/snacks/bowl/MouseDrop(mob/user) //Dropping the bowl of food onto the user - if(istype(user) && !use_check_and_message(user)) - user.put_in_active_hand(src) - src.pickup(user) +/obj/item/reagent_containers/food/snacks/bowl/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) //Dropping the bowl of food onto the user + var/mob/mob_dropped_over = over + if(istype(mob_dropped_over) && !use_check_and_message(mob_dropped_over)) + mob_dropped_over.put_in_active_hand(src) + src.pickup(mob_dropped_over) return + . = ..() /obj/item/reagent_containers/food/snacks/bowl/puffpuffs/update_icon() diff --git a/code/modules/reagents/reagent_containers/food/snacks/mexican.dm b/code/modules/reagents/reagent_containers/food/snacks/mexican.dm index 359c977d151..87144292085 100644 --- a/code/modules/reagents/reagent_containers/food/snacks/mexican.dm +++ b/code/modules/reagents/reagent_containers/food/snacks/mexican.dm @@ -208,11 +208,13 @@ user.put_in_hands(waste) qdel(src) -/obj/item/reagent_containers/food/snacks/chipplate/MouseDrop(mob/user) //Dropping the chip onto the user - if(istype(user) && user == usr) - user.put_in_active_hand(src) - src.pickup(user) +/obj/item/reagent_containers/food/snacks/chipplate/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) //Dropping the chip onto the user + var/mob/mob_dropped_over = over + if(istype(mob_dropped_over) && user == user) + mob_dropped_over.put_in_active_hand(src) + src.pickup(mob_dropped_over) return + . = ..() /obj/item/reagent_containers/food/snacks/chipplate/nachos diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index ec7a6478e94..7e5bee9af39 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -246,8 +246,11 @@ // mouse drop another mob or self // -/obj/machinery/disposal/MouseDrop_T(atom/dropping, mob/user) - var/mob/target = dropping +/obj/machinery/disposal/mouse_drop_receive(atom/dropped, mob/user, params) + var/mob/target = dropped + if(!istype(target)) + return + if(user.stat || !user.canmove || !istype(target)) return if(target.buckled_to || get_dist(user, src) > 1 || get_dist(user, target) > 1) @@ -304,7 +307,6 @@ C.show_message(msg, 3) update() - return /obj/machinery/disposal/proc/check_mob_size(mob/target) return 1 diff --git a/code/modules/research/xenoarchaeology/tools/anomaly_container.dm b/code/modules/research/xenoarchaeology/tools/anomaly_container.dm index 6a45fddc564..1b44b5e1c09 100644 --- a/code/modules/research/xenoarchaeology/tools/anomaly_container.dm +++ b/code/modules/research/xenoarchaeology/tools/anomaly_container.dm @@ -41,7 +41,7 @@ underlays.Cut() desc = initial(desc) -/obj/machinery/artifact/MouseDrop(atom/over) +/obj/machinery/artifact/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if(istype(over, /obj/structure/anomaly_container)) var/obj/structure/anomaly_container/box = over box.contain(src) diff --git a/code/modules/tables/interactions.dm b/code/modules/tables/interactions.dm index bfaecdee5cf..56a7caf74d1 100644 --- a/code/modules/tables/interactions.dm +++ b/code/modules/tables/interactions.dm @@ -132,23 +132,23 @@ throw_things(user) LAZYREMOVE(climbers, user) -/obj/structure/table/MouseDrop_T(atom/dropping, mob/user, params) - var/obj/item/stack/material/what = dropping +/obj/structure/table/mouse_drop_receive(atom/dropped, mob/user, params) + var/obj/item/stack/material/what = dropped if(can_reinforce && isliving(usr) && (!usr.stat) && istype(what) && usr.get_active_hand() == what && Adjacent(usr)) reinforce_table(what, usr) return - if(ismob(dropping.loc)) //If placing an item - if(!isitem(dropping) || user.get_active_hand() != dropping) + if(ismob(dropped.loc)) //If placing an item + if(!isitem(dropped) || user.get_active_hand() != dropped) return ..() if(isrobot(user)) return user.drop_item() - if(dropping.loc != src.loc) - step(dropping, get_dir(dropping, src)) + if(dropped.loc != src.loc) + step(dropped, get_dir(dropped, src)) - else if(isturf(dropping.loc) && isitem(dropping)) //If pushing an item on the tabletop - var/obj/item/I = dropping + else if(isturf(dropped.loc) && isitem(dropped)) //If pushing an item on the tabletop + var/obj/item/I = dropped if(I.anchored) return diff --git a/code/modules/vehicles/animal.dm b/code/modules/vehicles/animal.dm index 49ce0947b9a..647ea032fc7 100644 --- a/code/modules/vehicles/animal.dm +++ b/code/modules/vehicles/animal.dm @@ -54,20 +54,20 @@ return FALSE return ..(M) -/obj/vehicle/animal/MouseDrop(atom/over) - if(use_check_and_message(usr)) - return - - if(usr == over && ishuman(over)) - var/mob/living/carbon/human/H = over - storage_compartment.open(H) - -/obj/vehicle/animal/MouseDrop_T(atom/dropping, mob/user) +/obj/vehicle/animal/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) if(use_check_and_message(user)) return - if(!load(dropping)) - to_chat(user, SPAN_WARNING("You were unable to load \the [dropping] onto \the [src].")) + if(user == over && ishuman(over)) + var/mob/living/carbon/human/H = over + storage_compartment.open(H) + +/obj/vehicle/animal/mouse_drop_receive(atom/dropped, mob/user, params) + if(use_check_and_message(user)) + return + + if(!load(dropped)) + to_chat(user, SPAN_WARNING("You were unable to load \the [dropped] onto \the [src].")) return /obj/vehicle/animal/attack_hand(var/mob/user as mob) diff --git a/code/modules/vehicles/bike.dm b/code/modules/vehicles/bike.dm index 92b2d912e78..5360bc3b645 100644 --- a/code/modules/vehicles/bike.dm +++ b/code/modules/vehicles/bike.dm @@ -151,14 +151,14 @@ return 0 return ..(M) -/obj/vehicle/bike/MouseDrop(atom/over) - if(usr == over && ishuman(over)) +/obj/vehicle/bike/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) + if(user == over && ishuman(over)) var/mob/living/carbon/human/H = over storage_compartment.open(H) -/obj/vehicle/bike/MouseDrop_T(atom/dropping, mob/user) - if(!load(dropping)) - to_chat(user, SPAN_WARNING("You were unable to load \the [dropping] onto \the [src].")) +/obj/vehicle/bike/mouse_drop_receive(atom/dropped, mob/user, params) + if(!load(dropped)) + to_chat(user, SPAN_WARNING("You were unable to load \the [dropped] onto \the [src].")) return /obj/vehicle/bike/attack_hand(var/mob/user as mob) diff --git a/code/modules/vehicles/droppod.dm b/code/modules/vehicles/droppod.dm index 8e96cc8a64e..da904e268a8 100644 --- a/code/modules/vehicles/droppod.dm +++ b/code/modules/vehicles/droppod.dm @@ -32,10 +32,10 @@ desc = "A high-tech titanium pod, capable of transporting its passenger right into the action at considerable ranges. The metal foam dispensers lining the top prevent most hull breaches on station ingress." icon_state = "syndie_pod" -/obj/vehicle/droppod/MouseDrop() +/obj/vehicle/droppod/mouse_drop_dragged(atom/over, mob/user, src_location, over_location, params) return -/obj/vehicle/droppod/MouseDrop_T() +/obj/vehicle/droppod/mouse_drop_receive(atom/dropped, mob/user, params) return /obj/vehicle/droppod/emag_act() diff --git a/code/modules/vehicles/train.dm b/code/modules/vehicles/train.dm index 59114bfac3c..c8f28502063 100644 --- a/code/modules/vehicles/train.dm +++ b/code/modules/vehicles/train.dm @@ -84,14 +84,14 @@ // Interaction procs //------------------------------------------- -/obj/vehicle/train/MouseDrop_T(atom/dropping, mob/user) +/obj/vehicle/train/mouse_drop_receive(atom/dropped, mob/user, params) if(use_check_and_message(user)) return - if(istype(dropping, /obj/vehicle/train)) - latch(dropping, user) + if(istype(dropped, /obj/vehicle/train)) + latch(dropped, user) else - if(!load(dropping)) - to_chat(user, SPAN_WARNING("You were unable to load \the [dropping] on \the [src].")) + if(!load(dropped)) + to_chat(user, SPAN_WARNING("You were unable to load \the [dropped] on \the [src].")) /obj/vehicle/train/attack_hand(mob/user as mob) if(use_check_and_message(user)) diff --git a/code/modules/vehicles/unicycle.dm b/code/modules/vehicles/unicycle.dm index 2f525d199da..e51e1e0a83f 100644 --- a/code/modules/vehicles/unicycle.dm +++ b/code/modules/vehicles/unicycle.dm @@ -29,9 +29,9 @@ return 0 return ..(M) -/obj/vehicle/unicycle/MouseDrop_T(atom/dropping, mob/user) - if(!load(dropping)) - to_chat(user, SPAN_WARNING("You were unable to load \the [dropping] onto \the [src].")) +/obj/vehicle/unicycle/mouse_drop_receive(atom/dropped, mob/user, params) + if(!load(dropped)) + to_chat(user, SPAN_WARNING("You were unable to load \the [dropped] onto \the [src].")) return /obj/vehicle/unicycle/attack_hand(var/mob/user as mob) diff --git a/html/changelogs/fluffyghost_updatemousedrag.yml b/html/changelogs/fluffyghost_updatemousedrag.yml new file mode 100644 index 00000000000..1f135e5d2c1 --- /dev/null +++ b/html/changelogs/fluffyghost_updatemousedrag.yml @@ -0,0 +1,59 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# - (fixes bugs) +# wip +# - (work in progress) +# qol +# - (quality of life) +# soundadd +# - (adds a sound) +# sounddel +# - (removes a sound) +# rscadd +# - (adds a feature) +# rscdel +# - (removes a feature) +# imageadd +# - (adds an image or sprite) +# imagedel +# - (removes an image or sprite) +# spellcheck +# - (fixes spelling or grammar) +# experiment +# - (experimental change) +# balance +# - (balance changes) +# code_imp +# - (misc internal code change) +# refactor +# - (refactors code) +# config +# - (makes a change to the config files) +# admin +# - (makes changes to administrator tools) +# server +# - (miscellaneous changes to server) +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, this gets changed to [] after reading. Just remove the brackets when you add new shit. +# Please surround your changes in double quotes ("). It works without them, but if you use certain characters it screws up compiling. The quotes will not show up in the changelog. +changes: + - refactor: "Refactored mousedrag procs, added signals, some safeguards, did some cleanups around, renamed them to make a little more sense. Mostly put in line with TG's code." + - rscadd: "Fast clicking and releasing with a drag, depending on the grace period and how fast it is done, can be counted as clicks, to aid in combat scenarios where you spamclick."