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."