From f7d9e0dfd0024389a60622815654978a0cb97bd0 Mon Sep 17 00:00:00 2001 From: Fira Date: Mon, 27 Jul 2026 08:28:34 +0000 Subject: [PATCH 1/3] perf optimization --- code/controllers/subsystem/minimap.dm | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index d6b287a4c777..67b0d107eb59 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -624,18 +624,20 @@ SUBSYSTEM_DEF(minimaps) */ /image/proc/minimap_on_move(atom/movable/source, oldloc) SIGNAL_HANDLER - if(isturf(source.loc)) - pixel_x = MINIMAP_PIXEL_FROM_WORLD(source.x) + SSminimaps.minimaps_by_z["[source.z]"].x_offset - pixel_y = MINIMAP_PIXEL_FROM_WORLD(source.y) + SSminimaps.minimaps_by_z["[source.z]"].y_offset + if(source.z) + var/datum/hud_displays/minimap = SSminimaps.minimaps_by_z["[source.z]"] + pixel_x = MINIMAP_PIXEL_FROM_WORLD(source.x) + minimap.x_offset + pixel_y = MINIMAP_PIXEL_FROM_WORLD(source.y) + minimap.y_offset return - var/atom/movable/movable_loc = source.loc - source.override_minimap_tracking(source.loc) - pixel_x = MINIMAP_PIXEL_FROM_WORLD(movable_loc.x) + SSminimaps.minimaps_by_z["[movable_loc.z]"].x_offset - pixel_y = MINIMAP_PIXEL_FROM_WORLD(movable_loc.y) + SSminimaps.minimaps_by_z["[movable_loc.z]"].y_offset + var/atom/movable/movable_loc = source.loc // How does none of this just crash if the loc isn't on map? + source.override_minimap_tracking() + var/datum/hud_displays/minimap = SSminimaps.minimaps_by_z["[movable_loc.z]"] + pixel_x = MINIMAP_PIXEL_FROM_WORLD(movable_loc.x) + minimap.x_offset + pixel_y = MINIMAP_PIXEL_FROM_WORLD(movable_loc.y) + minimap.y_offset ///Used to handle minimap tracking inside other movables -/atom/movable/proc/override_minimap_tracking(atom/movable/loc) +/atom/movable/proc/override_minimap_tracking() // This could be unrolled into minimap_on_move var/image/blip = SSminimaps.images_by_source[src] blip.RegisterSignal(loc, COMSIG_MOVABLE_MOVED, TYPE_PROC_REF(/image, minimap_on_move)) RegisterSignal(loc, COMSIG_ATOM_EXITED, PROC_REF(cancel_override_minimap_tracking)) From e50758c73e519181c50c0e9221fd82a7caa06a5f Mon Sep 17 00:00:00 2001 From: Fira Date: Mon, 27 Jul 2026 08:37:32 +0000 Subject: [PATCH 2/3] you too --- code/controllers/subsystem/minimap.dm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 67b0d107eb59..90b1fab852b3 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -661,9 +661,10 @@ SUBSYSTEM_DEF(minimaps) return UnregisterSignal(source, list(COMSIG_PARENT_QDELETING, COMSIG_MOVABLE_Z_CHANGED)) var/turf/source_turf = get_turf(source) + var/datum/hud_displays/minimap = minimaps_by_z["[source_turf.z]"] for(var/flag in GLOB.all_minimap_flags) - minimaps_by_z["[source_turf.z]"].images_assoc["[flag]"] -= source - minimaps_by_z["[source_turf.z]"].images_assoc["[flag]label"] -= source + minimap.images_assoc["[flag]"] -= source + minimap.images_assoc["[flag]label"] -= source images_by_source -= source removal_cbs[source].Invoke() removal_cbs -= source From 595aa20d4ffea45b5174c3c0ab4efa0a288cc447 Mon Sep 17 00:00:00 2001 From: Fira Date: Mon, 27 Jul 2026 08:38:59 +0000 Subject: [PATCH 3/3] removes comment. not relevant --- code/controllers/subsystem/minimap.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/controllers/subsystem/minimap.dm b/code/controllers/subsystem/minimap.dm index 90b1fab852b3..a96212ec9567 100644 --- a/code/controllers/subsystem/minimap.dm +++ b/code/controllers/subsystem/minimap.dm @@ -637,7 +637,7 @@ SUBSYSTEM_DEF(minimaps) pixel_y = MINIMAP_PIXEL_FROM_WORLD(movable_loc.y) + minimap.y_offset ///Used to handle minimap tracking inside other movables -/atom/movable/proc/override_minimap_tracking() // This could be unrolled into minimap_on_move +/atom/movable/proc/override_minimap_tracking() var/image/blip = SSminimaps.images_by_source[src] blip.RegisterSignal(loc, COMSIG_MOVABLE_MOVED, TYPE_PROC_REF(/image, minimap_on_move)) RegisterSignal(loc, COMSIG_ATOM_EXITED, PROC_REF(cancel_override_minimap_tracking))