Merge pull request #3183 from VOREStation/vplk-ss-holomaps

Reorganzied Holo Minimaps into SSholomaps subsystem.
This commit is contained in:
Leshana
2018-03-05 20:13:32 -05:00
committed by GitHub
6 changed files with 44 additions and 28 deletions
+7 -17
View File
@@ -23,23 +23,13 @@
/*|| istype(tile, /turf/simulated/shuttle/floor)*/ \
|| (locate(/obj/structure/catwalk) in tile))
// WARNING - TOTAL HACK - HOOKING INIT
/datum/controller/game_controller/setup_objects()
..()
generateHoloMinimaps()
/// Generates all the holo minimaps, initializing it all nicely, probably.
// TODO - This should be a subsystem ~Leshana
var/global/holomaps_initialized = FALSE
var/global/list/holoMiniMaps = list()
var/global/list/extraMiniMaps = list()
/proc/generateHoloMinimaps()
/datum/controller/subsystem/holomaps/proc/generateHoloMinimaps()
var/start_time = world.timeofday
// Build the base map for each z level
for (var/z = 1 to world.maxz)
global.holoMiniMaps |= z // hack, todo fix
global.holoMiniMaps[z] = generateHoloMinimap(z)
holoMiniMaps |= z // hack, todo fix
holoMiniMaps[z] = generateHoloMinimap(z)
// Generate the area overlays, small maps, etc for the station levels.
for (var/z in using_map.station_levels)
@@ -49,7 +39,7 @@ var/global/list/extraMiniMaps = list()
for(var/smoosh_list in using_map.holomap_smoosh)
smooshTetherHolomaps(smoosh_list)
global.holomaps_initialized = TRUE
holomaps_initialized = TRUE
admin_notice("<span class='notice'>Holomaps initialized in [round(0.1*(world.timeofday-start_time),0.1)] seconds.</span>", R_DEBUG)
// TODO - Check - They had a delayed init perhaps?
@@ -57,7 +47,7 @@ var/global/list/extraMiniMaps = list()
S.setup_holomap()
// Generates the "base" holomap for one z-level, showing only the physical structure of walls and paths.
/proc/generateHoloMinimap(var/zLevel = 1)
/datum/controller/subsystem/holomaps/proc/generateHoloMinimap(var/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)
@@ -87,7 +77,7 @@ var/global/list/extraMiniMaps = list()
// This seems to do the drawing thing, but draws only the areas, having nothing to do with the tiles.
// Leshana: I'm guessing this map will get overlayed on top of the base map at runtime? We'll see.
// Wait, seems we actually blend the area map on top of it right now! Huh.
/proc/generateStationMinimap(var/zLevel)
/datum/controller/subsystem/holomaps/proc/generateStationMinimap(var/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)
@@ -134,7 +124,7 @@ var/global/list/extraMiniMaps = list()
extraMiniMaps["[HOLOMAP_EXTRA_STATIONMAPSMALL]_[zLevel]"] = actual_small_map
// For tiny multi-z maps like the tether, we want to smoosh em together into a nice big one!
/proc/smooshTetherHolomaps(var/list/zlevels)
/datum/controller/subsystem/holomaps/proc/smooshTetherHolomaps(var/list/zlevels)
var/icon/big_map = icon(HOLOMAP_ICON, "stationmap")
var/icon/small_map = icon(HOLOMAP_ICON, "blank")
// For each zlevel in turn, overlay them on top of each other
+2 -2
View File
@@ -6,7 +6,7 @@
/datum/station_holomap/proc/initialize_holomap(var/turf/T, var/isAI = null, var/mob/user = null, var/reinit = FALSE)
if(!station_map || reinit)
station_map = image(extraMiniMaps["[HOLOMAP_EXTRA_STATIONMAP]_[T.z]"])
station_map = image(SSholomaps.extraMiniMaps["[HOLOMAP_EXTRA_STATIONMAP]_[T.z]"])
if(!cursor || reinit)
cursor = image('icons/holomap_markers_vr.dmi', "you")
if(!legend || reinit)
@@ -33,7 +33,7 @@
// TODO - Strategic Holomap support
// /datum/station_holomap/strategic/initialize_holomap(var/turf/T, var/isAI=null, var/mob/user=null)
// ..()
// station_map = image(extraMiniMaps[HOLOMAP_EXTRA_STATIONMAP_STRATEGIC])
// station_map = image(SSholomaps.extraMiniMaps[HOLOMAP_EXTRA_STATIONMAP_STRATEGIC])
// legend = image('icons/effects/64x64.dmi', "strategic")
// legend.pixel_x = 3*WORLD_ICON_SIZE
// legend.pixel_y = 3*WORLD_ICON_SIZE
+9 -9
View File
@@ -1,5 +1,6 @@
var/global/list/station_holomaps = list()
//
// Wall mounted holomap of the station
//
/obj/machinery/station_map
name = "station holomap"
desc = "A virtual map of the surrounding station."
@@ -10,7 +11,6 @@ var/global/list/station_holomaps = list()
use_power = 1
idle_power_usage = 10
active_power_usage = 500
//auto_init = 0 // We handle our own special initialization needs. // TODO - Make this not ~Leshana
circuit = /obj/item/weapon/circuitboard/station_map
// TODO - Port use_auto_lights from /vg - for now declare here
@@ -34,17 +34,17 @@ var/global/list/station_holomaps = list()
..()
holomap_datum = new()
original_zLevel = loc.z
station_holomaps += src
SSholomaps.station_holomaps += src
flags |= ON_BORDER // Why? It doesn't help if its not density
/obj/machinery/station_map/initialize()
. = ..()
if(ticker && holomaps_initialized)
if(SSholomaps.holomaps_initialized)
spawn(1) // Tragically we need to spawn this in order to give the frame construcing us time to set pixel_x/y
setup_holomap()
/obj/machinery/station_map/Destroy()
station_holomaps -= src
SSholomaps.station_holomaps -= src
stopWatching()
holomap_datum = null
. = ..()
@@ -54,7 +54,7 @@ var/global/list/station_holomaps = list()
bogus = FALSE
var/turf/T = get_turf(src)
original_zLevel = T.z
if(!("[HOLOMAP_EXTRA_STATIONMAP]_[original_zLevel]" in extraMiniMaps))
if(!("[HOLOMAP_EXTRA_STATIONMAP]_[original_zLevel]" in SSholomaps.extraMiniMaps))
bogus = TRUE
holomap_datum.initialize_holomap_bogus()
update_icon()
@@ -62,7 +62,7 @@ var/global/list/station_holomaps = list()
holomap_datum.initialize_holomap(T, reinit = TRUE)
small_station_map = image(extraMiniMaps["[HOLOMAP_EXTRA_STATIONMAPSMALL]_[original_zLevel]"], dir = dir)
small_station_map = image(SSholomaps.extraMiniMaps["[HOLOMAP_EXTRA_STATIONMAPSMALL]_[original_zLevel]"], dir = dir)
// small_station_map.plane = LIGHTING_PLANE // Not until we do planes ~Leshana
// small_station_map.layer = LIGHTING_LAYER+1 // Weird things will happen!
@@ -182,7 +182,7 @@ var/global/list/station_holomaps = list()
if(bogus)
holomap_datum.initialize_holomap_bogus()
else
small_station_map.icon = extraMiniMaps["[HOLOMAP_EXTRA_STATIONMAPSMALL]_[original_zLevel]"]
small_station_map.icon = SSholomaps.extraMiniMaps["[HOLOMAP_EXTRA_STATIONMAPSMALL]_[original_zLevel]"]
overlays |= small_station_map
holomap_datum.initialize_holomap(get_turf(src))