From 54e4fa3d6b8fd15794438fb44d45fb9ec9e6e587 Mon Sep 17 00:00:00 2001 From: ShadowLarkens Date: Thu, 29 May 2025 04:03:16 -0700 Subject: [PATCH] Piggyback on holomaps to generate runtime maps (#17731) --- code/__defines/subsystems.dm | 4 +-- code/controllers/subsystems/holomaps.dm | 26 +++++++++++++++ code/modules/asset_cache/assets/nanomap.dm | 6 ++++ .../assets/spritesheets/nanomaps.dm | 33 ------------------- code/modules/tgui/modules/atmos_control.dm | 2 +- code/modules/tgui/modules/crew_monitor.dm | 2 +- code/modules/tgui/tgui.dm | 1 - tgui/packages/tgui/components/NanoMap.tsx | 5 ++- vorestation.dme | 2 +- 9 files changed, 39 insertions(+), 42 deletions(-) create mode 100644 code/modules/asset_cache/assets/nanomap.dm delete mode 100644 code/modules/asset_cache/assets/spritesheets/nanomaps.dm diff --git a/code/__defines/subsystems.dm b/code/__defines/subsystems.dm index fc9a8bca43..5f39a5c3ab 100644 --- a/code/__defines/subsystems.dm +++ b/code/__defines/subsystems.dm @@ -149,8 +149,8 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G #define INIT_ORDER_DEFAULT 0 #define INIT_ORDER_LIGHTING 0 #define INIT_ORDER_AIR -1 -#define INIT_ORDER_ASSETS -3 -#define INIT_ORDER_HOLOMAPS -5 +#define INIT_ORDER_HOLOMAPS -3 +#define INIT_ORDER_ASSETS -5 #define INIT_ORDER_NIGHTSHIFT -6 #define INIT_ORDER_OVERLAY -7 #define INIT_ORDER_XENOARCH -20 diff --git a/code/controllers/subsystems/holomaps.dm b/code/controllers/subsystems/holomaps.dm index 6b4af9d334..11270bc2a5 100644 --- a/code/controllers/subsystems/holomaps.dm +++ b/code/controllers/subsystems/holomaps.dm @@ -22,3 +22,29 @@ SUBSYSTEM_DEF(holomaps) if (!GLOB.Debug2) return // Only show up in stat panel if debugging is enabled. . = ..() + +/datum/controller/subsystem/holomaps/proc/dump_nanomap_icons() + . = list() + + for(var/z = 1 to world.maxz) + var/icon/base = icon(HOLOMAP_ICON, "blank") // start at 480x480 + base.Scale(world.maxx, world.maxy) // scale down to perfectly fit the map size + + var/icon/walls = icon(holoMiniMaps[z]) + var/icon/areas = extraMiniMaps["[HOLOMAP_EXTRA_STATIONMAPAREAS]_[z]"] + + base.Blend(walls, ICON_OVERLAY) + if(areas) + base.Blend(areas, ICON_OVERLAY) + + var/fname = "data/spritesheets/minimap_[z].png" + + // Copy to a file + fcopy(base, fname) + + // Strip DMI metadata to prevent any ~issues~ + var/error = rustg_dmi_strip_metadata(fname) + if(length(error)) + stack_trace("Failed to strip [fname]: [error]") + + .["minimap_[z].png"] = fname diff --git a/code/modules/asset_cache/assets/nanomap.dm b/code/modules/asset_cache/assets/nanomap.dm new file mode 100644 index 0000000000..7d23a05472 --- /dev/null +++ b/code/modules/asset_cache/assets/nanomap.dm @@ -0,0 +1,6 @@ +/datum/asset/simple/holo_nanomap + keep_local_name = TRUE + +/datum/asset/simple/holo_nanomap/register() + assets = SSholomaps.dump_nanomap_icons() + . = ..() diff --git a/code/modules/asset_cache/assets/spritesheets/nanomaps.dm b/code/modules/asset_cache/assets/spritesheets/nanomaps.dm deleted file mode 100644 index 6aab3298a0..0000000000 --- a/code/modules/asset_cache/assets/spritesheets/nanomaps.dm +++ /dev/null @@ -1,33 +0,0 @@ -/datum/asset/simple/nanomaps - // It REALLY doesnt matter too much if these arent up to date - // They are relatively big - assets = list( - // VOREStation Edit: We don't need Southern Cross - // "southern_cross_nanomap_z1.png" = 'icons/_nanomaps/southern_cross_nanomap_z1.png', - // "southern_cross_nanomap_z10.png" = 'icons/_nanomaps/southern_cross_nanomap_z10.png', - // "southern_cross_nanomap_z2.png" = 'icons/_nanomaps/southern_cross_nanomap_z2.png', - // "southern_cross_nanomap_z3.png" = 'icons/_nanomaps/southern_cross_nanomap_z3.png', - // "southern_cross_nanomap_z5.png" = 'icons/_nanomaps/southern_cross_nanomap_z5.png', - // "southern_cross_nanomap_z6.png" = 'icons/_nanomaps/southern_cross_nanomap_z6.png', - "tether_nanomap_z1.png" = 'icons/_nanomaps/tether_nanomap_z1.png', - "tether_nanomap_z2.png" = 'icons/_nanomaps/tether_nanomap_z2.png', - "tether_nanomap_z3.png" = 'icons/_nanomaps/tether_nanomap_z3.png', - "tether_nanomap_z4.png" = 'icons/_nanomaps/tether_nanomap_z4.png', - "tether_nanomap_z5.png" = 'icons/_nanomaps/tether_nanomap_z5.png', - "tether_nanomap_z6.png" = 'icons/_nanomaps/tether_nanomap_z6.png', - "tether_nanomap_z7.png" = 'icons/_nanomaps/tether_nanomap_z7.png', - "stellardelight_nanomap_z1.png" = 'icons/_nanomaps/sd_deck1.png', - "stellardelight_nanomap_z2.png" = 'icons/_nanomaps/sd_deck2.png', - "stellardelight_nanomap_z3.png" = 'icons/_nanomaps/sd_deck3.png', - "groundbase_nanomap_z1.png" = 'icons/_nanomaps/gb1.png', - "groundbase_nanomap_z2.png" = 'icons/_nanomaps/gb2.png', - "groundbase_nanomap_z3.png" = 'icons/_nanomaps/gb3.png', - "groundbase_nanomap_z4.png" = 'icons/_nanomaps/gbnorth.png', - "groundbase_nanomap_z5.png" = 'icons/_nanomaps/gbsouth.png', - "groundbase_nanomap_z6.png" = 'icons/_nanomaps/gbeast.png', - "groundbase_nanomap_z7.png" = 'icons/_nanomaps/gbwest.png', - "groundbase_nanomap_z10.png" = 'icons/_nanomaps/gbmining.png', - - - // VOREStation Edit End - ) diff --git a/code/modules/tgui/modules/atmos_control.dm b/code/modules/tgui/modules/atmos_control.dm index ad08a9efd2..1750509c03 100644 --- a/code/modules/tgui/modules/atmos_control.dm +++ b/code/modules/tgui/modules/atmos_control.dm @@ -36,7 +36,7 @@ /datum/tgui_module/atmos_control/ui_assets(mob/user) . = ..() - . += get_asset_datum(/datum/asset/simple/nanomaps) + . += get_asset_datum(/datum/asset/simple/holo_nanomap) /datum/tgui_module/atmos_control/tgui_interact(mob/user, datum/tgui/ui = null) ui = SStgui.try_update_ui(user, src, ui) diff --git a/code/modules/tgui/modules/crew_monitor.dm b/code/modules/tgui/modules/crew_monitor.dm index e2e3c056ab..dfcb5e4cfe 100644 --- a/code/modules/tgui/modules/crew_monitor.dm +++ b/code/modules/tgui/modules/crew_monitor.dm @@ -4,7 +4,7 @@ /datum/tgui_module/crew_monitor/ui_assets(mob/user) return list( - get_asset_datum(/datum/asset/simple/nanomaps), + get_asset_datum(/datum/asset/simple/holo_nanomap), ) /datum/tgui_module/crew_monitor/tgui_act(action, params, datum/tgui/ui) diff --git a/code/modules/tgui/tgui.dm b/code/modules/tgui/tgui.dm index fd5f3bc71a..e2fd46c67d 100644 --- a/code/modules/tgui/tgui.dm +++ b/code/modules/tgui/tgui.dm @@ -280,7 +280,6 @@ ), //"refreshing" = refreshing, "refreshing" = FALSE, - "map" = (using_map && using_map.path) ? using_map.path : "Unknown", "mapZLevel" = map_z_level, "window" = list( "key" = window_key, diff --git a/tgui/packages/tgui/components/NanoMap.tsx b/tgui/packages/tgui/components/NanoMap.tsx index 07f0e344aa..d0fa314281 100644 --- a/tgui/packages/tgui/components/NanoMap.tsx +++ b/tgui/packages/tgui/components/NanoMap.tsx @@ -180,9 +180,7 @@ export class NanoMap extends Component { const { dragging, offsetX, offsetY, zoom = 1 } = this.state; const { children } = this.props; - const mapUrl = resolveAsset( - config.map + '_nanomap_z' + config.mapZLevel + '.png', - ); + const mapUrl = resolveAsset('minimap_' + config.mapZLevel + '.png'); // (x * zoom), x Needs to be double the turf- map size. (for virgo, 140x140) const mapSize = this.props.zoomScale * zoom + 'px'; const newStyle: {} = { @@ -192,6 +190,7 @@ export class NanoMap extends Component { 'margin-left': offsetX + 'px', overflow: 'hidden', position: 'relative', + 'image-rendering': 'pixelated', 'background-image': 'url(' + mapUrl + ')', 'background-size': 'cover', 'background-repeat': 'no-repeat', diff --git a/vorestation.dme b/vorestation.dme index c49f855383..f3e6c8ea76 100644 --- a/vorestation.dme +++ b/vorestation.dme @@ -2056,6 +2056,7 @@ #include "code\modules\asset_cache\assets\jquery.dm" #include "code\modules\asset_cache\assets\lobby.dm" #include "code\modules\asset_cache\assets\microwave.dm" +#include "code\modules\asset_cache\assets\nanomap.dm" #include "code\modules\asset_cache\assets\ntos.dm" #include "code\modules\asset_cache\assets\permissions.dm" #include "code\modules\asset_cache\assets\preferences.dm" @@ -2064,7 +2065,6 @@ #include "code\modules\asset_cache\assets\spritesheets\chat.dm" #include "code\modules\asset_cache\assets\spritesheets\chem_master.dm" #include "code\modules\asset_cache\assets\spritesheets\kitchen_recipes.dm" -#include "code\modules\asset_cache\assets\spritesheets\nanomaps.dm" #include "code\modules\asset_cache\assets\spritesheets\pipes.dm" #include "code\modules\asset_cache\assets\spritesheets\robot_icons.dm" #include "code\modules\asset_cache\assets\spritesheets\stacks.dm"