From e41b5acf8eedcda714e120685519cff047d28190 Mon Sep 17 00:00:00 2001 From: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Date: Wed, 23 Oct 2024 21:48:49 +0200 Subject: [PATCH] [NO GBP] Fixes lattices causing spacemove jank (#87320) ## About The Pull Request Lattices blocking space movement was handled on /atom/movable while my comsigs were on /mob, thus making lattices overrule all force code. Mobs now properly handle them via pushoff code. ## Why Is This Good For The Game Lattices are very jarring to move along rn, this was not intentional. ## Changelog :cl: fix: Moving along lattices in space with a jetpack on no longer causes your screen to jerk /:cl: --- code/datums/drift_handler.dm | 2 +- code/game/atoms_movable.dm | 5 ++++- code/modules/mob/mob_movement.dm | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/code/datums/drift_handler.dm b/code/datums/drift_handler.dm index 7000483f9ab..21530584364 100644 --- a/code/datums/drift_handler.dm +++ b/code/datums/drift_handler.dm @@ -205,7 +205,7 @@ /datum/drift_handler/proc/attempt_halt(mob/source, movement_dir, continuous_move, atom/backup) SIGNAL_HANDLER - if (get_dir(source, backup) == movement_dir || source.loc == backup.loc) + if ((backup.density || !backup.CanPass(source, get_dir(backup, source))) && (get_dir(source, backup) == movement_dir || source.loc == backup.loc)) if (drift_force >= INERTIA_FORCE_THROW_FLOOR) source.throw_at(backup, 1, floor(1 + (drift_force - INERTIA_FORCE_THROW_FLOOR) / INERTIA_FORCE_PER_THROW_FORCE), spin = FALSE) return diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 45b77efdb1f..8acbf59b4d8 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -1260,11 +1260,14 @@ if(!isturf(loc)) return TRUE - if(locate(/obj/structure/lattice) in range(1, get_turf(src))) //Not realistic but makes pushing things in space easier + if (handle_spacemove_grabbing()) return TRUE return FALSE +/atom/movable/proc/handle_spacemove_grabbing() + if(locate(/obj/structure/lattice) in range(1, get_turf(src))) //Not realistic but makes pushing things in space easier + return TRUE /// Only moves the object if it's under no gravity /// Accepts the direction to move, if the push should be instant, and an optional parameter to fine tune the start delay diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 1c8d6ad09fc..f79a1c10cc6 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -293,6 +293,10 @@ to_chat(src, span_info("You push off of [backup] to propel yourself.")) return TRUE +/// We handle lattices via backups +/mob/handle_spacemove_grabbing() + return + /** * Finds a target near a mob that is viable for pushing off when moving. * Takes the intended movement direction as input, alongside if the context is checking if we're allowed to continue drifting @@ -325,7 +329,7 @@ continue var/pass_allowed = rebound.CanPass(src, get_dir(rebound, src)) - if(!rebound.density && pass_allowed) + if(!rebound.density && pass_allowed && !istype(rebound, /obj/structure/lattice)) continue //Sometime this tick, this pushed off something. Doesn't count as a valid pushoff target if(rebound.last_pushoff == world.time)