From 8355a43e2febe77c42e5b81338bdb73620100180 Mon Sep 17 00:00:00 2001 From: jimmyl <70376633+mc-oofert@users.noreply.github.com> Date: Sat, 18 Nov 2023 04:31:00 +0100 Subject: [PATCH] [no gbp] fixes being unable to climb up onto unblocked spaces with a climbing hook (#79744) ## About The Pull Request climbing hook (the thing in your internals box on icebox and other multiz planetary maps if any) should now allow you to climb through directional windows if they arent blocking your direction on the target tile, and over railing ## Why It's Good For The Game hooks should be easier to use ## Changelog :cl: fix: you can climb over more stuff with a climbing hook /:cl: --- code/game/objects/items/climbingrope.dm | 26 ++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/code/game/objects/items/climbingrope.dm b/code/game/objects/items/climbingrope.dm index 2c96d1844b1..03178604074 100644 --- a/code/game/objects/items/climbingrope.dm +++ b/code/game/objects/items/climbingrope.dm @@ -32,20 +32,23 @@ return if(!istype(target) || isopenspaceturf(target)) return - if(target.is_blocked_turf(exclude_mobs = TRUE)) - return + var/turf/user_turf = get_turf(user) var/turf/above = GET_TURF_ABOVE(user_turf) + if(target_blocked(target, above)) + return if(!isopenspaceturf(above) || !above.Adjacent(target)) //are we below a hole, is the target blocked, is the target adjacent to our hole balloon_alert(user, "blocked!") return + var/away_dir = get_dir(above, target) user.visible_message(span_notice("[user] begins climbing upwards with [src]."), span_notice("You get to work on properly hooking [src] and going upwards.")) playsound(target, 'sound/effects/picaxe1.ogg', 50) //plays twice so people above and below can hear playsound(user_turf, 'sound/effects/picaxe1.ogg', 50) var/list/effects = list(new /obj/effect/temp_visual/climbing_hook(target, away_dir), new /obj/effect/temp_visual/climbing_hook(user_turf, away_dir)) + if(do_after(user, climb_time, target)) - user.Move(target) + user.forceMove(target) uses-- if(uses <= 0) @@ -54,6 +57,23 @@ QDEL_LIST(effects) +// didnt want to mess up is_blocked_turf_ignore_climbable +/// checks if our target is blocked, also checks for border objects facing the above turf and climbable stuff +/obj/item/climbing_hook/proc/target_blocked(turf/target, turf/above) + if(target.density || above.density) + return TRUE + + for(var/atom/movable/atom_content as anything in target.contents) + if(isliving(atom_content)) + continue + if(HAS_TRAIT(atom_content, TRAIT_CLIMBABLE)) + continue + if((atom_content.flags_1 & ON_BORDER_1) && atom_content.dir != get_dir(target, above)) //if the border object is facing the hole then it is blocking us, likely + continue + if(atom_content.density) + return TRUE + return FALSE + /obj/item/climbing_hook/emergency name = "emergency climbing hook" desc = "An emergency climbing hook to scale up holes. The rope is EXTREMELY cheap and may not withstand extended use."