Read github PR for details.

This commit is contained in:
Neerti
2017-10-10 00:48:27 -04:00
parent 459fbbdc2a
commit 7225ea2b66
30 changed files with 15292 additions and 13782 deletions

View File

@@ -110,3 +110,77 @@
if(teleport_x_offset && teleport_y_offset && teleport_z_offset)
var/turf/T = locate(rand(teleport_x, teleport_x_offset), rand(teleport_y, teleport_y_offset), rand(teleport_z, teleport_z_offset))
A.forceMove(T)
/* Teleporter that sends objects stepping on it to a specific landmark. */
/obj/effect/step_trigger/teleporter/landmark
var/obj/effect/landmark/the_landmark = null
var/landmark_id = null
/obj/effect/step_trigger/teleporter/landmark/initialize()
for(var/obj/effect/landmark/teleport_mark/mark in tele_landmarks)
if(mark.landmark_id == landmark_id)
the_landmark = mark
return
/obj/effect/step_trigger/teleporter/landmark/Trigger(var/atom/movable/A)
if(the_landmark)
A.forceMove(get_turf(the_landmark))
var/global/list/tele_landmarks = list() // Terrible, but the alternative is looping through world.
/obj/effect/landmark/teleport_mark
var/landmark_id = null
/obj/effect/landmark/teleport_mark/New()
..()
tele_landmarks += src
/obj/effect/landmark/teleport_mark/Destroy()
tele_landmarks -= src
return ..()
/* Teleporter which simulates falling out of the sky. */
/obj/effect/step_trigger/teleporter/planetary_fall
var/datum/planet/planet = null
/obj/effect/step_trigger/teleporter/planetary_fall/sif/initialize()
planet = planet_sif
/obj/effect/step_trigger/teleporter/planetary_fall/Trigger(var/atom/movable/A)
if(planet)
if(!planet.planet_floors.len)
message_admins("ERROR: planetary_fall step trigger's list of outdoor floors was empty.")
return
var/turf/simulated/T = null
var/safety = 100 // Infinite loop protection.
while(!T && safety)
var/turf/simulated/candidate = pick(planet.planet_floors)
if(!istype(candidate) || istype(candidate, /turf/simulated/sky))
safety--
continue
else
T = candidate
break
if(!T)
message_admins("ERROR: planetary_fall step trigger could not find a suitable landing turf.")
return
if(isobserver(A))
A.forceMove(T) // Harmlessly move ghosts.
return
if(isliving(A)) // Someday, implement parachutes. For now, just turbomurder whoever falls.
var/mob/living/L = A
for(var/i = 1 to 6)
L.adjustBruteLoss(100)
message_admins("\The [A] fell out of the sky.")
explosion(T, 0, 1, 2)
A.forceMove(T)
T.visible_message("<span class='danger'><font size='3'>\A [A] falls out of the sky and crashes into \the [T]!</font></span>")
else
message_admins("ERROR: planetary_fall step trigger lacks a planet to fall onto.")
return

View File

@@ -0,0 +1,46 @@
// A simple turf to fake the appearance of flying.
/turf/simulated/sky
name = "sky"
desc = "Hope you don't have a fear of heights."
icon = 'icons/turf/floors.dmi'
icon_state = "sky_slow"
outdoors = TRUE
// Assume there's a vacuum for the purposes of avoiding active edges at initialization, as well as ZAS fun if a window breaks.
oxygen = 0
carbon_dioxide = 0
nitrogen = 0
phoron = 0
/turf/simulated/sky/initialize()
outdoor_turfs.Add(src)
set_light(2, 2, "#FFFFFF")
/turf/simulated/sky/north
dir = NORTH
/turf/simulated/sky/south
dir = SOUTH
/turf/simulated/sky/east
dir = EAST
/turf/simulated/sky/west
dir = WEST
/turf/simulated/sky/moving
icon_state = "sky_fast"
/turf/simulated/sky/moving/north
dir = NORTH
/turf/simulated/sky/moving/south
dir = SOUTH
/turf/simulated/sky/moving/east
dir = EAST
/turf/simulated/sky/moving/west
dir = WEST

