mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-09 16:12:17 +00:00
- Replace changes from 8c7371c5d4b900308cecdba5335989e8c9f191fe
- Removed debugging prints in skybox generation
- Reverted change to GetConnnectedZLevels to avoid the chicken-or-egg initialization issue of find_z_levels() requiring knowledge of a sector's z-levels during the attempt to determine a sector's z-levels.
- Make find_z_levels() always called again so that lazy open space initialization works on landable ships again.
- Instead, allow static configuration of sector map_z to override the default behavior of calling GetConnectedZLevels()
167 lines
5.9 KiB
Plaintext
167 lines
5.9 KiB
Plaintext
//===================================================================================
|
|
//Overmap object representing zlevel(s)
|
|
//===================================================================================
|
|
/obj/effect/overmap/visitable
|
|
name = "map object"
|
|
scannable = TRUE
|
|
scanner_desc = "!! No Data Available !!"
|
|
|
|
var/list/map_z = list()
|
|
var/list/extra_z_levels //if you need to manually insist that these z-levels are part of this sector, for things like edge-of-map step trigger transitions rather than multi-z complexes
|
|
|
|
var/list/initial_generic_waypoints //store landmark_tag of landmarks that should be added to the actual lists below on init.
|
|
var/list/initial_restricted_waypoints //For use with non-automatic landmarks (automatic ones add themselves).
|
|
|
|
var/list/generic_waypoints = list() //waypoints that any shuttle can use
|
|
var/list/restricted_waypoints = list() //waypoints for specific shuttles
|
|
var/docking_codes
|
|
|
|
var/start_x //Coordinates for self placing
|
|
var/start_y //will use random values if unset
|
|
|
|
var/base = 0 //starting sector, counts as station_levels
|
|
var/in_space = 1 //can be accessed via lucky EVA
|
|
|
|
var/hide_from_reports = FALSE
|
|
|
|
var/has_distress_beacon
|
|
|
|
/obj/effect/overmap/visitable/Initialize()
|
|
. = ..()
|
|
if(. == INITIALIZE_HINT_QDEL)
|
|
return
|
|
|
|
find_z_levels() // This populates map_z and assigns z levels to the ship.
|
|
register_z_levels() // This makes external calls to update global z level information.
|
|
|
|
if(!global.using_map.overmap_z)
|
|
build_overmap()
|
|
|
|
start_x = start_x || rand(OVERMAP_EDGE, global.using_map.overmap_size - OVERMAP_EDGE)
|
|
start_y = start_y || rand(OVERMAP_EDGE, global.using_map.overmap_size - OVERMAP_EDGE)
|
|
|
|
forceMove(locate(start_x, start_y, global.using_map.overmap_z))
|
|
|
|
docking_codes = "[ascii2text(rand(65,90))][ascii2text(rand(65,90))][ascii2text(rand(65,90))][ascii2text(rand(65,90))]"
|
|
|
|
testing("Located sector \"[name]\" at [start_x],[start_y], containing Z [english_list(map_z)]")
|
|
|
|
LAZYADD(SSshuttles.sectors_to_initialize, src) //Queued for further init. Will populate the waypoint lists; waypoints not spawned yet will be added in as they spawn.
|
|
SSshuttles.process_init_queues()
|
|
|
|
//This is called later in the init order by SSshuttles to populate sector objects. Importantly for subtypes, shuttles will be created by then.
|
|
/obj/effect/overmap/visitable/proc/populate_sector_objects()
|
|
|
|
/obj/effect/overmap/visitable/proc/get_areas()
|
|
. = list()
|
|
for(var/area/A)
|
|
if (A.z in map_z)
|
|
. += A
|
|
|
|
/obj/effect/overmap/visitable/proc/find_z_levels()
|
|
if(!LAZYLEN(map_z)) // If map_z is already populated use it as-is, otherwise start with connected z-levels.
|
|
map_z = GetConnectedZlevels(z)
|
|
if(LAZYLEN(extra_z_levels))
|
|
map_z |= extra_z_levels
|
|
|
|
/obj/effect/overmap/visitable/proc/register_z_levels()
|
|
for(var/zlevel in map_z)
|
|
map_sectors["[zlevel]"] = src
|
|
|
|
global.using_map.player_levels |= map_z
|
|
if(!in_space)
|
|
global.using_map.sealed_levels |= map_z
|
|
/* VOREStation Removal - We have a map system that does this already.
|
|
if(base)
|
|
global.using_map.station_levels |= map_z
|
|
global.using_map.contact_levels |= map_z
|
|
global.using_map.map_levels |= map_z
|
|
*/
|
|
|
|
/obj/effect/overmap/visitable/proc/get_space_zlevels()
|
|
if(in_space)
|
|
return map_z
|
|
else
|
|
return list()
|
|
|
|
//Helper for init.
|
|
/obj/effect/overmap/visitable/proc/check_ownership(obj/object)
|
|
if((get_z(object) in map_z) && !(get_area(object) in SSshuttles.shuttle_areas))
|
|
return 1
|
|
|
|
//If shuttle_name is false, will add to generic waypoints; otherwise will add to restricted. Does not do checks.
|
|
/obj/effect/overmap/visitable/proc/add_landmark(obj/effect/shuttle_landmark/landmark, shuttle_name)
|
|
landmark.sector_set(src, shuttle_name)
|
|
if(shuttle_name)
|
|
LAZYADD(restricted_waypoints[shuttle_name], landmark)
|
|
else
|
|
generic_waypoints += landmark
|
|
|
|
/obj/effect/overmap/visitable/proc/remove_landmark(obj/effect/shuttle_landmark/landmark, shuttle_name)
|
|
if(shuttle_name)
|
|
var/list/shuttles = restricted_waypoints[shuttle_name]
|
|
LAZYREMOVE(shuttles, landmark)
|
|
else
|
|
generic_waypoints -= landmark
|
|
|
|
/obj/effect/overmap/visitable/proc/get_waypoints(var/shuttle_name)
|
|
. = list()
|
|
for(var/obj/effect/overmap/visitable/contained in src)
|
|
. += contained.get_waypoints(shuttle_name)
|
|
for(var/thing in generic_waypoints)
|
|
.[thing] = name
|
|
if(shuttle_name in restricted_waypoints)
|
|
for(var/thing in restricted_waypoints[shuttle_name])
|
|
.[thing] = name
|
|
|
|
/obj/effect/overmap/visitable/proc/generate_skybox()
|
|
return
|
|
|
|
/obj/effect/overmap/visitable/MouseEntered(location, control, params)
|
|
openToolTip(user = usr, tip_src = src, params = params, title = name)
|
|
|
|
..()
|
|
|
|
/obj/effect/overmap/visitable/MouseDown()
|
|
closeToolTip(usr) //No reason not to, really
|
|
|
|
..()
|
|
|
|
/obj/effect/overmap/visitable/MouseExited()
|
|
closeToolTip(usr) //No reason not to, really
|
|
|
|
..()
|
|
|
|
/obj/effect/overmap/visitable/sector
|
|
name = "generic sector"
|
|
desc = "Sector with some stuff in it."
|
|
icon_state = "sector"
|
|
anchored = 1
|
|
|
|
// Because of the way these are spawned, they will potentially have their invisibility adjusted by the turfs they are mapped on
|
|
// prior to being moved to the overmap. This blocks that. Use set_invisibility to adjust invisibility as needed instead.
|
|
/obj/effect/overmap/visitable/sector/hide()
|
|
|
|
/proc/build_overmap()
|
|
if(!global.using_map.use_overmap)
|
|
return 1
|
|
|
|
testing("Building overmap...")
|
|
world.increment_max_z()
|
|
global.using_map.overmap_z = world.maxz
|
|
|
|
testing("Putting overmap on [global.using_map.overmap_z]")
|
|
var/area/overmap/A = new
|
|
for (var/square in block(locate(1,1,global.using_map.overmap_z), locate(global.using_map.overmap_size,global.using_map.overmap_size,global.using_map.overmap_z)))
|
|
var/turf/T = square
|
|
if(T.x == 1 || T.y == 1 || T.x == global.using_map.overmap_size || T.y == global.using_map.overmap_size)
|
|
T = T.ChangeTurf(/turf/unsimulated/map/edge)
|
|
else
|
|
T = T.ChangeTurf(/turf/unsimulated/map)
|
|
ChangeArea(T, A)
|
|
|
|
global.using_map.sealed_levels |= global.using_map.overmap_z
|
|
|
|
testing("Overmap build complete.")
|
|
return 1
|