Scan mind and Project mind now use vision to determine the naming in the target list (#12963)

* Scan mind and Project mind now use vision to determine the naming

* Copy pasta mistake fix

* logic fix with name dupe prevention

* Refactor ala review
This commit is contained in:
farie82
2020-09-18 00:31:08 +02:00
committed by GitHub
parent e135c2326b
commit 67e6cf5079
2 changed files with 50 additions and 23 deletions
+35
View File
@@ -478,6 +478,41 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
return 0 //Unsupported slot
//END HUMAN
/mob/proc/get_visible_mobs()
var/list/seen_mobs = list()
for(var/mob/M in view(src))
seen_mobs += M
return seen_mobs
/**
* Returns an assoc list which contains the mobs in range and their "visible" name.
* Mobs out of view but in range will be listed as unknown. Else they will have their visible name
*/
/mob/proc/get_telepathic_targets()
var/list/validtargets = new /list()
var/turf/T = get_turf(src)
var/list/mobs_in_view = get_visible_mobs()
for(var/mob/living/M in range(14, T))
if(M && M.mind)
if(M == src)
continue
var/mob_name
if(M in mobs_in_view)
mob_name = M.name
else
mob_name = "Unknown entity"
var/i = 0
var/result_name
do
result_name = mob_name
if(i++)
result_name += " ([i])" // Avoid dupes
while(validtargets[result_name])
validtargets[result_name] = M
return validtargets
// If you're looking for `reset_perspective`, that's a synonym for this proc.
/mob/proc/reset_perspective(atom/A)
if(client)