refactor is_blocked_turf (#29324)

This commit is contained in:
warriorstar-orion
2025-05-20 20:43:45 -04:00
committed by GitHub
parent 7faed06981
commit 45e88ffb71
33 changed files with 107 additions and 75 deletions
@@ -117,7 +117,7 @@
var/turf/T = Stuff
if((isspaceturf(T) || isfloorturf(T)) && NewTerrainFloors)
var/turf/simulated/O = T.ChangeTurf(NewTerrainFloors, keep_icon = FALSE)
if(prob(florachance) && length(NewFlora) && !is_blocked_turf(O))
if(prob(florachance) && length(NewFlora) && !O.is_blocked_turf())
var/atom/Picked = pick(NewFlora)
new Picked(O)
continue
@@ -167,7 +167,8 @@
if(is_in_teleport_proof_area(beacon))
to_chat(user, "<span class='warning'>[src] sparks and fizzles.</span>")
return
if(is_blocked_turf(get_turf(beacon), TRUE))
var/turf/beacon_turf = get_turf(beacon)
if(beacon_turf.is_blocked_turf(exclude_mobs = TRUE))
to_chat(user, "<span class='warning'>The beacon is blocked by something, preventing teleportation!</span>")
return
if(!isturf(user.loc))
@@ -184,7 +185,7 @@
if(do_after(user, 40, target = user) && user && beacon)
var/turf/T = get_turf(beacon)
var/turf/source = get_turf(user)
if(is_blocked_turf(T, TRUE))
if(T.is_blocked_turf(exclude_mobs = TRUE))
teleporting = FALSE
to_chat(user, "<span class='warning'>The beacon is blocked by something, preventing teleportation!</span>")
user.update_action_buttons_icon()
@@ -205,7 +206,7 @@
if(beacon)
beacon.icon_state = "hierophant_tele_off"
return
if(is_blocked_turf(T, TRUE))
if(T.is_blocked_turf(exclude_mobs = TRUE))
teleporting = FALSE
to_chat(user, "<span class='warning'>The beacon is blocked by something, preventing teleportation!</span>")
user.update_action_buttons_icon()
@@ -240,7 +241,7 @@
/obj/item/hierophant_club/proc/teleport_mob(turf/source, mob/M, turf/target, mob/user)
var/turf/turf_to_teleport_to = get_step(target, get_dir(source, M)) //get position relative to caster
if(!turf_to_teleport_to || is_blocked_turf(turf_to_teleport_to, TRUE))
if(!turf_to_teleport_to || turf_to_teleport_to.is_blocked_turf(exclude_mobs = TRUE))
return
if(SEND_SIGNAL(M, COMSIG_MOVABLE_TELEPORTING, turf_to_teleport_to) & COMPONENT_BLOCK_TELEPORT)
return FALSE
@@ -683,7 +683,7 @@
for(var/distance in 0 to 8)
var/turf/current_dash_target = dash_target
current_dash_target = get_step(current_dash_target, user.dir)
if(!is_blocked_turf(current_dash_target, TRUE))
if(!current_dash_target.is_blocked_turf(exclude_mobs = TRUE))
dash_target = current_dash_target
else
break