View File

@@ -78,7 +78,7 @@
destination_names = list(
"NSS Exodus in Nyx",
"NCS Northern Star in Vir",
"NCS Southern Cross in Vir",
"NLS Southern Cross in Vir",
"NDV Icarus in Nyx",
"NAS Vir Central Command",
"a dockyard orbiting Sif",

View File

@@ -91,7 +91,7 @@
/datum/lore/codex/page/southern_cross/add_content()
name = "Southern Cross (Artificial Satellite)"
keywords += list("Southern Cross")
keywords += list("Southern Cross", "NLS Southern Cross")
data = "The Southern Cross is a telecommunications and supply hub for [quick_link("NanoTrasen")], named after it's companion satellite, the \
[quick_link("Northern Star")]. It acts as a logistics hub for the smaller installations NanoTrasen has in Sif orbit and on the surface."

View File

@@ -17,8 +17,8 @@
var/turf/unsimulated/wall/planetary/planetary_wall_type = /turf/unsimulated/wall/planetary
var/turf/simulated/floor/planet_floors = list()
var/turf/unsimulated/wall/planetary/planet_walls = list()
var/list/turf/simulated/floor/planet_floors = list()
var/list/turf/unsimulated/wall/planetary/planet_walls = list()
var/needs_work = 0 // Bitflags to signal to the planet controller these need (properly deferrable) work. Flags defined in controller.

View File

@@ -174,6 +174,7 @@ datum/weather/sif
temp_high = T0C // 0c
temp_low = 243.15 // -30c
light_modifier = 0.5
flight_falure_modifier = 5
transition_chances = list(
WEATHER_LIGHT_SNOW = 20,
WEATHER_SNOW = 50,
@@ -197,6 +198,7 @@ datum/weather/sif
temp_high = 233.15 // -40c
temp_low = 213.15 // -60c
light_modifier = 0.3
flight_falure_modifier = 10
transition_chances = list(
WEATHER_SNOW = 45,
WEATHER_BLIZZARD = 40,
@@ -232,7 +234,7 @@ datum/weather/sif
if(!T.outdoors)
return // They're indoors, so no need to rain on them.
L.adjust_fire_stacks(-5)
L.water_act(1)
to_chat(L, "<span class='warning'>Rain falls on you.</span>")
/datum/weather/sif/storm
@@ -241,6 +243,7 @@ datum/weather/sif
temp_high = 243.15 // -30c
temp_low = 233.15 // -50c
light_modifier = 0.3
flight_falure_modifier = 10
transition_chances = list(
WEATHER_RAIN = 45,
WEATHER_STORM = 40,
@@ -255,7 +258,7 @@ datum/weather/sif
if(!T.outdoors)
return // They're indoors, so no need to rain on them.
L.adjust_fire_stacks(-10)
L.water_act(2)
to_chat(L, "<span class='warning'>Rain falls on you, drenching you in water.</span>")
/datum/weather/sif/hail
@@ -264,6 +267,7 @@ datum/weather/sif
temp_high = T0C // 0c
temp_low = 243.15 // -30c
light_modifier = 0.3
flight_falure_modifier = 15
transition_chances = list(
WEATHER_RAIN = 45,
WEATHER_STORM = 10,
@@ -295,6 +299,7 @@ datum/weather/sif
name = "blood moon"
light_modifier = 0.5
light_color = "#FF0000"
flight_falure_modifier = 25
transition_chances = list(
WEATHER_BLOODMOON = 100
)

View File

@@ -59,6 +59,7 @@
var/temp_low = T0C
var/light_modifier = 1.0 // Lower numbers means more darkness.
var/light_color = null // If set, changes how the day/night light looks.
var/flight_falure_modifier = 0 // Some types of weather make flying harder, and therefore make crashes more likely.
var/transition_chances = list() // Assoc list
var/datum/weather_holder/holder = null

View File

@@ -12,6 +12,7 @@
var/datum/computer/file/embedded_program/docking/docking_controller //the controller itself. (micro-controller, not game controller)
var/arrive_time = 0 //the time at which the shuttle arrives when long jumping
var/depart_time = 0 //Similar to above, set when the shuttle leaves when long jumping, to compare against arrive time.
var/flags = SHUTTLE_FLAGS_PROCESS
var/category = /datum/shuttle
@@ -50,6 +51,14 @@
/datum/shuttle/proc/post_warmup_checks()
return TRUE
// If you need an event to occur when the shuttle jumps in short or long jump, override this.
/datum/shuttle/proc/on_shuttle_departure()
return
// Similar to above, but when it finishes moving to the target. Short jump generally makes this occur immediately after the above proc.
/datum/shuttle/proc/on_shuttle_arrival()
return
/datum/shuttle/proc/short_jump(var/area/origin,var/area/destination)
if(moving_status != SHUTTLE_IDLE)
return
@@ -70,9 +79,14 @@
make_sounds(origin, HYPERSPACE_END)
return //someone cancelled the launch
on_shuttle_departure()
moving_status = SHUTTLE_INTRANSIT //shouldn't matter but just to be safe
move(origin, destination)
moving_status = SHUTTLE_IDLE
on_shuttle_arrival()
make_sounds(destination, HYPERSPACE_END)
/datum/shuttle/proc/long_jump(var/area/departing, var/area/destination, var/area/interim, var/travel_time, var/direction)
@@ -98,7 +112,13 @@
return //someone cancelled the launch
arrive_time = world.time + travel_time*10
depart_time = world.time
on_shuttle_departure()
moving_status = SHUTTLE_INTRANSIT
move(departing, interim, direction)
var/last_progress_sound = 0
@@ -111,6 +131,9 @@
move(interim, destination, direction)
moving_status = SHUTTLE_IDLE
on_shuttle_arrival()
make_sounds(destination, HYPERSPACE_END)
/datum/shuttle/proc/dock()

View File

@@ -0,0 +1,274 @@
//This shuttle traverses a "web" of route_datums to have a wider range of places to go and make flying feel like movement is actually occuring.
/datum/shuttle/web_shuttle
flags = SHUTTLE_FLAGS_NONE
var/cloaked = FALSE
var/can_cloak = FALSE
var/cooldown = 5 SECONDS
var/last_move = 0 //the time at which we last moved
var/area/current_area = null
var/datum/shuttle_web_master/web_master = null
var/web_master_type = null
var/flight_time_modifier = 1.0
category = /datum/shuttle/web_shuttle
/datum/shuttle/web_shuttle/New()
current_area = locate(current_area)
web_master = new web_master_type(src)
build_destinations()
..()
/datum/shuttle/web_shuttle/Destroy()
qdel(web_master)
return ..()
/datum/shuttle/web_shuttle/current_dock_target()
if(web_master)
return web_master.current_dock_target()
/datum/shuttle/web_shuttle/move(var/area/origin, var/area/destination)
..()
last_move = world.time
/datum/shuttle/web_shuttle/on_shuttle_departure()
web_master.on_shuttle_departure()
/datum/shuttle/web_shuttle/on_shuttle_arrival()
web_master.on_shuttle_arrival()
/datum/shuttle/web_shuttle/proc/build_destinations()
return
/obj/machinery/computer/shuttle_control/web
name = "flight computer"
icon_state = "flightcomp_center"
icon_keyboard = "flight_center_key"
icon_screen = "flight_center"
// Fairly copypasta-y.
/obj/machinery/computer/shuttle_control/web/attack_hand(mob/user)
if(..(user))
return
src.add_fingerprint(user)
ui_interact(user)
/*
// If nanoUI falls over and you want a non-nanoUI UI, feel free to uncomment this section.
var/datum/shuttle/web_shuttle/WS = shuttle_controller.shuttles[shuttle_tag]
if(!istype(WS))
message_admins("ERROR: Shuttle computer ([src]) ([shuttle_tag]) could not find their shuttle in the shuttles list.")
return
var/list/dat = list()
dat += "<center>[shuttle_tag] Ship Control<hr>"
if(WS.moving_status != SHUTTLE_IDLE)
dat += "Location: <font color='red'>Moving</font> <br>"
else
var/area/areacheck = get_area(src)
dat += "Location: [areacheck.name]<br>"
if((WS.last_move + WS.cooldown) > world.time)
dat += "<font color='red'>Engines charging.</font><br>"
else
dat += "<font color='green'>Engines ready.</font><br>"
if(WS.can_cloak)
dat += "<br><b><A href='?src=\ref[src];toggle_cloak=[1]'>Toggle cloaking field</A></b><br>"
for(var/datum/shuttle_route/route in WS.current_destination.routes)
dat += "<b><a href='?src=\ref[src];traverse=\ref[route]'>[route.display_route(WS.current_destination)]</a></b><br>"
//Docking
dat += "<center><br><br>"
if(WS.skip_docking_checks())
dat += "Docking Status: <font color='grey'>Not in use.</font>"
else
var/override_en = WS.docking_controller.override_enabled
var/docking_status = WS.docking_controller.get_docking_status()
dat += "Docking Status: "
switch(docking_status)
if("undocked")
dat += "<font color='[override_en? "red" : "grey"]'>Undocked</font>"
if("docking")
dat += "<font color='[override_en? "red" : "yellow"]'>Docking</font>"
if("undocking")
dat += "<font color='[override_en? "red" : "yellow"]'>Undocking</font>"
if("docked")
dat += "<font color='[override_en? "red" : "green"]'>Docked</font>"
if(override_en)
dat += " <font color='red'>(Override Enabled)</font>"
dat += ". <A href='?src=\ref[src];refresh=[1]'>\[Refresh\]</A><br><br>"
switch(docking_status)
if("undocked")
dat += "<b><A href='?src=\ref[src];dock_command=[1]'>Dock</A></b>"
if("docked")
dat += "<b><A href='?src=\ref[src];undock_command=[1]'>Undock</A></b>"
dat += "</center>"
user << browse(dat.Join(), "window=[shuttle_tag]shuttlecontrol;size=300x300")
*/
/obj/machinery/computer/shuttle_control/web/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
var/list/routes[0]
var/datum/shuttle/web_shuttle/shuttle = shuttle_controller.shuttles[shuttle_tag]
if(!istype(shuttle))
return
var/list/R = shuttle.web_master.get_available_routes()
for (var/i = 1 to length(R))
var/datum/shuttle_route/route = R[i]
var/travel_time = null
var/travel_modifier = shuttle.flight_time_modifier
if(route.travel_time == 0)
travel_time = "Instant"
else if( (route.travel_time * travel_modifier) >= 1 MINUTE)
travel_time = "[ (route.travel_time * travel_modifier) / (1 MINUTE)] minute\s"
else
travel_time = "[ (route.travel_time * travel_modifier) / (1 SECOND)] second\s"
routes.Add(list(list("name" = html_encode(capitalize(route.display_route(shuttle.web_master.current_destination) )), "index" = i, "travel_time" = travel_time)))
var/shuttle_location = shuttle.web_master.current_destination.name // Destination related, not loc.
var/future_location = null
if(shuttle.web_master.future_destination)
future_location = shuttle.web_master.future_destination.name
var/shuttle_state
switch(shuttle.moving_status)
if(SHUTTLE_IDLE)
shuttle_state = "idle"
if(SHUTTLE_WARMUP)
shuttle_state = "warmup"
if(SHUTTLE_INTRANSIT)
shuttle_state = "in_transit"
// For the progress bar.
var/elapsed_time = world.time - shuttle.depart_time
var/total_time = shuttle.arrive_time - shuttle.depart_time
var/percent_finished = 0
if(total_time) // Need to check or we might divide by zero.
percent_finished = (elapsed_time / total_time) * 100
data = list(
"shuttle_location" = shuttle_location,
"future_location" = future_location,
"shuttle_state" = shuttle_state,
"routes" = routes,
"has_docking" = shuttle.docking_controller? 1 : 0,
"skip_docking" = shuttle.skip_docking_checks(),
"is_moving" = shuttle.moving_status != SHUTTLE_IDLE,
"docking_status" = shuttle.docking_controller? shuttle.docking_controller.get_docking_status() : null,
"docking_override" = shuttle.docking_controller? shuttle.docking_controller.override_enabled : null,
"is_in_transit" = shuttle.has_arrive_time(),
"travel_progress" = between(0, percent_finished, 100),
"time_left" = round( (total_time - elapsed_time) / 10),
"can_cloak" = shuttle.can_cloak ? 1 : 0,
"cloaked" = shuttle.cloaked ? 1 : 0
)
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if(!ui)
ui = new(user, src, ui_key, "flight.tmpl", "[shuttle_tag] Flight Computer", 470, 500)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/machinery/computer/shuttle_control/web/Topic(href, href_list)
if(..())
return 1
usr.set_machine(src)
src.add_fingerprint(usr)
var/datum/shuttle/web_shuttle/WS = shuttle_controller.shuttles[shuttle_tag]
if(!istype(WS))
message_admins("ERROR: Shuttle computer ([src]) ([shuttle_tag]) could not find their shuttle in the shuttles list.")
return
if(href_list["refresh"])
ui_interact(usr)
if (WS.moving_status != SHUTTLE_IDLE)
usr << "<font color='blue'>[shuttle_tag] vessel is busy moving.</font>"
return
if(href_list["dock_command"])
WS.dock()
if(href_list["undock_command"])
WS.undock()
if(href_list["cloak_command"])
if(!WS.can_cloak)
return
WS.cloaked = TRUE
to_chat(usr, "<span class='danger'>Ship stealth systems have been activated. The station will not be warned of our arrival.</span>")
if(href_list["uncloak_command"])
if(!WS.can_cloak)
return
WS.cloaked = FALSE
to_chat(usr, "<span class='danger'>Ship stealth systems have been deactivated. The station will be warned of our arrival.</span>")
if(href_list["traverse"])
if((WS.last_move + WS.cooldown) > world.time)
usr << "<font color='red'>The ship's drive is inoperable while the engines are charging.</font>"
return
var/index = text2num(href_list["traverse"])
var/datum/shuttle_route/new_route = WS.web_master.current_destination.routes[index]
if(!istype(new_route))
message_admins("ERROR: Shuttle computer was asked to traverse a nonexistant route.")
return
if(!check_docking(WS))
// updateUsrDialog()
ui_interact(usr)
return
var/datum/shuttle_destination/target_destination = new_route.get_other_side(WS.web_master.current_destination)
if(!istype(target_destination))
message_admins("ERROR: Shuttle computer was asked to travel to a nonexistant destination.")
return
WS.web_master.future_destination = target_destination
to_chat(usr, "<span class='notice'>[shuttle_tag] flight computer received command.</span>")
var/travel_time = new_route.travel_time * WS.flight_time_modifier
if(new_route.interim && new_route.travel_time)
WS.long_jump(WS.current_area, target_destination.my_area, new_route.interim, travel_time / 10)
else
WS.short_jump(WS.current_area, target_destination.my_area)
ui_interact(usr)
// Props, for now.
/obj/structure/flight_left
name = "flight computer meters"
desc = "You hope the pilot knows what this does."
icon = 'icons/obj/flight_computer.dmi'
icon_state = "left"
density = TRUE
anchored = TRUE
/obj/structure/flight_right
name = "flight computer panel"
desc = "Probably shouldn't open it."
icon = 'icons/obj/flight_computer.dmi'
icon_state = "right"
density = TRUE
anchored = TRUE

View File

@@ -0,0 +1,192 @@
// This file actually has three seperate datums.
// This is the first datum, and it connects shuttle_destinations together.
/datum/shuttle_route
var/datum/shuttle_destination/start = null // One of the two sides of this route. Start just means it was the creator of this route.
var/datum/shuttle_destination/end = null // The second side.
var/area/interim = null // Where the shuttle sits during the movement. Make sure no other shuttle shares this or Very Bad Things will happen.
var/travel_time = 0 // How long it takes to move from start to end, or end to start. Set to 0 for instant travel.
var/one_way = FALSE // If true, you can't travel from end to start.
/datum/shuttle_route/New(var/_start, var/_end, var/_interim, var/_time = 0, var/_oneway = FALSE)
start = _start
end = _end
if(_interim)
interim = locate(_interim)
travel_time = _time
one_way = _oneway
/datum/shuttle_route/Destroy()
start.routes -= src
end.routes -= src
return ..()
/datum/shuttle_route/proc/get_other_side(var/datum/shuttle_destination/PoV)
if(PoV == start)
return end
if(PoV == end)
return start
return null
/datum/shuttle_route/proc/display_route(var/datum/shuttle_destination/PoV)
var/datum/shuttle_destination/target = null
if(PoV == start)
target = end
else if(PoV == end)
target = start
else
return "ERROR"
return target.name
// This is the second datum, and contains information on all the potential destinations for a specific shuttle.
/datum/shuttle_destination
var/name = "a place" // Name of the destination, used for the flight computer.
var/area/my_area = null // Where the shuttle will move to when it actually arrives.
var/datum/shuttle_web_master/master = null // The datum that does the coordination with the actual shuttle datum.
var/list/routes = list() // Routes that are connected to this destination.
var/preferred_interim_area = null // When building a new route, use this interim area.
var/dock_target = null // The tag_id that the shuttle will use to try to dock to the destination, if able.
var/announcer = null // The name of the 'announcer' that will say the arrival/departure messages. Defaults to the map's boss name if blank.
var/arrival_message = null // Message said if the ship enters this destination. Not announced if the ship is cloaked.
var/departure_message = null // Message said if the ship exits this destination. Not announced if the ship is cloaked.
// When this destination is instantiated, it will go and instantiate other destinations in this assoc list and build routes between them.
// The list format is '/datum/shuttle_destination/subtype = 1 MINUTES'
var/list/destinations_to_create = list()
// When the web_master finishes creating all the destinations, it will go and build routes between this and them if they're on this list.
// The list format is '/datum/shuttle_destination/subtype = 1 MINUTES'
var/list/routes_to_make = list()
/datum/shuttle_destination/New(var/new_master)
my_area = locate(my_area)
master = new_master
/datum/shuttle_destination/Destroy()
for(var/datum/shuttle_route/R in routes)
qdel(R)
master = null
return ..()
// build_destinations()
// This builds destination instances connected to this instance, recursively.
/datum/shuttle_destination/proc/build_destinations(var/list/already_made = list())
already_made += src.type
world << "SHUTTLES: [name] is going to build destinations. already_made list is \[[english_list(already_made)]\]"
for(var/type_to_make in destinations_to_create)
if(type_to_make in already_made) // Avoid circular initializations.
world << "SHUTTLES: [name] can't build [type_to_make] due to being a duplicate."
continue
// Instance the new destination, and call this proc on their 'downstream' destinations.
var/datum/shuttle_destination/new_dest = new type_to_make()
world << "SHUTTLES: [name] has created [new_dest.name] and will make it build their own destinations."
already_made += new_dest.build_destinations(already_made)
// Now link our new destination to us.
var/travel_delay = destinations_to_create[type_to_make]
link_destinations(new_dest, preferred_interim_area, travel_delay)
world << "SHUTTLES: [name] has linked themselves to [new_dest.name]"
world << "SHUTTLES: [name] has finished building destinations. already_made list is \[[english_list(already_made)]\]."
return already_made
/datum/shuttle_destination/proc/enter(var/datum/shuttle_destination/old_destination)
announce_arrival()
/datum/shuttle_destination/proc/exit(var/datum/shuttle_destination/new_destination)
announce_departure()
/datum/shuttle_destination/proc/announce_departure()
if(isnull(departure_message) || master.my_shuttle.cloaked)
return
command_announcement.Announce(departure_message,(announcer ? announcer : "[using_map.boss_name]"))
/datum/shuttle_destination/proc/announce_arrival()
if(isnull(arrival_message) || master.my_shuttle.cloaked)
return
command_announcement.Announce(arrival_message,(announcer ? announcer : "[using_map.boss_name]"))
/datum/shuttle_destination/proc/link_destinations(var/datum/shuttle_destination/other_place, var/area/interim_area, var/travel_time = 0)
// First, check to make sure this doesn't cause a duplicate route.
for(var/datum/shuttle_route/R in routes)
if(R.start == other_place || R.end == other_place)
return
// Now we can connect them.
var/datum/shuttle_route/new_route = new(src, other_place, interim_area, travel_time)
routes += new_route
other_place.routes += new_route
// Depending on certain circumstances, the shuttles can fail.
// What happens depends on where the shuttle is. If it's in space, it just can't move until its fixed.
// If it's flying in Sif, however, things get interesting.
/datum/shuttle_destination/proc/flight_failure()
return
// This is the third and final datum, which coordinates with the shuttle datum to tell it where it is, where it can go, and how long it will take.
// It is also responsible for instancing all the destinations it has control over, and linking them together.
/datum/shuttle_web_master
var/datum/shuttle/web_shuttle/my_shuttle = null // Ref to the shuttle this datum is coordinating with.
var/datum/shuttle_destination/current_destination = null // Where the shuttle currently is. Bit of a misnomer.
var/datum/shuttle_destination/future_destination = null // Where it will be in the near future.
var/datum/shuttle_destination/starting_destination = null // Where the shuttle will start at, generally at the home base.
var/list/destinations = list() // List of currently instanced destinations.
var/destination_class = null // Type to use in typesof(), to build destinations.
/datum/shuttle_web_master/New(var/new_shuttle, var/new_destination_class = null)
my_shuttle = new_shuttle
if(new_destination_class)
destination_class = new_destination_class
build_destinations()
current_destination = get_destination_by_type(starting_destination)
/datum/shuttle_web_master/Destroy()
my_shuttle = null
for(var/datum/shuttle_destination/D in destinations)
qdel(D)
return ..()
/datum/shuttle_web_master/proc/build_destinations()
// First, instantiate all the destination subtypes relevant to this datum.
var/list/destination_types = typesof(destination_class) - destination_class
for(var/new_type in destination_types)
var/datum/shuttle_destination/D = new new_type(src)
destinations += D
// Now start the process of connecting all of them.
for(var/datum/shuttle_destination/D in destinations)
for(var/type_to_link in D.routes_to_make)
var/travel_delay = D.routes_to_make[type_to_link]
D.link_destinations(get_destination_by_type(type_to_link), D.preferred_interim_area, travel_delay)
/datum/shuttle_web_master/proc/on_shuttle_departure()
current_destination.exit()
/datum/shuttle_web_master/proc/on_shuttle_arrival()
if(future_destination)
future_destination.enter()
current_destination = future_destination
future_destination = null
my_shuttle.current_area = current_destination.my_area
/datum/shuttle_web_master/proc/current_dock_target()
if(current_destination)
return current_destination.dock_target
/datum/shuttle_web_master/proc/get_available_routes()
if(current_destination)
return current_destination.routes.Copy()
/datum/shuttle_web_master/proc/get_current_destination()
return current_destination
/datum/shuttle_web_master/proc/get_destination_by_type(var/type_to_get)
return locate(type_to_get) in destinations