Skip to content

Commit

Permalink
[no gbp] fixes being unable to climb up onto unblocked spaces with a …
Browse files Browse the repository at this point in the history
…climbing hook (tgstation#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:
  • Loading branch information
mc-oofert authored Nov 18, 2023
1 parent 22826d2 commit 8355a43
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions code/game/objects/items/climbingrope.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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."
Expand Down

0 comments on commit 8355a43

Please sign in to comment.