diff --git a/code/_onclick/click.dm b/code/_onclick/click.dm index 117c8e162d6..1d7e07f7b99 100644 --- a/code/_onclick/click.dm +++ b/code/_onclick/click.dm @@ -197,7 +197,7 @@ * A backwards depth-limited breadth-first-search to see if the target is * logically "in" anything adjacent to us. */ -/atom/movable/proc/CanReach(atom/ultimate_target, obj/item/tool, view_only = FALSE) +/atom/proc/CanReach(atom/ultimate_target, obj/item/tool, view_only = FALSE) var/list/direct_access = DirectAccess() var/depth = 1 + (view_only ? STORAGE_VIEW_DEPTH : INVENTORY_DEPTH) @@ -231,7 +231,7 @@ return FALSE -/atom/movable/proc/DirectAccess() +/atom/proc/DirectAccess() return list(src, loc) /mob/DirectAccess(atom/target) diff --git a/code/_onclick/drag_drop.dm b/code/_onclick/drag_drop.dm index 1bbc20d4913..aa23d5a57ea 100644 --- a/code/_onclick/drag_drop.dm +++ b/code/_onclick/drag_drop.dm @@ -37,17 +37,13 @@ // 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)) - if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_ADJACENT)) - if(!Adjacent(user) || !over.Adjacent(user)) - return // should stop you from dragging through windows + //Check for adjacency + if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_ADJACENT) && (!CanReach(user) || !over.CanReach(user))) + return // should stop you from dragging through windows if(!(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_USABILITY)) - var/combined_flags = interaction_flags_mouse_drop | over.interaction_flags_mouse_drop - if(combined_atom_flags & INTERACT_ATOM_MOUSEDROP_IGNORE_ADJACENT) - combined_flags |= BYPASS_ADJACENCY - else - combined_flags |= SILENT_ADJACENCY - if(!user.can_perform_action(src, combined_flags)) + //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)