Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily revert "Overmap shuttles no longer need empty sectors" #18978

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 18 additions & 21 deletions code/modules/overmap/sectors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,24 @@ 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)

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)

update_name()

Expand Down Expand Up @@ -111,26 +128,6 @@ 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)
Expand Down
67 changes: 20 additions & 47 deletions code/modules/overmap/ships/landable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
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
Expand Down Expand Up @@ -37,22 +35,24 @@

// We autobuild our z levels.
/obj/effect/overmap/visitable/ship/landable/find_z_levels()
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)

if(multiz)
new /obj/effect/landmark/map_data(locate(1, 1, world.maxz), (multiz + 1))
else
..()

/obj/effect/overmap/visitable/ship/landable/move_to_starting_location()
if(!use_mapped_z_levels)
return
else
..() // this picks a random turf
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)

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/get_areas()
var/datum/shuttle/shuttle_datum = SSshuttle.shuttles[shuttle]
Expand All @@ -63,34 +63,8 @@
/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)
Expand All @@ -107,9 +81,8 @@
var/list/visitors // landmark -> visiting shuttle stationed there

/obj/effect/shuttle_landmark/ship/Initialize(mapload, shuttle_name)
if(!mapload)
landmark_tag += "_[shuttle_name]"
src.shuttle_name = shuttle_name
landmark_tag += "_[shuttle_name]"
src.shuttle_name = shuttle_name
. = ..()

/obj/effect/shuttle_landmark/ship/Destroy()
Expand Down
19 changes: 15 additions & 4 deletions maps/away/ships/konyang/air_konyang/air_konyang.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
map = "Air Konyang"
descriptor = "Air Konyang civilian transport."

/obj/effect/overmap/visitable/sector/air_konyang_spawn
name = "empty sector"
desc = "An empty sector."
icon_state = null //this away site only exists so the shuttle can spawn and doesn't need to be seen. Invisible var causes issues when used for this purpose.
initial_restricted_waypoints = list(
"Air Konyang Transport" = list("nav_air_konyang_start")
)

/obj/effect/overmap/visitable/ship/landable/air_konyang
name = "Air Konyang Transport"
class = "AKPV" //Air Konyang Passenger Vessel
Expand All @@ -34,7 +42,6 @@
fore_dir = SOUTH
vessel_size = SHIP_SIZE_SMALL
shuttle = "Air Konyang Transport"
use_mapped_z_levels = TRUE

/obj/effect/overmap/visitable/ship/landable/air_konyang/New()
designation = "[pick("Qianlima", "Senrima", "Cheollima", "Chollima")]"
Expand All @@ -56,10 +63,14 @@
logging_home_tag = "nav_air_konyang_start"
defer_initialisation = TRUE

/obj/effect/shuttle_landmark/ship/air_konyang
/obj/effect/shuttle_landmark/air_konyang/start
name = "Empty Space"
landmark_tag = "nav_air_konyang_start"
base_area = /area/space
base_turf = /turf/space
movable_flags = MOVABLE_FLAG_EFFECTMOVE

/obj/effect/shuttle_landmark/air_konyang_transit
/obj/effect/shuttle_landmark/air_konyang/transit
name = "In transit"
landmark_tag = "nav_air_konyang_transit"
base_turf = /turf/space/transit/north
base_turf = /turf/space/transit
Loading
Loading