mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-21 12:56:10 +01:00
088a71aacd
Fixes https://github.com/Aurorastation/Aurora.3/issues/14594 Fixes https://github.com/Aurorastation/Aurora.3/issues/19524 Fixes https://github.com/Aurorastation/Aurora.3/issues/19525 Fixes https://github.com/Aurorastation/Aurora.3/issues/19554 Fixes https://github.com/Aurorastation/Aurora.3/issues/19565 Fixes https://github.com/Aurorastation/Aurora.3/issues/19669 Fixes https://github.com/Aurorastation/Aurora.3/issues/19739 Fixes https://github.com/Aurorastation/Aurora.3/issues/19751 Fixes https://github.com/Aurorastation/Aurora.3/issues/20323 Fixes https://github.com/Aurorastation/Aurora.3/issues/20530 Fixes https://github.com/Aurorastation/Aurora.3/issues/21008 Fixes https://github.com/Aurorastation/Aurora.3/issues/21370 Fixes https://github.com/Aurorastation/Aurora.3/issues/21375 Fixes https://github.com/Aurorastation/Aurora.3/issues/21438 Fixes https://github.com/Aurorastation/Aurora.3/issues/21456 changes: - balance: "Budget insulated gloves no longer able to be manually restocked in YouTool (random insulation coefficient reroll exploit)." - bugfix: "Replaces missing req_access values from D3 Medical Equipment Storage." - bugfix: "Emitters can be rotated again (alt-click lock toggling disabled)." - bugfix: "Lights no longer explode when toggled off and on." - bugfix: "Langchat images now pop up for untranslated speech." - bugfix: "Cyborgs can no longer flip Plasteel Barricades remotely." - bugfix: "Fixes ghost vision inconsistently toggling when Following mobs." - bugfix: "Removes deprecated 'Gender and Pronouns' section from Appearance Changer (has been replaced by 'Pronouns' section)." - bugfix: "Offship locations will not print Mining Yield Declarations saying they're from SCCV Horizon." - bugfix: "Simple mobs which target their surroundings (destroying tables windows etc) will not do so if inside a container." - bugfix: "Newscaster Announcements channel now logs announcements made by heads of staff." - bugfix: "Held phoron- or chlorine-contaminated items will respect if you're wearing a sealed suit or thick gloves (that is to say, if the gloves provide fire protection)." - bugfix: "Fixes runtime in Electrical Storm event." - bugfix: "Fixes some bounties returning 0 credit reward due to rounding issues." - bugfix: "Removes old fusion debug vars, fixed outdated maths." - bugfix: "Fixes Horizon kitchen alt fridge being swapped w/ empty freezer." - bugfix: "Fixes chameleon projector sometimes turning user invisible." - bugfix: "You are again able to push an object currently being pulled." - bugfix: "Command Support roles which start with flash-protective sunglasses can now also choose them in their loadout." - code_imp: "Updates more code comments to DMDocs." - code_imp: "Corrects poison/venom for greimorian variable naming." - rscadd: "Adds missing fire alarm to Paramedic Quarters." - rscadd: "Holomap now respects and displays outer hull structure." --------- Signed-off-by: Batrachophreno <Batrochophreno@gmail.com>
160 lines
6.2 KiB
Plaintext
160 lines
6.2 KiB
Plaintext
// Minimap generation system adapted from vorestation, adapted from /vg/.
|
|
// Seems to be much simpler/saner than /vg/'s implementation.
|
|
|
|
SUBSYSTEM_DEF(holomap)
|
|
name = "Holomap"
|
|
flags = SS_NO_FIRE
|
|
init_order = SS_INIT_HOLOMAP
|
|
|
|
/// 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()
|
|
|
|
/// Same as `minimaps_base64`, but does not discriminate between walls and paths.
|
|
var/list/minimaps_scan_base64 = list()
|
|
|
|
/// List of all `/obj/effect/landmark/minimap_poi`.
|
|
var/list/obj/effect/landmark/minimap_poi/pois = list()
|
|
|
|
|
|
/*#############################################
|
|
Typecaches used for map icon generation
|
|
#############################################*/
|
|
var/static/list/mineral_wall_tcache = typecacheof(list(
|
|
/turf/simulated/mineral,
|
|
/turf/unsimulated/mineral,
|
|
))
|
|
var/static/list/mineral_floor_tcache = typecacheof(list(
|
|
/turf/simulated/floor/exoplanet/asteroid,
|
|
/turf/simulated/mineral,
|
|
/turf/simulated/floor/exoplanet,
|
|
))
|
|
var/static/list/hull_tcache = typecacheof(list(
|
|
/turf/simulated/wall,
|
|
/turf/simulated/floor,
|
|
/turf/unsimulated/wall,
|
|
/turf/unsimulated/floor,
|
|
))
|
|
var/static/list/outer_hull_tcache = typecacheof(list(
|
|
/turf/simulated/wall/shuttle/scc_space_ship,
|
|
/turf/unsimulated/wall/shuttle/scc_space_ship
|
|
))
|
|
var/static/list/rock_tcache = typecacheof(list(
|
|
/turf/simulated/mineral,
|
|
/turf/simulated/floor/exoplanet/asteroid,
|
|
/turf/simulated/open
|
|
))
|
|
var/static/list/obstacle_tcache = typecacheof(list(
|
|
/turf/simulated/wall,
|
|
/turf/unsimulated/mineral,
|
|
/turf/unsimulated/wall
|
|
))
|
|
var/static/list/path_tcache = typecacheof(list(
|
|
/turf/simulated/floor,
|
|
/turf/unsimulated/floor
|
|
)) - typecacheof(/turf/simulated/floor/exoplanet/asteroid)
|
|
|
|
/datum/controller/subsystem/holomap/Initialize()
|
|
generate_all_minimaps()
|
|
LOG_DEBUG("SSholomap: [minimaps.len] maps.")
|
|
|
|
return SS_INIT_SUCCESS
|
|
|
|
/datum/controller/subsystem/holomap/proc/generate_all_minimaps()
|
|
minimaps.len = world.maxz
|
|
minimaps_base64.len = world.maxz
|
|
minimaps_area_colored_base64.len = world.maxz
|
|
minimaps_scan_base64.len = world.maxz
|
|
|
|
for (var/z in 1 to world.maxz)
|
|
generate_minimap(z)
|
|
generate_minimap_area_colored(z)
|
|
generate_minimap_scan(z)
|
|
CHECK_TICK
|
|
|
|
/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('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()]")
|
|
|
|
for(var/turf/T as anything in Z_TURFS(zlevel))
|
|
var/area/A = T.loc
|
|
var/Ttype = T.type
|
|
|
|
if(A.area_flags & AREA_FLAG_HIDE_FROM_HOLOMAP)
|
|
if(outer_hull_tcache[Ttype] || (length(T.contents) && (locate(/obj/structure/shuttle_part/scc_space_ship, T) || locate(/obj/structure/window/shuttle/scc_space_ship, T))))
|
|
canvas.DrawBox(HOLOMAP_OBSTACLE + "DD", T.x, T.y)
|
|
|
|
if(length(T.contents) && locate(/obj/machinery/door/airlock/external, T))
|
|
canvas.DrawBox(HOLOMAP_PATH + "DD", T.x, T.y)
|
|
|
|
if(!istype(A, /area/horizon/maintenance) && !istype(A, /area/horizon/weapons) && !istype(A, /area/horizon/ai) && !istype(A, /area/horizon/command/bridge/aibunker) && !istype(A, /area/horizon/command/bridge/selfdestruct))
|
|
if(path_tcache[Ttype] || (length(T.contents) && locate(/obj/structure/grille, T)))
|
|
canvas.DrawBox(HOLOMAP_PATH + "DD", T.x, T.y)
|
|
else
|
|
continue
|
|
if(rock_tcache[Ttype])
|
|
continue
|
|
if(obstacle_tcache[Ttype] || (length(T.contents) && locate(/obj/structure/grille, T)))
|
|
canvas.DrawBox(HOLOMAP_OBSTACLE + "DD", T.x, T.y)
|
|
else if(path_tcache[Ttype] || (length(T.contents) && locate(/obj/structure/lattice/catwalk, T)))
|
|
canvas.DrawBox(HOLOMAP_PATH + "DD", T.x, T.y)
|
|
|
|
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('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()]")
|
|
|
|
for (var/turf/T as anything in Z_TURFS(zlevel))
|
|
var/area/A = T.loc
|
|
|
|
if (A.area_flags & AREA_FLAG_HIDE_FROM_HOLOMAP)
|
|
continue
|
|
if (A.holomap_color)
|
|
canvas.DrawBox(A.holomap_color + "99", T.x, T.y)
|
|
|
|
var/icon/map_base = icon(minimaps[zlevel])
|
|
|
|
// Generate the full sized map by blending the base and areas onto the backdrop
|
|
var/icon/big_map = icon('icons/255x255.dmi', "blank")
|
|
big_map.Blend(map_base, ICON_OVERLAY)
|
|
big_map.Blend(canvas, ICON_OVERLAY)
|
|
minimaps_area_colored_base64[zlevel] = icon2base64(big_map)
|
|
|
|
/datum/controller/subsystem/holomap/proc/generate_minimap_scan(zlevel = 1)
|
|
// Sanity checks - Better to generate a helpful error message now than have DrawBox() runtime
|
|
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()]")
|
|
|
|
for(var/turf/T as anything in Z_TURFS(zlevel))
|
|
var/Ttype = T.type
|
|
|
|
if (mineral_wall_tcache[Ttype])
|
|
canvas.DrawBox(HOLOMAP_MINERAL_WALL, T.x, T.y)
|
|
else if (mineral_floor_tcache[Ttype])
|
|
canvas.DrawBox(HOLOMAP_MINERAL_FLOOR, T.x, T.y)
|
|
else if(hull_tcache[Ttype])
|
|
canvas.DrawBox(HOLOMAP_OBSTACLE, T.x, T.y)
|
|
|
|
minimaps_scan_base64[zlevel] = icon2base64(canvas)
|