AI holograms can switch between holopads more seamlessly (#28450)

* Let the AI be more flexible

* Early checks
This commit is contained in:
Vi3trice
2025-02-24 14:26:54 +00:00
committed by GitHub
parent 3db0313d28
commit 22167b684f
+8 -5
View File
@@ -367,7 +367,9 @@ GLOBAL_LIST_EMPTY(holopads)
var/obj/machinery/hologram/holopad/another = pad
if(another == src)
continue
if(another.validate_location(T))
if(T.loc != get_area(another))
continue
if(another.validate_location(T, holo_owner))
var/obj/effect/overlay/holo_pad_hologram/h = masters[holo_owner]
unset_holo(holo_owner)
another.set_holo(holo_owner, h)
@@ -385,9 +387,10 @@ GLOBAL_LIST_EMPTY(holopads)
return TRUE
//Can we display holos there
//Area check instead of line of sight check because this is a called a lot if AI wants to move around.
/obj/machinery/hologram/holopad/proc/validate_location(turf/T)
if(T.z == z && (get_dist(T, src) <= holo_range) && T.loc == get_area(src))
/obj/machinery/hologram/holopad/proc/validate_location(turf/T, mob/living/user)
if(!is_ai(user) && T.loc != get_area(src)) //For AI, the area check is done on trying to find another holopad instead
return FALSE
if(T.z == z && (get_dist(T, src) <= holo_range))
return TRUE
return FALSE
@@ -396,7 +399,7 @@ GLOBAL_LIST_EMPTY(holopads)
if(masters[user])
var/obj/effect/overlay/holo_pad_hologram/holo = masters[user]
var/transfered = FALSE
if(!validate_location(new_turf))
if(!validate_location(new_turf, user))
if(!transfer_to_nearby_pad(new_turf,user))
clear_holo(user)
return FALSE