diff --git a/code/game/dna/genes/powers.dm b/code/game/dna/genes/powers.dm index 52136ff1816..c2edd753f2d 100644 --- a/code/game/dna/genes/powers.dm +++ b/code/game/dna/genes/powers.dm @@ -69,18 +69,23 @@ user.reset_view(0) return - for(var/mob/living/target in targets) + for(var/T in targets) + var/mob/living/target + if (isliving(T)) + target = T + if (istype (T, /datum/mind)) + target = user.can_mind_interact(T) if(target) if(target == user) user.remoteview_target = null user.reset_view(0) - else if(!user.can_mind_interact(target)) - user.remoteview_target = null - user.reset_view(0) else user.remoteview_target = target user.reset_view(target) break + else// can_mind_interact returned null + user.remoteview_target = null + user.reset_view(0) /datum/dna/gene/basic/regenerate name = "Regenerate" @@ -133,7 +138,7 @@ override_base = "genetic" hud_state = "gen_project" - compatible_mobs = list(/mob/living/carbon/human) + compatible_mobs = list(/mob/living/carbon/human, /datum/mind) mind_affecting = 1 /spell/targeted/remotesay/cast(var/list/targets, mob/living/carbon/human/user) @@ -150,8 +155,11 @@ return 1 for(var/T in targets) - var/mob/living/carbon/human/target = T - + var/mob/living/target + if (isliving(T)) + target = T + if (istype (T, /datum/mind)) + target = user.can_mind_interact(T) if(!T || !istype(target) || tinfoil_check(target) || !user.can_mind_interact(target)) user.show_message("You project your mind towards [believed_name]: [say]") return diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 7b3ca37fdcf..de5e3775fe9 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -1896,8 +1896,8 @@ mob/proc/on_foot() if(M == src || !istype(M) || !mind) return if(!ear_deaf && !stat) - if(!(mind.heard_before[M.name])) - mind.heard_before[M.name] = M + if(!(mind.heard_before[M.name]) && M.mind) + mind.heard_before[M.name] = M.mind M.heard_by |= mind /mob/acidable() @@ -2161,30 +2161,36 @@ mob/proc/on_foot() /mob/proc/attempt_crawling(var/turf/target) return FALSE -/mob/proc/can_mind_interact(mob/living/carbon/target) - //to_chat(world, "Starting can interact on [target]") - if(!iscarbon(target)) - return 0 //Can't see non humans with your fancy human mind. - //to_chat(world, "[target] is a human") +/mob/proc/can_mind_interact(var/datum/mind/target_mind) + var/mob/living/target + if(isliving(target_mind)) + target = target_mind + else + if(!istype(target_mind)) + return null + target = target_mind.current + if (!istype(target)) + return null var/turf/target_turf = get_turf(target) var/turf/our_turf = get_turf(src) if(!target_turf) - //to_chat(world, "[target] is in null space") - return 0 - if((target_turf.z != our_turf.z) || target.stat!=CONSCIOUS) //Not on the same zlevel as us or they're dead. - //to_chat(world, "[(target_turf.z != our_turf.z) ? "not on the same zlevel as [target]" : "[target] is not concious"]") - if(target_turf.z != map.zCentcomm) - to_chat(src, "The target mind is too faint...")//Prevent "The mind of Admin is too faint..." - - return 0 + return null + if (target.isDead()) + to_chat(src, "You cannot sense the target mind anymore, that's not good...") + return null + if(target_turf.z != our_turf.z) //Not on the same zlevel as us + to_chat(src, "The target mind is too faint, they must be quite far from you...") + return null + if(target.stat != CONSCIOUS) + to_chat(src, "The target mind is too faint, but still close, they must be unconscious...") + return null if(M_PSY_RESIST in target.mutations) - //to_chat(world, "[target] has psy resist") to_chat(src, "The target mind is resisting!") - return 0 + return null if(target.is_wearing_any(list(/obj/item/clothing/head/helmet/space/martian,/obj/item/clothing/head/tinfoil,/obj/item/clothing/head/helmet/stun), slot_head)) to_chat(src, "Interference is disrupting the connection with the target mind.") - return 0 - return 1 + return null + return target /mob/proc/canMouseDrag()//used mostly to check if the mob can drag'and'drop stuff in/out of various other stuff, such as disposals, cryo tubes, etc. return TRUE diff --git a/code/modules/spells/targeted/targeted.dm b/code/modules/spells/targeted/targeted.dm index 04870003525..9df3bbd13d3 100644 --- a/code/modules/spells/targeted/targeted.dm +++ b/code/modules/spells/targeted/targeted.dm @@ -38,8 +38,10 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp return 0 if(!(range == GLOBALCAST) && !(range == SELFCAST && target == user) && (options && !(target in options))) //Shouldn't be necessary but a good check in case of overrides return 0 - if(mind_affecting && !user.can_mind_interact(target)) - return 0 + if(ismob(target) && mind_affecting) + var/mob/M = target + if (!user.can_mind_interact(M.mind)) + return 0 return !compatible_mobs.len || is_type_in_list(target, compatible_mobs) /spell/targeted/choose_targets(mob/user = usr) @@ -59,9 +61,9 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp if(!user || !user.mind || !user.mind.heard_before.len) return var/target_name = input(user, "Choose the target, from those whose voices you've heard before.", "Targeting") in user.mind.heard_before - var/mob/temp_target = user.mind.heard_before[target_name] + var/datum/mind/temp_target = user.mind.heard_before[target_name] believed_name = target_name - targets += temp_target + targets += temp_target.current else if((range == 0 || range == SELFCAST) && (spell_flags & INCLUDEUSER)) targets += user else @@ -82,8 +84,7 @@ Targeted spells have two useful flags: INCLUDEUSER and SELECTABLE. These are exp continue if(mind_affecting) if(iscarbon(user)) - var/mob/living/carbon/C = user - if(!C.can_mind_interact(M)) + if(!M.mind || !user.can_mind_interact(M.mind)) continue possible_targets += M