mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-29 07:59:01 +01:00
Replace holomap with PDA map program (#17751)
* map program, holomap init order
* huh
* programz
* program defines
* hmm.......
* a
* map 😩
* sane code, zoom
* holo_minimaps -> minimaps
* o
* remove station holomap stuff
* changelog, shitcode, mapping
* c
* o
* minus
* generate_all_minimaps()
* holomap init order
* tests rerun please
* tests rerun please
* aurora station_map removal
* legend via labeledlist
* table
* key
* aaaaaaaaaaaaaaaaaaaaaaa
---------
Co-authored-by: DreamySkrell <>
This commit is contained in:
co-authored by
DreamySkrell <>
parent
4201960811
commit
e8cb6187da
@@ -6,35 +6,39 @@ SUBSYSTEM_DEF(holomap)
|
||||
flags = SS_NO_FIRE
|
||||
init_order = SS_INIT_HOLOMAP
|
||||
|
||||
var/list/holo_minimaps = list()
|
||||
var/list/extra_minimaps = list()
|
||||
var/list/station_holomaps = list()
|
||||
/// List of images of minimaps, for every z-level, initialized at round start.
|
||||
/// This is the "base" minimap, shows only the physical structure of walls and paths, and respects `HIDE_FROM_HOLOMAP`.
|
||||
/// Key of list is the `z` of the z-level, value is the `/icon/`.
|
||||
/// Every image is 255x255px.
|
||||
var/list/minimaps = list()
|
||||
|
||||
/// Same as `minimaps`, but images are base64 encoded.
|
||||
var/list/minimaps_base64 = list()
|
||||
|
||||
/// Same as `minimaps_base64`, but the map is colored with `holomap_color` of the `/area/`
|
||||
var/list/minimaps_area_colored_base64 = list()
|
||||
|
||||
/datum/controller/subsystem/holomap/Initialize()
|
||||
holo_minimaps.len = world.maxz
|
||||
for (var/z in 1 to world.maxz)
|
||||
holo_minimaps[z] = generateHoloMinimap(z)
|
||||
|
||||
LOG_DEBUG("SSholomap: [holo_minimaps.len] maps.")
|
||||
|
||||
for (var/z in current_map.station_levels)
|
||||
generateStationMinimap(z)
|
||||
|
||||
generate_all_minimaps()
|
||||
LOG_DEBUG("SSholomap: [minimaps.len] maps.")
|
||||
..()
|
||||
|
||||
/datum/controller/subsystem/holomap/proc/generate_all_minimaps()
|
||||
minimaps.len = world.maxz
|
||||
minimaps_base64.len = world.maxz
|
||||
minimaps_area_colored_base64.len = world.maxz
|
||||
|
||||
// Generates the "base" holomap for one z-level, showing only the physical structure of walls and paths.
|
||||
/datum/controller/subsystem/holomap/proc/generateHoloMinimap(zlevel = 1)
|
||||
// Save these values now to avoid a bazillion array lookups
|
||||
var/offset_x = HOLOMAP_PIXEL_OFFSET_X(zlevel)
|
||||
var/offset_y = HOLOMAP_PIXEL_OFFSET_Y(zlevel)
|
||||
for (var/z in 1 to world.maxz)
|
||||
generate_minimap(z)
|
||||
generate_minimap_area_colored(z)
|
||||
|
||||
/datum/controller/subsystem/holomap/proc/generate_minimap(zlevel = 1)
|
||||
// Sanity checks - Better to generate a helpful error message now than have DrawBox() runtime
|
||||
var/icon/canvas = icon(HOLOMAP_ICON, "blank")
|
||||
if(world.maxx + offset_x > canvas.Width())
|
||||
CRASH("Minimap for z=[zlevel] : world.maxx ([world.maxx]) + holomap_offset_x ([offset_x]) must be <= [canvas.Width()]")
|
||||
if(world.maxy + offset_y > canvas.Height())
|
||||
CRASH("Minimap for z=[zlevel] : world.maxy ([world.maxy]) + holomap_offset_y ([offset_y]) must be <= [canvas.Height()]")
|
||||
var/icon/canvas = icon('icons/255x255.dmi', "blank")
|
||||
if(world.maxx > canvas.Width())
|
||||
CRASH("Minimap for z=[zlevel] : world.maxx ([world.maxx]) must be <= [canvas.Width()]")
|
||||
if(world.maxy > canvas.Height())
|
||||
CRASH("Minimap for z=[zlevel] : world.maxy ([world.maxy]) must be <= [canvas.Height()]")
|
||||
|
||||
var/list/rock_tcache = typecacheof(list(
|
||||
/turf/simulated/mineral,
|
||||
@@ -64,25 +68,22 @@ SUBSYSTEM_DEF(holomap)
|
||||
if (rock_tcache[Ttype])
|
||||
continue
|
||||
if (obstacle_tcache[Ttype] || (T.contents.len && locate(/obj/structure/grille, T)))
|
||||
canvas.DrawBox(HOLOMAP_OBSTACLE, T.x + offset_x, T.y + offset_y)
|
||||
canvas.DrawBox(HOLOMAP_OBSTACLE + "DD", T.x, T.y)
|
||||
else if(path_tcache[Ttype] || (T.contents.len && locate(/obj/structure/lattice/catwalk, T)))
|
||||
canvas.DrawBox(HOLOMAP_PATH, T.x + offset_x, T.y + offset_y)
|
||||
canvas.DrawBox(HOLOMAP_PATH + "DD", T.x, T.y)
|
||||
|
||||
CHECK_TICK
|
||||
|
||||
return canvas
|
||||
|
||||
/datum/controller/subsystem/holomap/proc/generateStationMinimap(zlevel)
|
||||
// Save these values now to avoid a bazillion array lookups
|
||||
var/offset_x = HOLOMAP_PIXEL_OFFSET_X(zlevel)
|
||||
var/offset_y = HOLOMAP_PIXEL_OFFSET_Y(zlevel)
|
||||
minimaps[zlevel] = canvas
|
||||
minimaps_base64[zlevel] = icon2base64(canvas)
|
||||
|
||||
/datum/controller/subsystem/holomap/proc/generate_minimap_area_colored(zlevel)
|
||||
// Sanity checks - Better to generate a helpful error message now than have DrawBox() runtime
|
||||
var/icon/canvas = icon(HOLOMAP_ICON, "blank")
|
||||
if(world.maxx + offset_x > canvas.Width())
|
||||
crash_with("Minimap for z=[zlevel] : world.maxx ([world.maxx]) + holomap_offset_x ([offset_x]) must be <= [canvas.Width()]")
|
||||
if(world.maxy + offset_y > canvas.Height())
|
||||
crash_with("Minimap for z=[zlevel] : world.maxy ([world.maxy]) + holomap_offset_y ([offset_y]) must be <= [canvas.Height()]")
|
||||
var/icon/canvas = icon('icons/255x255.dmi', "blank")
|
||||
if(world.maxx > canvas.Width())
|
||||
crash_with("Minimap for z=[zlevel] : world.maxx ([world.maxx]) must be <= [canvas.Width()]")
|
||||
if(world.maxy > canvas.Height())
|
||||
crash_with("Minimap for z=[zlevel] : world.maxy ([world.maxy]) must be <= [canvas.Height()]")
|
||||
|
||||
var/turf/T
|
||||
var/area/A
|
||||
@@ -90,30 +91,13 @@ SUBSYSTEM_DEF(holomap)
|
||||
T = thing
|
||||
A = T.loc
|
||||
if (A.holomap_color)
|
||||
canvas.DrawBox(A.holomap_color, T.x + offset_x, T.y + offset_y)
|
||||
canvas.DrawBox(A.holomap_color + "99", T.x, T.y)
|
||||
|
||||
// Save this nice area-colored canvas in case we want to layer it or something I guess
|
||||
extra_minimaps["[HOLOMAP_EXTRA_STATIONMAPAREAS]_[zlevel]"] = canvas
|
||||
|
||||
var/icon/map_base = icon(holo_minimaps[zlevel])
|
||||
var/icon/map_base = icon(minimaps[zlevel])
|
||||
map_base.Blend(HOLOMAP_HOLOFIER, ICON_MULTIPLY)
|
||||
|
||||
// Generate the full sized map by blending the base and areas onto the backdrop
|
||||
var/icon/big_map = icon(HOLOMAP_ICON, "stationmap")
|
||||
var/icon/big_map = icon('icons/255x255.dmi', "blank")
|
||||
big_map.Blend(map_base, ICON_OVERLAY)
|
||||
big_map.Blend(canvas, ICON_OVERLAY)
|
||||
extra_minimaps["[HOLOMAP_EXTRA_STATIONMAP]_[zlevel]"] = big_map
|
||||
|
||||
// Generate the "small" map (I presume for putting on wall map things?)
|
||||
var/icon/small_map = icon(HOLOMAP_ICON, "blank")
|
||||
small_map.Blend(map_base, ICON_OVERLAY)
|
||||
small_map.Blend(canvas, ICON_OVERLAY)
|
||||
small_map.Scale(WORLD_ICON_SIZE, WORLD_ICON_SIZE)
|
||||
|
||||
// And rotate it in every direction of course!
|
||||
var/icon/actual_small_map = icon(small_map)
|
||||
actual_small_map.Insert(new_icon = small_map, dir = SOUTH)
|
||||
actual_small_map.Insert(new_icon = turn(small_map, 90), dir = WEST)
|
||||
actual_small_map.Insert(new_icon = turn(small_map, 180), dir = NORTH)
|
||||
actual_small_map.Insert(new_icon = turn(small_map, 270), dir = EAST)
|
||||
extra_minimaps["[HOLOMAP_EXTRA_STATIONMAPSMALL]_[zlevel]"] = actual_small_map
|
||||
minimaps_area_colored_base64[zlevel] = icon2base64(big_map)
|
||||
|
||||
@@ -18,7 +18,6 @@ SUBSYSTEM_DEF(misc_early)
|
||||
global_hud.thermal,
|
||||
global_hud.meson,
|
||||
global_hud.science,
|
||||
global_hud.holomap
|
||||
)
|
||||
|
||||
// Populate global list of tips by category
|
||||
|
||||
Reference in New Issue
Block a user