-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor is_blocked_turf #29324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
refactor is_blocked_turf #29324
Conversation
wonder if it can be now renamed into just |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can shorten it i believe
@@ -246,7 +246,7 @@ Difficulty: Medium | |||
if(get_dist(src, O) >= MINER_DASH_RANGE && turf_dist_to_target <= self_dist_to_target && !islava(O) && !ischasm(O)) | |||
var/valid = TRUE | |||
for(var/turf/T in get_line(own_turf, O)) | |||
if(is_blocked_turf(T, TRUE)) | |||
if(T.is_blocked_turf(exclude_mobs = TRUE)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(T.is_blocked_turf(exclude_mobs = TRUE)) | |
if(T.is_blocked_turf(TRUE)) |
@@ -680,7 +680,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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!current_dash_target.is_blocked_turf(exclude_mobs = TRUE)) | |
if(!current_dash_target.is_blocked_turf(TRUE)) |
@@ -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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!turf_to_teleport_to || turf_to_teleport_to.is_blocked_turf(exclude_mobs = TRUE)) | |
if(!turf_to_teleport_to || turf_to_teleport_to.is_blocked_turf(TRUE)) |
@@ -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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(T.is_blocked_turf(exclude_mobs = TRUE)) | |
if(T.is_blocked_turf(TRUE)) |
@@ -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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(T.is_blocked_turf(exclude_mobs = TRUE)) | |
if(T.is_blocked_turf(TRUE)) |
@@ -82,7 +82,7 @@ | |||
return | |||
var/turf/T = get_turf(target) | |||
|
|||
if(is_blocked_turf(T, TRUE)) //can't put mines on a tile that has dense stuff | |||
if(T.is_blocked_turf(exclude_mobs = TRUE)) //can't put mines on a tile that has dense stuff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(T.is_blocked_turf(exclude_mobs = TRUE)) //can't put mines on a tile that has dense stuff | |
if(T.is_blocked_turf(TRUE)) //can't put mines on a tile that has dense stuff |
@@ -180,7 +180,7 @@ | |||
|
|||
/obj/effect/spawner/random/proc/has_unblocked_line(destination) | |||
for(var/turf/potential_blockage as anything in get_line(get_turf(src), destination)) | |||
if(!is_blocked_turf(potential_blockage, exclude_mobs = TRUE)) | |||
if(!potential_blockage.is_blocked_turf(exclude_mobs = TRUE)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!potential_blockage.is_blocked_turf(exclude_mobs = TRUE)) | |
if(!potential_blockage.is_blocked_turf(TRUE)) |
@@ -1053,7 +1053,7 @@ | |||
|
|||
var/has_tried_to_move = FALSE | |||
|
|||
if(is_blocked_turf(target_turf, TRUE, excluded_objs = list(src))) | |||
if(target_turf.is_blocked_turf(exclude_mobs = TRUE, ignore_atoms = list(src))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(target_turf.is_blocked_turf(exclude_mobs = TRUE, ignore_atoms = list(src))) | |
if(target_turf.is_blocked_turf(TRUE, ignore_atoms = list(src))) |
@@ -61,7 +61,7 @@ | |||
sleep(jaunt_in_time) | |||
qdel(holder) | |||
if(!QDELETED(target)) | |||
if(is_blocked_turf(mobloc, TRUE)) | |||
if(mobloc.is_blocked_turf(exclude_mobs = TRUE)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(mobloc.is_blocked_turf(exclude_mobs = TRUE)) | |
if(mobloc.is_blocked_turf(TRUE)) |
for(var/turf/potential_blockage as anything in get_line(get_turf(structure_parent), turf_in_view)) | ||
if(!is_blocked_turf(potential_blockage, exclude_mobs = TRUE, excluded_objs = list(parent))) | ||
nearby_empty_tiles += turf_in_view | ||
if(potential_blockage.is_blocked_turf(exclude_mobs = TRUE, source_atom = parent)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(potential_blockage.is_blocked_turf(exclude_mobs = TRUE, source_atom = parent)) | |
if(potential_blockage.is_blocked_turf(TRUE, parent)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd personally lean towards leaving these args in place, it never hurts to be a little more verbose about what the arguments to a proc are
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me. I'd argue that keeping the arguments for the proc is probably a net positive
Regarding the use of the argument name in the proc call, as @lewcc said, keeping the argument name makes it clearer what the purpose of the boolean value is for. |
What Does This PR Do
This PR pulls our implementation of /proc/is_blocked_turf more in line with /tg/'s /turf/proc/is_blocked_turf.
Why It's Good For The Game
The argument names and behavior of these two different procs is just different enough to be confusing when porting things like AI behavior subtrees, so better to avoid any confusion on how to properly handle the discrepancies.
Testing
Compiles, will request TM as well.
Declaration
Changelog
NPFC