diff --git a/baystation12.dme b/baystation12.dme index b0f8c143381f5..bef2848f2d2b4 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -324,7 +324,6 @@ #include "code\datums\extensions\multitool\store.dm" #include "code\datums\extensions\multitool\circuitboards\buildtype_select.dm" #include "code\datums\extensions\multitool\circuitboards\circuitboards.dm" -#include "code\datums\extensions\multitool\circuitboards\shuttle_console.dm" #include "code\datums\extensions\multitool\circuitboards\stationalert.dm" #include "code\datums\extensions\multitool\items\clothing.dm" #include "code\datums\extensions\multitool\items\items.dm" diff --git a/code/datums/extensions/multitool/circuitboards/shuttle_console.dm b/code/datums/extensions/multitool/circuitboards/shuttle_console.dm deleted file mode 100644 index c3d958c51d85e..0000000000000 --- a/code/datums/extensions/multitool/circuitboards/shuttle_console.dm +++ /dev/null @@ -1,29 +0,0 @@ -/datum/extension/interactive/multitool/circuitboards/shuttle_console - expected_type = /obj/item/stock_parts/circuitboard/shuttle_console - -/datum/extension/interactive/multitool/circuitboards/shuttle_console/get_interact_window(obj/item/device/multitool/M, mob/user) - var/obj/item/stock_parts/circuitboard/shuttle_console/board = holder - var/dat = list() - dat += "Current Selected Shuttle: [board.shuttle_tag || "NONE"]
" - dat += "Synchronize to current shuttle." - return JOINTEXT(dat) - -/datum/extension/interactive/multitool/circuitboards/shuttle_console/on_topic(href, href_list, user) - var/obj/item/stock_parts/circuitboard/shuttle_console/board = holder - if(href_list["sync"]) - var/new_name - for(var/shuttle_name in SSshuttle.shuttles) - var/datum/shuttle/shuttle = SSshuttle.shuttles[shuttle_name] - if(get_area(board) in shuttle.shuttle_area) - new_name = shuttle_name - break - if(!new_name) - to_chat(user, SPAN_WARNING("No eligible shuttle could be located. Make sure the board is inside a shuttle and try again.")) - return MT_NOACTION - if(!board.is_valid_shuttle(SSshuttle.shuttles[new_name])) - to_chat(user, SPAN_WARNING("The current shuttle does not support this console type. Try a different shuttle or circuit board.")) - return MT_NOACTION - board.shuttle_tag = new_name - to_chat(user, SPAN_NOTICE("You set the shuttle name to '[new_name]'")) - return MT_REFRESH - return ..() diff --git a/code/game/objects/items/weapons/circuitboards/computer/shuttle.dm b/code/game/objects/items/weapons/circuitboards/computer/shuttle.dm index 23734ac651316..d2e97106b6c3d 100644 --- a/code/game/objects/items/weapons/circuitboards/computer/shuttle.dm +++ b/code/game/objects/items/weapons/circuitboards/computer/shuttle.dm @@ -2,24 +2,7 @@ name = "circuit board (basic shuttle console)" build_path = /obj/machinery/computer/shuttle_control origin_tech = list(TECH_DATA = 3) - var/shuttle_tag - -/obj/item/stock_parts/circuitboard/shuttle_console/construct(obj/machinery/computer/shuttle_control/M) - M.shuttle_tag = shuttle_tag - -/obj/item/stock_parts/circuitboard/shuttle_console/deconstruct(obj/machinery/computer/shuttle_control/M) - shuttle_tag = M.shuttle_tag - -/obj/item/stock_parts/circuitboard/shuttle_console/Initialize() - set_extension(src, /datum/extension/interactive/multitool/circuitboards/shuttle_console) - . = ..() - -/obj/item/stock_parts/circuitboard/shuttle_console/proc/is_valid_shuttle(datum/shuttle/shuttle) - return TRUE /obj/item/stock_parts/circuitboard/shuttle_console/explore name = "circuit board (long range shuttle console)" build_path = /obj/machinery/computer/shuttle_control/explore - -/obj/item/stock_parts/circuitboard/shuttle_console/explore/is_valid_shuttle(datum/shuttle/shuttle) - return istype(shuttle, /datum/shuttle/autodock/overmap) diff --git a/code/modules/overmap/ships/computers/shuttle.dm b/code/modules/overmap/ships/computers/shuttle.dm index 8cccaa32de6f9..d71b2a2998bf9 100644 --- a/code/modules/overmap/ships/computers/shuttle.dm +++ b/code/modules/overmap/ships/computers/shuttle.dm @@ -6,6 +6,11 @@ machine_name = "long range shuttle console" machine_desc = "Used to control spacecraft that are designed to move between local sectors in open space." + +/obj/machinery/computer/shuttle_control/explore/is_valid_shuttle(datum/shuttle/shuttle) + return istype(shuttle, /datum/shuttle/autodock/overmap) + + /obj/machinery/computer/shuttle_control/explore/get_ui_data(datum/shuttle/autodock/overmap/shuttle) . = ..() if(istype(shuttle)) diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index 752bbd43336f3..88029386e4e41 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -7,12 +7,45 @@ machine_name = "basic shuttle console" machine_desc = "A simple control system for small spacecraft, allowing automated movement from one navigation point to another." - var/shuttle_tag // Used to coordinate data in shuttle controller. + /// Used to coordinate data in shuttle controller. Set by `sync_shuttle()`. + var/shuttle_tag var/hacked = 0 // Has been emagged, no access restrictions. var/ui_template = "shuttle_control_console.tmpl" +/obj/machinery/computer/shuttle_control/Initialize(mapload, init_shuttle_tag) + . = ..() + if (init_shuttle_tag) + shuttle_tag = init_shuttle_tag + if (!shuttle_tag) + sync_shuttle() + + +/obj/machinery/computer/shuttle_control/on_update_icon() + icon_screen = shuttle_tag ? initial(icon_screen) : "shuttle_error" + ..() + + +/// Sets `shuttle_tag` to a new value based on the computer's current area, or to `null` if the area is not a valid shuttle. +/obj/machinery/computer/shuttle_control/proc/sync_shuttle() + shuttle_tag = null + var/area/current_area = get_area(src) + for (var/shuttle_name in SSshuttle.shuttles) + var/datum/shuttle/shuttle = SSshuttle.shuttles[shuttle_name] + if (!(current_area in shuttle.shuttle_area)) + continue + if (!is_valid_shuttle(SSshuttle.shuttles[shuttle_name])) + break + shuttle_tag = shuttle_name + break + + +/// Determines whether the given shuttle datum is valid for this computer. +/obj/machinery/computer/shuttle_control/proc/is_valid_shuttle(datum/shuttle/shuttle) + return !istype(shuttle, /datum/shuttle/autodock/overmap) + + /obj/machinery/computer/shuttle_control/interface_interact(mob/user) ui_interact(user) return TRUE diff --git a/icons/obj/machines/computer.dmi b/icons/obj/machines/computer.dmi index 53d576b2bdaa9..ead1dbe2b9255 100644 Binary files a/icons/obj/machines/computer.dmi and b/icons/obj/machines/computer.dmi differ