mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
AI holograms can switch between holopads more seamlessly (#28450)
* Let the AI be more flexible * Early checks
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user