From 068917d820a21817a1fcecac26f1066e959a63a8 Mon Sep 17 00:00:00 2001 From: CHOMPStation2 <58959929+CHOMPStation2@users.noreply.github.com> Date: Sun, 17 Dec 2023 03:44:12 -0700 Subject: [PATCH] [MIRROR] pull through z-levels and map transits (#7429) Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: CHOMPStation2 --- .../objects/effects/map_effects/portal.dm | 2 +- code/game/turfs/space/space.dm | 15 +++++++++++-- code/modules/mob/mob.dm | 22 ++++++++++++++++++- code/modules/multiz/movement.dm | 8 +++++++ 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/code/game/objects/effects/map_effects/portal.dm b/code/game/objects/effects/map_effects/portal.dm index f07ba99767..6c33e71b83 100644 --- a/code/game/objects/effects/map_effects/portal.dm +++ b/code/game/objects/effects/map_effects/portal.dm @@ -93,7 +93,7 @@ when portals are shortly lived, or when portals are made to be obvious with spec // pulled.forceMove(get_turf(counterpart)) pulled.forceMove(counterpart.get_focused_turf()) L.forceMove(counterpart.get_focused_turf()) - L.start_pulling(pulled) + L.continue_pulling(pulled) else L.forceMove(counterpart.get_focused_turf()) else diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index 4986701fcc..a997ed9a66 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -41,7 +41,7 @@ /turf/space/proc/toggle_transit(var/direction) if(edge) //Not a great way to do this yet. Maybe we'll come up with one. We could pre-make sprites... or tile the overlay over it? return - + if(!direction) //Stopping our transit appearance = SSskybox.dust_cache["[((x + y) ^ ~(x * y) + z) % 25]"] else if(direction & (NORTH|SOUTH)) //Starting transit vertically @@ -137,7 +137,18 @@ . = ..() if(edge && ticker?.mode && !density) // !density so 'fake' space turfs don't fling ghosts everywhere - A?.touch_map_edge() + if(isliving(A)) + var/mob/living/L = A + if(L.pulling) + var/atom/movable/pulled = L.pulling + L.stop_pulling() + A?.touch_map_edge() + pulled.forceMove(L.loc) + L.continue_pulling(pulled) + else + A?.touch_map_edge() + else + A?.touch_map_edge() /turf/space/proc/Sandbox_Spacemove(atom/movable/A as mob|obj) var/cur_x diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index e1332a4528..6de125ce9b 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -71,7 +71,7 @@ to_chat(src, "... You can almost hear someone talking ...") else if(client && client.prefs.chat_timestamp) - msg = replacetext(msg, new/regex("^(]*)?>)((?:.|\\n)*)", ""), "$1[time] $2") + msg = replacetext(msg, new/regex("^(]*)?>)((?:.|\\n)*)", ""), "$1[time] $2") to_chat(src,msg) else if(teleop) to_chat(teleop, create_text_tag("body", "BODY:", teleop.client) + "[msg]") @@ -621,6 +621,26 @@ var/mob/pulled = AM pulled.inertia_dir = 0 +// We have pulled something before, so we should be able to safely continue pulling it. This proc is only for portals! +/mob/proc/continue_pulling(var/atom/movable/AM) + + if ( !AM || src==AM || !isturf(src.loc) ) //if there's no person pulling OR the person is pulling themself OR the object being pulled is inside something: abort! + return + + if (AM.anchored) + return + + src.pulling = AM + AM.pulledby = src + + if(pullin) + pullin.icon_state = "pull1" + + //Attempted fix for people flying away through space when cuffed and dragged. + if(ismob(AM)) + var/mob/pulled = AM + pulled.inertia_dir = 0 + /mob/proc/can_use_hands() return diff --git a/code/modules/multiz/movement.dm b/code/modules/multiz/movement.dm index c4986ea123..e080cef444 100644 --- a/code/modules/multiz/movement.dm +++ b/code/modules/multiz/movement.dm @@ -134,10 +134,18 @@ if(!Move(destination)) return 0 if(isliving(src)) + var/list/atom/movable/pulling = list() + var/mob/living/L = src + if(L.pulling && !L.pulling.anchored) + pulling |= L.pulling + for(var/obj/item/weapon/grab/G in list(L.l_hand, L.r_hand)) + pulling |= G.affecting if(direction == UP) src.audible_message("[src] moves up.") else if(direction == DOWN) src.audible_message("[src] moves down.") + for(var/atom/movable/P in pulling) + P.forceMove(destination) return 1 /mob/proc/can_overcome_gravity()