diff --git a/code/game/objects/items/weapons/circuitboards/computer/shuttle.dm b/code/game/objects/items/weapons/circuitboards/computer/shuttle.dm new file mode 100644 index 0000000000..1c3c0ec25f --- /dev/null +++ b/code/game/objects/items/weapons/circuitboards/computer/shuttle.dm @@ -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 diff --git a/code/modules/overmap/ships/computers/shuttle.dm b/code/modules/overmap/ships/computers/shuttle.dm index 726c339178..42904d2a42 100644 --- a/code/modules/overmap/ships/computers/shuttle.dm +++ b/code/modules/overmap/ships/computers/shuttle.dm @@ -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) diff --git a/code/modules/shuttles/shuttle_console_multi.dm b/code/modules/shuttles/shuttle_console_multi.dm index 9d6dccad56..9a724a9ab7 100644 --- a/code/modules/shuttles/shuttle_console_multi.dm +++ b/code/modules/shuttles/shuttle_console_multi.dm @@ -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) diff --git a/polaris.dme b/polaris.dme index c206d68cfd..411da42e33 100644 --- a/polaris.dme +++ b/polaris.dme @@ -1057,6 +1057,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"