diff --git a/code/controllers/subsystems/shuttles.dm b/code/controllers/subsystems/shuttles.dm index 27bbbae027..907701f0bf 100644 --- a/code/controllers/subsystems/shuttles.dm +++ b/code/controllers/subsystems/shuttles.dm @@ -84,6 +84,7 @@ SUBSYSTEM_DEF(shuttles) if(shuttle) shuttles_made += shuttle hook_up_motherships(shuttles_made) + hook_up_shuttle_objects(shuttles_made) shuttles_to_initialize = null /datum/controller/subsystem/shuttles/proc/initialize_sectors() @@ -165,6 +166,11 @@ SUBSYSTEM_DEF(shuttles) else error("Shuttle [S] was unable to find mothership [mothership]!") +// Let shuttles scan their owned areas for objects they want to configure (Called after mothership hookup) +/datum/controller/subsystem/shuttles/proc/hook_up_shuttle_objects(shuttles_list) + for(var/datum/shuttle/S in shuttles_list) + S.populate_shuttle_objects() + // Admin command to halt/resume overmap /datum/controller/subsystem/shuttles/proc/toggle_overmap(new_setting) if(overmap_halted == new_setting) diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index 27f8759770..27c2c8b284 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -74,6 +74,16 @@ SSsupply.shuttle = null . = ..() +// This is called after all shuttles have been initialized by SSshuttles, but before sectors have been initialized. +// Importantly for subtypes, all shuttles will have been initialized and mothershuttles hooked up by the time this is called. +/datum/shuttle/proc/populate_shuttle_objects() + // Scan for shuttle consoles on them needing auto-config. + for(var/area/A in find_childfree_areas()) // Let sub-shuttles handle their areas, only do our own. + for(var/obj/machinery/computer/shuttle_control/SC in A) + if(!SC.shuttle_tag) + SC.set_shuttle_tag(src.name) + return + // This creates a graphical warning to where the shuttle is about to land, in approximately five seconds. /datum/shuttle/proc/create_warning_effect(var/obj/effect/shuttle_landmark/destination) destination.create_warning_effect(src) diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index f8c2a8210d..e07166799b 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -126,6 +126,13 @@ ui.open() ui.set_auto_update(1) +// Call to set the linked shuttle tag; override to add behaviour to shuttle tag changes +/obj/machinery/computer/shuttle_control/proc/set_shuttle_tag(var/new_shuttle_tag) + if(shuttle_tag == new_shuttle_tag) + return FALSE + shuttle_tag = new_shuttle_tag + return TRUE + /obj/machinery/computer/shuttle_control/emag_act(var/remaining_charges, var/mob/user) if (!hacked) req_access = list()