Make shuttle control consoles constructable.

- Adds circuit boards for shuttle consoles. (Ferry, Multi, and Overmap).
- Deconstructing a console saves the linked shuttle tag in the board for when it is re-constructed.  New boards start blank but will auto-link if you build the console on a shuttle.
- Boards know what type of shuttle they can control and will only auto-link with a shuttle if it is the appropriate type.

Note: By default the only mapped-in shuttle consoles that are deconstrutable are overmap and multi shuttle consoles.   For any others, consoles built mid-game will be deconstrutable but the mapped-in ones will not.  That way the arrival, escape, supply ferry shuttles etc won't be messed with unless the mapper specifically chooses to override and make them that way.
This commit is contained in:
Leshana
2020-04-11 19:53:35 -04:00
parent 13d4144bc1
commit 4d9cc39664
4 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
#ifndef T_BOARD
#error T_BOARD macro is not defined but we need it!
#endif
//
// Shuttle control console. Board tries to auto-link the computer if built on a shuttle.
//
/obj/item/weapon/circuitboard/shuttle_console
origin_tech = list(TECH_DATA = 3)
var/shuttle_category = null // Shuttle datum's category must exactly equal this to auto-detect
var/shuttle_tag = null // If set, link constructed console to this shuttle. If null, auto-detect.
/obj/item/weapon/circuitboard/shuttle_console/deconstruct(obj/machinery/computer/shuttle_control/M)
shuttle_tag = M.shuttle_tag
if(shuttle_tag)
name = T_BOARD("[shuttle_tag] control console")
// Try to auto-link the shuttle computer if it is constructed on a shuttle (and not pre-programmed)
/obj/item/weapon/circuitboard/shuttle_console/construct(obj/machinery/computer/shuttle_control/M)
if(!shuttle_tag)
shuttle_tag = auto_detect_shuttle(M) // We don't have a preset tag, so lets try to auto-link.
if(shuttle_tag && M.set_shuttle_tag(shuttle_tag))
log_and_message_admins("[key_name_admin(usr)] built a [M] for [shuttle_tag] at [ADMIN_COORDJMP(M)]")
M.ping("[M] auto-links with shuttle [shuttle_tag]")
// Return shuttle_tag of shuttle of current area
/obj/item/weapon/circuitboard/shuttle_console/proc/auto_detect_shuttle(obj/machinery/computer/shuttle_control/M)
var/area/A = get_area(M)
if(!A || !(A in SSshuttles.shuttle_areas))
return // Definately not on a shuttle
for(var/shuttle_name in SSshuttles.shuttles)
var/datum/shuttle/S = SSshuttles.shuttles[shuttle_name]
if(A in S.find_childfree_areas())
// Found the owning shuttle! Return it if its a valid type
return (S.category == shuttle_category) ? S.name : null
// Overmap shuttle console.
/obj/item/weapon/circuitboard/shuttle_console/explore
name = T_BOARD("long range shuttle control console")
build_path = /obj/machinery/computer/shuttle_control/explore
origin_tech = list(TECH_DATA = 3, TECH_BLUESPACE = 4)
shuttle_category = /datum/shuttle/autodock/overmap
// Multi-shuttle console
/obj/item/weapon/circuitboard/shuttle_console/multi
name = T_BOARD("multi-route shuttle control console")
build_path = /obj/machinery/computer/shuttle_control/multi
shuttle_category = /datum/shuttle/autodock/multi
// Basic "ferry" shuttle console
/obj/item/weapon/circuitboard/shuttle_console/ferry
name = T_BOARD("basic shuttle control console")
build_path = /obj/machinery/computer/shuttle_control
shuttle_category = /datum/shuttle/autodock/ferry

View File

@@ -1,6 +1,7 @@
//Shuttle controller computer for shuttles going between sectors
/obj/machinery/computer/shuttle_control/explore
name = "general shuttle control console"
circuit = /obj/item/weapon/circuitboard/shuttle_console/explore
ui_template = "shuttle_control_console_exploration.tmpl"
/obj/machinery/computer/shuttle_control/explore/get_ui_data(var/datum/shuttle/autodock/overmap/shuttle)

View File

@@ -1,4 +1,5 @@
/obj/machinery/computer/shuttle_control/multi
circuit = /obj/item/weapon/circuitboard/shuttle_console/multi
ui_template = "shuttle_control_console_multi.tmpl"
/obj/machinery/computer/shuttle_control/multi/get_ui_data(var/datum/shuttle/autodock/multi/shuttle)

View File

@@ -1197,6 +1197,7 @@
#include "code\game\objects\items\weapons\circuitboards\computer\camera_monitor.dm"
#include "code\game\objects\items\weapons\circuitboards\computer\computer.dm"
#include "code\game\objects\items\weapons\circuitboards\computer\research.dm"
#include "code\game\objects\items\weapons\circuitboards\computer\shuttle.dm"
#include "code\game\objects\items\weapons\circuitboards\computer\supply.dm"
#include "code\game\objects\items\weapons\circuitboards\computer\telecomms.dm"
#include "code\game\objects\items\weapons\circuitboards\machinery\biogenerator.dm"