From 02a8e9fcf909930c34ac34edd7ecaac09b98658e Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+Steals-The-PRs@users.noreply.github.com> Date: Sun, 30 Jun 2024 01:27:53 +0300 Subject: [PATCH] [MIRROR] [NO GBP] Fixes critical storage issues [MDB IGNORE] (#4128) * [NO GBP] Fixes critical storage issues (#84449) Closes #84447 Closes #84445 Fixes incorrect assoc list deletion, storage deletion order and some math oopsies :cl: fix: Storage no longer deletes all of its viewers upon being deleted fix: Storage UI now renders properly /:cl: * [NO GBP] Fixes critical storage issues --------- Co-authored-by: NovaBot <154629622+NovaBot13@users.noreply.github.com> Co-authored-by: SmArtKar <44720187+SmArtKar@users.noreply.github.com> Co-authored-by: NovaBot13 Co-authored-by: Iajret --- code/datums/storage/storage.dm | 8 +++++--- code/datums/storage/storage_interface.dm | 13 +++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/code/datums/storage/storage.dm b/code/datums/storage/storage.dm index 0001d0e2913..5aca0ae2f8a 100644 --- a/code/datums/storage/storage.dm +++ b/code/datums/storage/storage.dm @@ -138,14 +138,15 @@ src.max_total_storage = max_total_storage /datum/storage/Destroy() - parent = null - real_location = null for(var/mob/person in is_using) hide_contents(person) is_using.Cut() - QDEL_LAZYLIST(storage_interfaces) + QDEL_LIST_ASSOC_VAL(storage_interfaces) + + parent = null + real_location = null return ..() @@ -1036,6 +1037,7 @@ GLOBAL_LIST_EMPTY(cached_storage_typecaches) to_hide.client.screen -= storage_interfaces[to_hide].list_ui_elements() to_hide.client.screen -= real_location.contents QDEL_NULL(storage_interfaces[to_hide]) + storage_interfaces -= to_hide return TRUE diff --git a/code/datums/storage/storage_interface.dm b/code/datums/storage/storage_interface.dm index df6bdc9f2d1..cd28b9eb3f7 100644 --- a/code/datums/storage/storage_interface.dm +++ b/code/datums/storage/storage_interface.dm @@ -50,18 +50,19 @@ var/end_pixel_y = start_pixel_y + (rows - 1) * 32 cells.screen_loc = spanning_screen_loc(start_pixel_x, start_pixel_y, end_pixel_x, end_pixel_y) - var/left_edge_loc = spanning_screen_loc(start_pixel_x + 32, start_pixel_y, end_pixel_x, end_pixel_y) - var/right_edge_loc = spanning_screen_loc(start_pixel_x, start_pixel_y, end_pixel_x + max(0, (columns - 2)) * 32, end_pixel_y) + var/left_edge_loc = spanning_screen_loc(min(start_pixel_x + 32, end_pixel_x), start_pixel_y, end_pixel_x, end_pixel_y) + var/right_edge_loc = spanning_screen_loc(start_pixel_x, start_pixel_y, max(start_pixel_x, end_pixel_x - 32), end_pixel_y) corner_top_left.screen_loc = left_edge_loc - corner_top_right.screen_loc = right_edge_loc corner_bottom_left.screen_loc = left_edge_loc + corner_top_right.screen_loc = right_edge_loc corner_bottom_right.screen_loc = right_edge_loc - var/row_loc = spanning_screen_loc(start_pixel_x, start_pixel_y + 27, end_pixel_x, end_pixel_y + 27 + max(0, rows - 2) * 32) - rowjoin_left.screen_loc = row_loc + var/row_left_loc = spanning_screen_loc(start_pixel_x, start_pixel_y + 27, start_pixel_x, start_pixel_y + 27 + max(0, rows - 2) * 32) + rowjoin_left.screen_loc = row_left_loc rowjoin_left.alpha = (rows > 1) * 255 - rowjoin_right.screen_loc = row_loc + var/row_right_loc = spanning_screen_loc(end_pixel_x, start_pixel_y + 27, end_pixel_x, start_pixel_y + 27 + max(0, rows - 2) * 32) + rowjoin_right.screen_loc = row_right_loc rowjoin_right.alpha = (rows > 1) * 255 closer.screen_loc = "[screen_start_x + columns]:[screen_pixel_x - 5],[screen_start_y]:[screen_pixel_y]"