mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 04:30:44 +01:00
[MIRROR] Ai interact uses is_valid_z_level helper [MDB IGNORE] (#16141)
* Ai interact uses is_valid_z_level helper (#69759) * Makes AI can_interact_with use the valid z level helper * Makes AI's ``can_interact_with`` proc use ``is_valid_z_level`` instead helper instead of manually doing it. * Minor code improvement while im here 👍 * Ai interact uses is_valid_z_level helper Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
co-authored by
John Willard
parent
d097c14187
commit
4e65ee0dfb
@@ -337,25 +337,26 @@
|
||||
if(C)
|
||||
C.post_status("shuttle")
|
||||
|
||||
/mob/living/silicon/ai/can_interact_with(atom/A)
|
||||
/mob/living/silicon/ai/can_interact_with(atom/A, treat_mob_as_adjacent)
|
||||
. = ..()
|
||||
var/turf/ai = get_turf(src)
|
||||
var/turf/target = get_turf(A)
|
||||
if (.)
|
||||
return
|
||||
var/turf/ai_turf = get_turf(src)
|
||||
var/turf/target_turf = get_turf(A)
|
||||
|
||||
if(!target)
|
||||
if(!target_turf)
|
||||
return
|
||||
|
||||
if ((ai.z != target.z) && !is_station_level(ai.z))
|
||||
if (!is_valid_z_level(ai_turf, target_turf))
|
||||
return FALSE
|
||||
|
||||
if (istype(loc, /obj/item/aicard))
|
||||
if (!ai || !target)
|
||||
if (!ai_turf)
|
||||
return FALSE
|
||||
return ISINRANGE(target.x, ai.x - interaction_range, ai.x + interaction_range) && ISINRANGE(target.y, ai.y - interaction_range, ai.y + interaction_range)
|
||||
return ISINRANGE(target_turf.x, ai_turf.x - interaction_range, ai_turf.x + interaction_range) \
|
||||
&& ISINRANGE(target_turf.y, ai_turf.y - interaction_range, ai_turf.y + interaction_range)
|
||||
else
|
||||
return GLOB.cameranet.checkTurfVis(get_turf(A))
|
||||
return GLOB.cameranet.checkTurfVis(target_turf)
|
||||
|
||||
/mob/living/silicon/ai/cancel_camera()
|
||||
view_core()
|
||||
|
||||
Reference in New Issue
Block a user