From e1ebb7faeb467e0775bde68428abaf995e9f3494 Mon Sep 17 00:00:00 2001 From: Waterpig <49160555+Majkl-J@users.noreply.github.com> Date: Tue, 10 Mar 2026 03:19:31 +0100 Subject: [PATCH] Makes the parallax not jump randomly when reloaded with swap_out_random_parallax_layer (#95284) ## About The Pull Request Turns out `/datum/hud/proc/update_parallax` still had a lot of remnant code back from when it ticked an update on every tick, even though it now only gets called on movement/z level changes. This prevented it from updating the locations of parallax layers unless you move, which is usually not an issue and goes unnoticed in the case of hud reloads or pref changes, since the parallax layer cache keeps the correct offsets. Except in the one specific case that needs to clear this cache entirely (`swap_out_random_parallax_layer`), which causes it to regenerate with no offsets, and jump to the correct position abrubtly when you move. This fixes that ## Why It's Good For The Game Fixes a bug. I tested when the proc gets called extensively and it's exclusively on movement and on hud/pref updates concerning the parallax, which all should get a full reload and not a half-attempt. ## Changelog :cl: fix: Parallax layers no longer snap to and from the center of the screen abrubtly when changing the random parallax layer. /:cl: --- code/_onclick/hud/parallax/parallax.dm | 5 ----- 1 file changed, 5 deletions(-) diff --git a/code/_onclick/hud/parallax/parallax.dm b/code/_onclick/hud/parallax/parallax.dm index 74f16c1a64a..9ed21d8e073 100644 --- a/code/_onclick/hud/parallax/parallax.dm +++ b/code/_onclick/hud/parallax/parallax.dm @@ -175,18 +175,13 @@ // Update the movement direction of the parallax if necessary (for shuttles) set_parallax_movedir(areaobj.parallax_movedir, FALSE, screenmob) - var/force = FALSE if(!C.previous_turf || (C.previous_turf.z != posobj.z)) C.previous_turf = posobj - force = TRUE //Doing it this way prevents parallax layers from "jumping" when you change Z-Levels. var/offset_x = posobj.x - C.previous_turf.x var/offset_y = posobj.y - C.previous_turf.y - if(!offset_x && !offset_y && !force) - return - var/glide_rate = round(ICON_SIZE_ALL / screenmob.glide_size * world.tick_lag, world.tick_lag) C.previous_turf = posobj