diff --git a/code/__DEFINES/interaction_flags.dm b/code/__DEFINES/interaction_flags.dm index fb3a7439b10..30381f5ebb6 100644 --- a/code/__DEFINES/interaction_flags.dm +++ b/code/__DEFINES/interaction_flags.dm @@ -16,6 +16,8 @@ #define INTERACT_ATOM_NO_FINGERPRINT_ATTACK_HAND (1<<7) /// adds hiddenprints instead of fingerprints on interact #define INTERACT_ATOM_NO_FINGERPRINT_INTERACT (1<<8) +/// allows this atom to skip the adjacency check +#define INTERACT_ATOM_ALLOW_USER_LOCATION (1<<9) /// attempt pickup on attack_hand for items #define INTERACT_ITEM_ATTACK_HAND_PICKUP (1<<0) diff --git a/code/_globalvars/bitfields.dm b/code/_globalvars/bitfields.dm index ad738a35f56..da3b9a3fd6e 100644 --- a/code/_globalvars/bitfields.dm +++ b/code/_globalvars/bitfields.dm @@ -149,6 +149,7 @@ DEFINE_BITFIELD(interaction_flags_atom, list( "INTERACT_ATOM_REQUIRES_ANCHORED" = INTERACT_ATOM_REQUIRES_ANCHORED, "INTERACT_ATOM_REQUIRES_DEXTERITY" = INTERACT_ATOM_REQUIRES_DEXTERITY, "INTERACT_ATOM_UI_INTERACT" = INTERACT_ATOM_UI_INTERACT, + "INTERACT_ATOM_ALLOW_USER_LOCATION" = INTERACT_ATOM_ALLOW_USER_LOCATION, )) DEFINE_BITFIELD(interaction_flags_machine, list( diff --git a/code/_onclick/other_mobs.dm b/code/_onclick/other_mobs.dm index b618a313076..ae0f7a89b00 100644 --- a/code/_onclick/other_mobs.dm +++ b/code/_onclick/other_mobs.dm @@ -64,8 +64,8 @@ return interact(user) return FALSE -/atom/proc/can_interact(mob/user) - if(!user.can_interact_with(src)) +/atom/proc/can_interact(mob/user, require_adjacent_turf = TRUE) + if(!user.can_interact_with(src, interaction_flags_atom & INTERACT_ATOM_ALLOW_USER_LOCATION)) return FALSE if((interaction_flags_atom & INTERACT_ATOM_REQUIRES_DEXTERITY) && !ISADVANCEDTOOLUSER(user)) to_chat(user, span_warning("You don't have the dexterity to do this!")) @@ -83,6 +83,7 @@ /atom/ui_status(mob/user) . = ..() + //Check if both user and atom are at the same location if(!can_interact(user)) . = min(., UI_UPDATE) diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index a4a44f564ff..718fc39d0e3 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -960,8 +960,13 @@ return 9 ///Can the mob interact() with an atom? -/mob/proc/can_interact_with(atom/A) - if(isAdminGhostAI(src) || Adjacent(A)) +/mob/proc/can_interact_with(atom/A, treat_mob_as_adjacent) + if(isAdminGhostAI(src)) + return TRUE + //Return early. we do not need to check that we are on adjacent turfs (i.e we are inside a closet) + if (treat_mob_as_adjacent && src == A.loc) + return TRUE + if (Adjacent(A)) return TRUE var/datum/dna/mob_dna = has_dna() if(mob_dna?.check_mutation(/datum/mutation/human/telekinesis) && tkMaxRangeCheck(src, A)) diff --git a/code/modules/modular_computers/computers/item/tablet.dm b/code/modules/modular_computers/computers/item/tablet.dm index aa46128022d..e9c83b50e11 100644 --- a/code/modules/modular_computers/computers/item/tablet.dm +++ b/code/modules/modular_computers/computers/item/tablet.dm @@ -18,6 +18,7 @@ comp_light_luminosity = 2.3 //Same as the PDA looping_sound = FALSE custom_materials = list(/datum/material/iron=300, /datum/material/glass=100, /datum/material/plastic=100) + interaction_flags_atom = INTERACT_ATOM_ALLOW_USER_LOCATION var/has_variants = TRUE var/finish_color = null