Setup auto-configuration of shuttle consoles.

- Its now possible to put shuttle consoles on a shuttle without a specific subtype or mapediting the shuttle_tag on them.
- After shtutle initialization, SSshuttles gives each initialized shuttle the chance to scan its areas for consoles it wants to claim and configure.
This commit is contained in:
Leshana
2020-04-04 19:50:31 -04:00
parent bd2a734bc3
commit f23af78ae9
3 changed files with 23 additions and 0 deletions

View File

@@ -84,6 +84,7 @@ SUBSYSTEM_DEF(shuttles)
if(shuttle) if(shuttle)
shuttles_made += shuttle shuttles_made += shuttle
hook_up_motherships(shuttles_made) hook_up_motherships(shuttles_made)
hook_up_shuttle_objects(shuttles_made)
shuttles_to_initialize = null shuttles_to_initialize = null
/datum/controller/subsystem/shuttles/proc/initialize_sectors() /datum/controller/subsystem/shuttles/proc/initialize_sectors()
@@ -165,6 +166,11 @@ SUBSYSTEM_DEF(shuttles)
else else
error("Shuttle [S] was unable to find mothership [mothership]!") 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 // Admin command to halt/resume overmap
/datum/controller/subsystem/shuttles/proc/toggle_overmap(new_setting) /datum/controller/subsystem/shuttles/proc/toggle_overmap(new_setting)
if(overmap_halted == new_setting) if(overmap_halted == new_setting)

View File

@@ -74,6 +74,16 @@
SSsupply.shuttle = null 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. // 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) /datum/shuttle/proc/create_warning_effect(var/obj/effect/shuttle_landmark/destination)
destination.create_warning_effect(src) destination.create_warning_effect(src)

View File

@@ -126,6 +126,13 @@
ui.open() ui.open()
ui.set_auto_update(1) 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) /obj/machinery/computer/shuttle_control/emag_act(var/remaining_charges, var/mob/user)
if (!hacked) if (!hacked)
req_access = list() req_access = list()