diff --git a/code/__DEFINES/_lists.dm b/code/__DEFINES/_lists.dm
index 6d38e6193b4..065376803ba 100644
--- a/code/__DEFINES/_lists.dm
+++ b/code/__DEFINES/_lists.dm
@@ -12,7 +12,7 @@
// Adds I to L, initalizing I if necessary
#define LAZYADD(L, I) if(!L) { L = list(); } L += I;
// Adds I to L, initalizing L if necessary, if I is not already in L
-#define LAZYDISTINCTADDSTINCTADD(L, I) if(!L) { L = list(); } L |= I;
+#define LAZYDISTINCTADD(L, I) if(!L) { L = list(); } L |= I;
#define LAZYFIND(L, V) (L ? L.Find(V) : 0)
// Reads I from L safely - Works with both associative and traditional lists.
#define LAZYACCESS(L, I) (L ? (isnum(I) ? (I > 0 && I <= length(L) ? L[I] : null) : L[I]) : null)
diff --git a/code/controllers/subsystems/emergency_shuttle.dm b/code/controllers/subsystems/emergency_shuttle.dm
index 86f7992fe29..463279427cd 100644
--- a/code/controllers/subsystems/emergency_shuttle.dm
+++ b/code/controllers/subsystems/emergency_shuttle.dm
@@ -3,6 +3,7 @@ SUBSYSTEM_DEF(emergencyshuttle)
wait = 20
var/datum/shuttle/autodock/ferry/emergency/shuttle // Set in shuttle_emergency.dm TODO - is it really?
+ var/list/escape_pods
var/launch_time //the time at which the shuttle will be launched
var/auto_recall = 0 //if set, the shuttle will be auto-recalled
@@ -18,6 +19,9 @@ SUBSYSTEM_DEF(emergencyshuttle)
var/datum/announcement/priority/emergency_shuttle_called = new(0, new_sound = sound('sound/AI/shuttlecalled.ogg'))
var/datum/announcement/priority/emergency_shuttle_recalled = new(0, new_sound = sound('sound/AI/shuttlerecalled.ogg'))
+/datum/emergency_shuttle_controller/New()
+ escape_pods = list()
+ ..()
/datum/controller/subsystem/emergencyshuttle/fire()
if (wait_for_launch)
if (evac && auto_recall && world.time >= auto_recall_time)
diff --git a/code/controllers/subsystems/shuttles.dm b/code/controllers/subsystems/shuttles.dm
index c3dfb0b8af3..49533cf8e63 100644
--- a/code/controllers/subsystems/shuttles.dm
+++ b/code/controllers/subsystems/shuttles.dm
@@ -1,5 +1,5 @@
//
-// SSshuttles subsystem - Handles initialization and processing of shuttles.
+// SSshuttle subsystem - Handles initialization and processing of shuttles.
//
// Also handles initialization and processing of overmap sectors. // For... some reason...
//
@@ -33,17 +33,14 @@ SUBSYSTEM_DEF(shuttle)
var/tmp/list/current_run // Shuttles remaining to process this fire() tick
-/datum/controller/subsystem/shuttles/PreInit()
- global.shuttle_controller = src // TODO - Remove this! Change everything to point at SSshuttles intead
-
/datum/controller/subsystem/shuttle/Initialize(timeofday)
last_landmark_registration_time = world.time
// Find all declared shuttle datums and initailize them. (Okay, queue them for initialization a few lines further down)
- for(var/shuttle_type in subtypesof(/datum/shuttle)) // This accounts for most shuttles, though away maps can queue up more.
+ for(var/shuttle_type in subtypesof(/datum/shuttle)) // This accounts for most shuttles, though away maps can queue up more.
var/datum/shuttle/shuttle = shuttle_type
if(initial(shuttle.category) == shuttle_type)
- continue // Its an "abstract class" datum, not for a real shuttle.
- if(!initial(shuttle.defer_initialisation)) // Skip if it asks not to be initialized at startup.
+ continue // Its an "abstract class" datum, not for a real shuttle.
+ if(!initial(shuttle.defer_initialisation)) // Skip if it asks not to be initialized at startup.
LAZYDISTINCTADD(shuttles_to_initialize, shuttle_type)
block_init_queue = FALSE
process_init_queues()
@@ -58,25 +55,24 @@ SUBSYSTEM_DEF(shuttle)
var/datum/shuttle/S = working_shuttles[working_shuttles.len]
working_shuttles.len--
if(!istype(S) || QDELETED(S))
- error("Bad entry in SSshuttles.process_shuttles - [log_info_line(S)] ")
+ log_debug("Bad entry in SSshuttle.process_shuttles - [log_info_line(S)] ")
process_shuttles -= S
continue
// NOTE - In old system, /datum/shuttle/ferry was processed only if (F.process_state || F.always_process)
if(S.process_state && (S.process(wait, times_fired, src) == PROCESS_KILL))
- else
process_shuttles -= S
if(MC_TICK_CHECK)
return
-/datum/controller/subsystem/shuttles/proc/process_init_queues()
+/datum/controller/subsystem/shuttle/proc/process_init_queues()
if(block_init_queue)
return
initialize_shuttles()
initialize_sectors()
// Initializes all shuttles in shuttles_to_initialize
-/datum/controller/subsystem/shuttles/proc/initialize_shuttles()
+/datum/controller/subsystem/shuttle/proc/initialize_shuttles()
var/list/shuttles_made = list()
for(var/shuttle_type in shuttles_to_initialize)
var/shuttle = initialize_shuttle(shuttle_type)
@@ -85,12 +81,12 @@ SUBSYSTEM_DEF(shuttle)
hook_up_motherships(shuttles_made)
shuttles_to_initialize = null
-/datum/controller/subsystem/shuttles/proc/initialize_sectors()
+/datum/controller/subsystem/shuttle/proc/initialize_sectors()
for(var/sector in sectors_to_initialize)
initialize_sector(sector)
sectors_to_initialize = null
-/datum/controller/subsystem/shuttles/proc/register_landmark(shuttle_landmark_tag, obj/effect/shuttle_landmark/shuttle_landmark)
+/datum/controller/subsystem/shuttle/proc/register_landmark(shuttle_landmark_tag, obj/effect/shuttle_landmark/shuttle_landmark)
if (registered_shuttle_landmarks[shuttle_landmark_tag])
CRASH("Attempted to register shuttle landmark with tag [shuttle_landmark_tag], but it is already registered!")
if (istype(shuttle_landmark))
@@ -106,12 +102,12 @@ SUBSYSTEM_DEF(shuttle)
// O = map_sectors["[shuttle_landmark.z]"]
// O ? O.add_landmark(shuttle_landmark, shuttle_landmark.shuttle_restricted) : (landmarks_awaiting_sector += shuttle_landmark)
-/datum/controller/subsystem/shuttles/proc/get_landmark(var/shuttle_landmark_tag)
+/datum/controller/subsystem/shuttle/proc/get_landmark(var/shuttle_landmark_tag)
return registered_shuttle_landmarks[shuttle_landmark_tag]
// Checks if the given sector's landmarks have initialized; if so, registers them with the sector, if not, marks them for assignment after they come in.
// Also adds automatic landmarks that were waiting on their sector to spawn.
-/datum/controller/subsystem/shuttles/proc/initialize_sector(obj/effect/overmap/visitable/given_sector)
+/datum/controller/subsystem/shuttle/proc/initialize_sector(obj/effect/overmap/visitable/given_sector)
return // TODO - Uncomment once overmap sectors are ported
// given_sector.populate_sector_objects() // This is a late init operation that sets up the sector's map_z and does non-overmap-related init tasks.
@@ -133,7 +129,7 @@ SUBSYSTEM_DEF(shuttle)
// TODO - Uncomment once overmap sectors are ported
//// Attempts to add a landmark instance with a sector (returns false if landmark isn't registered yet)
-///datum/controller/subsystem/shuttles/proc/try_add_landmark_tag(landmark_tag, obj/effect/overmap/visitable/given_sector)
+///datum/controller/subsystem/shuttle/proc/try_add_landmark_tag(landmark_tag, obj/effect/overmap/visitable/given_sector)
// var/obj/effect/shuttle_landmark/landmark = get_landmark(landmark_tag)
// if(!landmark)
// return
@@ -146,7 +142,7 @@ SUBSYSTEM_DEF(shuttle)
// given_sector.add_landmark(landmark, shuttle_name)
// . = 1
-/datum/controller/subsystem/shuttles/proc/initialize_shuttle(var/shuttle_type)
+/datum/controller/subsystem/shuttle/proc/initialize_shuttle(var/shuttle_type)
var/datum/shuttle/shuttle = shuttle_type
if(initial(shuttle.category) != shuttle_type) // Skip if its an "abstract class" datum
shuttle = new shuttle()
@@ -157,7 +153,7 @@ SUBSYSTEM_DEF(shuttle)
// and shuttles fetch refs in New(). Shuttles also dock() themselves in new if they want.
// TODO - Leshana to hook up more of this when overmap is ported.
-/datum/controller/subsystem/shuttles/proc/hook_up_motherships(shuttles_list)
+/datum/controller/subsystem/shuttle/proc/hook_up_motherships(shuttles_list)
for(var/datum/shuttle/S in shuttles_list)
if(S.mothershuttle && !S.motherdock)
var/datum/shuttle/mothership = shuttles[S.mothershuttle]
@@ -165,10 +161,10 @@ SUBSYSTEM_DEF(shuttle)
S.motherdock = S.current_location.landmark_tag
mothership.shuttle_area |= S.shuttle_area
else
- error("Shuttle [S] was unable to find mothership [mothership]!")
+ log_debug("Shuttle [S] was unable to find mothership [mothership]!")
// Admin command to halt/resume overmap
-// /datum/controller/subsystem/shuttles/proc/toggle_overmap(new_setting)
+// /datum/controller/subsystem/shuttle/proc/toggle_overmap(new_setting)
// if(overmap_halted == new_setting)
// return
// overmap_halted = !overmap_halted
@@ -176,5 +172,5 @@ SUBSYSTEM_DEF(shuttle)
// var/obj/effect/overmap/visitable/ship/ship_effect = ship
// overmap_halted ? ship_effect.halt() : ship_effect.unhalt()
-/datum/controller/subsystem/shuttles/stat_entry()
+/datum/controller/subsystem/shuttle/stat_entry()
..("Shuttles:[process_shuttles.len]/[shuttles.len], Ships:[ships.len], L:[registered_shuttle_landmarks.len][overmap_halted ? ", HALT" : ""]")
diff --git a/code/controllers/subsystems/supply.dm b/code/controllers/subsystems/supply.dm
index 7bb0f502f82..039c0a6b8e0 100644
--- a/code/controllers/subsystems/supply.dm
+++ b/code/controllers/subsystems/supply.dm
@@ -111,8 +111,8 @@ SUBSYSTEM_DEF(supply)
)
// Sell manifests
- if(find_slip && istype(A,/obj/item/weapon/paper/manifest))
- var/obj/item/weapon/paper/manifest/slip = A
+ if(find_slip && istype(A,/obj/item/paper/manifest))
+ var/obj/item/paper/manifest/slip = A
if(!slip.is_copy && slip.stamped && slip.stamped.len) // Yes, the clown stamp will work. clown is the highest authority on the station, it makes sense, trust me guys
points += points_per_slip
EC.contents[EC.contents.len]["value"] = points_per_slip
@@ -128,7 +128,7 @@ SUBSYSTEM_DEF(supply)
EC.value += EC.contents[EC.contents.len]["value"]
// Sell spacebucks
- if(istype(A, /obj/item/weapon/spacecash))
+ if(istype(A, /obj/item/spacecash))
var/obj/item/weapon/spacecash/cashmoney = A
EC.contents[EC.contents.len]["value"] = cashmoney.worth * points_per_money
EC.contents[EC.contents.len]["quantity"] = cashmoney.worth
diff --git a/code/controllers/subsystems/ticker.dm b/code/controllers/subsystems/ticker.dm
index 8d299f09e8a..1e40b5e9c75 100644
--- a/code/controllers/subsystems/ticker.dm
+++ b/code/controllers/subsystems/ticker.dm
@@ -226,7 +226,7 @@ SUBSYSTEM_DEF(ticker)
callHook("roundstart")
- // TODO - Leshana - Dear God Fix This. Fix all of this. Not just this line, this entire proc. This entire file!
+ // TODO Dear God Fix This. Fix all of this. Not just this line, this entire proc. This entire file!
spawn(0)//Forking here so we dont have to wait for this to finish
mode.post_setup()
//Cleanup some stuff
diff --git a/code/datums/observation/shuttle_added.dm b/code/datums/observation/shuttle_added.dm
index 8b82ebd8ff5..8db95c4041e 100644
--- a/code/datums/observation/shuttle_added.dm
+++ b/code/datums/observation/shuttle_added.dm
@@ -16,7 +16,7 @@ GLOBAL_DATUM_INIT(shuttle_added, /decl/observ/shuttle_added, new)
* Shuttle Added Handling *
*****************************/
-/datum/controller/subsystem/shuttles/initialize_shuttle()
+/datum/controller/subsystem/shuttle/initialize_shuttle()
. = ..()
if(.)
GLOB.shuttle_added.raise_event(.)
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index c9af6d86b25..cce1795839c 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -226,7 +226,7 @@
if(z in GLOB.using_map.sealed_levels)
return
- if(using_map.use_overmap)
+ if(GLOB.using_map.use_overmap)
overmap_spacetravel(get_turf(src), src)
return
diff --git a/code/game/machinery/embedded_controller/airlock_controllers.dm b/code/game/machinery/embedded_controller/airlock_controllers.dm
index 6e83b86b9e7..d207776fc83 100644
--- a/code/game/machinery/embedded_controller/airlock_controllers.dm
+++ b/code/game/machinery/embedded_controller/airlock_controllers.dm
@@ -16,7 +16,7 @@
var/cycle_to_external_air = 0
/obj/machinery/embedded_controller/radio/airlock/Destroy()
- // TODO - Leshana - Implement dummy terminals
+ // TODO Implement dummy terminals
//for(var/thing in dummy_terminals)
// var/obj/machinery/dummy_airlock_controller/dummy = thing
// dummy.master_controller = null
diff --git a/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm b/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm
index 734d0ba6346..09d5ed22486 100644
--- a/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm
+++ b/code/game/machinery/embedded_controller/airlock_docking_controller_multi.dm
@@ -1,18 +1,15 @@
-//a controller for a docking port with multiple independent airlocks
-//this is the master controller, that things will try to dock with.
+// A controller for a docking port with multiple independent airlocks
+// This is the master controller, that things will try to dock with.
/obj/machinery/embedded_controller/radio/docking_port_multi
name = "docking port controller"
+ program = /datum/computer/file/embedded_program/docking/multi
var/child_tags_txt
var/child_names_txt
var/list/child_names = list()
- var/datum/computer/file/embedded_program/docking/multi/docking_program
-
/obj/machinery/embedded_controller/radio/docking_port_multi/Initialize()
. = ..()
- docking_program = new/datum/computer/file/embedded_program/docking/multi(src)
- program = docking_program
var/list/names = splittext(child_names_txt, ";")
var/list/tags = splittext(child_tags_txt, ";")
@@ -24,6 +21,7 @@
/obj/machinery/embedded_controller/radio/docking_port_multi/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
+ var/datum/computer/file/embedded_program/docking/multi/docking_program = program // Cast to proper type
var/list/airlocks[child_names.len]
var/i = 1
@@ -44,24 +42,21 @@
ui.set_auto_update(1)
/obj/machinery/embedded_controller/radio/docking_port_multi/Topic(href, href_list)
- return
+ return 1 // Apparently we swallow all input (this is corrected legacy code)
-//a docking port based on an airlock
+// A docking port based on an airlock
+// This is the actual controller that will be commanded by the master defined above
/obj/machinery/embedded_controller/radio/airlock/docking_port_multi
name = "docking port controller"
- var/master_tag //for mapping
- var/datum/computer/file/embedded_program/airlock/multi_docking/airlock_program
+ program = /datum/computer/file/embedded_program/airlock/multi_docking
+ var/master_tag // For mapping
tag_secure = 1
-/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/Initialize()
- . = ..()
- airlock_program = new/datum/computer/file/embedded_program/airlock/multi_docking(src)
- program = airlock_program
-
/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
+ var/datum/computer/file/embedded_program/airlock/multi_docking/airlock_program // Cast to proper type
data = list(
"chamber_pressure" = round(airlock_program.memory["chamber_sensor_pressure"]),
@@ -82,14 +77,11 @@
ui.set_auto_update(1)
/obj/machinery/embedded_controller/radio/airlock/docking_port_multi/Topic(href, href_list)
- if(..())
+ if((. = ..()))
return
- usr.set_machine(src)
- src.add_fingerprint(usr)
-
var/clean = 0
- switch(href_list["command"]) //anti-HTML-hacking checks
+ switch(href_list["command"]) // Anti-HTML-hacking checks
if("cycle_ext")
clean = 1
if("cycle_int")
diff --git a/code/game/machinery/embedded_controller/airlock_program.dm b/code/game/machinery/embedded_controller/airlock_program.dm
index 5ebbac93aeb..d848e1d372b 100644
--- a/code/game/machinery/embedded_controller/airlock_program.dm
+++ b/code/game/machinery/embedded_controller/airlock_program.dm
@@ -1,4 +1,4 @@
-//Handles the control of airlocks
+// Handles the control of airlocks
#define STATE_IDLE 0
#define STATE_PREPARE 1
@@ -9,8 +9,8 @@
#define TARGET_INOPEN -1
#define TARGET_OUTOPEN -2
-#define MIN_TARGET_PRESSURE (ONE_ATMOSPHERE * 0.05) // Never try to pump to pure vacuum, its not happening.
-#define SKIPCYCLE_MARGIN 1 // Skip cycling airlock (just open the doors) if pressures are within this range.
+#define MIN_TARGET_PRESSURE (ONE_ATMOSPHERE * 0.05) // Never try to pump to pure vacuum, its not happening.
+#define SKIPCYCLE_MARGIN 1 // Skip cycling airlock (just open the doors) if pressures are within this range.
/datum/computer/file/embedded_program/airlock
var/tag_exterior_door
@@ -33,16 +33,16 @@
..(M)
memory["chamber_sensor_pressure"] = ONE_ATMOSPHERE
- memory["external_sensor_pressure"] = 0 //assume vacuum for simple airlock controller
+ memory["external_sensor_pressure"] = 0 // Assume vacuum for simple airlock controller
memory["internal_sensor_pressure"] = ONE_ATMOSPHERE
- memory["exterior_status"] = list(state = "closed", lock = "locked") //assume closed and locked in case the doors dont report in
+ memory["exterior_status"] = list(state = "closed", lock = "locked") // Assume closed and locked in case the doors dont report in
memory["interior_status"] = list(state = "closed", lock = "locked")
memory["pump_status"] = "unknown"
memory["target_pressure"] = ONE_ATMOSPHERE
memory["purge"] = 0
memory["secure"] = 0
- if (istype(M, /obj/machinery/embedded_controller/radio/airlock)) //if our controller is an airlock controller than we can auto-init our tags
+ if (istype(M, /obj/machinery/embedded_controller/radio/airlock)) // If our controller is an airlock controller than we can auto-init our tags
var/obj/machinery/embedded_controller/radio/airlock/controller = M
cycle_to_external_air = controller.cycle_to_external_air
if(cycle_to_external_air)
@@ -52,14 +52,14 @@
tag_interior_door = controller.tag_interior_door? controller.tag_interior_door : "[id_tag]_inner"
tag_airpump = controller.tag_airpump? controller.tag_airpump : "[id_tag]_pump"
tag_chamber_sensor = controller.tag_chamber_sensor? controller.tag_chamber_sensor : "[id_tag]_sensor"
- tag_exterior_sensor = controller.tag_exterior_sensor
- tag_interior_sensor = controller.tag_interior_sensor
+ tag_exterior_sensor = controller.tag_exterior_sensor || "[id_tag]_exterior_sensor"
+ tag_interior_sensor = controller.tag_interior_sensor || "[id_tag]_interior_sensor"
tag_airlock_mech_sensor = controller.tag_airlock_mech_sensor? controller.tag_airlock_mech_sensor : "[id_tag]_airlock_mech"
tag_shuttle_mech_sensor = controller.tag_shuttle_mech_sensor? controller.tag_shuttle_mech_sensor : "[id_tag]_shuttle_mech"
memory["secure"] = controller.tag_secure
spawn(10)
- signalDoor(tag_exterior_door, "update") //signals connected doors to update their status
+ signalDoor(tag_exterior_door, "update") // Signals connected doors to update their status
signalDoor(tag_interior_door, "update")
/datum/computer/file/embedded_program/airlock/receive_signal(datum/signal/signal, receive_method, receive_param)
@@ -98,7 +98,7 @@
if("cycle_interior")
receive_user_command("cycle_int_door")
if("cycle")
- if(memory["interior_status"]["state"] == "open") //handle backwards compatibility
+ if(memory["interior_status"]["state"] == "open") // Handle backwards compatibility
receive_user_command("cycle_ext")
else
receive_user_command("cycle_int")
@@ -109,7 +109,7 @@
if("cycle_interior")
receive_user_command("cycle_int")
if("cycle")
- if(memory["interior_status"]["state"] == "open") //handle backwards compatibility
+ if(memory["interior_status"]["state"] == "open") // Handle backwards compatibility
receive_user_command("cycle_ext")
else
receive_user_command("cycle_int")
@@ -117,13 +117,14 @@
/datum/computer/file/embedded_program/airlock/receive_user_command(command)
var/shutdown_pump = 0
+ . = TRUE
switch(command)
if("cycle_ext")
- //If airlock is already cycled in this direction, just toggle the doors.
+ // If airlock is already cycled in this direction, just toggle the doors.
if(!memory["purge"] && abs(memory["external_sensor_pressure"] - memory["chamber_sensor_pressure"]) <= SKIPCYCLE_MARGIN)
toggleDoor(memory["exterior_status"], tag_exterior_door, memory["secure"], "toggle")
- //only respond to these commands if the airlock isn't already doing something
- //prevents the controller from getting confused and doing strange things
+ // Only respond to these commands if the airlock isn't already doing something
+ // Prevents the controller from getting confused and doing strange things
else if(state == target_state)
begin_cycle_out()
@@ -163,9 +164,11 @@
else
signalDoor(tag_interior_door, "unlock")
signalDoor(tag_exterior_door, "unlock")
+ else
+ . = FALSE
if(shutdown_pump)
- signalPump(tag_airpump, 0) //send a signal to stop pressurizing
+ signalPump(tag_airpump, 0) // Send a signal to stop pressurizing
if(cycle_to_external_air)
signalPump(tag_pump_out_internal, 0)
signalPump(tag_pump_out_external, 0)
@@ -173,7 +176,7 @@
/datum/computer/file/embedded_program/airlock/process()
- if(!state) //Idle
+ if(!state) // Idle
if(target_state)
switch(target_state)
if(TARGET_INOPEN)
@@ -181,20 +184,20 @@
if(TARGET_OUTOPEN)
memory["target_pressure"] = memory["external_sensor_pressure"]
- //lock down the airlock before activating pumps
+ // Lock down the airlock before activating pumps
close_doors()
state = STATE_PREPARE
else
- //make sure to return to a sane idle state
- if(memory["pump_status"] != "off") //send a signal to stop pumping
+ // Make sure to return to a sane idle state
+ if(memory["pump_status"] != "off") // Send a signal to stop pumping
signalPump(tag_airpump, 0)
if(cycle_to_external_air)
signalPump(tag_pump_out_internal, 0)
signalPump(tag_pump_out_external, 0)
if ((state == STATE_PRESSURIZE || state == STATE_DEPRESSURIZE) && !check_doors_secured())
- //the airlock will not allow itself to continue to cycle when any of the doors are forced open.
+ // The airlock will not allow itself to continue to cycle when any of the doors are forced open.
stop_cycling()
switch(state)
@@ -204,37 +207,37 @@
var/target_pressure = memory["target_pressure"]
if(memory["purge"])
- //purge apparently means clearing the airlock chamber to vacuum (then refilling, handled later)
+ // Purge apparently means clearing the airlock chamber to vacuum (then refilling, handled later)
target_pressure = 0
state = STATE_DEPRESSURIZE
- if(!cycle_to_external_air || target_state == TARGET_OUTOPEN) // if going outside, pump internal air into air tank
- signalPump(tag_airpump, 1, 0, target_pressure) //send a signal to start depressurizing
+ if(!cycle_to_external_air || target_state == TARGET_OUTOPEN) // If going outside, pump internal air into air tank
+ signalPump(tag_airpump, 1, 0, target_pressure) // Send a signal to start depressurizing
else
- signalPump(tag_pump_out_internal, 1, 0, target_pressure) // if going inside, pump external air out of the airlock
- signalPump(tag_pump_out_external, 1, 1, 15000) // make sure the air is actually going outside
+ signalPump(tag_pump_out_internal, 1, 0, target_pressure) // If going inside, pump external air out of the airlock
+ signalPump(tag_pump_out_external, 1, 1, 15000) // Make sure the air is actually going outside
else if(chamber_pressure <= target_pressure)
state = STATE_PRESSURIZE
- if(!cycle_to_external_air || target_state == TARGET_INOPEN) // if going inside, pump air into airlock
- signalPump(tag_airpump, 1, 1, target_pressure) //send a signal to start pressurizing
+ if(!cycle_to_external_air || target_state == TARGET_INOPEN) // If going inside, pump air into airlock
+ signalPump(tag_airpump, 1, 1, target_pressure) // Send a signal to start pressurizing
else
- signalPump(tag_pump_out_internal, 1, 1, target_pressure) // if going outside, fill airlock with external air
+ signalPump(tag_pump_out_internal, 1, 1, target_pressure) // If going outside, fill airlock with external air
signalPump(tag_pump_out_external, 1, 0, 0)
else if(chamber_pressure > target_pressure)
if(!cycle_to_external_air)
state = STATE_DEPRESSURIZE
- signalPump(tag_airpump, 1, 0, target_pressure) //send a signal to start depressurizing
+ signalPump(tag_airpump, 1, 0, target_pressure) // Send a signal to start depressurizing
else
- memory["purge"] = 1 // should always purge first if using external air, chamber pressure should never be higher than target pressure here
- //Make sure the airlock isn't aiming for pure vacuum - an impossibility
+ memory["purge"] = 1 // Should always purge first if using external air, chamber pressure should never be higher than target pressure here
+ // Make sure the airlock isn't aiming for pure vacuum - an impossibility
memory["target_pressure"] = max(target_pressure, MIN_TARGET_PRESSURE)
if(STATE_PRESSURIZE)
if(memory["chamber_sensor_pressure"] >= memory["target_pressure"] * 0.95)
- //not done until the pump has reported that it's off
+ // Not done until the pump has reported that it's off
if(memory["pump_status"] != "off")
- signalPump(tag_airpump, 0) //send a signal to stop pumping
+ signalPump(tag_airpump, 0) //Send a signal to stop pumping
if(cycle_to_external_air)
signalPump(tag_pump_out_internal, 0)
signalPump(tag_pump_out_external, 0)
@@ -255,7 +258,7 @@
memory["purge"] = 0
memory["target_pressure"] = (target_state == TARGET_INOPEN ? memory["internal_sensor_pressure"] : memory["external_sensor_pressure"])
if (memory["target_pressure"] > SKIPCYCLE_MARGIN)
- state = STATE_PREPARE // Skip pressurizing if target pressure is already close enough.
+ state = STATE_PREPARE // Skip pressurizing if target pressure is already close enough.
else
cycleDoors(target_state)
state = STATE_IDLE
@@ -266,13 +269,17 @@
return 1
-//these are here so that other types don't have to make so many assuptions about our implementation
+// These are here so that other types don't have to make so many assuptions about our implementation
/datum/computer/file/embedded_program/airlock/proc/begin_cycle_in()
state = STATE_IDLE
target_state = TARGET_INOPEN
memory["purge"] = cycle_to_external_air
+/datum/computer/file/embedded_program/airlock/proc/begin_dock_cycle()
+ state = STATE_IDLE
+ target_state = TARGET_INOPEN
+
/datum/computer/file/embedded_program/airlock/proc/begin_cycle_out()
state = STATE_IDLE
target_state = TARGET_OUTOPEN
@@ -289,7 +296,7 @@
/datum/computer/file/embedded_program/airlock/proc/done_cycling()
return (state == STATE_IDLE && target_state == TARGET_NONE)
-//are the doors closed and locked?
+// Are the doors closed and locked?
/datum/computer/file/embedded_program/airlock/proc/check_exterior_door_secured()
return (memory["exterior_status"]["state"] == "closed" && memory["exterior_status"]["lock"] == "locked")
@@ -318,7 +325,7 @@
)
post_signal(signal)
-//this is called to set the appropriate door state at the end of a cycling process, or for the exterior buttons
+// This is called to set the appropriate door state at the end of a cycling process, or for the exterior buttons
/datum/computer/file/embedded_program/airlock/proc/cycleDoors(var/target)
switch(target)
if(TARGET_OUTOPEN)
@@ -410,4 +417,4 @@ send an additional command to open the door again.
#undef TARGET_NONE
#undef TARGET_INOPEN
-#undef TARGET_OUTOPEN
\ No newline at end of file
+#undef TARGET_OUTOPEN
diff --git a/code/game/machinery/embedded_controller/docking_program.dm b/code/game/machinery/embedded_controller/docking_program.dm
index 95acededb3c..8e1b9b24ffd 100644
--- a/code/game/machinery/embedded_controller/docking_program.dm
+++ b/code/game/machinery/embedded_controller/docking_program.dm
@@ -6,25 +6,25 @@
#define MODE_NONE 0
#define MODE_SERVER 1
-#define MODE_CLIENT 2 //The one who initiated the docking, and who can initiate the undocking. The server cannot initiate undocking, and is the one responsible for deciding to accept a docking request and signals when docking and undocking is complete. (Think server == station, client == shuttle)
+#define MODE_CLIENT 2 // The one who initiated the docking, and who can initiate the undocking. The server cannot initiate undocking, and is the one responsible for deciding to accept a docking request and signals when docking and undocking is complete. (Think server == station, client == shuttle)
-#define MESSAGE_RESEND_TIME 5 //how long (in seconds) do we wait before resending a message
+#define MESSAGE_RESEND_TIME 5 // How long (in seconds) do we wait before resending a message
/*
*** STATE TABLE ***
- MODE_CLIENT|STATE_UNDOCKED sent a request for docking and now waiting for a reply.
- MODE_CLIENT|STATE_DOCKING server told us they are OK to dock, waiting for our docking port to be ready.
- MODE_CLIENT|STATE_DOCKED idle - docked as client.
- MODE_CLIENT|STATE_UNDOCKING we are either waiting for our docking port to be ready or for the server to give us the OK to finish undocking.
+ MODE_CLIENT|STATE_UNDOCKED Sent a request for docking and now waiting for a reply.
+ MODE_CLIENT|STATE_DOCKING Server told us they are OK to dock, waiting for our docking port to be ready.
+ MODE_CLIENT|STATE_DOCKED Idle - docked as client.
+ MODE_CLIENT|STATE_UNDOCKING We are either waiting for our docking port to be ready or for the server to give us the OK to finish undocking.
- MODE_SERVER|STATE_UNDOCKED should never happen.
- MODE_SERVER|STATE_DOCKING someone requested docking, we are waiting for our docking port to be ready.
- MODE_SERVER|STATE_DOCKED idle - docked as server
- MODE_SERVER|STATE_UNDOCKING client requested undocking, we are waiting for our docking port to be ready.
+ MODE_SERVER|STATE_UNDOCKED Should never happen.
+ MODE_SERVER|STATE_DOCKING Someone requested docking, we are waiting for our docking port to be ready.
+ MODE_SERVER|STATE_DOCKED Idle - docked as server
+ MODE_SERVER|STATE_UNDOCKING Client requested undocking, we are waiting for our docking port to be ready.
- MODE_NONE|STATE_UNDOCKED idle - not docked.
- MODE_NONE|anything else should never happen.
+ MODE_NONE|STATE_UNDOCKED Idle - not docked.
+ MODE_NONE|anything else Should never happen.
*** Docking Signals ***
@@ -62,31 +62,36 @@
/datum/computer/file/embedded_program/docking
- var/tag_target //the tag of the docking controller that we are trying to dock with
+ var/tag_target // The tag of the docking controller that we are trying to dock with
var/dock_state = STATE_UNDOCKED
var/control_mode = MODE_NONE
- var/response_sent = 0 //so we don't spam confirmation messages
- var/resend_counter = 0 //for periodically resending confirmation messages in case they are missed
+ var/response_sent = 0 // So we don't spam confirmation messages
+ var/resend_counter = 0 // For periodically resending confirmation messages in case they are missed
- var/override_enabled = 0 //when enabled, do not open/close doors or cycle airlocks and wait for the player to do it manually
- var/received_confirm = 0 //for undocking, whether the server has recieved a confirmation from the client
+ var/override_enabled = 0 // When enabled, do not open/close doors or cycle airlocks and wait for the player to do it manually
+ var/received_confirm = 0 // For undocking, whether the server has recieved a confirmation from the client
+
+ var/docking_codes // Would only allow docking when receiving signal with these, if set
+ var/display_name // Override the name shown on docking monitoring program; defaults to area name + coordinates if unset
/datum/computer/file/embedded_program/docking/New()
..()
- var/datum/existing = locate(id_tag) //in case a datum already exists with our tag
- if(existing)
- existing.tag = null //take it from them
-
- tag = id_tag //Greatly simplifies shuttle initialization
+ if(id_tag)
+ if(SSshuttle.docking_registry[id_tag])
+ crash_with("Docking controller tag [id_tag] had multiple associated programs.")
+ SSshuttle.docking_registry[id_tag] = src
+/datum/computer/file/embedded_program/docking/Destroy()
+ SSshuttle.docking_registry -= id_tag
+ return ..()
/datum/computer/file/embedded_program/docking/receive_signal(datum/signal/signal, receive_method, receive_param)
- var/receive_tag = signal.data["tag"] //for docking signals, this is the sender id
+ var/receive_tag = signal.data["tag"] // For docking signals, this is the sender id
var/command = signal.data["command"]
- var/recipient = signal.data["recipient"] //the intended recipient of the docking signal
+ var/recipient = signal.data["recipient"] // The intended recipient of the docking signal
if (recipient != id_tag)
- return //this signal is not for us
+ return // This signal is not for us
switch (command)
if ("confirm_dock")
@@ -100,28 +105,35 @@
dock_state = STATE_DOCKED
broadcast_docking_status()
if (!override_enabled)
- finish_docking() //client done docking!
+ finish_docking() // Client done docking!
response_sent = 0
- else if (control_mode == MODE_SERVER && dock_state == STATE_DOCKING && receive_tag == tag_target) //client just sent us the confirmation back, we're done with the docking process
+ else if (control_mode == MODE_SERVER && dock_state == STATE_DOCKING && receive_tag == tag_target) // Client just sent us the confirmation back, we're done with the docking process
received_confirm = 1
if ("request_dock")
if (control_mode == MODE_NONE && dock_state == STATE_UNDOCKED)
- control_mode = MODE_SERVER
+ tag_target = receive_tag
+
+ if(docking_codes)
+ var/code = signal.data["code"]
+ if(code != docking_codes)
+ testing("Controller [id_tag] got request_dock but code:[code] != docking_codes:[docking_codes]")
+ return
+
+ control_mode = MODE_SERVER
dock_state = STATE_DOCKING
broadcast_docking_status()
- tag_target = receive_tag
if (!override_enabled)
prepare_for_docking()
- send_docking_command(tag_target, "confirm_dock") //acknowledge the request
+ send_docking_command(tag_target, "confirm_dock") // Acknowledge the request
if ("confirm_undock")
if (control_mode == MODE_CLIENT && dock_state == STATE_UNDOCKING && receive_tag == tag_target)
if (!override_enabled)
finish_undocking()
- reset() //client is done undocking!
+ reset() // Client is done undocking!
else if (control_mode == MODE_SERVER && dock_state == STATE_UNDOCKING && receive_tag == tag_target)
received_confirm = 1
@@ -139,21 +151,21 @@
/datum/computer/file/embedded_program/docking/process()
switch(dock_state)
- if (STATE_DOCKING) //waiting for our docking port to be ready for docking
+ if (STATE_DOCKING) // Waiting for our docking port to be ready for docking
if (ready_for_docking())
if (control_mode == MODE_CLIENT)
if (!response_sent)
- send_docking_command(tag_target, "confirm_dock") //tell the server we're ready
+ send_docking_command(tag_target, "confirm_dock") // Tell the server we're ready
response_sent = 1
else if (control_mode == MODE_SERVER && received_confirm)
- send_docking_command(tag_target, "confirm_dock") //tell the client we are done docking.
+ send_docking_command(tag_target, "confirm_dock") // Tell the client we are done docking.
dock_state = STATE_DOCKED
broadcast_docking_status()
if (!override_enabled)
- finish_docking() //server done docking!
+ finish_docking() // Server done docking!
response_sent = 0
received_confirm = 0
@@ -161,14 +173,14 @@
if (ready_for_undocking())
if (control_mode == MODE_CLIENT)
if (!response_sent)
- send_docking_command(tag_target, "confirm_undock") //tell the server we are OK to undock.
+ send_docking_command(tag_target, "confirm_undock") // Tell the server we are OK to undock.
response_sent = 1
else if (control_mode == MODE_SERVER && received_confirm)
- send_docking_command(tag_target, "confirm_undock") //tell the client we are done undocking.
+ send_docking_command(tag_target, "confirm_undock") // Tell the client we are done undocking.
if (!override_enabled)
finish_undocking()
- reset() //server is done undocking!
+ reset() // Server is done undocking!
if (response_sent || resend_counter > 0)
resend_counter++
@@ -177,7 +189,7 @@
response_sent = 0
resend_counter = 0
- //handle invalid states
+ // Handle invalid states
if (control_mode == MODE_NONE && dock_state != STATE_UNDOCKED)
if (tag_target)
send_docking_command(tag_target, "dock_error")
@@ -187,7 +199,7 @@
/datum/computer/file/embedded_program/docking/proc/initiate_docking(var/target)
- if (dock_state != STATE_UNDOCKED || control_mode == MODE_SERVER) //must be undocked and not serving another request to begin a new docking handshake
+ if (dock_state != STATE_UNDOCKED || control_mode == MODE_SERVER) // Must be undocked and not serving another request to begin a new docking handshake
return
tag_target = target
@@ -196,7 +208,7 @@
send_docking_command(tag_target, "request_dock")
/datum/computer/file/embedded_program/docking/proc/initiate_undocking()
- if (dock_state != STATE_DOCKED || control_mode != MODE_CLIENT) //must be docked and must be client to start undocking
+ if (dock_state != STATE_DOCKED || control_mode != MODE_CLIENT) // Must be docked and must be client to start undocking
return
dock_state = STATE_UNDOCKING
@@ -207,27 +219,27 @@
send_docking_command(tag_target, "request_undock")
-//tell the docking port to start getting ready for docking - e.g. pressurize
+// Tell the docking port to start getting ready for docking - e.g. pressurize
/datum/computer/file/embedded_program/docking/proc/prepare_for_docking()
return
-//are we ready for docking?
+// Are we ready for docking?
/datum/computer/file/embedded_program/docking/proc/ready_for_docking()
return 1
-//we are docked, open the doors or whatever.
+// We are docked, open the doors or whatever.
/datum/computer/file/embedded_program/docking/proc/finish_docking()
return
-//tell the docking port to start getting ready for undocking - e.g. close those doors.
+// Tell the docking port to start getting ready for undocking - e.g. close those doors.
/datum/computer/file/embedded_program/docking/proc/prepare_for_undocking()
return
-//we are docked, open the doors or whatever.
+// We are docked, open the doors or whatever.
/datum/computer/file/embedded_program/docking/proc/finish_undocking()
return
-//are we ready for undocking?
+// Are we ready for undocking?
/datum/computer/file/embedded_program/docking/proc/ready_for_undocking()
return 1
@@ -258,7 +270,7 @@
/datum/computer/file/embedded_program/docking/proc/undocked()
return (dock_state == STATE_UNDOCKED)
-//returns 1 if we are saftely undocked (and the shuttle can leave)
+// Returns 1 if we are saftely undocked (and the shuttle can leave)
/datum/computer/file/embedded_program/docking/proc/can_launch()
return undocked()
@@ -267,6 +279,7 @@
signal.data["tag"] = id_tag
signal.data["command"] = command
signal.data["recipient"] = recipient
+ signal.data["code"] = docking_codes
post_signal(signal)
/datum/computer/file/embedded_program/docking/proc/broadcast_docking_status()
@@ -275,7 +288,7 @@
signal.data["dock_status"] = get_docking_status()
post_signal(signal)
-//this is mostly for NanoUI
+// This is mostly for NanoUI
/datum/computer/file/embedded_program/docking/proc/get_docking_status()
switch (dock_state)
if (STATE_UNDOCKED) return "undocked"
@@ -283,6 +296,8 @@
if (STATE_UNDOCKING) return "undocking"
if (STATE_DOCKED) return "docked"
+/datum/computer/file/embedded_program/docking/proc/get_name()
+ return display_name ? display_name : "[get_area(master)] ([master.x], [master.y])"
#undef STATE_UNDOCKED
#undef STATE_DOCKING
@@ -291,4 +306,4 @@
#undef MODE_NONE
#undef MODE_SERVER
-#undef MODE_CLIENT
\ No newline at end of file
+#undef MODE_CLIENT
diff --git a/code/game/machinery/embedded_controller/embedded_controller_base.dm b/code/game/machinery/embedded_controller/embedded_controller_base.dm
index 32b8839f212..a624389afaf 100644
--- a/code/game/machinery/embedded_controller/embedded_controller_base.dm
+++ b/code/game/machinery/embedded_controller/embedded_controller_base.dm
@@ -1,18 +1,20 @@
/obj/machinery/embedded_controller
- var/datum/computer/file/embedded_program/program //the currently executing program
-
name = "Embedded Controller"
anchored = 1
-
use_power = USE_POWER_IDLE
idle_power_usage = 10
-
+ var/datum/computer/file/embedded_program/program // The currently executing program
var/on = 1
-obj/machinery/embedded_controller/radio/Destroy()
- if(radio_controller)
- radio_controller.remove_object(src,frequency)
- ..()
+/obj/machinery/embedded_controller/Initialize()
+ if(ispath(program))
+ program = new program(src)
+ return ..()
+
+/obj/machinery/embedded_controller/Destroy()
+ if(istype(program))
+ qdel(program) // The program will clear the ref in its Destroy
+ return ..()
/obj/machinery/embedded_controller/proc/post_signal(datum/signal/signal, comm_line)
return 0
@@ -22,7 +24,18 @@ obj/machinery/embedded_controller/radio/Destroy()
if(program)
program.receive_signal(signal, receive_method, receive_param)
- //spawn(5) program.process() //no, program.process sends some signals and machines respond and we here again and we lag -rastaf0
+ //spawn(5) program.process() // No, program.process sends some signals and machines respond and we here again and we lag -rastaf0
+
+/obj/machinery/embedded_controller/Topic(href, href_list)
+ if((. = ..()))
+ return
+ if(usr)
+ usr.set_machine(src)
+ src.add_fingerprint(usr)
+ // We would now pass it to the program, except that some of our embedded controller types want to block certain commands.
+ // Until/unless that is refactored differently, we rely on subtypes to pass it on.
+ //if(program)
+ // return program.receive_user_command(href_list["command"])
/obj/machinery/embedded_controller/process()
if(program)
@@ -40,26 +53,32 @@ obj/machinery/embedded_controller/radio/Destroy()
src.ui_interact(user)
-/obj/machinery/embedded_controller/ui_interact()
- return
+//
+// Embedded controller with a radio! (Most things (All things?) use this)
+//
/obj/machinery/embedded_controller/radio
icon = 'icons/obj/airlock_machines.dmi'
icon_state = "airlock_control_standby"
power_channel = ENVIRON
density = 0
+ unacidable = 1
var/id_tag
- //var/radio_power_use = 50 //power used to xmit signals
+ //var/radio_power_use = 50 // Power used to xmit signals
var/frequency = 1379
var/radio_filter = null
var/datum/radio_frequency/radio_connection
- unacidable = 1
/obj/machinery/embedded_controller/radio/Initialize()
+ set_frequency(frequency) // Set it before parent instantiates program
. = ..()
- set_frequency(frequency)
+
+/obj/machinery/embedded_controller/radio/Destroy()
+ if(radio_controller)
+ radio_controller.remove_object(src,frequency)
+ ..()
/obj/machinery/embedded_controller/radio/update_icon()
if(on && program)
@@ -73,7 +92,7 @@ obj/machinery/embedded_controller/radio/Destroy()
/obj/machinery/embedded_controller/radio/post_signal(datum/signal/signal, var/radio_filter = null)
signal.transmission_method = TRANSMISSION_RADIO
if(radio_connection)
- //use_power(radio_power_use) //neat idea, but causes way too much lag.
+ //use_power(radio_power_use) // Neat idea, but causes way too much lag.
return radio_connection.post_signal(src, signal, radio_filter)
else
qdel(signal)
@@ -81,4 +100,4 @@ obj/machinery/embedded_controller/radio/Destroy()
/obj/machinery/embedded_controller/radio/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
- radio_connection = radio_controller.add_object(src, frequency, radio_filter)
\ No newline at end of file
+ radio_connection = radio_controller.add_object(src, frequency, radio_filter)
diff --git a/code/game/machinery/embedded_controller/embedded_program_base.dm b/code/game/machinery/embedded_controller/embedded_program_base.dm
index 56a605759d0..f61e2e1cddb 100644
--- a/code/game/machinery/embedded_controller/embedded_program_base.dm
+++ b/code/game/machinery/embedded_controller/embedded_program_base.dm
@@ -11,8 +11,15 @@
var/obj/machinery/embedded_controller/radio/R = M
id_tag = R.id_tag
+/datum/computer/file/embedded_program/Destroy()
+ if(master)
+ master.program = null
+ master = null
+ return ..()
+
+// Return TRUE if was a command for us, otherwise return FALSE (so controllers with multiple programs can try each in turn until one accepts)
/datum/computer/file/embedded_program/proc/receive_user_command(command)
- return
+ return FALSE
/datum/computer/file/embedded_program/proc/receive_signal(datum/signal/signal, receive_method, receive_param)
return
diff --git a/code/game/machinery/embedded_controller/simple_docking_controller.dm b/code/game/machinery/embedded_controller/simple_docking_controller.dm
index 14b27b2512e..4b98d28c77e 100644
--- a/code/game/machinery/embedded_controller/simple_docking_controller.dm
+++ b/code/game/machinery/embedded_controller/simple_docking_controller.dm
@@ -1,16 +1,12 @@
-//a docking port that uses a single door
+// A docking port that uses a single door
/obj/machinery/embedded_controller/radio/simple_docking_controller
name = "docking hatch controller"
+ program = /datum/computer/file/embedded_program/docking/simple
var/tag_door
- var/datum/computer/file/embedded_program/docking/simple/docking_program
-
-/obj/machinery/embedded_controller/radio/simple_docking_controller/Initialize()
- . = ..()
- docking_program = new/datum/computer/file/embedded_program/docking/simple(src)
- program = docking_program
/obj/machinery/embedded_controller/radio/simple_docking_controller/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
+ var/datum/computer/file/embedded_program/docking/simple/docking_program = program // Cast to proper type
data = list(
"docking_status" = docking_program.get_docking_status(),
@@ -28,14 +24,11 @@
ui.set_auto_update(1)
/obj/machinery/embedded_controller/radio/simple_docking_controller/Topic(href, href_list)
- if(..())
- return 1
-
- usr.set_machine(src)
- src.add_fingerprint(usr)
+ if((. = ..()))
+ return
var/clean = 0
- switch(href_list["command"]) //anti-HTML-hacking checks
+ switch(href_list["command"]) // Anti-HTML-hacking checks
if("force_door")
clean = 1
if("toggle_override")
@@ -44,16 +37,15 @@
if(clean)
program.receive_user_command(href_list["command"])
- return 0
+ return
-
-//A docking controller program for a simple door based docking port
+// A docking controller program for a simple door based docking port
/datum/computer/file/embedded_program/docking/simple
var/tag_door
/datum/computer/file/embedded_program/docking/simple/New(var/obj/machinery/embedded_controller/M)
..(M)
- memory["door_status"] = list(state = "closed", lock = "locked") //assume closed and locked in case the doors dont report in
+ memory["door_status"] = list(state = "closed", lock = "locked") // Assume closed and locked in case the doors dont report in
if (istype(M, /obj/machinery/embedded_controller/radio/simple_docking_controller))
var/obj/machinery/embedded_controller/radio/simple_docking_controller/controller = M
@@ -61,7 +53,7 @@
tag_door = controller.tag_door? controller.tag_door : "[id_tag]_hatch"
spawn(10)
- signal_door("update") //signals connected doors to update their status
+ signal_door("update") // Signals connected doors to update their status
/datum/computer/file/embedded_program/docking/simple/receive_signal(datum/signal/signal, receive_method, receive_param)
@@ -76,6 +68,7 @@
..(signal, receive_method, receive_param)
/datum/computer/file/embedded_program/docking/simple/receive_user_command(command)
+ . = TRUE
switch(command)
if("force_door")
if (override_enabled)
@@ -88,7 +81,8 @@
disable_override()
else
enable_override()
-
+ else
+ . = FALSE
/datum/computer/file/embedded_program/docking/simple/proc/signal_door(var/command)
var/datum/signal/signal = new
@@ -114,23 +108,23 @@
else if(memory["door_status"]["lock"] == "unlocked")
signal_door("lock")
-//tell the docking port to start getting ready for docking - e.g. pressurize
+// Tell the docking port to start getting ready for docking - e.g. pressurize
/datum/computer/file/embedded_program/docking/simple/prepare_for_docking()
- return //don't need to do anything
+ return // Don't need to do anything
-//are we ready for docking?
+// Are we ready for docking?
/datum/computer/file/embedded_program/docking/simple/ready_for_docking()
- return 1 //don't need to do anything
+ return 1 // Don't need to do anything
-//we are docked, open the doors or whatever.
+// We are docked, open the doors or whatever.
/datum/computer/file/embedded_program/docking/simple/finish_docking()
open_door()
-//tell the docking port to start getting ready for undocking - e.g. close those doors.
+// Tell the docking port to start getting ready for undocking - e.g. close those doors.
/datum/computer/file/embedded_program/docking/simple/prepare_for_undocking()
close_door()
-//are we ready for undocking?
+// Are we ready for undocking?
/datum/computer/file/embedded_program/docking/simple/ready_for_undocking()
return (memory["door_status"]["state"] == "closed" && memory["door_status"]["lock"] == "locked")
@@ -161,4 +155,4 @@
set src in view(1)
src.program:initiate_undocking()
-*/
\ No newline at end of file
+*/
diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm
index d23c3ffdc11..de904977f31 100644
--- a/code/game/machinery/status_display.dm
+++ b/code/game/machinery/status_display.dm
@@ -19,23 +19,23 @@
density = 0
use_power = USE_POWER_IDLE
idle_power_usage = 10
- circuit = /obj/item/circuitboard/status_display
+ circuit = /obj/item/circuitboard/status_display
var/mode = 1 // 0 = Blank
// 1 = Shuttle timer
// 2 = Arbitrary message(s)
- // 3 = alert picture
+ // 3 = Alert picture
// 4 = Supply shuttle timer
- var/picture_state // icon_state of alert picture
- var/message1 = "" // message line 1
- var/message2 = "" // message line 2
- var/index1 // display index for scrolling messages or 0 if non-scrolling
+ var/picture_state // Icon_state of alert picture
+ var/message1 = "" // Message line 1
+ var/message2 = "" // Message line 2
+ var/index1 // Display index for scrolling messages or 0 if non-scrolling
var/index2
var/picture = null
- var/frequency = 1435 // radio frequency
+ var/frequency = 1435 // Radio frequency
- var/friendc = 0 // track if Friend Computer mode
+ var/friendc = 0 // Track if Friend Computer mode
var/ignore_friendc = 0
maptext_height = 26
@@ -63,13 +63,13 @@
attack_hand(user)
return
-// register for radio system
+// Register for radio system
/obj/machinery/status_display/Initialize()
. = ..()
if(radio_controller)
radio_controller.add_object(src, frequency)
-// timed process
+// Timed process
/obj/machinery/status_display/process()
if(stat & NOPOWER)
remove_display()
@@ -83,7 +83,7 @@
set_picture("ai_bsod")
..(severity)
-// set what is displayed
+// Set what is displayed
/obj/machinery/status_display/proc/update()
remove_display()
if(friendc && !ignore_friendc)
@@ -91,12 +91,12 @@
return 1
switch(mode)
- if(STATUS_DISPLAY_BLANK) //blank
+ if(STATUS_DISPLAY_BLANK) // Blank
return 1
- if(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME) //emergency shuttle timer
+ if(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME) // Emergency shuttle timer
if(!SSemergencyshuttle)
message1 = "-ETA-"
- message2 = "Never" // You're here forever.
+ message2 = "Never" // You're here forever.
return 1
if(SSemergencyshuttle.waiting_to_leave())
message1 = "-ETD-"
@@ -114,7 +114,7 @@
message2 = "Error"
update_display(message1, message2)
return 1
- if(STATUS_DISPLAY_MESSAGE) //custom messages
+ if(STATUS_DISPLAY_MESSAGE) // Custom messages
var/line1
var/line2
@@ -210,7 +210,7 @@
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
/obj/machinery/status_display/proc/get_supply_shuttle_timer()
- var/datum/shuttle/ferry/supply/shuttle = SSsupply.shuttle
+ var/datum/shuttle/autodock/ferry/supply/shuttle = SSsupply.shuttle
if(!shuttle)
return "Error"
diff --git a/code/game/machinery/supply_display.dm b/code/game/machinery/supply_display.dm
index 5c111c129f8..5a5c9750b6a 100644
--- a/code/game/machinery/supply_display.dm
+++ b/code/game/machinery/supply_display.dm
@@ -6,7 +6,7 @@
message1 = "CARGO"
message2 = ""
- var/datum/shuttle/ferry/supply/shuttle = SSsupply.shuttle
+ var/datum/shuttle/autodock/ferry/supply/shuttle = SSsupply.shuttle
if(!shuttle)
message2 = "Error"
else if(shuttle.has_arrive_time())
diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm
index aebbd17f29e..bfab65e15ba 100644
--- a/code/game/objects/items/devices/PDA/cart.dm
+++ b/code/game/objects/items/devices/PDA/cart.dm
@@ -6,7 +6,7 @@ var/list/command_cartridges = list(
/obj/item/cartridge/rd,
/obj/item/cartridge/cmo,
/obj/item/cartridge/head,
- /obj/item/cartridge/lawyer // Internal Affaris,
+ /obj/item/cartridge/lawyer // Internal Affaris,
)
var/list/security_cartridges = list(
@@ -33,7 +33,7 @@ var/list/research_cartridges = list(
)
var/list/cargo_cartridges = list(
- /obj/item/cartridge/quartermaster, // This also covers cargo-techs, apparently,
+ /obj/item/cartridge/quartermaster, // This also covers cargo-techs, apparently, for some reason
/obj/item/cartridge/miner,
/obj/item/cartridge/hop
)
@@ -62,7 +62,7 @@ var/list/civilian_cartridges = list(
var/access_janitor = 0
// var/access_flora = 0
var/access_reagent_scanner = 0
- var/access_remote_door = 0 // Control some blast doors remotely!!
+ var/access_remote_door = 0 // Control some blast doors remotely!!
var/remote_door_id = ""
var/access_status_display = 0
var/access_quartermaster = 0
@@ -71,11 +71,11 @@ var/list/civilian_cartridges = list(
var/charges = 0
var/mode = null
var/menu
- var/datum/data/record/active1 = null //General
- var/datum/data/record/active2 = null //Medical
- var/datum/data/record/active3 = null //Security
- var/selected_sensor = null // Power Sensor
- var/message1 // used for status_displays
+ var/datum/data/record/active1 = null // General
+ var/datum/data/record/active2 = null // Medical
+ var/datum/data/record/active3 = null // Security
+ var/selected_sensor = null // Power Sensor
+ var/message1 // Used for status_displays
var/message2
var/list/stored_data = list()
@@ -246,7 +246,7 @@ var/list/civilian_cartridges = list(
icon_state = "cart"
access_remote_door = 1
access_detonate_pda = 1
- remote_door_id = "smindicate" //Make sure this matches the syndicate shuttle's shield/door id!! //don't ask about the name, testing.
+ remote_door_id = "smindicate" // Make sure this matches the syndicate shuttle's shield/door id!! // Don't ask about the name, testing.
charges = 4
/obj/item/cartridge/proc/post_status(var/command, var/data1, var/data2)
@@ -425,7 +425,7 @@ var/list/civilian_cartridges = list(
if(mode==47)
var/supplyData[0]
- var/datum/shuttle/ferry/supply/shuttle = SSsupply.shuttle
+ var/datum/shuttle/autodock/ferry/supply/shuttle = SSsupply.shuttle
if (shuttle)
supplyData["shuttle_moving"] = shuttle.has_arrive_time()
supplyData["shuttle_eta"] = shuttle.eta_minutes()
@@ -462,7 +462,7 @@ var/list/civilian_cartridges = list(
- /* Janitor Supplies Locator (Mode: 49) */
+ /* Janitor Supplies Locator (Mode: 49) */
if(mode==49)
var/JaniData[0]
var/turf/cl = get_turf(src)
diff --git a/code/game/objects/items/devices/communicator/helper.dm b/code/game/objects/items/devices/communicator/helper.dm
index 078bd65b446..128e9616c2c 100644
--- a/code/game/objects/items/devices/communicator/helper.dm
+++ b/code/game/objects/items/devices/communicator/helper.dm
@@ -226,8 +226,8 @@
if(T)
var/list/levels = GLOB.using_map.get_map_levels(T.z, FALSE)
for(var/obj/machinery/power/sensor/S in machines)
- if((S.long_range) || (S.loc.z in levels) || (S.loc.z == T.z)) // Consoles have range on their Z-Level. Sensors with long_range var will work between Z levels.
- if(S.name_tag == "#UNKN#") // Default name. Shouldn't happen!
+ if((S.long_range) || (S.loc.z in levels) || (S.loc.z == T.z)) // Consoles have range on their Z-Level. Sensors with long_range var will work between Z levels.
+ if(S.name_tag == "#UNKN#") // Default name. Shouldn't happen!
warning("Powernet sensor with unset ID Tag! [S.x]X [S.y]Y [S.z]Z")
else
grid_sensors += S
@@ -299,7 +299,7 @@
janidata[++janidata.len] = list("field" = "Current Location", "val" = "[userloc.x], [userloc.y], [GLOB.using_map.get_zlevel_name(userloc.z)]")
else
janidata[++janidata.len] = list("field" = "Current Location", "val" = "Unknown")
- return janidata // If the user isn't on a valid turf, then it shouldn't be able to find anything anyways
+ return janidata // If the user isn't on a valid turf, then it shouldn't be able to find anything anyways
// Mops, mop buckets, janitorial carts.
for(var/obj/C in cleaningList)
@@ -332,23 +332,23 @@
// The contents of the three lists are inherently related, so separating them into different procs would be largely redundant
/obj/item/commcard/proc/get_GPS_lists()
// GPS Access
- var/intgps[0] // Gps devices within the commcard -- Allow tag edits, turning on/off, etc
- var/extgps[0] // Gps devices not inside the commcard -- Print locations if a gps is on
- var/stagps[0] // Gps net status, location, whether it's on, if it's got long range
+ var/intgps[0] // Gps devices within the commcard -- Allow tag edits, turning on/off, etc
+ var/extgps[0] // Gps devices not inside the commcard -- Print locations if a gps is on
+ var/stagps[0] // Gps net status, location, whether it's on, if it's got long range
var/obj/item/gps/cumulative = new(src)
cumulative.tracking = FALSE
- cumulative.local_mode = TRUE // Won't detect long-range signals automatically
+ cumulative.local_mode = TRUE // Won't detect long-range signals automatically
cumulative.long_range = FALSE
- var/list/toggled_gps = list() // List of GPS units that are turned off before display_list() is called
+ var/list/toggled_gps = list() // List of GPS units that are turned off before display_list() is called
for(var/obj/item/gps/G in internal_devices)
var/gpsdata[0]
if(G.tracking && !G.emped)
- cumulative.tracking = TRUE // Turn it on
+ cumulative.tracking = TRUE // Turn it on
if(G.long_range)
- cumulative.long_range = TRUE // It can detect long-range
+ cumulative.long_range = TRUE // It can detect long-range
if(!G.local_mode)
- cumulative.local_mode = FALSE // It is detecting long-range
+ cumulative.local_mode = FALSE // It is detecting long-range
gpsdata["ref"] = "\ref[G]"
gpsdata["tag"] = G.gps_tag
@@ -358,15 +358,15 @@
gpsdata["hide_signal"] = G.hide_signal
gpsdata["can_hide"] = G.can_hide_signal
- intgps[++intgps.len] = gpsdata // Add it to the list
+ intgps[++intgps.len] = gpsdata // Add it to the list
if(G.tracking)
- G.tracking = FALSE // Disable the internal gps units so they don't show up in the report
+ G.tracking = FALSE // Disable the internal gps units so they don't show up in the report
toggled_gps += G
var/list/remote_gps = cumulative.display_list() // Fetch information for all units except the ones inside of this device
- for(var/obj/item/gps/G in toggled_gps) // Reenable any internal GPS units
+ for(var/obj/item/gps/G in toggled_gps) // Reenable any internal GPS units
G.tracking = TRUE
stagps["enabled"] = cumulative.tracking
@@ -393,7 +393,7 @@
// code\game\machinery\computer\supply.dm, starting at line 55
/obj/item/commcard/proc/get_supply_shuttle_status()
var/shuttle_status[0]
- var/datum/shuttle/ferry/supply/shuttle = SSsupply.shuttle
+ var/datum/shuttle/autodock/ferry/supply/shuttle = SSsupply.shuttle
if(shuttle)
if(shuttle.has_arrive_time())
shuttle_status["location"] = "In transit"
@@ -403,8 +403,8 @@
else
shuttle_status["time"] = 0
if(shuttle.at_station())
- if(shuttle.docking_controller)
- switch(shuttle.docking_controller.get_docking_status())
+ if(shuttle.shuttle_docking_controller)
+ switch(shuttle.shuttle_docking_controller.get_docking_status())
if("docked")
shuttle_status["location"] = "Docked"
shuttle_status["mode"] = SUP_SHUTTLE_DOCKED
diff --git a/code/game/turfs/simulated/floor_types.dm b/code/game/turfs/simulated/floor_types.dm
index 9bcb2bcc28d..ce3d3382031 100644
--- a/code/game/turfs/simulated/floor_types.dm
+++ b/code/game/turfs/simulated/floor_types.dm
@@ -5,7 +5,7 @@
/turf/simulated/floor/diona/attackby()
return
-//Shuttle Floors
+// Shuttle Floors
/obj/landed_holder
name = "landed turf holder"
desc = "holds all the info about the turf this turf 'landed on'"
@@ -19,7 +19,7 @@
my_turf = turf
/obj/landed_holder/proc/land_on(var/turf/T)
- //Gather destination information
+ // Gather destination information
var/obj/landed_holder/new_holder = new(null)
new_holder.turf_type = T.type
new_holder.dir = T.dir
@@ -29,7 +29,7 @@
new_holder.underlays = T.underlays.Copy()
new_holder.decals = T.decals ? T.decals.Copy() : null
- //Set the destination to be like us
+ // Set the destination to be like us
T.Destroy()
var/turf/simulated/shuttle/new_dest = T.ChangeTurf(my_turf.type,,1)
new_dest.setDir(my_turf.dir)
@@ -38,7 +38,7 @@
new_dest.copy_overlays(my_turf, TRUE)
new_dest.underlays = my_turf.underlays
new_dest.decals = my_turf.decals
- //Shuttle specific stuff
+ // Shuttle specific stuff
new_dest.interior_corner = my_turf.interior_corner
new_dest.takes_underlays = my_turf.takes_underlays
new_dest.under_turf = my_turf.under_turf
@@ -49,15 +49,15 @@
new_holder.my_turf = new_dest
new_dest.landed_holder = new_holder
- //Update underlays if necessary (interior corners won't have changed).
+ // Update underlays if necessary (interior corners won't have changed).
if(new_dest.takes_underlays && !new_dest.interior_corner)
new_dest.underlay_update()
return new_dest
-/obj/landed_holder/proc/leave_turf()
+/obj/landed_holder/proc/leave_turf(var/turf/base_turf = null)
var/turf/new_source
- //Change our source to whatever it was before
+ // Change our source to whatever it was before
if(turf_type)
new_source = my_turf.ChangeTurf(turf_type,,1)
new_source.setDir(dir)
@@ -67,7 +67,7 @@
new_source.underlays = underlays
new_source.decals = decals
else
- new_source = my_turf.ChangeTurf(get_base_turf_by_area(my_turf),,1)
+ new_source = my_turf.ChangeTurf(base_turf ? base_turf : get_base_turf_by_area(my_turf),,1)
return new_source
@@ -80,9 +80,9 @@
var/obj/landed_holder/landed_holder
var/interior_corner = 0
var/takes_underlays = 0
- var/turf/under_turf //Underlay override turf path.
- var/join_flags = 0 //Bitstring to represent adjacency of joining walls
- var/join_group = "shuttle" //A tag for what other walls to join with. Null if you don't want them to.
+ var/turf/under_turf // Underlay override turf path.
+ var/join_flags = 0 // Bitstring to represent adjacency of joining walls
+ var/join_group = "shuttle" // A tag for what other walls to join with. Null if you don't want them to.
/turf/simulated/shuttle/Destroy()
landed_holder = null
@@ -90,22 +90,22 @@
/turf/simulated/shuttle/proc/underlay_update()
if(!takes_underlays)
- //Basically, if it's not forced, and we don't care, don't do it.
+ // Basically, if it's not forced, and we don't care, don't do it.
return 0
- var/turf/under //May be a path or a turf
- var/mutable_appearance/us = new(src) //We'll use this for changes later
+ var/turf/under // May be a path or a turf
+ var/mutable_appearance/us = new(src) // We'll use this for changes later
us.underlays.Cut()
- //Mapper wanted something specific
+ // Mapper wanted something specific
if(under_turf)
under = under_turf
- //Well if this isn't our first rodeo, we know EXACTLY what we landed on, and it looks like this.
+ // Well if this isn't our first rodeo, we know EXACTLY what we landed on, and it looks like this.
if(landed_holder && !interior_corner)
var/mutable_appearance/landed_on = new(landed_holder)
- landed_on.layer = FLOAT_LAYER //Not turf
- landed_on.plane = FLOAT_PLANE //Not turf
+ landed_on.layer = FLOAT_LAYER // Not turf
+ landed_on.plane = FLOAT_PLANE // Not turf
us.underlays = list(landed_on)
appearance = us
return
@@ -115,9 +115,9 @@
var/turf/T2
var/turf/T3
- T1 = get_step(src, turn(join_flags,135)) // 45 degrees before opposite
- T2 = get_step(src, turn(join_flags,225)) // 45 degrees beyond opposite
- T3 = get_step(src, turn(join_flags,180)) // Opposite from the diagonal
+ T1 = get_step(src, turn(join_flags,135)) // 45 degrees before opposite
+ T2 = get_step(src, turn(join_flags,225)) // 45 degrees beyond opposite
+ T3 = get_step(src, turn(join_flags,180)) // Opposite from the diagonal
if(isfloor(T1) && ((T1.type == T2.type) || (T1.type == T3.type)))
under = T1
@@ -129,21 +129,21 @@
under = get_base_turf_by_area(src)
if(istype(under,/turf/simulated/shuttle))
- interior_corner = 1 //Prevents us from 'landing on grass' and having interior corners update.
+ interior_corner = 1 // Prevents us from 'landing on grass' and having interior corners update.
var/mutable_appearance/under_ma
- if(ispath(under)) //It's just a mapper-specified path
+ if(ispath(under)) // It's just a mapper-specified path
under_ma = new()
under_ma.icon = initial(under.icon)
under_ma.icon_state = initial(under.icon_state)
under_ma.color = initial(under.color)
- else //It's a real turf
+ else // It's a real turf
under_ma = new(under)
if(under_ma)
- if(ispath(under,/turf/space)) //Scramble space turfs
+ if(ispath(under,/turf/space)) // Scramble space turfs
under_ma.icon_state = "[rand(1,25)]"
us.underlays = list(under_ma)
@@ -182,7 +182,7 @@
icon_state = "alienpod1"
light_range = 3
light_power = 0.6
- light_color = "#66ffff" // Bright cyan.
+ light_color = "#66ffff" // Bright cyan.
block_tele = TRUE
/turf/simulated/shuttle/floor/alien/Initialize()
@@ -193,7 +193,7 @@
icon_state = "alienplating"
block_tele = TRUE
-/turf/simulated/shuttle/floor/alienplating/external // For the outer rim of the UFO, to avoid active edges.
+/turf/simulated/shuttle/floor/alienplating/external // For the outer rim of the UFO, to avoid active edges.
// The actual temperature adjustment is defined if the SC or other future map is compiled.
/turf/simulated/shuttle/plating
@@ -204,13 +204,13 @@
/turf/simulated/shuttle/plating/airless
initial_gas_mix = GAS_STRING_VACUUM
-//For 'carrying' otherwise empty turfs or stuff in space turfs with you or having holes in the floor or whatever.
+// For 'carrying' otherwise empty turfs or stuff in space turfs with you or having holes in the floor or whatever.
/turf/simulated/shuttle/plating/carry
name = "carry turf"
icon = 'icons/turf/shuttle_parts.dmi'
icon_state = "carry"
takes_underlays = 1
- blocks_air = 1 //I'd make these unsimulated but it just fucks with so much stuff so many other places.
+ blocks_air = 1 // I'd make these unsimulated but it just fucks with so much stuff so many other places.
/turf/simulated/shuttle/plating/carry/Initialize()
. = ..()
@@ -227,10 +227,10 @@
. = ..()
icon_state = "carry_ingame"
-/turf/simulated/shuttle/plating/skipjack //Skipjack plating
+/turf/simulated/shuttle/plating/skipjack // Skipjack plating
initial_gas_mix = GAS_STRING_STP_NITROGEN
-/turf/simulated/shuttle/floor/skipjack //Skipjack floors
+/turf/simulated/shuttle/floor/skipjack // Skipjack floors
name = "skipjack floor"
icon_state = "floor_dred"
initial_gas_mix = GAS_STRING_STP_NITROGEN
@@ -247,7 +247,7 @@
name = "voidcraft tiles"
icon_state = "void_light"
-/turf/simulated/shuttle/floor/voidcraft/external // For avoiding active edges.
+/turf/simulated/shuttle/floor/voidcraft/external // For avoiding active edges.
// The actual temperature adjustment is defined if the SC or other future map is compiled.
/turf/simulated/shuttle/floor/voidcraft/external/dark
diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm
index a0a8b15a7e0..f46453fcfbc 100644
--- a/code/game/turfs/space/space.dm
+++ b/code/game/turfs/space/space.dm
@@ -19,11 +19,14 @@
/turf/space/is_space()
return 1
-// override for space turfs, since they should never hide anything
+// Override for space turfs, since they should never hide anything
/turf/space/levelupdate()
for(var/obj/O in src)
O.hide(0)
+/turf/space/is_solid_structure()
+ return locate(/obj/structure/lattice, src) // Counts as solid structure if it has a lattice
+
/turf/space/proc/update_starlight()
if(!config_legacy.starlight)
return
@@ -66,7 +69,7 @@
// Patch holes in the ceiling
if(T)
if(istype(T, /turf/simulated/open) || istype(T, /turf/space))
- // Must be build adjacent to an existing floor/wall, no floating floors
+ // Must be build adjacent to an existing floor/wall, no floating floors
var/turf/simulated/A = locate(/turf/simulated/floor) in T.CardinalTurfs()
if(!A)
A = locate(/turf/simulated/wall) in T.CardinalTurfs()
@@ -74,7 +77,7 @@
to_chat(user, "There's nothing to attach the ceiling to!")
return
- if(R.use(1)) // Cost of roofing tiles is 1:1 with cost to place lattice and plating
+ if(R.use(1)) // Cost of roofing tiles is 1:1 with cost to place lattice and plating
T.ReplaceWithLattice()
T.ChangeTurf(/turf/simulated/floor)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 3ddf60b8a3c..00e5673480f 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -10,35 +10,35 @@
var/initial_gas_mix = GAS_STRING_TURF_DEFAULT
// End
- //Properties for airtight tiles (/wall)
+ // Properties for airtight tiles (/wall)
var/thermal_conductivity = 0.05
var/heat_capacity = 1
- //Properties for both
- var/temperature = T20C // Initial turf temperature.
- var/blocks_air = 0 // Does this turf contain air/let air through?
+ // Properties for both
+ var/temperature = T20C // Initial turf temperature.
+ var/blocks_air = 0 // Does this turf contain air/let air through?
// General properties.
var/icon_old = null
- var/pathweight = 1 // How much does it cost to pathfind over this turf?
- var/blessed = 0 // Has the turf been blessed?
+ var/pathweight = 1 // How much does it cost to pathfind over this turf?
+ var/blessed = 0 // Has the turf been blessed?
var/list/decals
- var/movement_cost = 0 // How much the turf slows down movement, if any.
+ var/movement_cost = 0 // How much the turf slows down movement, if any.
var/list/footstep_sounds = null
- var/block_tele = FALSE // If true, most forms of teleporting to or from this turf tile will fail.
+ var/block_tele = FALSE // If true, most forms of teleporting to or from this turf tile will fail.
var/can_build_into_floor = FALSE // Used for things like RCDs (and maybe lattices/floor tiles in the future), to see if a floor should replace it.
- var/list/dangerous_objects // List of 'dangerous' objs that the turf holds that can cause something bad to happen when stepped on, used for AI mobs.
+ var/list/dangerous_objects // List of 'dangerous' objs that the turf holds that can cause something bad to happen when stepped on, used for AI mobs.
/turf/Initialize(mapload)
if(flags & INITIALIZED)
stack_trace("Warning: [src]([type]) initialized multiple times!")
flags |= INITIALIZED
- // by default, vis_contents is inherited from the turf that was here before
+ // By default, vis_contents is inherited from the turf that was here before
vis_contents.Cut()
if(color)
@@ -88,14 +88,12 @@
ComponentInitialize()
- // VORESTATION EDIT
- if(movement_cost && pathweight == 1) // This updates pathweight automatically.
+ if(movement_cost && pathweight == 1) // This updates pathweight automatically.
pathweight = movement_cost
if(dynamic_lighting)
luminosity = 0
else
luminosity = 1
- // VORE/POLARIS EDIT END
return INITIALIZE_HINT_NORMAL
@@ -117,7 +115,7 @@
*/
if(force)
..()
- //this will completely wipe turf state
+ // This will completely wipe turf state
var/turf/B = new world.turf(src)
for(var/A in B.contents)
qdel(A)
@@ -144,6 +142,10 @@
/turf/proc/is_intact()
return 0
+// Used by shuttle code to check if this turf is empty enough to not crush want it lands on.
+/turf/proc/is_solid_structure()
+ return 1
+
/turf/attack_hand(mob/user)
. = ..()
user.move_pulled_towards(src)
@@ -161,14 +163,14 @@
return FALSE
var/list/viable_targets = list()
- var/success = FALSE // Hitting something makes this true. If its still false, the miss sound is played.
+ var/success = FALSE // Hitting something makes this true. If its still false, the miss sound is played.
for(var/mob/living/L in contents)
- if(L == user) // Don't hit ourselves.
+ if(L == user) // Don't hit ourselves.
continue
viable_targets += L
- if(!viable_targets.len) // No valid targets on this tile.
+ if(!viable_targets.len) // No valid targets on this tile.
if(W.can_cleave)
success = W.cleave(user, src)
else
@@ -178,7 +180,7 @@
user.setClickCooldown(user.get_attack_speed(W))
user.do_attack_animation(src, no_attack_icons = TRUE)
- if(!success) // Nothing got hit.
+ if(!success) // Nothing got hit.
user.visible_message("\The [user] swipes \the [W] over \the [src].")
playsound(src, 'sound/weapons/punchmiss.ogg', 25, 1, -1)
return success
@@ -259,7 +261,7 @@
return 1
return 0
-//expects an atom containing the reagents used to clean the turf
+// Expects an atom containing the reagents used to clean the turf
/turf/proc/clean(atom/source, mob/user)
if(source.reagents.has_reagent("water", 1) || source.reagents.has_reagent("cleaner", 1))
clean_blood()
@@ -271,7 +273,7 @@
qdel(O)
else
to_chat(user, "\The [source] is too dry to wash that.")
- source.reagents.trans_to_turf(src, 1, 10) //10 is the multiplier for the reaction effect. probably needed to wet the floor properly.
+ source.reagents.trans_to_turf(src, 1, 10) // 10 is the multiplier for the reaction effect. probably needed to wet the floor properly.
/turf/proc/update_blood_overlays()
return
@@ -309,7 +311,7 @@
if(!istype(O))
return FALSE
LAZYREMOVE(dangerous_objects, O)
- UNSETEMPTY(dangerous_objects) // This nulls the list var if it's empty.
+ UNSETEMPTY(dangerous_objects) // This nulls the list var if it's empty.
// color = "#00FF00"
// This is all the way up here since its the common ancestor for things that need to get replaced with a floor when an RCD is used on them.
diff --git a/code/modules/admin/secrets/admin_secrets/launch_shuttle.dm b/code/modules/admin/secrets/admin_secrets/launch_shuttle.dm
index 9c659eb9417..c7b76063c39 100644
--- a/code/modules/admin/secrets/admin_secrets/launch_shuttle.dm
+++ b/code/modules/admin/secrets/admin_secrets/launch_shuttle.dm
@@ -11,14 +11,14 @@
return
var/list/valid_shuttles = list()
for (var/shuttle_tag in SSshuttle.shuttles)
- if (istype(SSshuttle.shuttles[shuttle_tag], /datum/shuttle/ferry))
+ if (istype(SSshuttle.shuttles[shuttle_tag], /datum/shuttle/autodock))
valid_shuttles += shuttle_tag
var/shuttle_tag = input(user, "Which shuttle do you want to launch?") as null|anything in valid_shuttles
if (!shuttle_tag)
return
- var/datum/shuttle/ferry/S = SSshuttle.shuttles[shuttle_tag]
+ var/datum/shuttle/autodock/S = SSshuttle.shuttles[shuttle_tag]
if (S.can_launch())
S.launch(user)
log_and_message_admins("launched the [shuttle_tag] shuttle", user)
diff --git a/code/modules/admin/secrets/admin_secrets/launch_shuttle_forced.dm b/code/modules/admin/secrets/admin_secrets/launch_shuttle_forced.dm
index cb2f8ce3fc3..7d82541876f 100644
--- a/code/modules/admin/secrets/admin_secrets/launch_shuttle_forced.dm
+++ b/code/modules/admin/secrets/admin_secrets/launch_shuttle_forced.dm
@@ -11,14 +11,14 @@
return
var/list/valid_shuttles = list()
for (var/shuttle_tag in SSshuttle.shuttles)
- if (istype(SSshuttle.shuttles[shuttle_tag], /datum/shuttle/ferry))
+ if (istype(SSshuttle.shuttles[shuttle_tag], /datum/shuttle/autodock))
valid_shuttles += shuttle_tag
var/shuttle_tag = input(user, "Which shuttle's launch do you want to force?") as null|anything in valid_shuttles
if (!shuttle_tag)
return
- var/datum/shuttle/ferry/S = SSshuttle.shuttles[shuttle_tag]
+ var/datum/shuttle/autodock/S = SSshuttle.shuttles[shuttle_tag]
if (S.can_force())
S.force_launch(user)
log_and_message_admins("forced the [shuttle_tag] shuttle", user)
diff --git a/code/modules/admin/secrets/admin_secrets/move_shuttle.dm b/code/modules/admin/secrets/admin_secrets/move_shuttle.dm
index 8b18ff3d6af..b02a108cd64 100644
--- a/code/modules/admin/secrets/admin_secrets/move_shuttle.dm
+++ b/code/modules/admin/secrets/admin_secrets/move_shuttle.dm
@@ -18,11 +18,11 @@
var/datum/shuttle/S = SSshuttle.shuttles[shuttle_tag]
- var/origin_area = input(user, "Which area is the shuttle at now? (MAKE SURE THIS IS CORRECT OR THINGS WILL BREAK)") as null|area in world
- if (!origin_area) return
+ var/destination_tag = input(user, "Which landmark do you want to jump to? (IF YOU GET THIS WRONG THINGS WILL BREAK)") as null|anything in SSshuttle.registered_shuttle_landmarks
+ if (!destination_tag) return
- var/destination_area = input(user, "Which area is the shuttle at now? (MAKE SURE THIS IS CORRECT OR THINGS WILL BREAK)") as null|area in world
- if (!destination_area) return
+ var/destination_location = SSshuttle.get_landmark(destination_tag)
+ if (!destination_location) return
- S.move(origin_area, destination_area)
+ S.attempt_move(destination_location)
log_and_message_admins("moved the [shuttle_tag] shuttle", user)
diff --git a/code/modules/lighting/lighting_turf.dm b/code/modules/lighting/lighting_turf.dm
index d82d31598b2..51c91de2363 100644
--- a/code/modules/lighting/lighting_turf.dm
+++ b/code/modules/lighting/lighting_turf.dm
@@ -1,13 +1,13 @@
/turf
- var/dynamic_lighting = TRUE // Does the turf use dynamic lighting?
- luminosity = 1
+ var/dynamic_lighting = TRUE // Does the turf use dynamic lighting?
+ luminosity = 1
var/tmp/lighting_corners_initialised = FALSE
- var/tmp/list/datum/light_source/affecting_lights // List of light sources affecting this turf.
- var/tmp/atom/movable/lighting_overlay/lighting_overlay // Our lighting overlay.
+ var/tmp/list/datum/light_source/affecting_lights // List of light sources affecting this turf.
+ var/tmp/atom/movable/lighting_overlay/lighting_overlay // Our lighting overlay.
var/tmp/list/datum/lighting_corner/corners
- var/tmp/has_opaque_atom = FALSE // Not to be confused with opacity, this will be TRUE if there's any opaque atom on the tile.
+ var/tmp/has_opaque_atom = FALSE // Not to be confused with opacity, this will be TRUE if there's any opaque atom on the tile.
// Causes any affecting light sources to be queued for a visibility update, for example a door got opened.
/turf/proc/reconsider_lights()
@@ -16,7 +16,7 @@
/turf/proc/lighting_clear_overlay()
if(lighting_overlay)
- qdel(lighting_overlay)
+ qdel(lighting_overlay, force = TRUE)
for(var/datum/lighting_corner/C in corners)
C.update_active()
@@ -34,7 +34,7 @@
new /atom/movable/lighting_overlay(src)
for(var/datum/lighting_corner/C in corners)
- if(!C.active) // We would activate the corner, calculate the lighting for it.
+ if(!C.active) // We would activate the corner, calculate the lighting for it.
for(var/L in C.affecting)
var/datum/light_source/S = L
S.recalc_corner(C)
@@ -50,7 +50,7 @@
for(var/datum/lighting_corner/L in corners)
totallums += max(L.lum_r, L.lum_g, L.lum_b)
- totallums /= 4 // 4 corners, max channel selected, return the average
+ totallums /= 4 // 4 corners, max channel selected, return the average
totallums =(totallums - minlum) /(maxlum - minlum)
@@ -59,7 +59,7 @@
// Can't think of a good name, this proc will recalculate the has_opaque_atom variable.
/turf/proc/recalc_atom_opacity()
has_opaque_atom = FALSE
- for(var/atom/A in src.contents + src) // Loop through every movable atom on our tile PLUS ourselves (we matter too...)
+ for(var/atom/A in src.contents + src) // Loop through every movable atom on our tile PLUS ourselves (we matter too...)
if(A.opacity)
has_opaque_atom = TRUE
@@ -68,19 +68,19 @@
..()
if(Obj && Obj.opacity)
- has_opaque_atom = TRUE // Make sure to do this before reconsider_lights(), incase we're on instant updates. Guaranteed to be on in this case.
+ has_opaque_atom = TRUE // Make sure to do this before reconsider_lights(), incase we're on instant updates. Guaranteed to be on in this case.
reconsider_lights()
/turf/Exited(var/atom/movable/Obj, var/atom/newloc)
..()
if(Obj && Obj.opacity)
- recalc_atom_opacity() // Make sure to do this before reconsider_lights(), incase we're on instant updates.
+ recalc_atom_opacity() // Make sure to do this before reconsider_lights(), incase we're on instant updates.
reconsider_lights()
/turf/proc/get_corners()
if(has_opaque_atom)
- return null // Since this proc gets used in a for loop, null won't be looped though.
+ return null // Since this proc gets used in a for loop, null won't be looped though.
return corners
@@ -90,7 +90,7 @@
corners = list(null, null, null, null)
for(var/i = 1 to 4)
- if(corners[i]) // Already have a corner on this direction.
+ if(corners[i]) // Already have a corner on this direction.
continue
corners[i] = new /datum/lighting_corner(src, LIGHTING_CORNER_DIAGONAL[i])
diff --git a/code/modules/maps/tg/map_template.dm b/code/modules/maps/tg/map_template.dm
index 491bc06dd3f..b87a3c4233d 100644
--- a/code/modules/maps/tg/map_template.dm
+++ b/code/modules/maps/tg/map_template.dm
@@ -4,7 +4,7 @@ var/list/global/map_templates = list()
/proc/load_map_templates()
for(var/T in subtypesof(/datum/map_template))
var/datum/map_template/template = T
- if(!(initial(template.mappath))) // If it's missing the actual path its probably a base type or being used for inheritence.
+ if(!(initial(template.mappath))) // If it's missing the actual path its probably a base type or being used for inheritence.
continue
template = new T()
map_templates[template.name] = template
@@ -13,22 +13,22 @@ var/list/global/map_templates = list()
/datum/map_template
var/name = "Default Template Name"
var/desc = "Some text should go here. Maybe."
- var/template_group = null // If this is set, no more than one template in the same group will be spawned, per submap seeding.
+ var/template_group = null // If this is set, no more than one template in the same group will be spawned, per submap seeding.
var/width = 0
var/height = 0
var/mappath = null
- var/loaded = 0 // Times loaded this round
- var/annihilate = FALSE // If true, all (movable) atoms at the location where the map is loaded will be deleted before the map is loaded in.
+ var/loaded = 0 // Times loaded this round
+ var/annihilate = FALSE // If true, all (movable) atoms at the location where the map is loaded will be deleted before the map is loaded in.
- var/cost = null // The map generator has a set 'budget' it spends to place down different submaps. It will pick available submaps randomly until \
+ var/cost = null // The map generator has a set 'budget' it spends to place down different submaps. It will pick available submaps randomly until \
it runs out. The cost of a submap should roughly corrispond with several factors such as size, loot, difficulty, desired scarcity, etc. \
Set to -1 to force the submap to always be made.
- var/allow_duplicates = FALSE // If false, only one map template will be spawned by the game. Doesn't affect admins spawning then manually.
- var/discard_prob = 0 // If non-zero, there is a chance that the map seeding algorithm will skip this template when selecting potential templates to use.
+ var/allow_duplicates = FALSE // If false, only one map template will be spawned by the game. Doesn't affect admins spawning then manually.
+ var/discard_prob = 0 // If non-zero, there is a chance that the map seeding algorithm will skip this template when selecting potential templates to use.
var/static/dmm_suite/maploader = new
- var/fixed_orientation = FALSE //for ruins
+ var/fixed_orientation = FALSE // For ruins
/// Zlevel traits
var/list/ztraits
@@ -49,13 +49,16 @@ var/list/global/map_templates = list()
width = bounds[MAP_MAXY]
height = bounds[MAP_MAXX]
else
- width = bounds[MAP_MAXX] // Assumes all templates are rectangular, have a single Z level, and begin at 1,1,1
+ width = bounds[MAP_MAXX] // Assumes all templates are rectangular, have a single Z level, and begin at 1,1,1
height = bounds[MAP_MAXY]
return bounds
/datum/map_template/proc/initTemplateBounds(var/list/bounds)
if (SSatoms.subsystem_initialized == INITIALIZATION_INSSATOMS)
- return // let proper initialisation handle it later
+ return // Let proper initialisation handle it later
+
+ var/prev_shuttle_queue_state = SSshuttle.block_init_queue
+ SSshuttle.block_init_queue = TRUE
var/list/atom/atoms = list()
var/list/area/areas = list()
@@ -89,6 +92,9 @@ var/list/global/map_templates = list()
var/area/A = I
A.power_change()
+ SSshuttle.block_init_queue = prev_shuttle_queue_state
+ SSshuttle.process_init_queues() // We will flush the queue unless there were other blockers, in which case they will do it.
+
admin_notice("Submap initializations finished.", R_DEBUG)
/datum/map_template/proc/load_new_z(var/centered = FALSE, var/orientation = SOUTH, list/traits = src.ztraits || list(ZTRAIT_AWAY = TRUE))
@@ -106,10 +112,10 @@ var/list/global/map_templates = list()
// repopulate_sorted_areas()
- //initialize things that are normally initialized after map load
+ // Initialize things that are normally initialized after map load
initTemplateBounds(bounds)
log_game("Z-level [name] loaded at at [x],[y],[world.maxz]")
- on_map_loaded(world.maxz) //VOREStation Edit
+ on_map_loaded(world.maxz)
return TRUE
/datum/map_template/proc/load(turf/T, centered = FALSE, orientation = SOUTH)
@@ -130,10 +136,10 @@ var/list/global/map_templates = list()
if(!bounds)
return
-// if(!SSmapping.loading_ruins) //Will be done manually during mapping ss init
+// if(!SSmapping.loading_ruins) // Will be done manually during mapping ss init
// repopulate_sorted_areas()
- //initialize things that are normally initialized after map load
+ // Initialize things that are normally initialized after map load
initTemplateBounds(bounds)
log_game("[name] loaded at at [T.x],[T.y],[T.z]")
@@ -160,8 +166,8 @@ var/list/global/map_templates = list()
admin_notice("Annihilated [deleted_atoms] objects.", R_DEBUG)
-//for your ever biggening badminnery kevinz000
-//❤ - Cyberboss
+// For your ever biggening badminnery kevinz000
+// ❤ - Cyberboss
/proc/load_new_z_level(var/file, var/name, var/orientation = SOUTH)
var/datum/map_template/template = new(file, name)
template.load_new_z(orientation)
@@ -180,20 +186,20 @@ var/list/global/map_templates = list()
admin_notice("Z level [zl] does not exist - Not generating submaps", R_DEBUG)
return
- var/overall_sanity = 100 // If the proc fails to place a submap more than this, the whole thing aborts.
- var/list/potential_submaps = list() // Submaps we may or may not place.
- var/list/priority_submaps = list() // Submaps that will always be placed.
+ var/overall_sanity = 100 // If the proc fails to place a submap more than this, the whole thing aborts.
+ var/list/potential_submaps = list() // Submaps we may or may not place.
+ var/list/priority_submaps = list() // Submaps that will always be placed.
// Lets go find some submaps to make.
for(var/map in map_templates)
var/datum/map_template/MT = map_templates[map]
- if(!MT.allow_duplicates && MT.loaded > 0) // This probably won't be an issue but we might as well.
+ if(!MT.allow_duplicates && MT.loaded > 0) // This probably won't be an issue but we might as well.
continue
- if(!istype(MT, desired_map_template_type)) // Not the type wanted.
+ if(!istype(MT, desired_map_template_type)) // Not the type wanted.
continue
if(MT.discard_prob && prob(MT.discard_prob))
continue
- if(MT.cost && MT.cost < 0) // Negative costs always get spawned.
+ if(MT.cost && MT.cost < 0) // Negative costs always get spawned.
priority_submaps += MT
else
potential_submaps += MT
@@ -201,7 +207,7 @@ var/list/global/map_templates = list()
CHECK_TICK
var/list/loaded_submap_names = list()
- var/list/template_groups_used = list() // Used to avoid spawning three seperate versions of the same PoI.
+ var/list/template_groups_used = list() // Used to avoid spawning three seperate versions of the same PoI.
// Now lets start choosing some.
while(budget > 0 && overall_sanity > 0)
@@ -209,12 +215,12 @@ var/list/global/map_templates = list()
var/datum/map_template/chosen_template = null
if(potential_submaps.len)
- if(priority_submaps.len) // Do these first.
+ if(priority_submaps.len) // Do these first.
chosen_template = pick(priority_submaps)
else
chosen_template = pick(potential_submaps)
- else // We're out of submaps.
+ else // We're out of submaps.
admin_notice("Submap loader had no submaps to pick from with [budget] left to spend.", R_DEBUG)
break
@@ -233,7 +239,7 @@ var/list/global/map_templates = list()
continue
// If so, try to place it.
- var/specific_sanity = 100 // A hundred chances to place the chosen submap.
+ var/specific_sanity = 100 // A hundred chances to place the chosen submap.
while(specific_sanity > 0)
specific_sanity--
var/orientation = pick(cardinal)
@@ -247,8 +253,8 @@ var/list/global/map_templates = list()
for(var/turf/check in chosen_template.get_affected_turfs(T,TRUE,orientation))
var/area/new_area = get_area(check)
if(!(istype(new_area, whitelist)))
- valid = FALSE // Probably overlapping something important.
- // world << "Invalid due to overlapping with area [new_area.type] at ([check.x], [check.y], [check.z]), when attempting to place at ([T.x], [T.y], [T.z])."
+ valid = FALSE // Probably overlapping something important.
+ // world << "Invalid due to overlapping with area [new_area.type] at ([check.x], [check.y], [check.z]), when attempting to place at ([T.x], [T.y], [T.z])."
break
CHECK_TICK
@@ -260,7 +266,7 @@ var/list/global/map_templates = list()
admin_notice("Submap \"[chosen_template.name]\" placed at ([T.x], [T.y], [T.z])\n", R_DEBUG)
// Do loading here.
- chosen_template.load(T, centered = TRUE, orientation=orientation) // This is run before the main map's initialization routine, so that can initilize our submaps for us instead.
+ chosen_template.load(T, centered = TRUE, orientation=orientation) // This is run before the main map's initialization routine, so that can initilize our submaps for us instead.
CHECK_TICK
@@ -279,12 +285,12 @@ var/list/global/map_templates = list()
budget -= chosen_template.cost
// Remove the submap from our options.
- if(chosen_template in priority_submaps) // Always remove priority submaps.
+ if(chosen_template in priority_submaps) // Always remove priority submaps.
priority_submaps -= chosen_template
else if(!chosen_template.allow_duplicates)
potential_submaps -= chosen_template
- break // Load the next submap.
+ break // Load the next submap.
var/list/pretty_submap_list = list()
for(var/submap_name in loaded_submap_names)
@@ -298,4 +304,4 @@ var/list/global/map_templates = list()
admin_notice("Submap loader gave up with [budget] left to spend.", R_DEBUG)
else
admin_notice("Submaps loaded.", R_DEBUG)
- admin_notice("Loaded: [english_list(pretty_submap_list)]", R_DEBUG)
\ No newline at end of file
+ admin_notice("Loaded: [english_list(pretty_submap_list)]", R_DEBUG)
diff --git a/code/modules/media/mediamanager.dm b/code/modules/media/mediamanager.dm
index 3d24b0b6604..480d9b67f20 100644
--- a/code/modules/media/mediamanager.dm
+++ b/code/modules/media/mediamanager.dm
@@ -31,7 +31,7 @@
if(M && M.client)
M.stop_all_music()
// SHITTY HACK TO AVOID RACE CONDITION WITH SERVER REBOOT.
- sleep(10) // TODO - Leshana - see if this is needed
+ sleep(10) // TODO see if this is needed
// Update when moving between areas.
// TODO - While this direct override might technically be faster, probably better code to use observer or hooks ~Leshana
diff --git a/code/modules/multiz/turf.dm b/code/modules/multiz/turf.dm
index 148a181cfd2..6bbd29441f4 100644
--- a/code/modules/multiz/turf.dm
+++ b/code/modules/multiz/turf.dm
@@ -1,11 +1,11 @@
/turf/proc/CanZPass(atom/A, direction)
- if(z == A.z) //moving FROM this turf
- return direction == UP //can't go below
+ if(z == A.z) // Moving FROM this turf
+ return direction == UP //Can't go below
else
- if(direction == UP) //on a turf below, trying to enter
+ if(direction == UP) // On a turf below, trying to enter
return 0
- if(direction == DOWN) //on a turf above, trying to enter
- return !density && isopenspace(GetAbove(src)) // VOREStation Edit
+ if(direction == DOWN) // On a turf above, trying to enter
+ return !density && isopenspace(GetAbove(src))
/turf/simulated/open/CanZPass(atom, direction)
return 1
@@ -24,8 +24,8 @@
desc = "\..."
density = 0
plane = OPENSPACE_PLANE_START
- pathweight = 100000 //Seriously, don't try and path over this one numbnuts
- dynamic_lighting = 0 // Someday lets do proper lighting z-transfer. Until then we are leaving this off so it looks nicer.
+ pathweight = 100000 // Seriously, don't try and path over this one numbnuts
+ dynamic_lighting = 0 // Someday lets do proper lighting z-transfer. Until then we are leaving this off so it looks nicer.
can_build_into_floor = TRUE
var/turf/below
@@ -55,13 +55,13 @@
below = GetBelow(src)
GLOB.turf_changed_event.register(below, src, /atom/proc/update_icon)
levelupdate()
- below.update_icon() // So the 'ceiling-less' overlay gets added.
+ below.update_icon() // So the 'ceiling-less' overlay gets added.
for(var/atom/movable/A in src)
if(A.movement_type & GROUND)
A.fall()
SSopenspace.add_turf(src, 1)
-// override to make sure nothing is hidden
+// Override to make sure nothing is hidden
/turf/simulated/open/levelupdate()
for(var/obj/O in src)
O.hide(0)
@@ -92,11 +92,11 @@
underlays = list(bottom_turf)
copy_overlays(below)
- // get objects (not mobs, they are handled by /obj/zshadow)
+ // Get objects (not mobs, they are handled by /obj/zshadow)
var/list/o_img = list()
for(var/obj/O in below)
- if(O.invisibility) continue // Ignore objects that have any form of invisibility
- if(O.loc != below) continue // Ignore multi-turf objects not directly below
+ if(O.invisibility) continue // Ignore objects that have any form of invisibility
+ if(O.loc != below) continue // Ignore multi-turf objects not directly below
var/image/temp2 = image(O, dir = O.dir, layer = O.layer)
temp2.plane = src.plane
temp2.color = O.color
@@ -144,14 +144,14 @@
else
to_chat(user, "The plating is going to need some support.")
- //To lay cable.
+ // To lay cable.
if(istype(C, /obj/item/stack/cable_coil))
var/obj/item/stack/cable_coil/coil = C
coil.turf_place(src, user)
return
return
-//Most things use is_plating to test if there is a cover tile on top (like regular floors)
+// Most things use is_plating to test if there is a cover tile on top (like regular floors)
/turf/simulated/open/is_plating()
return TRUE
@@ -159,6 +159,9 @@
var/turf/below = GetBelow(src)
return !below || below.is_space()
+/turf/simulated/open/is_solid_structure()
+ return locate(/obj/structure/lattice, src) // Counts as solid structure if it has a lattice (same as space)
+
/turf/simulated/open/is_safe_to_enter(mob/living/L)
if(L.can_fall())
if(!locate(/obj/structure/stairs) in GetBelow(src))
diff --git a/code/modules/overmap/_defines.dm b/code/modules/overmap/_defines.dm
index 6d17d8e3981..53f97bd2bef 100644
--- a/code/modules/overmap/_defines.dm
+++ b/code/modules/overmap/_defines.dm
@@ -1,13 +1,64 @@
-//Zlevel where overmap objects should be
+// Zlevel where overmap objects should be
#define OVERMAP_ZLEVEL 1
-//How far from the edge of overmap zlevel could randomly placed objects spawn
+// How far from the edge of overmap zlevel could randomly placed objects spawn
#define OVERMAP_EDGE 7
-//list used to track which zlevels are being 'moved' by the proc below
+
+
+// Dimension of overmap (squares 4 lyfe)
+var/global/list/map_sectors = list()
+
+/area/overmap/
+ name = "System Map"
+ icon_state = "start"
+ requires_power = 0
+ base_turf = /turf/unsimulated/map
+
+/turf/unsimulated/map
+ icon = 'icons/turf/space.dmi'
+ icon_state = "map"
+
+/turf/unsimulated/map/edge
+ opacity = 1
+ density = 1
+
+/turf/unsimulated/map/New()
+ ..()
+ name = "[x]-[y]"
+ var/list/numbers = list()
+
+ if(x == 1 || x == global.using_map.overmap_size)
+ numbers += list("[round(y/10)]","[round(y%10)]")
+ if(y == 1 || y == global.using_map.overmap_size)
+ numbers += "-"
+ if(y == 1 || y == global.using_map.overmap_size)
+ numbers += list("[round(x/10)]","[round(x%10)]")
+
+ for(var/i = 1 to numbers.len)
+ var/image/I = image('icons/effects/numbers.dmi',numbers[i])
+ I.pixel_x = 5*i - 2
+ I.pixel_y = world.icon_size/2 - 3
+ if(y == 1)
+ I.pixel_y = 3
+ I.pixel_x = 5*i + 4
+ if(y == global.using_map.overmap_size)
+ I.pixel_y = world.icon_size - 9
+ I.pixel_x = 5*i + 4
+ if(x == 1)
+ I.pixel_x = 5*i - 2
+ if(x == global.using_map.overmap_size)
+ I.pixel_x = 5*i + 2
+ overlays += I
+
+
+
+
+
+// List used to track which zlevels are being 'moved' by the proc below
var/list/moving_levels = list()
-//Proc to 'move' stars in spess
-//yes it looks ugly, but it should only fire when state actually change.
-//null direction stops movement
+// Proc to 'move' stars in spess
+// Yes it looks ugly, but it should only fire when state actually change.
+// Null direction stops movement
proc/toggle_move_stars(zlevel, direction)
if(!zlevel)
return
@@ -35,6 +86,7 @@ proc/toggle_move_stars(zlevel, direction)
AM.throw_at(get_step(T,reverse_direction(direction)), 5, 1)
+/*
//list used to cache empty zlevels to avoid nedless map bloat
var/list/cached_space = list()
@@ -99,3 +151,4 @@ proc/overmap_spacetravel(var/turf/space/T, var/atom/movable/A)
testing("Catching [M] for future use")
source.loc = null
cached_space += source
+*/
diff --git a/code/modules/overmap/helpers.dm b/code/modules/overmap/helpers.dm
new file mode 100644
index 00000000000..e07be07ac02
--- /dev/null
+++ b/code/modules/overmap/helpers.dm
@@ -0,0 +1,5 @@
+/proc/get_overmap_sector(var/z)
+ if(using_map.use_overmap)
+ return map_sectors["[z]"]
+ else
+ return null
diff --git a/code/modules/overmap/overmap_object.dm b/code/modules/overmap/overmap_object.dm
new file mode 100644
index 00000000000..17a1262a821
--- /dev/null
+++ b/code/modules/overmap/overmap_object.dm
@@ -0,0 +1,38 @@
+/obj/effect/overmap
+ name = "map object"
+ icon = 'icons/obj/overmap.dmi'
+ icon_state = "object"
+
+ var/known = 1 // Shows up on nav computers automatically
+ var/scannable // If set to TRUE will show up on ship sensors for detailed scans
+
+// Overlay of how this object should look on other skyboxes
+/obj/effect/overmap/proc/get_skybox_representation()
+ return
+
+/obj/effect/overmap/proc/get_scan_data(mob/user)
+ return desc
+
+/obj/effect/overmap/Initialize()
+ . = ..()
+ if(!global.using_map.use_overmap)
+ return INITIALIZE_HINT_QDEL
+
+ if(known)
+ //layer = ABOVE_LIGHTING_LAYER
+ plane = PLANE_LIGHTING_ABOVE
+ // TODO - Leshana HELM
+ // for(var/obj/machinery/computer/ship/helm/H in global.machines)
+ // H.get_known_sectors()
+/*
+TODO No need for this, we don't have skyboxes
+/obj/effect/overmap/Crossed(var/obj/effect/overmap/visitable/other)
+ if(istype(other))
+ for(var/obj/effect/overmap/visitable/O in loc)
+ SSskybox.rebuild_skyboxes(O.map_z)
+/obj/effect/overmap/Uncrossed(var/obj/effect/overmap/visitable/other)
+ if(istype(other))
+ SSskybox.rebuild_skyboxes(other.map_z)
+ for(var/obj/effect/overmap/visitable/O in loc)
+ SSskybox.rebuild_skyboxes(O.map_z)
+*/
diff --git a/code/modules/overmap/sectors.dm b/code/modules/overmap/sectors.dm
index 61a64283ed4..6942ebda7be 100644
--- a/code/modules/overmap/sectors.dm
+++ b/code/modules/overmap/sectors.dm
@@ -1,124 +1,137 @@
//===================================================================================
-//Hook for building overmap
+//Overmap object representing zlevel(s)
//===================================================================================
-var/global/list/map_sectors = list()
-
-/hook/startup/proc/build_map()
- if(!config_legacy.use_overmap)
- return 1
- testing("Building overmap...")
- var/obj/effect/mapinfo/data
- for(var/level in 1 to world.maxz)
- data = locate("sector[level]")
- if (data)
- testing("Located sector \"[data.name]\" at [data.mapx],[data.mapy] corresponding to zlevel [level]")
- map_sectors["[level]"] = new data.obj_type(data)
- return 1
-
-//===================================================================================
-//Metaobject for storing information about sector this zlevel is representing.
-//Should be placed only once on every zlevel.
-//===================================================================================
-/obj/effect/mapinfo/
- name = "map info metaobject"
- icon = 'icons/mob/screen1.dmi'
- icon_state = "x2"
- invisibility = 101
- var/obj_type //type of overmap object it spawns
- var/landing_area //type of area used as inbound shuttle landing, null if no shuttle landing area
- var/zlevel
- var/mapx //coordinates on the
- var/mapy //overmap zlevel
- var/known = 1
-
-/obj/effect/mapinfo/New()
- tag = "sector[z]"
- zlevel = z
- loc = null
-
-/obj/effect/mapinfo/sector
- name = "generic sector"
- obj_type = /obj/effect/map/sector
-
-/obj/effect/mapinfo/ship
- name = "generic ship"
- obj_type = /obj/effect/map/ship
-
-
-//===================================================================================
-//Overmap object representing zlevel
-//===================================================================================
-
-/obj/effect/map
+/obj/effect/overmap/visitable
name = "map object"
- icon = 'icons/obj/items.dmi'
- icon_state = "sheet-plasteel"
- var/map_z = 0
- var/area/shuttle/shuttle_landing
- var/always_known = 1
+ scannable = TRUE
-/obj/effect/map/New(var/obj/effect/mapinfo/data)
- map_z = data.zlevel
- name = data.name
- always_known = data.known
- if (data.icon != 'icons/mob/screen1.dmi')
- icon = data.icon
- icon_state = data.icon_state
- if(data.desc)
- desc = data.desc
- var/new_x = data.mapx ? data.mapx : rand(OVERMAP_EDGE, world.maxx - OVERMAP_EDGE)
- var/new_y = data.mapy ? data.mapy : rand(OVERMAP_EDGE, world.maxy - OVERMAP_EDGE)
- loc = locate(new_x, new_y, OVERMAP_ZLEVEL)
+ var/list/map_z = list()
- if(data.landing_area)
- shuttle_landing = locate(data.landing_area)
+ 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).
-/obj/effect/map/CanAllowThrough(atom/movable/A)
- testing("[A] attempts to enter sector\"[name]\"")
- return 1
+ var/list/generic_waypoints = list() // Waypoints that any shuttle can use
+ var/list/restricted_waypoints = list() // Waypoints for specific shuttles
+ var/docking_codes
-/obj/effect/map/Crossed(atom/movable/A)
- testing("[A] has entered sector\"[name]\"")
- if (istype(A,/obj/effect/map/ship))
- var/obj/effect/map/ship/S = A
- S.current_sector = src
+ var/start_x // Coordinates for self placing
+ var/start_y // Will use random values if unset
-/obj/effect/map/Uncrossed(atom/movable/A)
- testing("[A] has left sector\"[name]\"")
- if (istype(A,/obj/effect/map/ship))
- var/obj/effect/map/ship/S = A
- S.current_sector = null
+ var/base = 0 // Starting sector, counts as station_levels
+ var/in_space = 1 // Can be accessed via lucky EVA
-/obj/effect/map/sector
+ 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(SSshuttle.sectors_to_initialize, src) // Queued for further init. Will populate the waypoint lists; waypoints not spawned yet will be added in as they spawn.
+ SSshuttle.process_init_queues()
+
+// 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()
+
+// TODO Implement
+///obj/effect/overmap/visitable/proc/get_areas()
+// return get_filtered_areas(list(/proc/area_belongs_to_zlevels = map_z))
+
+/obj/effect/overmap/visitable/proc/find_z_levels()
+ map_z = GetConnectedZlevels(z)
+
+/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
+ if(base)
+ global.using_map.station_levels |= map_z
+ global.using_map.contact_levels |= map_z
+ global.using_map.map_levels |= map_z
+
+// Helper for init.
+/obj/effect/overmap/visitable/proc/check_ownership(obj/object)
+ if((object.z in map_z) && !(get_area(object) in SSshuttle.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/sector
name = "generic sector"
desc = "Sector with some stuff in it."
+ icon_state = "sector"
anchored = 1
-//Space stragglers go here
+// 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()
-/obj/effect/map/sector/temporary
- name = "Deep Space"
- icon_state = ""
- always_known = 0
+/proc/build_overmap()
+ if(!global.using_map.use_overmap)
+ return 1
-/obj/effect/map/sector/temporary/New(var/nx, var/ny, var/nz)
- loc = locate(nx, ny, OVERMAP_ZLEVEL)
- map_z = nz
- map_sectors["[map_z]"] = src
- testing("Temporary sector at [x],[y] was created, corresponding zlevel is [map_z].")
+ testing("Building overmap...")
+ world.maxz++
+ global.using_map.overmap_z = world.maxz
-/obj/effect/map/sector/temporary/Destroy()
- map_sectors["[map_z]"] = null
- testing("Temporary sector at [x],[y] was deleted.")
- if (can_die())
- testing("Associated zlevel disappeared.")
- 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 == 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)
-/obj/effect/map/sector/temporary/proc/can_die(var/mob/observer)
- testing("Checking if sector at [map_z] can die.")
- for(var/mob/M in player_list)
- if(M != observer && M.z == map_z)
- testing("There are people on it.")
- return 0
+ global.using_map.sealed_levels |= global.using_map.overmap_z
+
+ testing("Overmap build complete.")
return 1
diff --git a/code/modules/overmap/spacetravel.dm b/code/modules/overmap/spacetravel.dm
new file mode 100644
index 00000000000..4b0734f50bd
--- /dev/null
+++ b/code/modules/overmap/spacetravel.dm
@@ -0,0 +1,114 @@
+// List used to cache empty zlevels to avoid nedless map bloat
+var/list/cached_space = list()
+
+// Space stragglers go here
+
+/obj/effect/overmap/visitable/sector/temporary
+ name = "Deep Space"
+ invisibility = 101
+ known = 0
+
+/obj/effect/overmap/visitable/sector/temporary/New(var/nx, var/ny, var/nz)
+ loc = locate(nx, ny, global.using_map.overmap_z)
+ x = nx
+ y = ny
+ map_z += nz
+ map_sectors["[nz]"] = src
+ testing("Temporary sector at [x],[y] was created, corresponding zlevel is [nz].")
+
+/obj/effect/overmap/visitable/sector/temporary/Destroy()
+ map_sectors["[map_z]"] = null
+ testing("Temporary sector at [x],[y] was deleted.")
+
+/obj/effect/overmap/visitable/sector/temporary/proc/can_die(var/mob/observer)
+ testing("Checking if sector at [map_z[1]] can die.")
+ for(var/mob/M in global.player_list)
+ if(M != observer && (M.z in map_z))
+ testing("There are people on it.")
+ return 0
+ return 1
+
+proc/get_deepspace(x,y)
+ var/obj/effect/overmap/visitable/sector/temporary/res = locate(x,y,global.using_map.overmap_z)
+ if(istype(res))
+ return res
+ else if(cached_space.len)
+ res = cached_space[cached_space.len]
+ cached_space -= res
+ res.x = x
+ res.y = y
+ return res
+ else
+ return new /obj/effect/overmap/visitable/sector/temporary(x, y, global.using_map.get_empty_zlevel())
+
+/atom/movable/proc/lost_in_space()
+ for(var/atom/movable/AM in contents)
+ if(!AM.lost_in_space())
+ return FALSE
+ return TRUE
+
+/mob/lost_in_space()
+ return isnull(client)
+
+/mob/living/carbon/human/lost_in_space()
+ return isnull(client) && !key && stat == DEAD
+
+proc/overmap_spacetravel(var/turf/space/T, var/atom/movable/A)
+ if (!T || !A)
+ return
+
+ var/obj/effect/overmap/visitable/M = map_sectors["[T.z]"]
+ if (!M)
+ return
+
+ if(A.lost_in_space())
+ if(!QDELETED(A))
+ qdel(A)
+ return
+
+ var/nx = 1
+ var/ny = 1
+ var/nz = 1
+
+ if(T.x <= TRANSITIONEDGE)
+ nx = world.maxx - TRANSITIONEDGE - 2
+ ny = rand(TRANSITIONEDGE + 2, world.maxy - TRANSITIONEDGE - 2)
+
+ else if (A.x >= (world.maxx - TRANSITIONEDGE - 1))
+ nx = TRANSITIONEDGE + 2
+ ny = rand(TRANSITIONEDGE + 2, world.maxy - TRANSITIONEDGE - 2)
+
+ else if (T.y <= TRANSITIONEDGE)
+ ny = world.maxy - TRANSITIONEDGE -2
+ nx = rand(TRANSITIONEDGE + 2, world.maxx - TRANSITIONEDGE - 2)
+
+ else if (A.y >= (world.maxy - TRANSITIONEDGE - 1))
+ ny = TRANSITIONEDGE + 2
+ nx = rand(TRANSITIONEDGE + 2, world.maxx - TRANSITIONEDGE - 2)
+
+ testing("[A] spacemoving from [M] ([M.x], [M.y]).")
+
+ var/turf/map = locate(M.x,M.y,global.using_map.overmap_z)
+ var/obj/effect/overmap/visitable/TM
+ for(var/obj/effect/overmap/visitable/O in map)
+ if(O != M && O.in_space && prob(50))
+ TM = O
+ break
+ if(!TM)
+ TM = get_deepspace(M.x,M.y)
+ nz = pick(TM.map_z)
+
+ var/turf/dest = locate(nx,ny,nz)
+ if(dest)
+ A.forceMove(dest)
+ if(ismob(A))
+ var/mob/D = A
+ if(D.pulling)
+ D.pulling.forceMove(dest)
+
+ if(istype(M, /obj/effect/overmap/visitable/sector/temporary))
+ var/obj/effect/overmap/visitable/sector/temporary/source = M
+ if (source.can_die())
+ testing("Caching [M] for future use")
+ source.forceMove(null)
+ cached_space += source
diff --git a/code/modules/rogueminer_vr/zone_console.dm b/code/modules/rogueminer_vr/zone_console.dm
index 815433e9ef6..19d37167089 100644
--- a/code/modules/rogueminer_vr/zone_console.dm
+++ b/code/modules/rogueminer_vr/zone_console.dm
@@ -17,14 +17,17 @@
var/debug = 0
var/debug_scans = 0
var/scanning = 0
- var/legacy_zone = 0 //Disable scanning and whatnot.
+ var/legacy_zone = 0 // Disable scanning and whatnot.
var/obj/machinery/computer/shuttle_control/belter/shuttle_control
/obj/machinery/computer/roguezones/Initialize()
. = ..()
+ shuttle_control = locate(/obj/machinery/computer/shuttle_control/belter)
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/machinery/computer/roguezones/LateInitialize()
if(!rm_controller)
rm_controller = new /datum/controller/rogue()
- shuttle_control = locate(/obj/machinery/computer/shuttle_control/belter)
/obj/machinery/computer/roguezones/attack_ai(mob/user as mob)
return attack_hand(user)
@@ -49,7 +52,7 @@
data["difficulty"] = rm_controller.diffstep_strs[rm_controller.diffstep]
data["occupied"] = curZoneOccupied
data["scanning"] = scanning
- data["updated"] = world.time - rm_controller.last_scan < 200 //Very recently scanned (20 seconds)
+ data["updated"] = world.time - rm_controller.last_scan < 200 // Very recently scanned (20 seconds)
data["debug"] = debug
if(!shuttle_control)
@@ -66,9 +69,9 @@
data["shuttle_at_station"] = 0
var/can_scan = 0
- if(chargePercent >= 100) //Keep having weird problems with these in one 'if' statement
- if(shuttle_control && (shuttle_control.z in GLOB.using_map.belter_docked_z)) //Even though I put them all in parens to avoid OoO problems...
- if(!curZoneOccupied) //Not sure why.
+ if(chargePercent >= 100) // Keep having weird problems with these in one 'if' statement
+ if(shuttle_control && (shuttle_control.z in GLOB.using_map.belter_docked_z)) // Even though I put them all in parens to avoid OoO problems...
+ if(!curZoneOccupied) // Not sure why.
if(!scanning)
can_scan = 1
@@ -104,31 +107,32 @@
/obj/machinery/computer/roguezones/proc/scan_for_new_zone()
if(scanning) return
- //Set some kinda scanning var to pause UI input on console
+ // Set some kinda scanning var to pause UI input on console
rm_controller.last_scan = world.time
scanning = 1
sleep(60)
- //Break the shuttle temporarily.
+ // Break the shuttle temporarily.
shuttle_control.shuttle_tag = null
- //Build and get a new zone.
+ // Build and get a new zone.
var/datum/rogue/zonemaster/ZM_target = rm_controller.prepare_new_zone()
- //Update shuttle destination.
- var/datum/shuttle/ferry/S = SSshuttle.shuttles["Belter"]
- S.area_offsite = ZM_target.myshuttle
+ // Update shuttle destination.
+ var/datum/shuttle/autodock/ferry/S = SSshuttle.shuttles["Belter"]
+ S.landmark_offsite = ZM_target.myshuttle_landmark
+ S.next_location = S.get_location_waypoint(!S.location)
- //Re-enable shuttle.
+ // Re-enable shuttle.
shuttle_control.shuttle_tag = "Belter"
- //Update rm_previous
+ // Update rm_previous
rm_controller.previous_zone = rm_controller.current_zone
- //Update rm_current
+ // Update rm_current
rm_controller.current_zone = ZM_target
- //Unset scanning
+ // Unset scanning
scanning = 0
return
@@ -139,13 +143,13 @@
/obj/machinery/computer/roguezones/proc/failsafe_shuttle_recall()
if(!shuttle_control)
- return // Shuttle computer has been destroyed
+ return // Shuttle computer has been destroyed
if (!(shuttle_control.z in GLOB.using_map.belter_belt_z))
- return // Usable only when shuttle is away
+ return // Usable only when shuttle is away
if(rm_controller.current_zone && rm_controller.current_zone.is_occupied())
- return // Not usable if shuttle is in occupied zone
+ return // Not usable if shuttle is in occupied zone
// Okay do it
- var/datum/shuttle/ferry/S = SSshuttle.shuttles["Belter"]
+ var/datum/shuttle/autodock/ferry/S = SSshuttle.shuttles["Belter"]
S.launch(usr)
/obj/item/circuitboard/roguezones
@@ -169,4 +173,4 @@
When a new zone has been scanned, your station's shuttle destination will be updated to direct it to the newly discovered area automatically.
You can then travel to the new area to mine in that location.
- This technology produced under license from Thinktronic Systems, LTD."}
\ No newline at end of file
+ This technology produced under license from Thinktronic Systems, LTD."}
diff --git a/code/modules/rogueminer_vr/zonemaster.dm b/code/modules/rogueminer_vr/zonemaster.dm
index acdb707ba12..e0ee925ea78 100644
--- a/code/modules/rogueminer_vr/zonemaster.dm
+++ b/code/modules/rogueminer_vr/zonemaster.dm
@@ -4,36 +4,39 @@
//////////////////////////////
/datum/rogue/zonemaster
- //our area
+ // Our area
var/area/asteroid/rogue/myarea
- var/area/shuttle/belter/myshuttle
+ // var/area/shuttle/belter/myshuttle
+ var/obj/effect/shuttle_landmark/myshuttle_landmark
//world.time
var/prepared_at = 0
- //accepting shuttles
+ // Accepting shuttles
var/ready = 0
- //completely empty
+ // Completely empty
var/clean = 1
- //scored or not
+ // Scored or not
var/scored = 0
- //for scoring
+ // For scoring
var/list/mineral_rocks = list()
var/list/spawned_mobs = list()
var/original_mobs = 0
- //in-use spawns from the area
+ // In-use spawns from the area
var/obj/asteroid_spawner/list/rockspawns = list()
var/obj/rogue_mobspawner/list/mobspawns = list()
/datum/rogue/zonemaster/New(var/area/A)
ASSERT(A)
myarea = A
- myshuttle = locate(myarea.shuttle_area)
- spawn(10) //This is called from controller New() and freaks out if this calls back too fast.
+ myshuttle_landmark = locate(/obj/effect/shuttle_landmark) in myarea
+ if(!istype(myshuttle_landmark))
+ warning("Zonemaster cannot find a shuttle landmark in its area '[A]'")
+ spawn(10) // This is called from controller New() and freaks out if this calls back too fast.
rm_controller.mark_clean(src)
///////////////////////////////
@@ -43,10 +46,10 @@
/datum/rogue/zonemaster/proc/is_occupied()
var/humans = 0
for(var/mob/living/carbon/human/H in human_mob_list)
- if(H.stat >= DEAD) //Conditions for exclusion here, like if disconnected people start blocking it.
+ if(H.stat >= DEAD) // Conditions for exclusion here, like if disconnected people start blocking it.
continue
var/area/A = get_area(H)
- if((A == myarea) || (A == myshuttle)) //The loc of a turf is the area it is in.
+ if(A == myarea) // The loc of a turf is the area it is in.
humans++
return humans
@@ -54,7 +57,7 @@
///// Asteroid Generation /////
///////////////////////////////
/datum/rogue/zonemaster/proc/generate_asteroid(var/core_min = 2, var/core_max = 5)
- //Chance for a predefined structure instead, more common later
+ // Chance for a predefined structure instead, more common later
if(prob(rm_controller.diffstep*4))
rm_controller.dbg("ZM(ga): Fell into prefab asteroid chance.")
var/prefab = pick(rm_controller.prefabs["tier[rm_controller.diffstep]"])
@@ -65,47 +68,47 @@
var/datum/rogue/asteroid/A = new(rand(core_min,core_max))
rm_controller.dbg("ZM(ga): New asteroid with C:[A.coresize], TW:[A.type_wall].")
- //Add the core to the asteroid's map
+ // Add the core to the asteroid's map
rm_controller.dbg("ZM(ga): Starting core generation for [A.coresize] size core..")
for(var/x = 1; x <= A.coresize, x++)
for(var/y = 1; y <= A.coresize, y++)
rm_controller.dbg("ZM(ga): Doing core-relative [x],[y] at [A.coresize+x],[A.coresize+y], [A.type_wall].")
A.spot_add(A.coresize+x, A.coresize+y, A.type_wall)
- var/max_armlen = A.coresize - 1 //Can tweak to change appearance.
+ var/max_armlen = A.coresize - 1 // Can tweak to change appearance.
- //Add the arms to the asteroid's map
- //Vertical arms
- for(var/x = A.coresize+1, x <= A.coresize*2, x++) //Start at leftmost side of core, work towards higher X.
+ // Add the arms to the asteroid's map
+ // Vertical arms
+ for(var/x = A.coresize+1, x <= A.coresize*2, x++) // Start at leftmost side of core, work towards higher X.
rm_controller.dbg("ZM(ga): Vert arms. My current column is x:[x].")
var/B_arm = rand(0,max_armlen)
var/T_arm = rand(0,max_armlen)
rm_controller.dbg("ZM(ga): B/T. Going to make B:[B_arm], T:[T_arm] for x:[x].")
- //Bottom arm
- for(var/y = A.coresize, y > A.coresize-B_arm, y--) //Start at bottom edge of the core, work towards lower Y.
+ // Bottom arm
+ for(var/y = A.coresize, y > A.coresize-B_arm, y--) // Start at bottom edge of the core, work towards lower Y.
A.spot_add(x,y,A.type_wall)
- //Top arm
- for(var/y = (A.coresize*2)+1, y < ((A.coresize*2)+1)+T_arm, y++) //Start at top edge of the core, work towards higher Y.
+ // Top arm
+ for(var/y = (A.coresize*2)+1, y < ((A.coresize*2)+1)+T_arm, y++) // Start at top edge of the core, work towards higher Y.
A.spot_add(x,y,A.type_wall)
- //Horizontal arms
- for(var/y = A.coresize+1, y <= A.coresize*2, y++) //Start at lower side of core, work towards higher Y.
+ // Horizontal arms
+ for(var/y = A.coresize+1, y <= A.coresize*2, y++) // Start at lower side of core, work towards higher Y.
rm_controller.dbg("ZM(ga): Horiz arms. My current row is y:[y].")
var/R_arm = rand(0,max_armlen)
var/L_arm = rand(0,max_armlen)
rm_controller.dbg("ZM(ga): R/L. Going to make R:[R_arm], L:[L_arm] for y:[y].")
- //Right arm
- for(var/x = (A.coresize*2)+1, x <= ((A.coresize*2)+1)+R_arm, x++) //Start at right edge of core, work towards higher X.
+ // Right arm
+ for(var/x = (A.coresize*2)+1, x <= ((A.coresize*2)+1)+R_arm, x++) // Start at right edge of core, work towards higher X.
A.spot_add(x,y,A.type_wall)
- //Left arm
- for(var/x = A.coresize, x > A.coresize-L_arm, x--) //Start at left edge of core, work towards lower X.
+ // Left arm
+ for(var/x = A.coresize, x > A.coresize-L_arm, x--) // Start at left edge of core, work towards lower X.
A.spot_add(x,y,A.type_wall)
- //Diagonals
+ // Diagonals
// hao do
rm_controller.dbg("ZM(ga): Asteroid generation done.")
@@ -117,7 +120,7 @@
rm_controller.dbg("ZM(pa): Placing at point [SP.x],[SP.y],[SP.z].")
SP.myasteroid = A
- //Bottom-left corner of our bounding box
+ // Bottom-left corner of our bounding box
var/BLx = SP.x - (A.width/2)
var/BLy = SP.y - (A.width/2)
rm_controller.dbg("ZM(pa): BLx is [BLx], BLy is [BLy].")
@@ -140,10 +143,10 @@
for(var/T in curr_y)
rm_controller.dbg("ZM(pa): Doing entry [T] in Y-list [Iy].")
- if(ispath(T,/turf)) //We're spawning a turf
+ if(ispath(T,/turf)) // We're spawning a turf
rm_controller.dbg("ZM(pa): Turf-generate mode.")
- //Make sure we locate()'d a turf and not something else
+ // Make sure we locate()'d a turf and not something else
if(!isturf(spot))
spot = get_turf(spot)
var/turf/P = spot
@@ -155,7 +158,7 @@
place_resources(newturf)
newturf.update_icon(1)
- else //Anything not a turf
+ else // Anything not a turf
rm_controller.dbg("ZM(pa): Creating [T].")
new T(spot)
@@ -165,14 +168,14 @@
#define DIGSITESIZE_LOWER 4
#define DIGSITESIZE_UPPER 12
#define ARTIFACTSPAWNNUM_LOWER 6
- #define ARTIFACTSPAWNNUM_UPPER 12 //Replace with difficulty-based ones.
+ #define ARTIFACTSPAWNNUM_UPPER 12 // Replace with difficulty-based ones.
- if(!M.mineral && prob(rm_controller.diffstep_chances[rm_controller.diffstep])) //Difficulty translates directly into ore chance
+ if(!M.mineral && prob(rm_controller.diffstep_chances[rm_controller.diffstep])) // Difficulty translates directly into ore chance
rm_controller.dbg("ZM(par): Adding mineral to [M.x],[M.y].")
M.make_ore(rm_controller.diffstep >= 3 ? 1 : 0)
mineral_rocks += M
- //If above difficulty threshold make rare ore instead (M.make_ore(1))
- //Increase with difficulty etc
+ // If above difficulty threshold make rare ore instead (M.make_ore(1))
+ // Increase with difficulty etc
if(!M.density)
return
@@ -232,17 +235,17 @@
archeo_turf.finds.Add(new /datum/find(digsite, rand(60, 140)))
archeo_turf.finds.Add(new /datum/find(digsite, rand(150, 190)))
- //sometimes a find will be close enough to the surface to show
+ // Sometimes a find will be close enough to the surface to show
var/datum/find/F = archeo_turf.finds[1]
if(F.excavation_required <= F.view_range)
archeo_turf.archaeo_overlay = "overlay_archaeo[rand(1,3)]"
archeo_turf.update_icon()
- //have a chance for an artifact to spawn here, but not in animal or plant digsites
+ // Have a chance for an artifact to spawn here, but not in animal or plant digsites
if(isnull(M.artifact_find) && digsite != DIGSITE_GARDEN && digsite != DIGSITE_ANIMAL)
SSxenoarch.artifact_spawning_turfs.Add(archeo_turf)
- //create artifact machinery
+ // Create artifact machinery
var/num_artifacts_spawn = rand(ARTIFACTSPAWNNUM_LOWER, ARTIFACTSPAWNNUM_UPPER)
while(SSxenoarch.artifact_spawning_turfs.len > num_artifacts_spawn)
pick_n_take(SSxenoarch.artifact_spawning_turfs)
@@ -256,13 +259,13 @@
#undef DIGSITESIZE_LOWER
#undef DIGSITESIZE_UPPER
#undef ARTIFACTSPAWNNUM_LOWER
- #undef ARTIFACTSPAWNNUM_UPPER //Replace with difficulty-based ones.
+ #undef ARTIFACTSPAWNNUM_UPPER // Replace with difficulty-based ones.
///////////////////////////////
///// Zone Population /////////
///////////////////////////////
-//Overall 'prepare' proc (marks as ready)
+// Overall 'prepare' proc (marks as ready)
/datum/rogue/zonemaster/proc/prepare_zone(var/delay = 0)
rm_controller.unmark_clean(src)
rm_controller.dbg("ZM(p): Preparing zone with difficulty level [rm_controller.diffstep].")
@@ -281,7 +284,7 @@
for(var/obj/rogue_mobspawner/SP in mobspawns)
rm_controller.dbg("ZM(p): Spawning mob at [SP.x],[SP.y],[SP.z].")
- //Make sure we can spawn a spacemob here
+ // Make sure we can spawn a spacemob here
if(!istype(get_turf(SP),/turf/space))
rm_controller.dbg("ZM(p): Turf blocking mob spawn at [SP.x],[SP.y],[SP.z].")
mobspawns -= SP
@@ -307,7 +310,7 @@
rm_controller.mark_ready(src)
return myarea
-//Randomize the landmarks that are enabled
+// Randomize the landmarks that are enabled
/datum/rogue/zonemaster/proc/randomize_spawns(var/chance = 50)
rm_controller.dbg("ZM(rs): Previously [rockspawns.len] rockspawns.")
rockspawns.Cut()
@@ -335,7 +338,7 @@
scored = 1
var/tally = bonus
- //Ore-bearing rocks that were mined
+ // Ore-bearing rocks that were mined
for(var/turf/T in mineral_rocks)
var/has_minerals = 0
for(var/atom/I in T.contents)
@@ -345,15 +348,15 @@
if(has_minerals == 0)
tally += RM_DIFF_VALUE_ORE
- mineral_rocks.Cut() //For good measure, to prevent rescoring.
+ mineral_rocks.Cut() // For good measure, to prevent rescoring.
for(var/I = 1, I <= spawned_mobs.len, I++)
if(isnull(spawned_mobs[I]))
- tally += RM_DIFF_VALUE_MOB //Mobs so annihilated they were deleted
+ tally += RM_DIFF_VALUE_MOB // Mobs so annihilated they were deleted
rm_controller.dbg("ZM(sz): Scoring one mob annihilated.")
if(istype(spawned_mobs[I],/mob))
var/mob/M = spawned_mobs[I]
- if(M.stat > 0) //Knocked out or dead or anything other than normal
+ if(M.stat > 0) // Knocked out or dead or anything other than normal
tally += RM_DIFF_VALUE_MOB
rm_controller.dbg("ZM(sz): Scoring one mob dead.")
@@ -362,16 +365,16 @@
rm_controller.adjust_difficulty(tally)
rm_controller.dbg("ZM(sz): Finished scoring and adjusted by [tally].")
- world.log << "RM(stats): SCORE [myarea] for [tally]." //DEBUG code for playtest stats gathering.
+ world.log << "RM(stats): SCORE [myarea] for [tally]." // DEBUG code for playtest stats gathering.
return tally
-//Overall 'destroy' proc (marks as unready)
+// Overall 'destroy' proc (marks as unready)
/datum/rogue/zonemaster/proc/clean_zone(var/delay = 1)
rm_controller.dbg("ZM(cz): Cleaning zone with area [myarea].")
- world.log << "RM(stats): CLEAN start [myarea] at [world.time] prepared at [prepared_at]." //DEBUG code for playtest stats gathering.
+ world.log << "RM(stats): CLEAN start [myarea] at [world.time] prepared at [prepared_at]." // DEBUG code for playtest stats gathering.
rm_controller.unmark_ready(src)
- //Cut these lists so qdel can dereference the things properly
+ // Cut these lists so qdel can dereference the things properly
mineral_rocks.Cut()
spawned_mobs.Cut()
rockspawns.Cut()
@@ -380,6 +383,7 @@
var/ignored = list(
/obj/asteroid_spawner,
/obj/rogue_mobspawner,
+ /obj/effect/shuttle_landmark,
/obj/effect/step_trigger/teleporter/roguemine_loop/north,
/obj/effect/step_trigger/teleporter/roguemine_loop/south,
/obj/effect/step_trigger/teleporter/roguemine_loop/east,
@@ -389,27 +393,31 @@
if(I.type == /turf/space)
I.overlays.Cut()
continue
+ else if(!I.simulated)
+ continue
else if(I.type in ignored)
continue
qdel(I)
sleep(delay)
- //A deletion so nice that I give it twice
+ // A deletion so nice that I give it twice
for(var/atom/I in myarea.contents)
if(I.type == /turf/space)
I.overlays.Cut()
continue
+ else if(!I.simulated)
+ continue
else if(I.type in ignored)
continue
qdel(I)
sleep(delay)
- //Clean up vars
+ // Clean up vars
scored = 0
original_mobs = 0
prepared_at = 0
- world.log << "RM(stats): CLEAN done [myarea] at [world.time]." //DEBUG code for playtest stats gathering.
+ world.log << "RM(stats): CLEAN done [myarea] at [world.time]." // DEBUG code for playtest stats gathering.
rm_controller.dbg("ZM(cz): Finished cleaning up zone area [myarea].")
rm_controller.mark_clean(src)
@@ -419,4 +427,4 @@
///// Mysterious Mystery //////
///////////////////////////////
-//Throw a meteor at a player in the zone
\ No newline at end of file
+// Throw a meteor at a player in the zone
diff --git a/code/modules/shuttles/_defines.dm b/code/modules/shuttles/_defines.dm
index ad8c39466b4..f1928b3ff44 100644
--- a/code/modules/shuttles/_defines.dm
+++ b/code/modules/shuttles/_defines.dm
@@ -1,4 +1,22 @@
-#define SHUTTLE_FLAGS_NONE 0
-#define SHUTTLE_FLAGS_PROCESS 1
-#define SHUTTLE_FLAGS_SUPPLY 2
-#define SHUTTLE_FLAGS_ALL (~SHUTTLE_FLAGS_NONE)
\ No newline at end of file
+// Shuttle flags
+#define SHUTTLE_FLAGS_NONE 0
+#define SHUTTLE_FLAGS_PROCESS 1 // Should be processed by shuttle subsystem
+#define SHUTTLE_FLAGS_SUPPLY 2 // This is the supply shuttle. Why is this a tag?
+#define SHUTTLE_FLAGS_ZERO_G 4 // Shuttle has no internal gravity generation
+#define SHUTTLE_FLAGS_ALL (~SHUTTLE_FLAGS_NONE)
+
+// shuttle_landmark flags
+#define SLANDMARK_FLAG_AUTOSET 1 // If set, will set base area and turf type to same as where it was spawned at
+#define SLANDMARK_FLAG_ZERO_G 2 // Zero-G shuttles moved here will lose gravity unless the area has ambient gravity.
+
+// Ferry shuttle location constants
+#define FERRY_LOCATION_STATION 0
+#define FERRY_LOCATION_OFFSITE 1
+#define FERRY_GOING_TO_STATION 0
+#define FERRY_GOING_TO_OFFSITE 1
+
+#ifndef DEBUG_SHUTTLES
+ #define log_shuttle(M)
+#else
+ #define log_shuttle(M) log_debug("[M]")
+#endif
diff --git a/code/modules/shuttles/crashes.dm b/code/modules/shuttles/crashes.dm
index 636bab0bcb2..08620b40210 100644
--- a/code/modules/shuttles/crashes.dm
+++ b/code/modules/shuttles/crashes.dm
@@ -3,47 +3,53 @@
//
/datum/shuttle
- var/list/crash_areas = null
+ var/list/crash_locations = null
var/crash_message = "Oops. The shuttle blew up." // Announcement made when shuttle crashes
/datum/shuttle/New()
- if(crash_areas)
- for(var/i in 1 to crash_areas.len)
- crash_areas[i] = locate(crash_areas[i])
+ if(crash_locations)
+ var/crash_location_ids = crash_locations
+ crash_locations = list()
+ for(var/location_tag in crash_location_ids)
+ var/obj/effect/shuttle_landmark/L = SSshuttle.get_landmark(location_tag)
+ if(L)
+ crash_locations += L
..()
// Return 0 to let the jump continue, 1 to abort the jump.
// Default implementation checks if the shuttle should crash and if so crashes it.
-/datum/shuttle/proc/process_longjump(var/area/origin, var/area/intended_destination, var/direction)
- if(should_crash())
- do_crash(origin)
+/datum/shuttle/proc/process_longjump(var/obj/effect/shuttle_landmark/intended_destination)
+ if(should_crash(intended_destination))
+ do_crash(intended_destination)
return 1
// Decide if this is the time we crash. Return true for yes
-/datum/shuttle/proc/should_crash(var/area/origin, var/area/intended_destination, var/direction)
+/datum/shuttle/proc/should_crash(var/obj/effect/shuttle_landmark/intended_destination)
return FALSE
// Actually crash the shuttle
-/datum/shuttle/proc/do_crash(var/area/source)
+/datum/shuttle/proc/do_crash(var/obj/effect/shuttle_landmark/intended_destination)
// Choose the target
- var/area/target = pick(crash_areas)
+ var/obj/effect/shuttle_landmark/target = pick(crash_locations)
ASSERT(istype(target))
// Blow up the target area?
//command_announcement.Announce(departure_message,(announcer ? announcer : "[GLOB.using_map.boss_name]"))
- //What people are we dealing with here
+ // What people are we dealing with here
var/list/victims = list()
- for(var/mob/living/L in source)
- victims += L
- spawn(0)
- shake_camera(L,2 SECONDS,4)
+ for(var/area/A in shuttle_area)
+ for(var/mob/living/L in A)
+ victims += L
+ spawn(0)
+ shake_camera(L,2 SECONDS,4)
- //SHAKA SHAKA SHAKA
+ // SHAKA SHAKA SHAKA
sleep(2 SECONDS)
// Move the shuttle
- move(source, target)
+ if (!attempt_move(target))
+ return // Lucky!
// Hide people
for(var/living in victims)
@@ -54,9 +60,11 @@
L.loc = null
// Blow up the shuttle
- var/list/area_turfs = get_area_turfs(target)
- var/turf/epicenter = pick(area_turfs)
- var/boomsize = area_turfs.len / 10 // Bigger shuttle = bigger boom
+ var/list/shuttle_turfs = list()
+ for(var/area/A in shuttle_area)
+ shuttle_turfs += get_area_turfs(A)
+ var/turf/epicenter = pick(shuttle_turfs)
+ var/boomsize = shuttle_turfs.len / 10 // Bigger shuttle = bigger boom
explosion(epicenter, 0, boomsize, boomsize*2, boomsize*3)
moving_status = SHUTTLE_CRASHED
command_announcement.Announce("[crash_message]", "Shuttle Alert")
diff --git a/code/modules/shuttles/escape_pods.dm b/code/modules/shuttles/escape_pods.dm
index 9ff0e8aa4c2..952e0ee41ff 100644
--- a/code/modules/shuttles/escape_pods.dm
+++ b/code/modules/shuttles/escape_pods.dm
@@ -1,57 +1,62 @@
-/datum/shuttle/ferry/escape_pod
- var/datum/computer/file/embedded_program/docking/simple/escape_pod/arming_controller
- category = /datum/shuttle/ferry/escape_pod
+/datum/shuttle/autodock/ferry/escape_pod
+ var/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/arming_controller
+ category = /datum/shuttle/autodock/ferry/escape_pod
-/datum/shuttle/ferry/escape_pod/New()
+/datum/shuttle/autodock/ferry/escape_pod/New()
move_time = move_time + rand(-30, 60)
if(name in SSshuttle.escape_pods)
CRASH("An escape pod with the name '[name]' has already been defined.")
SSshuttle.escape_pods[name] = src
+
..()
-/datum/shuttle/ferry/escape_pod/init_docking_controllers()
- ..()
- arming_controller = locate(dock_target_station)
+ // Find the arming controller (berth) - If not configured directly, try to read it from current location landmark
+ var/arming_controller_tag = arming_controller
+ if(!arming_controller && active_docking_controller)
+ arming_controller_tag = active_docking_controller.id_tag
+ arming_controller = SSshuttle.docking_registry[arming_controller_tag]
if(!istype(arming_controller))
- warning("warning: escape pod with station dock tag [dock_target_station] could not find it's dock target!")
+ CRASH("Could not find arming controller for escape pod \"[name]\", tag was '[arming_controller_tag]'.")
- if(docking_controller)
- var/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/controller_master = docking_controller.master
- if(!istype(controller_master))
- warning("warning: escape pod with docking tag [docking_controller_tag] could not find its controller master!")
- else
- controller_master.pod = src
+ // Find the pod's own controller
+ var/datum/computer/file/embedded_program/docking/simple/prog = SSshuttle.docking_registry[docking_controller_tag]
+ var/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/controller_master = prog.master
+ if(!istype(controller_master))
+ CRASH("Escape pod \"[name]\" could not find it's controller master! docking_controller_tag=[docking_controller_tag]")
+ controller_master.pod = src
-/datum/shuttle/ferry/escape_pod/can_launch()
- if(arming_controller && !arming_controller.armed) //must be armed
+/datum/shuttle/autodock/ferry/escape_pod/can_launch()
+ if(arming_controller && !arming_controller.armed) // Must be armed
return 0
if(location)
- return 0 //it's a one-way trip.
+ return 0 // It's a one-way trip.
return ..()
-/datum/shuttle/ferry/escape_pod/can_force()
+/datum/shuttle/autodock/ferry/escape_pod/can_force()
if (arming_controller.eject_time && world.time < arming_controller.eject_time + 50)
- return 0 //dont allow force launching until 5 seconds after the arming controller has reached it's countdown
+ return 0 // Dont allow force launching until 5 seconds after the arming controller has reached it's countdown
return ..()
-/datum/shuttle/ferry/escape_pod/can_cancel()
+/datum/shuttle/autodock/ferry/escape_pod/can_cancel()
return 0
-//This controller goes on the escape pod itself
+// This controller goes on the escape pod itself
/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod
name = "escape pod controller"
- var/datum/shuttle/ferry/escape_pod/pod
+ program = /datum/computer/file/embedded_program/docking/simple
+ var/datum/shuttle/autodock/ferry/escape_pod/pod
/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
+ var/datum/computer/file/embedded_program/docking/simple/docking_program = program // Cast to proper type
data = list(
"docking_status" = docking_program.get_docking_status(),
"override_enabled" = docking_program.override_enabled,
"door_state" = docking_program.memory["door_status"]["state"],
"door_lock" = docking_program.memory["door_status"]["lock"],
- "can_force" = pod.can_force() || (SSemergencyshuttle.departed && pod.can_launch()), //allow players to manually launch ahead of time if the shuttle leaves
+ "can_force" = pod.can_force() || (SSemergencyshuttle.departed && pod.can_launch()), // Allow players to manually launch ahead of time if the shuttle leaves
"is_armed" = pod.arming_controller.armed,
)
@@ -64,36 +69,34 @@
ui.set_auto_update(1)
/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod/Topic(href, href_list)
- if(..())
- return 1
+ if((. = ..()))
+ return
if("manual_arm")
pod.arming_controller.arm()
+ return TOPIC_REFRESH
if("force_launch")
if (pod.can_force())
pod.force_launch(src)
- else if (SSemergencyshuttle.departed && pod.can_launch()) //allow players to manually launch ahead of time if the shuttle leaves
+ else if (SSemergencyshuttle.departed && pod.can_launch()) // Allow players to manually launch ahead of time if the shuttle leaves
pod.launch(src)
-
+ return TOPIC_REFRESH
return 0
-//This controller is for the escape pod berth (station side)
+// This controller is for the escape pod berth (station side)
/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod_berth
name = "escape pod berth controller"
-
-/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod_berth/Initialize()
- . = ..()
- docking_program = new/datum/computer/file/embedded_program/docking/simple/escape_pod(src)
- program = docking_program
+ program = /datum/computer/file/embedded_program/docking/simple/escape_pod_berth
/obj/machinery/embedded_controller/radio/simple_docking_controller/escape_pod_berth/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
+ var/datum/computer/file/embedded_program/docking/simple/docking_program = program // Cast to proper type
var/armed = null
- if (istype(docking_program, /datum/computer/file/embedded_program/docking/simple/escape_pod))
- var/datum/computer/file/embedded_program/docking/simple/escape_pod/P = docking_program
+ if (istype(docking_program, /datum/computer/file/embedded_program/docking/simple/escape_pod_berth))
+ var/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/P = docking_program
armed = P.armed
data = list(
@@ -114,44 +117,44 @@
if (!emagged)
to_chat(user, "You emag the [src], arming the escape pod!")
emagged = 1
- if (istype(docking_program, /datum/computer/file/embedded_program/docking/simple/escape_pod))
- var/datum/computer/file/embedded_program/docking/simple/escape_pod/P = docking_program
+ if (istype(program, /datum/computer/file/embedded_program/docking/simple/escape_pod_berth))
+ var/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/P = program
if (!P.armed)
P.arm()
return 1
-//A docking controller program for a simple door based docking port
-/datum/computer/file/embedded_program/docking/simple/escape_pod
+// A docking controller program for a simple door based docking port
+/datum/computer/file/embedded_program/docking/simple/escape_pod_berth
var/armed = 0
- var/eject_delay = 10 //give latecomers some time to get out of the way if they don't make it onto the pod
+ var/eject_delay = 10 // Give latecomers some time to get out of the way if they don't make it onto the pod
var/eject_time = null
var/closing = 0
-/datum/computer/file/embedded_program/docking/simple/escape_pod/proc/arm()
+/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/proc/arm()
if(!armed)
armed = 1
open_door()
-/datum/computer/file/embedded_program/docking/simple/escape_pod/receive_user_command(command)
+/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/receive_user_command(command)
if (!armed)
- return
- ..(command)
+ return TRUE // Eat all commands.
+ return ..(command)
-/datum/computer/file/embedded_program/docking/simple/escape_pod/process()
+/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/process()
..()
if (eject_time && world.time >= eject_time && !closing)
close_door()
closing = 1
-/datum/computer/file/embedded_program/docking/simple/escape_pod/prepare_for_docking()
+/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/prepare_for_docking()
return
-/datum/computer/file/embedded_program/docking/simple/escape_pod/ready_for_docking()
+/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/ready_for_docking()
return 1
-/datum/computer/file/embedded_program/docking/simple/escape_pod/finish_docking()
- return //don't do anything - the doors only open when the pod is armed.
+/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/finish_docking()
+ return // Don't do anything - the doors only open when the pod is armed.
-/datum/computer/file/embedded_program/docking/simple/escape_pod/prepare_for_undocking()
+/datum/computer/file/embedded_program/docking/simple/escape_pod_berth/prepare_for_undocking()
eject_time = world.time + eject_delay*10
diff --git a/code/modules/shuttles/landmarks.dm b/code/modules/shuttles/landmarks.dm
new file mode 100644
index 00000000000..3c6c9ffeccc
--- /dev/null
+++ b/code/modules/shuttles/landmarks.dm
@@ -0,0 +1,187 @@
+// Making this separate from /obj/effect/landmark until that mess can be dealt with
+/obj/effect/shuttle_landmark
+ name = "Nav Point"
+ icon = 'icons/effects/effects.dmi'
+ icon_state = "energynet"
+ anchored = 1
+ unacidable = 1
+ simulated = 0
+ invisibility = 101
+
+ // ID of the landmark
+ var/landmark_tag
+ // ID of the controller on the dock side (intialize to id_tag, becomes reference)
+ var/datum/computer/file/embedded_program/docking/docking_controller
+ // Map of shuttle names to ID of controller used for this landmark for shuttles with multiple ones.
+ var/list/special_dock_targets
+
+ // When the shuttle leaves this landmark, it will leave behind the base area,
+ // also used to determine if the shuttle can arrive here without obstruction
+ var/area/base_area
+ // Will also leave this type of turf behind if set.
+ var/turf/base_turf
+ // Name of the shuttle, null for generic waypoint
+ var/shuttle_restricted
+ // var/flags = 0 - Already defined on /atom ? Is it being used for anything? Can we reuse it safely?
+
+/obj/effect/shuttle_landmark/Initialize()
+ . = ..()
+ if(docking_controller)
+ . = INITIALIZE_HINT_LATELOAD
+
+ if(flags & SLANDMARK_FLAG_AUTOSET)
+ base_area = get_area(src)
+ var/turf/T = get_turf(src)
+ if(T)
+ base_turf = T.type
+ else
+ base_area = locate(base_area || world.area)
+
+ name = (name + " ([x],[y])")
+ SSshuttle.register_landmark(landmark_tag, src)
+
+/obj/effect/shuttle_landmark/LateInitialize()
+ if(!docking_controller)
+ return
+ var/docking_tag = docking_controller
+ docking_controller = SSshuttle.docking_registry[docking_tag]
+ if(!istype(docking_controller))
+ log_error("Could not find docking controller for shuttle waypoint '[name]', docking tag was '[docking_tag]'.")
+ if(using_map.use_overmap)
+ var/obj/effect/overmap/visitable/location = map_sectors["[z]"]
+ if(location && location.docking_codes)
+ docking_controller.docking_codes = location.docking_codes
+
+/obj/effect/shuttle_landmark/forceMove()
+ var/obj/effect/overmap/visitable/map_origin = map_sectors["[z]"]
+ . = ..()
+ var/obj/effect/overmap/visitable/map_destination = map_sectors["[z]"]
+ if(map_origin != map_destination)
+ if(map_origin)
+ map_origin.remove_landmark(src, shuttle_restricted)
+ if(map_destination)
+ map_destination.add_landmark(src, shuttle_restricted)
+
+// Called when the landmark is added to an overmap sector.
+/obj/effect/shuttle_landmark/proc/sector_set(var/obj/effect/overmap/visitable/O, shuttle_name)
+ shuttle_restricted = shuttle_name
+
+/obj/effect/shuttle_landmark/proc/is_valid(var/datum/shuttle/shuttle)
+ if(shuttle.current_location == src)
+ return FALSE
+ for(var/area/A in shuttle.shuttle_area)
+ var/list/translation = get_turf_translation(get_turf(shuttle.current_location), get_turf(src), A.contents)
+ if(check_collision(base_area, list_values(translation)))
+ return FALSE
+ var/conn = GetConnectedZlevels(z)
+ for(var/w in (z - shuttle.multiz) to z)
+ if(!(w in conn))
+ return FALSE
+ return TRUE
+
+// This creates a graphical warning to where the shuttle is about to land in approximately five seconds.
+/obj/effect/shuttle_landmark/proc/create_warning_effect(var/datum/shuttle/shuttle)
+ if(shuttle.current_location == src)
+ return // TOO LATE!
+ for(var/area/A in shuttle.shuttle_area)
+ var/list/translation = get_turf_translation(get_turf(shuttle.current_location), get_turf(src), A.contents)
+ for(var/T in list_values(translation))
+ new /obj/effect/temporary_effect/shuttle_landing(T) // It'll delete itself when needed.
+ return
+
+// Should return a readable description of why not if it can't depart.
+/obj/effect/shuttle_landmark/proc/cannot_depart(datum/shuttle/shuttle)
+ return FALSE
+
+/obj/effect/shuttle_landmark/proc/shuttle_departed(datum/shuttle/shuttle)
+ return
+
+/obj/effect/shuttle_landmark/proc/shuttle_arrived(datum/shuttle/shuttle)
+ return
+
+/proc/check_collision(area/target_area, list/target_turfs)
+ for(var/target_turf in target_turfs)
+ var/turf/target = target_turf
+ if(!target)
+ return TRUE // Collides with edge of map
+ if(target.loc != target_area)
+ return TRUE // Collides with another area
+ if(target.density)
+ return TRUE // Dense turf
+ return FALSE
+
+//
+// Self-naming/numbering ones.
+//
+/obj/effect/shuttle_landmark/automatic
+ name = "Navpoint"
+ landmark_tag = "navpoint"
+ flags = SLANDMARK_FLAG_AUTOSET
+
+/obj/effect/shuttle_landmark/automatic/Initialize()
+ landmark_tag += "-[x]-[y]-[z]-[random_id("landmarks",1,9999)]"
+ return ..()
+
+/obj/effect/shuttle_landmark/automatic/sector_set(var/obj/effect/overmap/visitable/O)
+ ..()
+ name = ("[O.name] - [initial(name)] ([x],[y])")
+
+// Subtype that calls explosion on init to clear space for shuttles
+/obj/effect/shuttle_landmark/automatic/clearing
+ var/radius = 10
+
+/obj/effect/shuttle_landmark/automatic/clearing/Initialize()
+ ..()
+ return INITIALIZE_HINT_LATELOAD
+
+/obj/effect/shuttle_landmark/automatic/clearing/LateInitialize()
+ ..()
+ for(var/turf/T in range(radius, src))
+ if(T.density)
+ T.ChangeTurf(get_base_turf_by_area(T))
+
+
+// Subtype that also queues a shuttle datum (for shuttles starting on maps loaded at runtime)
+/obj/effect/shuttle_landmark/shuttle_initializer
+ var/datum/shuttle/shuttle_type
+
+/obj/effect/shuttle_landmark/shuttle_initializer/Initialize()
+ . = ..()
+ LAZYADD(SSshuttle.shuttles_to_initialize, shuttle_type) // Queue up for init.
+
+//
+// Bluespace flare landmark beacon
+//
+/obj/item/device/spaceflare
+ name = "bluespace flare"
+ desc = "Burst transmitter used to broadcast all needed information for shuttle navigation systems. Has a flare attached for marking the spot where you probably shouldn't be standing."
+ icon_state = "bluflare"
+ light_color = "#3728ff"
+ var/active
+
+/obj/item/device/spaceflare/attack_self(var/mob/user)
+ if(!active)
+ visible_message("[user] pulls the cord, activating the [src].")
+ activate()
+
+/obj/item/device/spaceflare/proc/activate()
+ if(active)
+ return
+ var/turf/T = get_turf(src)
+ var/mob/M = loc
+ if(istype(M) && !M.unEquip(src, T))
+ return
+
+ active = 1
+ anchored = 1
+
+ var/obj/effect/shuttle_landmark/automatic/mark = new(T)
+ mark.name = ("Beacon signal ([T.x],[T.y])")
+ T.hotspot_expose(1500, 5)
+ update_icon()
+
+/obj/item/device/spaceflare/update_icon()
+ . = ..()
+ if(active)
+ icon_state = "bluflare_on"
+ set_light(0.3, 0.1, 6, 2, "85d1ff")
diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm
index c1af96fdbe6..b5e05f1688e 100644
--- a/code/modules/shuttles/shuttle.dm
+++ b/code/modules/shuttles/shuttle.dm
@@ -1,6 +1,3 @@
-//These lists are populated in /datum/controller/subsystem/shuttles/proc/setup_shuttle_docks()
-//Shuttle subsystem is instantiated in shuttles.dm.
-
//shuttle moving state defines are in setup.dm
/datum/shuttle
@@ -8,18 +5,56 @@
var/warmup_time = 0
var/moving_status = SHUTTLE_IDLE
- var/docking_controller_tag //tag of the controller used to coordinate docking
- var/datum/computer/file/embedded_program/docking/docking_controller //the controller itself. (micro-controller, not game controller)
+ var/list/shuttle_area // Initial value can be either a single area type or a list of area types
+ var/obj/effect/shuttle_landmark/current_location // This variable is type-abused initially: specify the landmark_tag, not the actual landmark.
- 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/tmp/arrive_time = 0 // The time at which the shuttle arrives when long jumping
+ var/flags = SHUTTLE_FLAGS_NONE
+ var/process_state = IDLE_STATE // Used with SHUTTLE_FLAGS_PROCESS, as well as to store current state.
var/category = /datum/shuttle
+ var/multiz = 0 // How many multiz levels, starts at 0 TODO Leshana - Are we porting this?
- var/ceiling_type = /turf/unsimulated/floor/shuttle_ceiling
+ var/ceiling_type // Type path of turf to roof over the shuttle when at multi-z landmarks. Ignored if null.
-/datum/shuttle/New()
+ var/sound_takeoff = 'sound/effects/shuttles/shuttle_takeoff.ogg'
+ var/sound_landing = 'sound/effects/shuttles/shuttle_landing.ogg'
+
+ var/knockdown = 1 // Whether shuttle downs non-buckled people when it moves
+
+ var/defer_initialisation = FALSE // If this this shuttle should be initialised automatically.
+ // If set to true, you are responsible for initialzing the shuttle manually.
+ // Useful for shuttles that are initialized by map_template loading, or shuttles that are created in-game or not used.
+
+ var/mothershuttle // Tag of mothershuttle
+ var/motherdock // Tag of mothershuttle landmark, defaults to starting location
+
+ var/tmp/depart_time = 0 // Similar to above, set when the shuttle leaves when long jumping. Used for progress bars.
+
+ // Future Thoughts: Baystation put "docking" stuff in a subtype, leaving base type pure and free of docking stuff. Is this best?
+
+/datum/shuttle/New(_name, var/obj/effect/shuttle_landmark/initial_location)
..()
+ if(_name)
+ src.name = _name
+
+ var/list/areas = list()
+ if(!islist(shuttle_area))
+ shuttle_area = list(shuttle_area)
+ for(var/T in shuttle_area)
+ var/area/A = locate(T)
+ if(!istype(A))
+ CRASH("Shuttle \"[name]\" couldn't locate area [T].")
+ areas += A
+ shuttle_area = areas
+
+ if(initial_location)
+ current_location = initial_location
+ else
+ current_location = SSshuttle.get_landmark(current_location)
+ if(!istype(current_location))
+ log_debug("UM whoops, no initial? [src]")
+ CRASH("Shuttle '[name]' could not find its starting location landmark [current_location].")
+
if(src.name in SSshuttle.shuttles)
CRASH("A shuttle with the name '[name]' is already defined.")
SSshuttle.shuttles[src.name] = src
@@ -31,25 +66,17 @@
SSsupply.shuttle = src
/datum/shuttle/Destroy()
+ current_location = null
SSshuttle.shuttles -= src.name
SSshuttle.process_shuttles -= src
+ SSshuttle.shuttle_logs -= src
if(SSsupply.shuttle == src)
SSsupply.shuttle = null
. = ..()
-/datum/shuttle/process()
- return
-
-/datum/shuttle/proc/init_docking_controllers()
- if(docking_controller_tag)
- docking_controller = locate(docking_controller_tag)
- if(!istype(docking_controller))
- to_chat(world, "warning: shuttle with docking tag [docking_controller_tag] could not find its controller!")
-
// This creates a graphical warning to where the shuttle is about to land, in approximately five seconds.
-/datum/shuttle/proc/create_warning_effect(area/landing_area)
- for(var/turf/T in landing_area)
- new /obj/effect/temporary_effect/shuttle_landing(T) // It'll delete itself when needed.
+/datum/shuttle/proc/create_warning_effect(var/obj/effect/shuttle_landmark/destination)
+ destination.create_warning_effect(src)
// Return false to abort a jump, before the 'warmup' phase.
/datum/shuttle/proc/pre_warmup_checks()
@@ -60,197 +87,273 @@
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(var/area/origin)
- origin.shuttle_departed()
+// Keep in mind that destination is the intended destination, the shuttle may or may not actually reach it.s
+/datum/shuttle/proc/on_shuttle_departure(var/obj/effect/shuttle_landmark/origin, var/obj/effect/shuttle_landmark/destination)
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(var/area/destination)
- destination.shuttle_arrived()
+// Keep in mind we might not actually have gotten to destination. Check current_location to be sure where we ended up.
+/datum/shuttle/proc/on_shuttle_arrival(var/obj/effect/shuttle_landmark/origin, var/obj/effect/shuttle_landmark/destination)
return
-/datum/shuttle/proc/short_jump(var/area/origin,var/area/destination)
+/datum/shuttle/proc/short_jump(var/obj/effect/shuttle_landmark/destination)
if(moving_status != SHUTTLE_IDLE)
return
if(!pre_warmup_checks())
return
+ var/obj/effect/shuttle_landmark/start_location = current_location
+ // TODO - Figure out exactly when to play sounds. Before warmup_time delay? Should there be a sleep for waiting for sounds? or no?
moving_status = SHUTTLE_WARMUP
spawn(warmup_time*10)
- make_sounds(origin, HYPERSPACE_WARMUP)
+ make_sounds(HYPERSPACE_WARMUP)
create_warning_effect(destination)
- sleep(5 SECONDS) // so the sound finishes.
+ sleep(5 SECONDS) // So the sound finishes.
if(!post_warmup_checks())
- moving_status = SHUTTLE_IDLE
+ cancel_launch(null)
+
+ if(!fuel_check()) //Fuel error (probably out of fuel) occured, so cancel the launch
+ cancel_launch(null)
if (moving_status == SHUTTLE_IDLE)
- make_sounds(origin, HYPERSPACE_END)
- return //someone cancelled the launch
+ make_sounds(HYPERSPACE_END)
+ return // Someone cancelled the launch
- on_shuttle_departure(origin)
+ moving_status = SHUTTLE_INTRANSIT // Shouldn't matter but just to be safe
+ on_shuttle_departure(start_location, destination)
+
+ attempt_move(destination)
- moving_status = SHUTTLE_INTRANSIT //shouldn't matter but just to be safe
- move(origin, destination)
moving_status = SHUTTLE_IDLE
+ on_shuttle_arrival(start_location, destination)
- on_shuttle_arrival(destination)
+ make_sounds(HYPERSPACE_END)
- make_sounds(destination, HYPERSPACE_END)
-
-/datum/shuttle/proc/long_jump(var/area/departing, var/area/destination, var/area/interim, var/travel_time, var/direction)
- //world << "shuttle/long_jump: departing=[departing], destination=[destination], interim=[interim], travel_time=[travel_time]"
+// TODO - Far Future - Would be great if this was driven by process too.
+/datum/shuttle/proc/long_jump(var/obj/effect/shuttle_landmark/destination, var/obj/effect/shuttle_landmark/interim, var/travel_time)
+ //to_world("shuttle/long_jump: current_location=[current_location], destination=[destination], interim=[interim], travel_time=[travel_time]")
if(moving_status != SHUTTLE_IDLE)
return
if(!pre_warmup_checks())
return
- //it would be cool to play a sound here
+ var/obj/effect/shuttle_landmark/start_location = current_location
+ // TODO - Figure out exactly when to play sounds. Before warmup_time delay? Should there be a sleep for waiting for sounds? or no?
moving_status = SHUTTLE_WARMUP
spawn(warmup_time*10)
- make_sounds(departing, HYPERSPACE_WARMUP)
- create_warning_effect(interim) // Really doubt someone is gonna get crushed in the interim area but for completeness's sake we'll make the warning.
- sleep(5 SECONDS) // so the sound finishes.
+ make_sounds(HYPERSPACE_WARMUP)
+ create_warning_effect(interim) // Really doubt someone is gonna get crushed in the interim area but for completeness's sake we'll make the warning.
+ sleep(5 SECONDS) // So the sound finishes.
if(!post_warmup_checks())
- moving_status = SHUTTLE_IDLE
+ cancel_launch(null)
if (moving_status == SHUTTLE_IDLE)
- make_sounds(departing, HYPERSPACE_END)
- return //someone cancelled the launch
+ make_sounds(HYPERSPACE_END)
+ return // Someone cancelled the launch
arrive_time = world.time + travel_time*10
-
depart_time = world.time
moving_status = SHUTTLE_INTRANSIT
+ on_shuttle_departure(start_location, destination)
- on_shuttle_departure(departing)
+ if(attempt_move(interim, TRUE))
+ interim.shuttle_arrived()
- move(departing, interim, direction)
- interim.shuttle_arrived()
+ if(process_longjump(current_location, destination)) //To hook custom shuttle code in
+ return //It handled it for us (shuttle crash or such)
- if(process_longjump(departing, destination)) //VOREStation Edit - To hook custom shuttle code in
- return //VOREStation Edit - It handled it for us (shuttle crash or such)
+ var/last_progress_sound = 0
+ var/made_warning = FALSE
+ while (world.time < arrive_time)
+ // Make the shuttle make sounds every four seconds, since the sound file is five seconds.
+ if(last_progress_sound + 4 SECONDS < world.time)
+ make_sounds(HYPERSPACE_PROGRESS)
+ last_progress_sound = world.time
- var/last_progress_sound = 0
- var/made_warning = FALSE
- while (world.time < arrive_time)
- // Make the shuttle make sounds every four seconds, since the sound file is five seconds.
- if(last_progress_sound + 4 SECONDS < world.time)
- make_sounds(interim, HYPERSPACE_PROGRESS)
- last_progress_sound = world.time
+ if(arrive_time - world.time <= 5 SECONDS && !made_warning)
+ made_warning = TRUE
+ create_warning_effect(destination)
+ sleep(5)
- if(arrive_time - world.time <= 5 SECONDS && !made_warning)
- made_warning = TRUE
- create_warning_effect(destination)
- sleep(5)
+ if(!attempt_move(destination))
+ attempt_move(start_location) // Try to go back to where we started. If that fails, I guess we're stuck in the interim location.
- interim.shuttle_departed()
- move(interim, destination, direction)
+ moving_status = SHUTTLE_IDLE
+ on_shuttle_arrival(start_location, destination)
+ make_sounds(HYPERSPACE_END)
+
+//////////////////////////////
+// Forward declarations of public procs. They do nothing because this is not auto-dock.
+
+/datum/shuttle/proc/fuel_check()
+ return 1 // Fuel check should always pass in non-overmap shuttles (they have magic engines)
+
+/datum/shuttle/proc/cancel_launch(var/user)
+ // If we are past warming up its too late to cancel.
+ if (moving_status == SHUTTLE_WARMUP)
moving_status = SHUTTLE_IDLE
- on_shuttle_arrival(destination)
-
- make_sounds(destination, HYPERSPACE_END)
-
+/*
+ Docking stuff
+*/
/datum/shuttle/proc/dock()
- if (!docking_controller)
- return
-
- var/dock_target = current_dock_target()
- if (!dock_target)
- return
-
- docking_controller.initiate_docking(dock_target)
+ return
/datum/shuttle/proc/undock()
- if (!docking_controller)
- return
- docking_controller.initiate_undocking()
+ return
-/datum/shuttle/proc/current_dock_target()
- return null
+/datum/shuttle/proc/force_undock()
+ return
-/datum/shuttle/proc/skip_docking_checks()
- if (!docking_controller || !current_dock_target())
- return 1 //shuttles without docking controllers or at locations without docking ports act like old-style shuttles
- return 0
+// Check if we are docked (or never dock) and thus have properly arrived.
+/datum/shuttle/proc/check_docked()
+ return TRUE
-//just moves the shuttle from A to B, if it can be moved
-//A note to anyone overriding move in a subtype. move() must absolutely not, under any circumstances, fail to move the shuttle.
-//If you want to conditionally cancel shuttle launches, that logic must go in short_jump() or long_jump()
-/datum/shuttle/proc/move(var/area/origin, var/area/destination, var/direction=null)
+// Check if we are undocked and thus probably ready to depart.
+/datum/shuttle/proc/check_undocked()
+ return TRUE
+/*****************
+* Shuttle Moved Handling * (Observer Pattern Implementation: Shuttle Moved)
+* Shuttle Pre Move Handling * (Observer Pattern Implementation: Shuttle Pre Move)
+*****************/
+
+// Move the shuttle to destination if possible.
+// Returns TRUE if we actually moved, otherwise FALSE.
+/datum/shuttle/proc/attempt_move(var/obj/effect/shuttle_landmark/destination, var/interim = FALSE)
+ if(current_location == destination)
+ log_shuttle("Shuttle [src] attempted to move to [destination] but is already there!")
+ return FALSE
+
+ if(!destination.is_valid(src))
+ log_shuttle("Shuttle [src] aborting attempt_move() because destination=[destination] is not valid")
+ return FALSE
+ if(current_location.cannot_depart(src))
+ log_shuttle("Shuttle [src] aborting attempt_move() because current_location=[current_location] refuses.")
+ return FALSE
+
+ log_shuttle("[src] moving to [destination]. Areas are [english_list(shuttle_area)]")
+ var/list/translation = list()
+ for(var/area/A in shuttle_area)
+ log_shuttle("Translating [A]")
+ translation += get_turf_translation(get_turf(current_location), get_turf(destination), A.contents)
+ var/old_location = current_location
+
+ // Observer pattern pre-move
+ GLOB.shuttle_pre_move_event.raise_event(src, old_location, destination)
+ current_location.shuttle_departed(src)
+
+ // Actually do it! (This never fails)
+ perform_shuttle_move(destination, translation)
+
+ // Observer pattern post-move
+ destination.shuttle_arrived(src)
+ GLOB.shuttle_moved_event.raise_event(src, old_location, destination)
+
+ return TRUE
+
+// Just moves the shuttle from A to B
+// A note to anyone overriding move in a subtype. perform_shuttle_move() must absolutely not, under any circumstances, fail to move the shuttle.
+// If you want to conditionally cancel shuttle launches, that logic must go in short_jump() or long_jump()
+/datum/shuttle/proc/perform_shuttle_move(var/obj/effect/shuttle_landmark/destination, var/list/turf_translation)
+ log_shuttle("perform_shuttle_move() current=[current_location] destination=[destination]")
//world << "move_shuttle() called for [name] leaving [origin] en route to [destination]."
//world << "area_coming_from: [origin]"
//world << "destination: [destination]"
+ ASSERT(current_location != destination)
- if(origin == destination)
- //world << "cancelling move, shuttle will overlap."
- return
+ // If shuttle has no internal gravity, update our gravity with destination gravity
+ if((flags & SHUTTLE_FLAGS_ZERO_G))
+ var/new_grav = 1
+ if(destination.flags & SLANDMARK_FLAG_ZERO_G)
+ var/area/new_area = get_area(destination)
+ new_grav = new_area.has_gravity
+ for(var/area/our_area in shuttle_area)
+ if(our_area.has_gravity != new_grav)
+ our_area.gravitychange(new_grav)
- if (docking_controller && !docking_controller.undocked())
- docking_controller.force_undock()
+ // TODO - Old code used to throw stuff out of the way instead of squashing. Should we?
- var/list/dstturfs = list()
- var/throwy = world.maxy
-
- for(var/turf/T in destination)
- dstturfs += T
- if(T.y < throwy)
- throwy = T.y
-
- for(var/turf/T in dstturfs)
- var/turf/D = locate(T.x, throwy - 1, T.z)
- for(var/atom/movable/AM as mob|obj in T)
- AM.Move(D)
-
- for(var/mob/living/carbon/bug in destination)
- bug.gib()
-
- for(var/mob/living/simple_mob/pest in destination)
- pest.gib()
-
- origin.move_contents_to(destination, direction=direction)
-
- for(var/mob/M in destination)
- if(M.client)
- spawn(0)
- if(M.buckled)
- to_chat(M, "Sudden acceleration presses you into \the [M.buckled]!")
- shake_camera(M, 3, 1)
+ // Move, gib, or delete everything in our way!
+ for(var/turf/src_turf in turf_translation)
+ var/turf/dst_turf = turf_translation[src_turf]
+ if(src_turf.is_solid_structure()) // In case someone put a hole in the shuttle and you were lucky enough to be under it
+ for(var/atom/movable/AM in dst_turf)
+ //if(AM.movable_flags & MOVABLE_FLAG_DEL_SHUTTLE)
+ // qdel(AM)
+ // continue
+ if(!AM.simulated)
+ continue
+ if(isliving(AM))
+ var/mob/living/bug = AM
+ bug.gib()
else
- to_chat(M, "The floor lurches beneath you!")
- shake_camera(M, 10, 1)
- if(istype(M, /mob/living/carbon))
- if(!M.buckled)
- M.Weaken(3)
+ qdel(AM) //it just gets atomized I guess? TODO throw it into space somewhere, prevents people from using shuttles as an atom-smasher
+
+ var/list/powernets = list()
+ for(var/area/A in shuttle_area)
+ // If there was a zlevel above our origin and we own the ceiling, erase our ceiling now we're leaving
+ if(ceiling_type && HasAbove(current_location.z))
+ for(var/turf/TO in A.contents)
+ var/turf/TA = GetAbove(TO)
+ if(istype(TA, ceiling_type))
+ TA.ChangeTurf(get_base_turf_by_area(TA), 1, 1)
+ if(knockdown)
+ for(var/mob/living/M in A)
+ spawn(0)
+ if(M.buckled)
+ to_chat(M, "Sudden acceleration presses you into \the [M.buckled]!")
+ shake_camera(M, 3, 1)
+ else
+ to_chat(M, "The floor lurches beneath you!")
+ shake_camera(M, 10, 1)
+ // TODO - tossing?
+ //M.visible_message("[M.name] is tossed around by the sudden acceleration!")
+ //M.throw_at_random(FALSE, 4, 1)
+ if(istype(M, /mob/living/carbon))
+ M.Weaken(3)
+ // We only need to rebuild powernets for our cables. No need to check machines because they are on top of cables.
+ for(var/obj/structure/cable/C in A)
+ powernets |= C.powernet
+
+ // Actually do the movement of everything - This replaces origin.move_contents_to(destination)
+ translate_turfs(turf_translation, current_location.base_area, current_location.base_turf)
+ current_location = destination
+
+ // If there's a zlevel above our destination, paint in a ceiling on it so we retain our air
+ if(ceiling_type && HasAbove(current_location.z))
+ for(var/area/A in shuttle_area)
+ for(var/turf/TD in A.contents)
+ var/turf/TA = GetAbove(TD)
+ if(istype(TA, get_base_turf_by_area(TA)) || isopenspace(TA))
+ if(get_area(TA) in shuttle_area)
+ continue
+ TA.ChangeTurf(ceiling_type, TRUE, TRUE, TRUE)
// Power-related checks. If shuttle contains power related machinery, update powernets.
- var/update_power = 0
- for(var/obj/machinery/power/P in destination)
- update_power = 1
- break
+ // Note: Old way was to rebuild ALL powernets: if(powernets.len) SSmachines.makepowernets()
+ // New way only rebuilds the powernets we have to
+ var/list/cables = list()
+ for(var/datum/powernet/P in powernets)
+ cables |= P.cables
+ qdel(P)
+ SSmachines.setup_powernets_for_cables(cables)
- for(var/obj/structure/cable/C in destination)
- update_power = 1
- break
-
- if(update_power)
- SSmachines.makepowernets()
return
-//returns 1 if the shuttle has a valid arrive time
+// Returns 1 if the shuttle has a valid arrive time
/datum/shuttle/proc/has_arrive_time()
return (moving_status == SHUTTLE_INTRANSIT)
-/datum/shuttle/proc/make_sounds(var/area/A, var/sound_type)
+/datum/shuttle/proc/make_sounds(var/sound_type)
var/sound_to_play = null
switch(sound_type)
if(HYPERSPACE_WARMUP)
@@ -259,9 +362,29 @@
sound_to_play = 'sound/effects/shuttles/hyperspace_progress.ogg'
if(HYPERSPACE_END)
sound_to_play = 'sound/effects/shuttles/hyperspace_end.ogg'
- for(var/obj/machinery/door/E in A) //dumb, I know, but playing it on the engines doesn't do it justice
- playsound(E, sound_to_play, 50, FALSE)
+ for(var/area/A in shuttle_area)
+ for(var/obj/machinery/door/E in A) // Dumb, I know, but playing it on the engines doesn't do it justice
+ playsound(E, sound_to_play, 50, FALSE)
-/datum/shuttle/proc/message_passengers(area/A, var/message)
- for(var/mob/M in A)
- M.show_message(message, 2)
+/datum/shuttle/proc/message_passengers(var/message)
+ for(var/area/A in shuttle_area)
+ for(var/mob/M in A)
+ M.show_message(message, 2)
+
+/datum/shuttle/proc/find_children()
+ . = list()
+ for(var/shuttle_name in SSshuttle.shuttles)
+ var/datum/shuttle/shuttle = SSshuttle.shuttles[shuttle_name]
+ if(shuttle.mothershuttle == name)
+ . += shuttle
+
+// Returns the areas in shuttle_area that are not actually child shuttles.
+/datum/shuttle/proc/find_childfree_areas()
+ . = shuttle_area.Copy()
+ for(var/datum/shuttle/child in find_children())
+ . -= child.shuttle_area
+
+/datum/shuttle/proc/get_location_name()
+ if(moving_status == SHUTTLE_INTRANSIT)
+ return "In transit"
+ return current_location.name
diff --git a/code/modules/shuttles/shuttle_autodock.dm b/code/modules/shuttles/shuttle_autodock.dm
new file mode 100644
index 00000000000..4218deacca2
--- /dev/null
+++ b/code/modules/shuttles/shuttle_autodock.dm
@@ -0,0 +1,220 @@
+#define DOCK_ATTEMPT_TIMEOUT 200 // How long in ticks we wait before assuming the docking controller is broken or blown up.
+
+// Subtype of shuttle that handles docking with docking controllers
+// Consists of code pulled down from the old /datum/shuttle and up from /datum/shuttle/ferry
+// Note: Since all known shuttles extend this type, this really could just be built into /datum/shuttle
+// Why isn't it you ask? Eh, baystation did it this way and its convenient to keep the files smaller I guess.
+/datum/shuttle/autodock
+ var/in_use = null // Tells the controller whether this shuttle needs processing, also attempts to prevent double-use
+ var/last_dock_attempt_time = 0
+
+ var/docking_controller_tag = null // ID of the controller on the shuttle (If multiple, this is the default one)
+ var/datum/computer/file/embedded_program/docking/shuttle_docking_controller // Controller on the shuttle (the one in use)
+ var/docking_codes
+
+ var/tmp/obj/effect/shuttle_landmark/next_location //This is only used internally.
+ var/datum/computer/file/embedded_program/docking/active_docking_controller // Controller we are docked with (or trying to)
+
+ var/obj/effect/shuttle_landmark/landmark_transition // This variable is type-abused initially: specify the landmark_tag, not the actual landmark.
+ var/move_time = 240 // The time spent in the transition area
+
+ category = /datum/shuttle/autodock
+ flags = SHUTTLE_FLAGS_PROCESS | SHUTTLE_FLAGS_ZERO_G
+
+/datum/shuttle/autodock/New(var/_name, var/obj/effect/shuttle_landmark/start_waypoint)
+ ..(_name, start_waypoint)
+
+ // Initial dock
+ active_docking_controller = current_location.docking_controller
+ update_docking_target(current_location)
+ if(active_docking_controller)
+ set_docking_codes(active_docking_controller.docking_codes)
+ else if(global.using_map.use_overmap)
+ var/obj/effect/overmap/visitable/location = map_sectors["[current_location.z]"]
+ if(location && location.docking_codes)
+ set_docking_codes(location.docking_codes)
+ dock()
+
+ // Optional transition area
+ if(landmark_transition)
+ landmark_transition = SSshuttle.get_landmark(landmark_transition)
+
+/datum/shuttle/autodock/Destroy()
+ in_use = null
+ next_location = null
+ active_docking_controller = null
+ landmark_transition = null
+
+ return ..()
+
+/datum/shuttle/autodock/proc/set_docking_codes(var/code)
+ docking_codes = code
+ if(shuttle_docking_controller)
+ shuttle_docking_controller.docking_codes = code
+
+/datum/shuttle/autodock/perform_shuttle_move()
+ force_undock() // Bye! Have a beautiful time!
+ ..()
+
+// Despite the name this actually updates the SHUTTLE docking conroller, not the active.
+/datum/shuttle/autodock/proc/update_docking_target(var/obj/effect/shuttle_landmark/location)
+ var/current_dock_target
+ if(location && location.special_dock_targets && location.special_dock_targets[name])
+ current_dock_target = location.special_dock_targets[name]
+ else
+ current_dock_target = docking_controller_tag
+ shuttle_docking_controller = SSshuttle.docking_registry[current_dock_target]
+ if(current_dock_target && !shuttle_docking_controller)
+ to_world("warning: shuttle [src] can't find its controller with tag [current_dock_target]!")
+/*
+ Docking stuff
+*/
+/datum/shuttle/autodock/dock()
+ if(active_docking_controller && shuttle_docking_controller)
+ shuttle_docking_controller.initiate_docking(active_docking_controller.id_tag)
+ last_dock_attempt_time = world.time
+
+/datum/shuttle/autodock/undock()
+ if(shuttle_docking_controller)
+ shuttle_docking_controller.initiate_undocking()
+
+/datum/shuttle/autodock/force_undock()
+ if(shuttle_docking_controller)
+ shuttle_docking_controller.force_undock()
+
+/datum/shuttle/autodock/check_docked()
+ if(shuttle_docking_controller)
+ return shuttle_docking_controller.docked()
+ return TRUE
+
+/datum/shuttle/autodock/check_undocked()
+ if(shuttle_docking_controller)
+ return shuttle_docking_controller.can_launch()
+ return TRUE
+
+// You also could just directly reference active_docking_controller
+/datum/shuttle/autodock/proc/current_dock_target()
+ if(active_docking_controller)
+ return active_docking_controller.id_tag
+ return null
+
+// These checks are built into the check_docked() and check_undocked() procs
+/datum/shuttle/autodock/proc/skip_docking_checks()
+ if (!shuttle_docking_controller || !current_dock_target())
+ return TRUE // Shuttles without docking controllers or at locations without docking ports act like old-style shuttles
+ return FALSE
+
+
+/*
+ Please ensure that long_jump() and short_jump() are only called from here. This applies to subtypes as well.
+ Doing so will ensure that multiple jumps cannot be initiated in parallel.
+*/
+/datum/shuttle/autodock/process()
+ switch(process_state)
+ if (WAIT_LAUNCH)
+ if(check_undocked())
+ //*** Ready to go
+ process_launch()
+
+ if (FORCE_LAUNCH)
+ process_launch()
+
+ if (WAIT_ARRIVE)
+ if (moving_status == SHUTTLE_IDLE)
+ //*** We made it to the destination, update stuff
+ process_arrived()
+ process_state = WAIT_FINISH
+
+ if (WAIT_FINISH)
+ if (world.time > last_dock_attempt_time + DOCK_ATTEMPT_TIMEOUT || check_docked())
+ //*** All done here
+ process_state = IDLE_STATE
+ arrived()
+
+// Not to be confused with the arrived() proc
+/datum/shuttle/autodock/proc/process_arrived()
+ active_docking_controller = next_location.docking_controller
+ update_docking_target(next_location)
+ dock()
+
+ next_location = null
+ in_use = null // Release lock
+
+/datum/shuttle/autodock/proc/get_travel_time()
+ return move_time
+
+/datum/shuttle/autodock/proc/process_launch()
+ if(!next_location || !next_location.is_valid(src) || current_location.cannot_depart(src))
+ process_state = IDLE_STATE
+ in_use = null
+ return
+ if (get_travel_time() && landmark_transition)
+ . = long_jump(next_location, landmark_transition, get_travel_time())
+ else
+ . = short_jump(next_location)
+ process_state = WAIT_ARRIVE
+
+/*
+ Guards - (These don't take docking status into account, just the state machine and move safety)
+*/
+/datum/shuttle/autodock/proc/can_launch()
+ return (next_location && next_location.is_valid(src) && !current_location.cannot_depart(src) && moving_status == SHUTTLE_IDLE && !in_use)
+
+/datum/shuttle/autodock/proc/can_force()
+ return (next_location && next_location.is_valid(src) && !current_location.cannot_depart(src) && moving_status == SHUTTLE_IDLE && process_state == WAIT_LAUNCH)
+
+/datum/shuttle/autodock/proc/can_cancel()
+ return (moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH || process_state == FORCE_LAUNCH)
+
+/*
+ "Public" procs
+*/
+// Queue shuttle for undock and launch by shuttle subsystem.
+/datum/shuttle/autodock/proc/launch(var/user)
+ if (!can_launch()) return
+
+ in_use = user // Obtain an exclusive lock on the shuttle
+
+ process_state = WAIT_LAUNCH
+ undock()
+
+// Queue shuttle for forced undock and launch by shuttle subsystem.
+/datum/shuttle/autodock/proc/force_launch(var/user)
+ if (!can_force()) return
+
+ in_use = user // Obtain an exclusive lock on the shuttle
+
+ process_state = FORCE_LAUNCH
+
+// Cancel queued launch.
+/datum/shuttle/autodock/cancel_launch(var/user)
+ if (!can_cancel()) return
+
+ moving_status = SHUTTLE_IDLE
+ process_state = WAIT_FINISH
+ in_use = null
+
+ // Whatever we were doing with docking: stop it, then redock
+ force_undock()
+ spawn(1 SECOND)
+ dock()
+
+// Returns 1 if the shuttle is getting ready to move, but is not in transit yet
+/datum/shuttle/autodock/proc/is_launching()
+ return (moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH || process_state == FORCE_LAUNCH)
+
+// /datum/shuttle/autodock/get_location_name() defined in shuttle.dm
+
+/datum/shuttle/autodock/proc/get_destination_name()
+ if(!next_location)
+ return "None"
+ return next_location.name
+
+// This gets called when the shuttle finishes arriving at it's destination
+// This can be used by subtypes to do things when the shuttle arrives.
+// Note that this is called when the shuttle leaves the WAIT_FINISHED state, the proc name is a little misleading
+/datum/shuttle/autodock/proc/arrived()
+ return // Do nothing for now
+
+/obj/effect/shuttle_landmark/transit
+ flags = SLANDMARK_FLAG_ZERO_G
diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm
index 4c4b21650fb..ba4079583d1 100644
--- a/code/modules/shuttles/shuttle_console.dm
+++ b/code/modules/shuttles/shuttle_console.dm
@@ -4,26 +4,23 @@
icon_screen = "shuttle"
circuit = null
- var/shuttle_tag // Used to coordinate data in shuttle controller.
- var/hacked = 0 // Has been emagged, no access restrictions.
+ var/shuttle_tag // Used to coordinate data in shuttle controller.
+ var/hacked = 0 // Has been emagged, no access restrictions.
+
+ var/ui_template = "shuttle_control_console.tmpl"
/obj/machinery/computer/shuttle_control/attack_hand(user as mob)
if(..(user))
return
- //src.add_fingerprint(user) //shouldn't need fingerprints just for looking at it.
+ //src.add_fingerprint(user) // Shouldn't need fingerprints just for looking at it.
if(!allowed(user))
- to_chat(user, "Access Denied.")
+ to_chat(user, "Access Denied.")
return 1
ui_interact(user)
-/obj/machinery/computer/shuttle_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
- var/data[0]
- var/datum/shuttle/ferry/shuttle = SSshuttle.shuttles[shuttle_tag]
- if (!istype(shuttle))
- return
-
+/obj/machinery/computer/shuttle_control/proc/get_ui_data(var/datum/shuttle/autodock/shuttle)
var/shuttle_state
switch(shuttle.moving_status)
if(SHUTTLE_IDLE) shuttle_state = "idle"
@@ -33,55 +30,100 @@
var/shuttle_status
switch (shuttle.process_state)
if(IDLE_STATE)
+ var/cannot_depart = shuttle.current_location.cannot_depart(shuttle)
if (shuttle.in_use)
shuttle_status = "Busy."
- else if (!shuttle.location)
- shuttle_status = "Standing-by at station."
+ else if(cannot_depart)
+ shuttle_status = cannot_depart
else
- shuttle_status = "Standing-by at offsite location."
+ shuttle_status = "Standing-by at \the [shuttle.get_location_name()]."
+
if(WAIT_LAUNCH, FORCE_LAUNCH)
shuttle_status = "Shuttle has received command and will depart shortly."
if(WAIT_ARRIVE)
- shuttle_status = "Proceeding to destination."
+ shuttle_status = "Proceeding to \the [shuttle.get_destination_name()]."
if(WAIT_FINISH)
shuttle_status = "Arriving at destination now."
- data = list(
+ return list(
"shuttle_status" = shuttle_status,
"shuttle_state" = shuttle_state,
- "has_docking" = shuttle.docking_controller? 1 : 0,
- "docking_status" = shuttle.docking_controller? shuttle.docking_controller.get_docking_status() : null,
- "docking_override" = shuttle.docking_controller? shuttle.docking_controller.override_enabled : null,
+ "has_docking" = shuttle.shuttle_docking_controller ? 1 : 0,
+ "docking_status" = shuttle.shuttle_docking_controller?.get_docking_status(),
+ "docking_override" = shuttle.shuttle_docking_controller?.override_enabled,
"can_launch" = shuttle.can_launch(),
"can_cancel" = shuttle.can_cancel(),
"can_force" = shuttle.can_force(),
+ "docking_codes" = shuttle.docking_codes
)
- ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
-
- if (!ui)
- ui = new(user, src, ui_key, "shuttle_control_console.tmpl", "[shuttle_tag] Shuttle Control", 470, 310)
- ui.set_initial_data(data)
- ui.open()
- ui.set_auto_update(1)
+// This is a subset of the actual checks; contains those that give messages to the user.
+// This enables us to give nice error messages as well as not even bother proceeding if we can't.
+/obj/machinery/computer/shuttle_control/proc/can_move(var/datum/shuttle/autodock/shuttle, var/user)
+ var/cannot_depart = shuttle.current_location.cannot_depart(shuttle)
+ if(cannot_depart)
+ to_chat(user, "[cannot_depart]")
+ log_shuttle("Shuttle [shuttle] cannot depart [shuttle.current_location] because: [cannot_depart].")
+ return FALSE
+ if(!shuttle.next_location.is_valid(shuttle))
+ to_chat(user, "Destination zone is invalid or obstructed.")
+ log_shuttle("Shuttle [shuttle] destination [shuttle.next_location] is invalid.")
+ return FALSE
+ return TRUE
/obj/machinery/computer/shuttle_control/Topic(href, href_list)
- if(..())
- return 1
+ if((. = ..()))
+ return
usr.set_machine(src)
src.add_fingerprint(usr)
- var/datum/shuttle/ferry/shuttle = SSshuttle.shuttles[shuttle_tag]
- if (!istype(shuttle))
- return
+ var/datum/shuttle/autodock/shuttle = SSshuttle.shuttles[shuttle_tag]
+ if(!shuttle)
+ to_chat(usr, "Unable to establish link with the shuttle.")
+ return handle_topic_href(shuttle, href_list, usr)
+
+/obj/machinery/computer/shuttle_control/proc/handle_topic_href(var/datum/shuttle/autodock/shuttle, var/list/href_list, var/user)
+ if(!istype(shuttle))
+ return TOPIC_NOACTION
if(href_list["move"])
- shuttle.launch(src)
+ if(can_move(shuttle, user))
+ shuttle.launch(src)
+ return TOPIC_REFRESH
+ return TOPIC_HANDLED
+
if(href_list["force"])
- shuttle.force_launch(src)
- else if(href_list["cancel"])
+ if(can_move(shuttle, user))
+ shuttle.force_launch(src)
+ return TOPIC_REFRESH
+ return TOPIC_HANDLED
+
+ if(href_list["cancel"])
shuttle.cancel_launch(src)
+ return TOPIC_REFRESH
+
+ if(href_list["set_codes"])
+ var/newcode = input("Input new docking codes", "Docking codes", shuttle.docking_codes) as text|null
+ if (newcode && CanInteract(usr, global.default_state))
+ shuttle.set_docking_codes(uppertext(newcode))
+ return TOPIC_REFRESH
+
+// We delegate populating data to another proc to make it easier for overriding types to add their data.
+/obj/machinery/computer/shuttle_control/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
+ var/datum/shuttle/autodock/shuttle = SSshuttle.shuttles[shuttle_tag]
+ if (!istype(shuttle))
+ to_chat(user, "Unable to establish link with the shuttle.")
+ return
+
+ var/list/data = get_ui_data(shuttle)
+
+ ui = SSnanoui.try_update_ui(user, src, ui_key, ui, data, force_open)
+ if (!ui)
+ ui = new(user, src, ui_key, ui_template, "[shuttle_tag] Shuttle Control", 470, 310)
+ ui.set_initial_data(data)
+ ui.open()
+ ui.set_auto_update(1)
/obj/machinery/computer/shuttle_control/emag_act(var/remaining_charges, var/mob/user)
if (!hacked)
diff --git a/code/modules/shuttles/shuttle_console_multi.dm b/code/modules/shuttles/shuttle_console_multi.dm
new file mode 100644
index 00000000000..9d6dccad56c
--- /dev/null
+++ b/code/modules/shuttles/shuttle_console_multi.dm
@@ -0,0 +1,34 @@
+/obj/machinery/computer/shuttle_control/multi
+ ui_template = "shuttle_control_console_multi.tmpl"
+
+/obj/machinery/computer/shuttle_control/multi/get_ui_data(var/datum/shuttle/autodock/multi/shuttle)
+ . = ..()
+ if(istype(shuttle))
+ . += list(
+ "destination_name" = shuttle.next_location ? shuttle.next_location.name : "No destination set.",
+ "can_pick" = shuttle.moving_status == SHUTTLE_IDLE,
+ "can_cloak" = shuttle.can_cloak ? 1 : 0,
+ "cloaked" = shuttle.cloaked ? 1 : 0,
+ "legit" = shuttle.legit ? 1 : 0,
+ // "engines_charging" = ((shuttle.last_move + (shuttle.cooldown SECONDS)) > world.time), // Replaced by longer warmup_time
+ )
+
+/obj/machinery/computer/shuttle_control/multi/handle_topic_href(var/datum/shuttle/autodock/multi/shuttle, var/list/href_list)
+ if((. = ..()) != null)
+ return
+
+ if(href_list["pick"])
+ var/dest_key = input("Choose shuttle destination", "Shuttle Destination") as null|anything in shuttle.get_destinations()
+ if(dest_key && CanInteract(usr, global.default_state))
+ shuttle.set_destination(dest_key, usr)
+ return TOPIC_REFRESH
+
+ if(href_list["toggle_cloaked"])
+ if(!shuttle.can_cloak)
+ return TOPIC_HANDLED
+ shuttle.cloaked = !shuttle.cloaked
+ if(shuttle.legit)
+ to_chat(usr, "Ship ATC inhibitor systems have been [(shuttle.cloaked ? "activated. The station will not" : "deactivated. The station will")] be notified of our arrival.")
+ else
+ to_chat(usr, "Ship stealth systems have been [(shuttle.cloaked ? "activated. The station will not" : "deactivated. The station will")] be warned of our arrival.")
+ return TOPIC_REFRESH
diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm
index e06594228f1..5ce5b17ee53 100644
--- a/code/modules/shuttles/shuttle_emergency.dm
+++ b/code/modules/shuttles/shuttle_emergency.dm
@@ -1,72 +1,73 @@
-/datum/shuttle/ferry/emergency
- category = /datum/shuttle/ferry/emergency
+// Formerly /datum/shuttle/ferry/emergency
+/datum/shuttle/autodock/ferry/emergency
+ category = /datum/shuttle/autodock/ferry/emergency
-/datum/shuttle/ferry/emergency/New()
+/datum/shuttle/autodock/ferry/emergency/New()
+ ..()
if(SSemergencyshuttle.shuttle)
CRASH("An emergency shuttle has already been defined.")
SSemergencyshuttle.shuttle = src
- ..()
-/datum/shuttle/ferry/emergency/arrived()
+/datum/shuttle/autodock/ferry/emergency/arrived()
+ . = ..()
if (istype(in_use, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = in_use
C.reset_authorization()
SSemergencyshuttle.shuttle_arrived()
-/datum/shuttle/ferry/emergency/long_jump(var/area/departing, var/area/destination, var/area/interim, var/travel_time, var/direction)
- //world << "shuttle/ferry/emergency/long_jump: departing=[departing], destination=[destination], interim=[interim], travel_time=[travel_time]"
+/datum/shuttle/autodock/ferry/emergency/long_jump(var/destination, var/interim, var/travel_time)
if (!location)
travel_time = SHUTTLE_TRANSIT_DURATION_RETURN
else
travel_time = SHUTTLE_TRANSIT_DURATION
- //update move_time and launch_time so we get correct ETAs
+ // Update move_time and launch_time so we get correct ETAs
move_time = travel_time
SSemergencyshuttle.launch_time = world.time
+ ..(destination, interim, travel_time, direction)
+
+/datum/shuttle/autodock/ferry/emergency/perform_shuttle_move()
+ if (current_location == landmark_station) // Leaving the station
+ spawn(0)
+ emergency_shuttle.departed = 1
+ var/estimated_time = round(emergency_shuttle.estimate_arrival_time()/60,1)
+
+ if (emergency_shuttle.evac)
+ priority_announcement.Announce(replacetext(replacetext(using_map.emergency_shuttle_leaving_dock, "%dock_name%", "[using_map.dock_name]"), "%ETA%", "[estimated_time] minute\s"))
+ else
+ priority_announcement.Announce(replacetext(replacetext(using_map.shuttle_leaving_dock, "%dock_name%", "[using_map.dock_name]"), "%ETA%", "[estimated_time] minute\s"))
..()
-/datum/shuttle/ferry/emergency/move(var/area/origin,var/area/destination)
- ..(origin, destination)
-
- if (origin == area_station) //leaving the station
- SSemergencyshuttle.departed = 1
- var/estimated_time = round(SSemergencyshuttle.estimate_arrival_time()/60,1)
-
- if (SSemergencyshuttle.evac)
- priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.emergency_shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[estimated_time] minute\s"))
- else
- priority_announcement.Announce(replacetext(replacetext(GLOB.using_map.shuttle_leaving_dock, "%dock_name%", "[GLOB.using_map.dock_name]"), "%ETA%", "[estimated_time] minute\s"))
-
-/datum/shuttle/ferry/emergency/can_launch(var/user)
+/datum/shuttle/autodock/ferry/emergency/can_launch(var/user)
if (istype(user, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = user
if (!C.has_authorization())
return 0
return ..()
-/datum/shuttle/ferry/emergency/can_force(var/user)
+/datum/shuttle/autodock/ferry/emergency/can_force(var/user)
if (istype(user, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = user
- //Initiating or cancelling a launch ALWAYS requires authorization, but if we are already set to launch anyways than forcing does not.
- //This is so that people can force launch if the docking controller cannot safely undock without needing X heads to swipe.
+ // Initiating or cancelling a launch ALWAYS requires authorization, but if we are already set to launch anyways than forcing does not.
+ // This is so that people can force launch if the docking controller cannot safely undock without needing X heads to swipe.
if (!(process_state == WAIT_LAUNCH || C.has_authorization()))
return 0
return ..()
-/datum/shuttle/ferry/emergency/can_cancel(var/user)
+/datum/shuttle/autodock/ferry/emergency/can_cancel(var/user)
if (istype(user, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = user
if (!C.has_authorization())
return 0
return ..()
-/datum/shuttle/ferry/emergency/launch(var/user)
+/datum/shuttle/autodock/ferry/emergency/launch(var/user)
if (!can_launch(user)) return
- if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console
+ if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) // If we were given a command by an emergency shuttle console
if (SSemergencyshuttle.autopilot)
SSemergencyshuttle.autopilot = 0
to_chat(world, "Alert: The shuttle autopilot has been overridden. Launch sequence initiated!")
@@ -77,10 +78,10 @@
..(user)
-/datum/shuttle/ferry/emergency/force_launch(var/user)
+/datum/shuttle/autodock/ferry/emergency/force_launch(var/user)
if (!can_force(user)) return
- if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console
+ if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) // If we were given a command by an emergency shuttle console
if (SSemergencyshuttle.autopilot)
SSemergencyshuttle.autopilot = 0
to_chat(world, "Alert: The shuttle autopilot has been overridden. Bluespace drive engaged!")
@@ -91,10 +92,10 @@
..(user)
-/datum/shuttle/ferry/emergency/cancel_launch(var/user)
+/datum/shuttle/autodock/ferry/emergency/cancel_launch(var/user)
if (!can_cancel(user)) return
- if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console
+ if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) // If we were given a command by an emergency shuttle console
if (SSemergencyshuttle.autopilot)
SSemergencyshuttle.autopilot = 0
to_chat(world, "Alert: The shuttle autopilot has been overridden. Launch sequence aborted!")
@@ -117,15 +118,15 @@
return (authorized.len >= req_authorizations || emagged)
/obj/machinery/computer/shuttle_control/emergency/proc/reset_authorization()
- //No need to reset emagged status. If they really want to go back to the station they can.
+ // No need to reset emagged status. If they really want to go back to the station they can.
authorized = initial(authorized)
-//returns 1 if the ID was accepted and a new authorization was added, 0 otherwise
+// Returns 1 if the ID was accepted and a new authorization was added, 0 otherwise
/obj/machinery/computer/shuttle_control/emergency/proc/read_authorization(var/obj/item/ident)
if (!ident || !istype(ident))
return 0
if (authorized.len >= req_authorizations)
- return 0 //don't need any more
+ return 0 // Don't need any more
var/list/access
var/auth_name
@@ -141,7 +142,7 @@
dna_hash = ID.dna_hash
if (!access || !istype(access))
- return 0 //not an ID
+ return 0 // Not an ID
if (dna_hash in authorized)
src.visible_message("\The [src] buzzes. That ID has already been scanned.")
@@ -177,7 +178,7 @@
/obj/machinery/computer/shuttle_control/emergency/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
- var/datum/shuttle/ferry/emergency/shuttle = SSshuttle.shuttles[shuttle_tag]
+ var/datum/shuttle/autodock/ferry/emergency/shuttle = SSshuttle.shuttles[shuttle_tag]
if (!istype(shuttle))
return
@@ -203,7 +204,7 @@
if(WAIT_FINISH)
shuttle_status = "Arriving at destination now."
- //build a list of authorizations
+ // Build a list of authorizations
var/list/auth_list[req_authorizations]
if (!emagged)
@@ -211,7 +212,7 @@
for (var/dna_hash in authorized)
auth_list[i++] = list("auth_name"=authorized[dna_hash], "auth_hash"=dna_hash)
- while (i <= req_authorizations) //fill up the rest of the list with blank entries
+ while (i <= req_authorizations) // Fill up the rest of the list with blank entries
auth_list[i++] = list("auth_name"="", "auth_hash"=null)
else
for (var/i = 1; i <= req_authorizations; i++)
@@ -222,9 +223,9 @@
data = list(
"shuttle_status" = shuttle_status,
"shuttle_state" = shuttle_state,
- "has_docking" = shuttle.docking_controller? 1 : 0,
- "docking_status" = shuttle.docking_controller? shuttle.docking_controller.get_docking_status() : null,
- "docking_override" = shuttle.docking_controller? shuttle.docking_controller.override_enabled : null,
+ "has_docking" = shuttle.active_docking_controller? 1 : 0,
+ "docking_status" = shuttle.active_docking_controller? shuttle.active_docking_controller.get_docking_status() : null,
+ "docking_override" = shuttle.active_docking_controller? shuttle.active_docking_controller.override_enabled : null,
"can_launch" = shuttle.can_launch(src),
"can_cancel" = shuttle.can_cancel(src),
"can_force" = shuttle.can_force(src),
@@ -250,8 +251,8 @@
authorized -= dna_hash
if(!emagged && href_list["scanid"])
- //They selected an empty entry. Try to scan their id.
+ // They selected an empty entry. Try to scan their id.
if (ishuman(usr))
var/mob/living/carbon/human/H = usr
- if (!read_authorization(H.get_active_hand())) //try to read what's in their hand first
+ if (!read_authorization(H.get_active_hand())) // Try to read what's in their hand first
read_authorization(H.wear_id)
diff --git a/code/modules/shuttles/shuttle_ferry.dm b/code/modules/shuttles/shuttle_ferry.dm
index f279ce5d343..dc179c19bd9 100644
--- a/code/modules/shuttles/shuttle_ferry.dm
+++ b/code/modules/shuttles/shuttle_ferry.dm
@@ -1,177 +1,49 @@
-#define DOCK_ATTEMPT_TIMEOUT 200 //how long in ticks we wait before assuming the docking controller is broken or blown up.
+#define DOCK_ATTEMPT_TIMEOUT 200 // How long in ticks we wait before assuming the docking controller is broken or blown up.
-/datum/shuttle/ferry
- var/location = 0 //0 = at area_station, 1 = at area_offsite
- var/direction = 0 //0 = going to station, 1 = going to offsite.
- var/process_state = IDLE_STATE
- var/always_process = FALSE
+/datum/shuttle/autodock/ferry
+ var/location = FERRY_LOCATION_STATION // 0 = at area_station, 1 = at area_offsite
+ var/direction = FERRY_GOING_TO_STATION // 0 = going to station, 1 = going to offsite.
- var/in_use = null //tells the controller whether this shuttle needs processing
+ var/always_process = FALSE // TODO -why should this exist?
- var/area_transition
- var/move_time = 0 //the time spent in the transition area
- var/transit_direction = null //needed for area/move_contents_to() to properly handle shuttle corners - not exactly sure how it works.
+ var/obj/effect/shuttle_landmark/landmark_station // This variable is type-abused initially: specify the landmark_tag, not the actual landmark.
+ var/obj/effect/shuttle_landmark/landmark_offsite // This variable is type-abused initially: specify the landmark_tag, not the actual landmark.
- var/area/area_station
- var/area/area_offsite
- //TODO: change location to a string and use a mapping for area and dock targets.
- var/dock_target_station
- var/dock_target_offsite
+ category = /datum/shuttle/autodock/ferry
- var/last_dock_attempt_time = 0
- category = /datum/shuttle/ferry
+/datum/shuttle/autodock/ferry/New(var/_name)
+ if(landmark_station)
+ landmark_station = SSshuttle.get_landmark(landmark_station)
+ if(landmark_offsite)
+ landmark_offsite = SSshuttle.get_landmark(landmark_offsite)
-/datum/shuttle/ferry/New()
- area_offsite = locate(area_offsite)
- area_station = locate(area_station)
- if(area_transition)
- area_transition = locate(area_transition)
- ..()
+ ..(_name, get_location_waypoint(location))
-/datum/shuttle/ferry/short_jump(var/area/origin,var/area/destination)
- if(isnull(location))
- return
+ next_location = get_location_waypoint(!location)
- if(!destination)
- destination = get_location_area(!location)
- if(!origin)
- origin = get_location_area(location)
-
- direction = !location
- ..(origin, destination)
-
-/datum/shuttle/ferry/long_jump(var/area/departing, var/area/destination, var/area/interim, var/travel_time, var/direction)
- //world << "shuttle/ferry/long_jump: departing=[departing], destination=[destination], interim=[interim], travel_time=[travel_time]"
- if(isnull(location))
- return
-
- if(!destination)
- destination = get_location_area(!location)
- if(!departing)
- departing = get_location_area(location)
-
- direction = !location
- ..(departing, destination, interim, travel_time, direction)
-
-/datum/shuttle/ferry/move(var/area/origin,var/area/destination)
- ..(origin, destination)
-
- if (destination == area_station) location = 0
- if (destination == area_offsite) location = 1
- //if this is a long_jump retain the location we were last at until we get to the new one
-
-/datum/shuttle/ferry/dock()
- ..()
- last_dock_attempt_time = world.time
-
-/datum/shuttle/ferry/proc/get_location_area(location_id = null)
+// Gets the shuttle landmark associated with the given location (defaults to current location)
+/datum/shuttle/autodock/ferry/proc/get_location_waypoint(location_id = null)
if (isnull(location_id))
location_id = location
- if (!location_id)
- return area_station
- return area_offsite
+ if (location_id == FERRY_LOCATION_STATION)
+ return landmark_station
+ return landmark_offsite
-/*
- Please ensure that long_jump() and short_jump() are only called from here. This applies to subtypes as well.
- Doing so will ensure that multiple jumps cannot be initiated in parallel.
-*/
-/datum/shuttle/ferry/process()
- switch(process_state)
- if (WAIT_LAUNCH)
- if (skip_docking_checks() || docking_controller.can_launch())
+/datum/shuttle/autodock/ferry/short_jump(var/destination)
+ direction = !location // Heading away from where we currently are
+ . = ..()
- //world << "shuttle/ferry/process: area_transition=[area_transition], travel_time=[travel_time]"
- if (move_time && area_transition)
- long_jump(interim=area_transition, travel_time=move_time, direction=transit_direction)
- else
- short_jump()
+/datum/shuttle/autodock/ferry/long_jump(var/destination, var/obj/effect/shuttle_landmark/interim, var/travel_time)
+ direction = !location // Heading away from where we currently are
+ . = ..()
- process_state = WAIT_ARRIVE
-
- if (FORCE_LAUNCH)
- if (move_time && area_transition)
- long_jump(interim=area_transition, travel_time=move_time, direction=transit_direction)
- else
- short_jump()
-
- process_state = WAIT_ARRIVE
-
- if (WAIT_ARRIVE)
- if (moving_status == SHUTTLE_IDLE)
- dock()
- in_use = null //release lock
- process_state = WAIT_FINISH
-
- if (WAIT_FINISH)
- if (skip_docking_checks() || docking_controller.docked() || world.time > last_dock_attempt_time + DOCK_ATTEMPT_TIMEOUT)
- process_state = IDLE_STATE
- arrived()
-
-/datum/shuttle/ferry/current_dock_target()
- var/dock_target
- if (!location) //station
- dock_target = dock_target_station
- else
- dock_target = dock_target_offsite
- return dock_target
-
-
-/datum/shuttle/ferry/proc/launch(var/user)
- if (!can_launch()) return
-
- in_use = user //obtain an exclusive lock on the shuttle
-
- process_state = WAIT_LAUNCH
- undock()
-
-/datum/shuttle/ferry/proc/force_launch(var/user)
- if (!can_force()) return
-
- in_use = user //obtain an exclusive lock on the shuttle
-
- process_state = FORCE_LAUNCH
-
-/datum/shuttle/ferry/proc/cancel_launch(var/user)
- if (!can_cancel()) return
-
- moving_status = SHUTTLE_IDLE
- process_state = WAIT_FINISH
- in_use = null
-
- if (docking_controller && !docking_controller.undocked())
- docking_controller.force_undock()
-
- spawn(10)
- dock()
-
- return
-
-/datum/shuttle/ferry/proc/can_launch()
- if (moving_status != SHUTTLE_IDLE)
- return 0
-
- if (in_use)
- return 0
-
- return 1
-
-/datum/shuttle/ferry/proc/can_force()
- if (moving_status == SHUTTLE_IDLE && process_state == WAIT_LAUNCH)
- return 1
- return 0
-
-/datum/shuttle/ferry/proc/can_cancel()
- if (moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH || process_state == FORCE_LAUNCH)
- return 1
- return 0
-
-//returns 1 if the shuttle is getting ready to move, but is not in transit yet
-/datum/shuttle/ferry/proc/is_launching()
- return (moving_status == SHUTTLE_WARMUP || process_state == WAIT_LAUNCH || process_state == FORCE_LAUNCH)
-
-//This gets called when the shuttle finishes arriving at it's destination
-//This can be used by subtypes to do things when the shuttle arrives.
-/datum/shuttle/ferry/proc/arrived()
- return //do nothing for now
+/datum/shuttle/autodock/ferry/perform_shuttle_move()
+ ..()
+ if (current_location == landmark_station) location = FERRY_LOCATION_STATION
+ if (current_location == landmark_offsite) location = FERRY_LOCATION_OFFSITE
+// Once we have arrived where we are going, plot a course back!
+/datum/shuttle/autodock/ferry/process_arrived()
+ ..()
+ next_location = get_location_waypoint(!location)
diff --git a/code/modules/shuttles/shuttle_specops.dm b/code/modules/shuttles/shuttle_specops.dm
index aa59f1533d2..fcb3344405c 100644
--- a/code/modules/shuttles/shuttle_specops.dm
+++ b/code/modules/shuttles/shuttle_specops.dm
@@ -4,59 +4,31 @@
req_access = list(access_cent_specops)
/obj/machinery/computer/shuttle_control/specops/attack_ai(user as mob)
- to_chat(user, "Access Denied.")
+ to_chat(user, "Access Denied.")
return 1
-//for shuttles that may use a different docking port at each location
-/datum/shuttle/ferry/multidock
- var/docking_controller_tag_station
- var/docking_controller_tag_offsite
- var/datum/computer/file/embedded_program/docking/docking_controller_station
- var/datum/computer/file/embedded_program/docking/docking_controller_offsite
- category = /datum/shuttle/ferry/multidock
-
-/datum/shuttle/ferry/multidock/init_docking_controllers()
- if(docking_controller_tag_station)
- docking_controller_station = locate(docking_controller_tag_station)
- if(!istype(docking_controller_station))
- warning("warning: shuttle with docking tag [docking_controller_station] could not find its controller!")
- if(docking_controller_tag_offsite)
- docking_controller_offsite = locate(docking_controller_tag_offsite)
- if(!istype(docking_controller_offsite))
- warning("warning: shuttle with docking tag [docking_controller_offsite] could not find its controller!")
- if (!location)
- docking_controller = docking_controller_station
- else
- docking_controller = docking_controller_offsite
-
-/datum/shuttle/ferry/multidock/move(var/area/origin,var/area/destination)
- ..(origin, destination)
- if (!location)
- docking_controller = docking_controller_station
- else
- docking_controller = docking_controller_offsite
-
-/datum/shuttle/ferry/multidock/specops
- var/specops_return_delay = 6000 //After moving, the amount of time that must pass before the shuttle may move again
- var/specops_countdown_time = 600 //Length of the countdown when moving the shuttle
+// Formerly /datum/shuttle/ferry/multidock/specops
+/datum/shuttle/autodock/ferry/specops
+ var/specops_return_delay = 6000 // After moving, the amount of time that must pass before the shuttle may move again
+ var/specops_countdown_time = 600 // Length of the countdown when moving the shuttle
var/obj/item/radio/intercom/announcer = null
- var/reset_time = 0 //the world.time at which the shuttle will be ready to move again.
+ var/reset_time = 0 // The world.time at which the shuttle will be ready to move again.
var/launch_prep = 0
var/cancel_countdown = 0
- category = /datum/shuttle/ferry/multidock/specops
+ category = /datum/shuttle/autodock/ferry/specops
-/datum/shuttle/ferry/multidock/specops/New()
+/datum/shuttle/autodock/ferry/specops/New()
..()
- announcer = new /obj/item/radio/intercom(null)//We need a fake AI to announce some stuff below. Otherwise it will be wonky.
+ announcer = new /obj/item/radio/intercom(null) // We need a fake AI to announce some stuff below. Otherwise it will be wonky.
announcer.config(list("Response Team" = 0))
-/datum/shuttle/ferry/multidock/specops/proc/radio_announce(var/message)
+/datum/shuttle/autodock/ferry/specops/proc/radio_announce(var/message)
if(announcer)
announcer.autosay(message, "A.L.I.C.E.", "Response Team")
-/datum/shuttle/ferry/multidock/specops/launch(var/user)
+/datum/shuttle/autodock/ferry/specops/launch(var/user)
if (!can_launch())
return
@@ -64,16 +36,17 @@
var/obj/machinery/computer/C = user
if(world.time <= reset_time)
- C.visible_message("[GLOB.using_map.boss_name] will not allow the Special Operations shuttle to launch yet.")
+ C.visible_message("[global.using_map.boss_name] will not allow the Special Operations shuttle to launch yet.")
if (((world.time - reset_time)/10) > 60)
- C.visible_message("[-((world.time - reset_time)/10)/60] minutes remain!")
+ C.visible_message("[-((world.time - reset_time)/10)/60] minutes remain!")
else
- C.visible_message("[-(world.time - reset_time)/10] seconds remain!")
+ C.visible_message("[-(world.time - reset_time)/10] seconds remain!")
return
- C.visible_message("The Special Operations shuttle will depart in [(specops_countdown_time/10)] seconds.")
+ C.visible_message("The Special Operations shuttle will depart in [(specops_countdown_time/10)] seconds.")
- if (location) //returning
+ // Returning
+ if (location)
radio_announce("THE SPECIAL OPERATIONS SHUTTLE IS PREPARING TO RETURN")
else
radio_announce("THE SPECIAL OPERATIONS SHUTTLE IS PREPARING FOR LAUNCH")
@@ -81,31 +54,33 @@
sleep_until_launch()
if (location)
- var/obj/machinery/light/small/readylight/light = locate() in get_location_area()
+ var/obj/machinery/light/small/readylight/light = locate() in shuttle_area
if(light) light.set_state(0)
- //launch
+ // Launch
radio_announce("ALERT: INITIATING LAUNCH SEQUENCE")
..(user)
-/datum/shuttle/ferry/multidock/specops/move(var/area/origin,var/area/destination)
- ..(origin, destination)
+/datum/shuttle/autodock/ferry/specops/perform_shuttle_move()
+ ..()
- spawn(20)
- if (!location) //just arrived home
- for(var/turf/T in get_area_turfs(destination))
+ spawn(2 SECONDS)
+ if (!location)
+ // Just arrived home
+ for(var/turf/T in get_area_turfs(shuttle_area))
var/mob/M = locate(/mob) in T
to_chat(M, "You have arrived at [GLOB.using_map.boss_name]. Operation has ended!")
- else //just left for the station
+ else
+ // Fust left for the station
launch_mauraders()
- for(var/turf/T in get_area_turfs(destination))
+ for(var/turf/T in get_area_turfs(shuttle_area))
var/mob/M = locate(/mob) in T
to_chat(M, "You have arrived at [station_name()]. Commence operation!")
var/obj/machinery/light/small/readylight/light = locate() in T
if(light) light.set_state(1)
-/datum/shuttle/ferry/multidock/specops/cancel_launch()
+/datum/shuttle/autodock/ferry/specops/cancel_launch()
if (!can_cancel())
return
@@ -113,28 +88,27 @@
radio_announce("ALERT: LAUNCH SEQUENCE ABORTED")
if (istype(in_use, /obj/machinery/computer))
var/obj/machinery/computer/C = in_use
- C.visible_message("Launch sequence aborted.")
-
+ C.visible_message("Launch sequence aborted.")
..()
-/datum/shuttle/ferry/multidock/specops/can_launch()
+/datum/shuttle/autodock/ferry/specops/can_launch()
if(launch_prep)
return 0
return ..()
-//should be fine to allow forcing. process_state only becomes WAIT_LAUNCH after the countdown is over.
-///datum/shuttle/ferry/multidock/specops/can_force()
+// Should be fine to allow forcing. process_state only becomes WAIT_LAUNCH after the countdown is over.
+///datum/shuttle/autodock/ferry/specops/can_force()
// return 0
-/datum/shuttle/ferry/multidock/specops/can_cancel()
+/datum/shuttle/autodock/ferry/specops/can_cancel()
if(launch_prep)
return 1
return ..()
-/datum/shuttle/ferry/multidock/specops/proc/sleep_until_launch()
- var/message_tracker[] = list(0,1,2,3,5,10,30,45)//Create a a list with potential time values.
+/datum/shuttle/autodock/ferry/specops/proc/sleep_until_launch()
+ var/message_tracker[] = list(0,1,2,3,5,10,30,45) // Create a a list with potential time values.
var/launch_time = world.time + specops_countdown_time
var/time_until_launch
@@ -148,12 +122,12 @@
// launch_time = world.timeofday + 10 // midnight rollover
time_until_launch = (ticksleft / 10)
- //All this does is announce the time before launch.
- var/rounded_time_left = round(time_until_launch)//Round time so that it will report only once, not in fractions.
- if(rounded_time_left in message_tracker)//If that time is in the list for message announce.
+ // All this does is announce the time before launch.
+ var/rounded_time_left = round(time_until_launch) // Round time so that it will report only once, not in fractions.
+ if(rounded_time_left in message_tracker) // If that time is in the list for message announce.
radio_announce("ALERT: [rounded_time_left] SECOND[(rounded_time_left!=1)?"S":""] REMAIN")
- message_tracker -= rounded_time_left//Remove the number from the list so it won't be called again next cycle.
- //Should call all the numbers but lag could mean some issues. Oh well. Not much I can do about that.
+ message_tracker -= rounded_time_left // Remove the number from the list so it won't be called again next cycle.
+ // Should call all the numbers but lag could mean some issues. Oh well. Not much I can do about that.
sleep(5)
@@ -161,13 +135,13 @@
/proc/launch_mauraders()
- var/area/centcom/specops/special_ops = locate()//Where is the specops area located?
- //Begin Marauder launchpad.
- spawn(0)//So it parallel processes it.
+ var/area/centcom/specops/special_ops = locate() // Where is the specops area located?
+ // Begin Marauder launchpad.
+ spawn(0) // So it parallel processes it.
for(var/obj/machinery/door/blast/M in special_ops)
switch(M.id)
if("ASSAULT0")
- spawn(10)//1 second delay between each.
+ spawn(10) // 1 second delay between each.
M.open()
if("ASSAULT1")
spawn(20)
@@ -188,9 +162,9 @@
for(var/obj/effect/landmark/L in landmarks_list)
if(L.name == "Marauder Exit")
var/obj/effect/portal/P = new(L.loc)
- P.invisibility = 101//So it is not seen by anyone.
- P.failchance = 0//So it has no fail chance when teleporting.
- P.target = pick(spawn_marauder)//Where the marauder will arrive.
+ P.invisibility = 101 // So it is not seen by anyone.
+ P.failchance = 0 // So it has no fail chance when teleporting.
+ P.target = pick(spawn_marauder) // Where the marauder will arrive.
spawn_marauder.Remove(P.target)
sleep(10)
@@ -210,10 +184,10 @@
spawn(40)
M.drive()
- sleep(50)//Doors remain open for 5 seconds.
+ sleep(50) // Doors remain open for 5 seconds.
for(var/obj/machinery/door/blast/M in special_ops)
- switch(M.id)//Doors close at the same time.
+ switch(M.id) // Doors close at the same time.
if("ASSAULT0")
spawn(0)
M.close()
@@ -226,8 +200,8 @@
if("ASSAULT3")
spawn(0)
M.close()
- special_ops.readyreset()//Reset firealarm after the team launched.
- //End Marauder launchpad.
+ special_ops.readyreset() // Reset firealarm after the team launched.
+ // End Marauder launchpad.
/obj/machinery/light/small/readylight
brightness_range = 5
diff --git a/code/modules/shuttles/shuttle_supply.dm b/code/modules/shuttles/shuttle_supply.dm
index bd51066c3c5..1d6c3dfc785 100644
--- a/code/modules/shuttles/shuttle_supply.dm
+++ b/code/modules/shuttles/shuttle_supply.dm
@@ -1,82 +1,81 @@
-/datum/shuttle/ferry/supply
- var/away_location = 1 //the location to hide at while pretending to be in-transit
+// Formerly /datum/shuttle/ferry/supply
+/datum/shuttle/autodock/ferry/supply
+ var/away_location = FERRY_LOCATION_OFFSITE // The location to hide at while pretending to be in-transit
var/late_chance = 80
var/max_late_time = 300
- category = /datum/shuttle/ferry/supply
+ flags = SHUTTLE_FLAGS_PROCESS|SHUTTLE_FLAGS_SUPPLY
+ category = /datum/shuttle/autodock/ferry/supply
-/datum/shuttle/ferry/supply/short_jump(var/area/origin,var/area/destination)
+/datum/shuttle/autodock/ferry/supply/short_jump(var/obj/effect/shuttle_landmark/destination)
if(moving_status != SHUTTLE_IDLE)
return
if(isnull(location))
return
- if(!destination)
- destination = get_location_area(!location)
- if(!origin)
- origin = get_location_area(location)
-
- //it would be cool to play a sound here
+ // It would be cool to play a sound here
moving_status = SHUTTLE_WARMUP
spawn(warmup_time*10)
- make_sounds(origin, HYPERSPACE_WARMUP)
- sleep(5 SECONDS) // so the sound finishes.
+ make_sounds(HYPERSPACE_WARMUP)
+ sleep(5 SECONDS) // So the sound finishes.
if (moving_status == SHUTTLE_IDLE)
- make_sounds(origin, HYPERSPACE_END)
- return //someone cancelled the launch
+ make_sounds(HYPERSPACE_END)
+ return // Someone cancelled the launch
if (at_station() && forbidden_atoms_check())
- //cancel the launch because of forbidden atoms. announce over supply channel?
+ // Cancel the launch because of forbidden atoms. announce over supply channel?
moving_status = SHUTTLE_IDLE
- make_sounds(origin, HYPERSPACE_END)
+ make_sounds(HYPERSPACE_END)
return
- if (!at_station()) //at centcom
+ if (!at_station()) // At centcom
SSsupply.buy()
- //We pretend it's a long_jump by making the shuttle stay at centcom for the "in-transit" period.
- var/area/away_area = get_location_area(away_location)
+ // We pretend it's a long_jump by making the shuttle stay at centcom for the "in-transit" period.
+ var/obj/effect/shuttle_landmark/away_waypoint = get_location_waypoint(away_location)
moving_status = SHUTTLE_INTRANSIT
- //If we are at the away_area then we are just pretending to move, otherwise actually do the move
- if (origin != away_area)
- move(origin, away_area)
+ // If we are at the away_landmark then we are just pretending to move, otherwise actually do the move
+ if (next_location == away_waypoint)
+ attempt_move(away_waypoint)
- //wait ETA here.
+ // Wait ETA here.
arrive_time = world.time + SSsupply.movetime
while (world.time <= arrive_time)
sleep(5)
- if (destination != away_area)
- //late
+ if (next_location != away_waypoint)
+ // Late
if (prob(late_chance))
sleep(rand(0,max_late_time))
- move(away_area, destination)
+ attempt_move(destination)
moving_status = SHUTTLE_IDLE
- make_sounds(destination, HYPERSPACE_END)
+ make_sounds(HYPERSPACE_END)
- if (!at_station()) //at centcom
+ if (!at_station()) // At centcom
SSsupply.sell()
-// returns 1 if the supply shuttle should be prevented from moving because it contains forbidden atoms
+// Returns 1 if the supply shuttle should be prevented from moving because it contains forbidden atoms
/datum/shuttle/ferry/supply/proc/forbidden_atoms_check()
if (!at_station())
- return 0 //if badmins want to send mobs or a nuke on the supply shuttle from centcom we don't care
+ return 0 // If badmins want to send mobs or a nuke on the supply shuttle from centcom we don't care
- return SSsupply.forbidden_atoms_check(get_location_area())
+ for(var/area/A in shuttle_area)
+ if(SSsupply.forbidden_atoms_check(A))
+ return 1
-/datum/shuttle/ferry/supply/proc/at_station()
+/datum/shuttle/autodock/ferry/supply/proc/at_station()
return (!location)
-//returns 1 if the shuttle is idle and we can still mess with the cargo shopping list
-/datum/shuttle/ferry/supply/proc/idle()
+// Returns 1 if the shuttle is idle and we can still mess with the cargo shopping list
+/datum/shuttle/autodock/ferry/supply/proc/idle()
return (moving_status == SHUTTLE_IDLE)
-//returns the ETA in minutes
-/datum/shuttle/ferry/supply/proc/eta_minutes()
+// Returns the ETA in minutes
+/datum/shuttle/autodock/ferry/supply/proc/eta_minutes()
var/ticksleft = arrive_time - world.time
return round(ticksleft/600,1)
diff --git a/code/modules/shuttles/shuttles_multi.dm b/code/modules/shuttles/shuttles_multi.dm
index 0b851f0fffd..e128a6c5802 100644
--- a/code/modules/shuttles/shuttles_multi.dm
+++ b/code/modules/shuttles/shuttles_multi.dm
@@ -1,290 +1,63 @@
//This is a holder for things like the Skipjack and Nuke shuttle.
-/datum/shuttle/multi_shuttle
+// Formerly /datum/shuttle/multi_shuttle
+/datum/shuttle/autodock/multi
+ var/list/destination_tags
+ var/list/destinations_cache = list()
+ var/last_cache_rebuild_time = 0
+ category = /datum/shuttle/autodock/multi
- flags = SHUTTLE_FLAGS_NONE
var/cloaked = FALSE
var/can_cloak = FALSE
+
var/at_origin = 1
- var/returned_home = 0
-// var/move_time = 240
- var/move_time = 60
var/cooldown = 20
- var/last_move = 0 //the time at which we last moved
+ var/last_move = 0 // The time at which we last moved
var/announcer
var/arrival_message
var/departure_message
- var/area/interim
- var/area/last_departed
var/start_location
var/last_location
- var/list/destinations
- var/list/destination_dock_controller_tags = list() //optional, in case the shuttle has multiple docking ports like the ERT shuttle (even though that isn't a multi_shuttle)
- var/list/destination_dock_controllers = list()
- var/list/destination_dock_targets = list()
- var/area/origin
var/return_warning = 0
- var/legit = 0 //VOREStation Add - Whether or not a shuttle is a legit NT shuttle.
- category = /datum/shuttle/multi_shuttle
+ var/legit = FALSE // Whether or not a shuttle is a legit NT shuttle.
-/datum/shuttle/multi_shuttle/New()
- origin = locate(origin)
- interim = locate(interim)
- for(var/destination in destinations)
- destinations[destination] = locate(destinations[destination])
+/datum/shuttle/autodock/multi/New()
..()
+ start_location = current_location
+ last_location = current_location
-/datum/shuttle/multi_shuttle/init_docking_controllers()
- ..()
- for(var/destination in destinations)
- var/controller_tag = destination_dock_controller_tags[destination]
- if(!controller_tag)
- destination_dock_controllers[destination] = docking_controller
- else
- var/datum/computer/file/embedded_program/docking/C = locate(controller_tag)
+/datum/shuttle/autodock/multi/proc/set_destination(var/destination_key, mob/user)
+ if(moving_status != SHUTTLE_IDLE)
+ return
+ next_location = destinations_cache[destination_key]
+ if(!next_location)
+ warning("Shuttle [src] set to destination we can't find: [destination_key]")
- if(!istype(C))
- warning("warning: shuttle with docking tag [controller_tag] could not find its controller!")
- else
- destination_dock_controllers[destination] = C
+/datum/shuttle/autodock/multi/proc/get_destinations()
+ if (last_cache_rebuild_time < SSshuttle.last_landmark_registration_time)
+ build_destinations_cache()
+ return destinations_cache
- //might as well set this up here.
- if(origin) last_departed = origin
- last_location = start_location
- //VOREStation Add - Set up origin dock controller
- if(!(start_location in destination_dock_controller_tags))
- destination_dock_controllers[start_location] = docking_controller
- //VOREStation Add End
-/datum/shuttle/multi_shuttle/current_dock_target()
- return destination_dock_targets[last_location]
+/datum/shuttle/autodock/multi/proc/build_destinations_cache()
+ last_cache_rebuild_time = world.time
+ destinations_cache.Cut()
+ for(var/destination_tag in destination_tags)
+ var/obj/effect/shuttle_landmark/landmark = SSshuttle.get_landmark(destination_tag)
+ if (istype(landmark))
+ destinations_cache["[landmark.name]"] = landmark
-/datum/shuttle/multi_shuttle/move(var/area/origin, var/area/destination)
+/datum/shuttle/autodock/multi/perform_shuttle_move()
..()
last_move = world.time
- if (destination == src.origin)
- returned_home = 1
- docking_controller = destination_dock_controllers[last_location]
-
-/datum/shuttle/multi_shuttle/proc/announce_departure()
+/datum/shuttle/autodock/multi/proc/announce_departure()
if(cloaked || isnull(departure_message))
return
+ command_announcement.Announce(departure_message, (announcer ? announcer : "[using_map.boss_name]"))
- command_announcement.Announce(departure_message,(announcer ? announcer : "[GLOB.using_map.boss_name]"))
-
-/datum/shuttle/multi_shuttle/proc/announce_arrival()
+/datum/shuttle/autodock/multi/proc/announce_arrival()
if(cloaked || isnull(arrival_message))
return
-
- command_announcement.Announce(arrival_message,(announcer ? announcer : "[GLOB.using_map.boss_name]"))
-
-
-/obj/machinery/computer/shuttle_control/multi
- icon_keyboard = "syndie_key"
- icon_screen = "syndishuttle"
-
-/obj/machinery/computer/shuttle_control/multi/attack_hand(user as mob)
-
- if(..(user))
- return
- src.add_fingerprint(user)
-
- var/datum/shuttle/multi_shuttle/MS = SSshuttle.shuttles[shuttle_tag]
- if(!istype(MS)) return
-
- var/dat
- dat = "