From f2f5ba7a9e25dbcad9d42c731f58e8644726ae14 Mon Sep 17 00:00:00 2001 From: Atermonera Date: Thu, 27 Aug 2020 18:37:35 -0700 Subject: [PATCH 1/3] Ladders respect Move Up/Down paradigm --- code/modules/multiz/movement.dm | 63 ++++++++++++-------- code/modules/multiz/structures.dm | 29 +++++---- html/changelogs/atermonera - move updown.yml | 4 ++ 3 files changed, 62 insertions(+), 34 deletions(-) create mode 100644 html/changelogs/atermonera - move updown.yml diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm index f5201f60ec..04fbdb6a3b 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -37,6 +37,11 @@ forceMove(destination) return 1 + var/obj/structure/ladder/ladder = locate() in start.contents + if((direction == UP ? ladder?.target_up : ladder?.target_down) && (ladder?.allowed_directions & direction)) + if(src.may_climb_ladders(ladder)) + return ladder.climbLadder(src, (direction == UP ? ladder.target_up : ladder.target_down)) + if(!start.CanZPass(src, direction)) to_chat(src, "\The [start] is in the way.") return 0 @@ -46,32 +51,40 @@ return 0 var/area/area = get_area(src) - if(direction == UP && area.has_gravity() && !can_overcome_gravity()) - var/obj/structure/lattice/lattice = locate() in destination.contents - var/obj/structure/catwalk/catwalk = locate() in destination.contents - if(lattice) - var/pull_up_time = max(5 SECONDS + (src.movement_delay() * 10), 1) - to_chat(src, "You grab \the [lattice] and start pulling yourself upward...") - destination.audible_message("You hear something climbing up \the [lattice].") - if(do_after(src, pull_up_time)) - to_chat(src, "You pull yourself up.") + if(area.has_gravity() && !can_overcome_gravity()) + if(direction == UP) + var/obj/structure/lattice/lattice = locate() in destination.contents + var/obj/structure/catwalk/catwalk = locate() in destination.contents + + if(lattice) + var/pull_up_time = max(5 SECONDS + (src.movement_delay() * 10), 1) + to_chat(src, "You grab \the [lattice] and start pulling yourself upward...") + destination.audible_message("You hear something climbing up \the [lattice].") + if(do_after(src, pull_up_time)) + to_chat(src, "You pull yourself up.") + else + to_chat(src, "You gave up on pulling yourself up.") + return 0 + + else if(catwalk?.hatch_open) + var/pull_up_time = max(5 SECONDS + (src.movement_delay() * 10), 1) + to_chat(src, "You grab the edge of \the [catwalk] and start pulling yourself upward...") + var/old_dest = destination + destination = get_step(destination, dir) // mob's dir + if(!destination?.Enter(src, old_dest)) + to_chat(src, "There's something in the way up above in that direction, try another.") + return 0 + destination.audible_message("You hear something climbing up \the [catwalk].") + if(do_after(src, pull_up_time)) + to_chat(src, "You pull yourself up.") + else + to_chat(src, "You gave up on pulling yourself up.") + return 0 + else - to_chat(src, "You gave up on pulling yourself up.") - return 0 - else if(catwalk?.hatch_open) - var/pull_up_time = max(5 SECONDS + (src.movement_delay() * 10), 1) - to_chat(src, "You grab the edge of \the [catwalk] and start pulling yourself upward...") - var/old_dest = destination - destination = get_step(destination, dir) // mob's dir - if(!destination?.Enter(src, old_dest)) - to_chat(src, "There's something in the way up above in that direction, try another.") - return 0 - destination.audible_message("You hear something climbing up \the [catwalk].") - if(do_after(src, pull_up_time)) - to_chat(src, "You pull yourself up.") - else - to_chat(src, "You gave up on pulling yourself up.") + to_chat(src, "Gravity stops you from moving upward.") return 0 +<<<<<<< HEAD else if(ismob(src)) //VOREStation Edit Start. Are they a mob, and are they currently flying?? var/mob/H = src if(H.flying) @@ -94,6 +107,8 @@ else to_chat(src, "Gravity stops you from moving upward.") return 0 +======= +>>>>>>> 8dc9ba1... Ladders respect Move Up/Down paradigm (#7559) for(var/atom/A in destination) if(!A.CanPass(src, start, 1.5, 0)) diff --git a/code/modules/multiz/structures.dm b/code/modules/multiz/structures.dm index 0708426511..b22b70c739 100644 --- a/code/modules/multiz/structures.dm +++ b/code/modules/multiz/structures.dm @@ -52,16 +52,7 @@ to_chat(M, "You fail to reach \the [src].") return - var/direction = target_ladder == target_up ? "up" : "down" - - M.visible_message("\The [M] begins climbing [direction] \the [src]!", - "You begin climbing [direction] \the [src]!", - "You hear the grunting and clanging of a metal ladder being used.") - - target_ladder.audible_message("You hear something coming [direction] \the [src]") - - if(do_after(M, climb_time, src)) - climbLadder(M, target_ladder) + climbLadder(M, target_ladder) /obj/structure/ladder/attack_ghost(var/mob/M) var/target_ladder = getTargetLadder(M) @@ -105,6 +96,7 @@ /mob/observer/ghost/may_climb_ladders(var/ladder) return TRUE +<<<<<<< HEAD /obj/structure/ladder/proc/climbLadder(var/mob/M, var/target_ladder) var/turf/T = get_turf(target_ladder) for(var/atom/A in T) @@ -112,6 +104,23 @@ to_chat(M, "\The [A] is blocking \the [src].") return FALSE return M.forceMove(T) //VOREStation Edit - Fixes adminspawned ladders +======= +/obj/structure/ladder/proc/climbLadder(var/mob/M, var/obj/target_ladder) + var/direction = (target_ladder == target_up ? "up" : "down") + M.visible_message("\The [M] begins climbing [direction] \the [src]!", + "You begin climbing [direction] \the [src]!", + "You hear the grunting and clanging of a metal ladder being used.") + + target_ladder.audible_message("You hear something coming [direction] \the [src]") + + if(do_after(M, climb_time, src)) + var/turf/T = get_turf(target_ladder) + for(var/atom/A in T) + if(!A.CanPass(M, M.loc, 1.5, 0)) + to_chat(M, "\The [A] is blocking \the [src].") + return FALSE + return M.Move(T) +>>>>>>> 8dc9ba1... Ladders respect Move Up/Down paradigm (#7559) /obj/structure/ladder/CanPass(obj/mover, turf/source, height, airflow) return airflow || !density diff --git a/html/changelogs/atermonera - move updown.yml b/html/changelogs/atermonera - move updown.yml new file mode 100644 index 0000000000..ceae85d35e --- /dev/null +++ b/html/changelogs/atermonera - move updown.yml @@ -0,0 +1,4 @@ +author: Atermonera +delete-after: True +changes: + - tweak: "You can use Move Up/Down to traverse ladders No popup "Which way do you want to go?" windows required for bidirectional ladders!." From 9ac3f02519a246352fd1c3829a17d7bcc1d78e9e Mon Sep 17 00:00:00 2001 From: Novacat <35587478+Novacat@users.noreply.github.com> Date: Fri, 28 Aug 2020 12:58:04 -0400 Subject: [PATCH 2/3] Update movement.dm --- code/modules/multiz/movement.dm | 45 +++++++++++++++------------------ 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm index 04fbdb6a3b..fa276adbfb 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -81,34 +81,29 @@ to_chat(src, "You gave up on pulling yourself up.") return 0 + else if(ismob(src)) //VOREStation Edit Start. Are they a mob, and are they currently flying?? + var/mob/H = src + if(H.flying) + if(H.incapacitated(INCAPACITATION_ALL)) + to_chat(src, "You can't fly in your current state.") + H.stop_flying() //Should already be done, but just in case. + return 0 + var/fly_time = max(7 SECONDS + (H.movement_delay() * 10), 1) //So it's not too useful for combat. Could make this variable somehow, but that's down the road. + to_chat(src, "You begin to fly upwards...") + destination.audible_message("You hear the flapping of wings.") + H.audible_message("[H] begins to flap \his wings, preparing to move upwards!") + if(do_after(H, fly_time) && H.flying) + to_chat(src, "You fly upwards.") + else + to_chat(src, "You stopped flying upwards.") + return 0 + else + to_chat(src, "Gravity stops you from moving upward.") + return 0 //VOREStation Edit End. + else to_chat(src, "Gravity stops you from moving upward.") return 0 -<<<<<<< HEAD - else if(ismob(src)) //VOREStation Edit Start. Are they a mob, and are they currently flying?? - var/mob/H = src - if(H.flying) - if(H.incapacitated(INCAPACITATION_ALL)) - to_chat(src, "You can't fly in your current state.") - H.stop_flying() //Should already be done, but just in case. - return 0 - var/fly_time = max(7 SECONDS + (H.movement_delay() * 10), 1) //So it's not too useful for combat. Could make this variable somehow, but that's down the road. - to_chat(src, "You begin to fly upwards...") - destination.audible_message("You hear the flapping of wings.") - H.audible_message("[H] begins to flap \his wings, preparing to move upwards!") - if(do_after(H, fly_time) && H.flying) - to_chat(src, "You fly upwards.") - else - to_chat(src, "You stopped flying upwards.") - return 0 - else - to_chat(src, "Gravity stops you from moving upward.") - return 0 //VOREStation Edit End. - else - to_chat(src, "Gravity stops you from moving upward.") - return 0 -======= ->>>>>>> 8dc9ba1... Ladders respect Move Up/Down paradigm (#7559) for(var/atom/A in destination) if(!A.CanPass(src, start, 1.5, 0)) From dedbb71ccf8178541419df1918474361c89c214a Mon Sep 17 00:00:00 2001 From: Novacat <35587478+Novacat@users.noreply.github.com> Date: Fri, 28 Aug 2020 12:59:17 -0400 Subject: [PATCH 3/3] Update structures.dm --- code/modules/multiz/structures.dm | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/code/modules/multiz/structures.dm b/code/modules/multiz/structures.dm index b22b70c739..bf7f3c0865 100644 --- a/code/modules/multiz/structures.dm +++ b/code/modules/multiz/structures.dm @@ -96,15 +96,6 @@ /mob/observer/ghost/may_climb_ladders(var/ladder) return TRUE -<<<<<<< HEAD -/obj/structure/ladder/proc/climbLadder(var/mob/M, var/target_ladder) - var/turf/T = get_turf(target_ladder) - for(var/atom/A in T) - if(!A.CanPass(M, M.loc, 1.5, 0)) - to_chat(M, "\The [A] is blocking \the [src].") - return FALSE - return M.forceMove(T) //VOREStation Edit - Fixes adminspawned ladders -======= /obj/structure/ladder/proc/climbLadder(var/mob/M, var/obj/target_ladder) var/direction = (target_ladder == target_up ? "up" : "down") M.visible_message("\The [M] begins climbing [direction] \the [src]!", @@ -119,8 +110,7 @@ if(!A.CanPass(M, M.loc, 1.5, 0)) to_chat(M, "\The [A] is blocking \the [src].") return FALSE - return M.Move(T) ->>>>>>> 8dc9ba1... Ladders respect Move Up/Down paradigm (#7559) + return M.forceMove(T) //VOREStation Edit - Fixes adminspawned ladders /obj/structure/ladder/CanPass(obj/mover, turf/source, height, airflow) return airflow || !density