mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-23 21:12:24 +01:00
Overmap shuttles no longer need empty sectors (#18898)
Overmap shuttles can now be mapped onto their "Open Space" z-level, without the need for empty sectors
This commit is contained in:
@@ -78,24 +78,7 @@ var/global/area/overmap/map_overmap // Global object used to locate the overmap
|
||||
initial_generic_waypoints = flatten_list(initial_generic_waypoints)
|
||||
tracked_dock_tags = flatten_list(tracked_dock_tags)
|
||||
|
||||
var/map_low = OVERMAP_EDGE
|
||||
var/map_high = SSatlas.current_map.overmap_size - OVERMAP_EDGE
|
||||
var/turf/home
|
||||
if (place_near_main)
|
||||
var/obj/effect/overmap/visitable/main = GLOB.map_sectors["1"] ? GLOB.map_sectors["1"] : GLOB.map_sectors[GLOB.map_sectors[1]]
|
||||
if(islist(place_near_main))
|
||||
place_near_main = Roundm(Frand(place_near_main[1], place_near_main[2]), 0.1)
|
||||
home = CircularRandomTurfAround(main, abs(place_near_main), map_low, map_low, map_high, map_high)
|
||||
start_x = home.x
|
||||
start_y = home.y
|
||||
LOG_DEBUG("place_near_main moving [src] near [main] ([main.x],[main.y]) with radius [place_near_main], got ([home.x],[home.y])")
|
||||
else
|
||||
start_x = start_x || rand(map_low, map_high)
|
||||
start_y = start_y || rand(map_low, map_high)
|
||||
home = locate(start_x, start_y, SSatlas.current_map.overmap_z)
|
||||
|
||||
if(!invisible_until_ghostrole_spawn)
|
||||
forceMove(home)
|
||||
move_to_starting_location()
|
||||
|
||||
update_name()
|
||||
|
||||
@@ -128,6 +111,26 @@ var/global/area/overmap/map_overmap // Global object used to locate the overmap
|
||||
STOP_PROCESSING(SSovermap, src)
|
||||
. = ..()
|
||||
|
||||
/obj/effect/overmap/visitable/proc/move_to_starting_location()
|
||||
var/map_low = OVERMAP_EDGE
|
||||
var/map_high = SSatlas.current_map.overmap_size - OVERMAP_EDGE
|
||||
var/turf/home
|
||||
if (place_near_main)
|
||||
var/obj/effect/overmap/visitable/main = GLOB.map_sectors["1"] ? GLOB.map_sectors["1"] : GLOB.map_sectors[GLOB.map_sectors[1]]
|
||||
if(islist(place_near_main))
|
||||
place_near_main = Roundm(Frand(place_near_main[1], place_near_main[2]), 0.1)
|
||||
home = CircularRandomTurfAround(main, abs(place_near_main), map_low, map_low, map_high, map_high)
|
||||
start_x = home.x
|
||||
start_y = home.y
|
||||
LOG_DEBUG("place_near_main moving [src] near [main] ([main.x],[main.y]) with radius [place_near_main], got ([home.x],[home.y])")
|
||||
else
|
||||
start_x = start_x || rand(map_low, map_high)
|
||||
start_y = start_y || rand(map_low, map_high)
|
||||
home = locate(start_x, start_y, SSatlas.current_map.overmap_z)
|
||||
|
||||
if(!invisible_until_ghostrole_spawn)
|
||||
forceMove(home)
|
||||
|
||||
//This is called later in the init order by SSshuttle to populate sector objects. Importantly for subtypes, shuttles will be created by then.
|
||||
/obj/effect/overmap/visitable/proc/populate_sector_objects()
|
||||
for(var/obj/machinery/hologram/holopad/H as anything in SSmachinery.all_holopads)
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
var/obj/effect/shuttle_landmark/ship/landmark // Record our open space landmark for easy reference.
|
||||
var/multiz = 0 // Index of multi-z levels, starts at 0
|
||||
var/status = SHIP_STATUS_LANDED
|
||||
///If true, it will use the z-level it's mapped on as the "Open Space" level, if false it will create a new level for that.
|
||||
var/use_mapped_z_levels = FALSE //If you use this, use /obj/effect/shuttle_landmark/ship as the landmark (set the landmark_tag to match on the shuttle, no other setup needed)
|
||||
icon_state = "shuttle"
|
||||
moving_state = "shuttle_moving"
|
||||
layer = OVERMAP_SHUTTLE_LAYER
|
||||
@@ -35,24 +37,22 @@
|
||||
|
||||
// We autobuild our z levels.
|
||||
/obj/effect/overmap/visitable/ship/landable/find_z_levels()
|
||||
for(var/i = 0 to multiz)
|
||||
world.maxz++
|
||||
map_z += world.maxz
|
||||
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_NEW_Z, world.maxz)
|
||||
if(!use_mapped_z_levels)
|
||||
for(var/i = 0 to multiz)
|
||||
world.maxz++
|
||||
map_z += world.maxz
|
||||
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_NEW_Z, world.maxz)
|
||||
|
||||
var/turf/center_loc = locate(round(world.maxx/2), round(world.maxy/2), world.maxz)
|
||||
landmark = new (center_loc, shuttle)
|
||||
add_landmark(landmark, shuttle)
|
||||
if(multiz)
|
||||
new /obj/effect/landmark/map_data(locate(1, 1, world.maxz), (multiz + 1))
|
||||
else
|
||||
..()
|
||||
|
||||
var/visitor_dir = fore_dir
|
||||
for(var/landmark_name in list("FORE", "PORT", "AFT", "STARBOARD"))
|
||||
var/turf/visitor_turf = get_ranged_target_turf(center_loc, visitor_dir, round(min(world.maxx/4, world.maxy/4)))
|
||||
var/obj/effect/shuttle_landmark/visiting_shuttle/visitor_landmark = new (visitor_turf, landmark, landmark_name)
|
||||
add_landmark(visitor_landmark)
|
||||
visitor_dir = turn(visitor_dir, 90)
|
||||
|
||||
if(multiz)
|
||||
new /obj/effect/landmark/map_data(center_loc, (multiz + 1))
|
||||
/obj/effect/overmap/visitable/ship/landable/move_to_starting_location()
|
||||
if(!use_mapped_z_levels)
|
||||
return
|
||||
else
|
||||
..() // this picks a random turf
|
||||
|
||||
/obj/effect/overmap/visitable/ship/landable/get_areas()
|
||||
var/datum/shuttle/shuttle_datum = SSshuttle.shuttles[shuttle]
|
||||
@@ -63,8 +63,34 @@
|
||||
/obj/effect/overmap/visitable/ship/landable/populate_sector_objects()
|
||||
..()
|
||||
var/datum/shuttle/shuttle_datum = SSshuttle.shuttles[shuttle]
|
||||
//Finish open space setup
|
||||
if(!use_mapped_z_levels)
|
||||
var/turf/center_loc = locate(round(world.maxx/2), round(world.maxy/2), world.maxz)
|
||||
landmark = new (center_loc, shuttle)
|
||||
add_landmark(landmark, shuttle)
|
||||
else
|
||||
var/obj/effect/shuttle_landmark/ship/ship_landmark = shuttle_datum.current_location
|
||||
if(!istype(ship_landmark))
|
||||
stack_trace("Landable ship [src] with shuttle [shuttle] was mapped with a starting landmark type [ship_landmark.type], but should be /obj/effect/shuttle_landmark/ship.")
|
||||
ship_landmark = new(ship_landmark.loc, shuttle)
|
||||
qdel(shuttle_datum.current_location)
|
||||
shuttle_datum.current_location = ship_landmark
|
||||
landmark = ship_landmark
|
||||
landmark.shuttle_name = shuttle
|
||||
LAZYDISTINCTADD(initial_generic_waypoints, landmark.landmark_tag) // this is us being user-friendly: it means we register it properly regardless of whether the mapper put the tag in initial_restricted_waypoints
|
||||
|
||||
var/visitor_dir = fore_dir
|
||||
for(var/landmark_name in list("FORE", "PORT", "AFT", "STARBOARD"))
|
||||
var/turf/visitor_turf = get_ranged_target_turf(get_turf(landmark), visitor_dir, round(min(world.maxx/4, world.maxy/4)))
|
||||
var/obj/effect/shuttle_landmark/visiting_shuttle/visitor_landmark = new (visitor_turf, landmark, landmark_name)
|
||||
add_landmark(visitor_landmark)
|
||||
visitor_dir = turn(visitor_dir, 90)
|
||||
|
||||
//Configure shuttle datum
|
||||
GLOB.shuttle_moved_event.register(shuttle_datum, src, PROC_REF(on_shuttle_jump))
|
||||
on_landing(landmark, shuttle_datum.current_location) // We "land" at round start to properly place ourselves on the overmap.
|
||||
if(landmark == shuttle_datum.current_location)
|
||||
status = SHIP_STATUS_OVERMAP
|
||||
|
||||
var/obj/effect/overmap/visitable/mothership = GLOB.map_sectors["[shuttle_datum.current_location.z]"]
|
||||
if(mothership)
|
||||
@@ -81,8 +107,9 @@
|
||||
var/list/visitors // landmark -> visiting shuttle stationed there
|
||||
|
||||
/obj/effect/shuttle_landmark/ship/Initialize(mapload, shuttle_name)
|
||||
landmark_tag += "_[shuttle_name]"
|
||||
src.shuttle_name = shuttle_name
|
||||
if(!mapload)
|
||||
landmark_tag += "_[shuttle_name]"
|
||||
src.shuttle_name = shuttle_name
|
||||
. = ..()
|
||||
|
||||
/obj/effect/shuttle_landmark/ship/Destroy()
|
||||
|
||||
Reference in New Issue
Block a user