diff --git a/code/game/machinery/quantum_pad.dm b/code/game/machinery/quantum_pad.dm index 4a978a018c8..0ec9171d298 100644 --- a/code/game/machinery/quantum_pad.dm +++ b/code/game/machinery/quantum_pad.dm @@ -25,6 +25,10 @@ if(map_pad_id) mapped_quantum_pads[map_pad_id] = src + AddComponent(/datum/component/usb_port, list( + /obj/item/circuit_component/quantumpad, + )) + /obj/machinery/quantumpad/Destroy() mapped_quantum_pads -= map_pad_id return ..() @@ -138,7 +142,7 @@ if(linked_pad) ghost.forceMove(get_turf(linked_pad)) -/obj/machinery/quantumpad/proc/doteleport(mob/user, obj/machinery/quantumpad/target_pad = linked_pad) +/obj/machinery/quantumpad/proc/doteleport(mob/user = null, obj/machinery/quantumpad/target_pad = linked_pad) if(target_pad) playsound(get_turf(src), 'sound/weapons/flash.ogg', 25, TRUE) teleporting = TRUE @@ -148,11 +152,13 @@ teleporting = FALSE return if(machine_stat & NOPOWER) - to_chat(user, span_warning("[src] is unpowered!")) + if(user) + to_chat(user, span_warning("[src] is unpowered!")) teleporting = FALSE return if(!target_pad || QDELETED(target_pad) || target_pad.machine_stat & NOPOWER) - to_chat(user, span_warning("Linked pad is not responding to ping. Teleport aborted.")) + if(user) + to_chat(user, span_warning("Linked pad is not responding to ping. Teleport aborted.")) teleporting = FALSE return @@ -196,3 +202,63 @@ /obj/item/paper/guides/quantumpad name = "Quantum Pad For Dummies" info = "
You are now the proud owner of the best conveyor set available for space mail order! We at Nano-it-up know you love to prepare your own structures without wasting time, so we have devised a special streamlined assembly procedure that puts all other mail-order products to shame!
Firstly, you need to link the conveyor switch assembly to each of the conveyor belt assemblies. After doing so, you simply need to install the belt assemblies onto the floor, et voila, belt built. Our special Nano-it-up smart switch will detected any linked assemblies as far as the eye can see! This convenience, you can only have it when you Nano-it-up. Stay nano!
" #undef MAX_CONVEYOR_ITEMS_MOVE + +/obj/item/circuit_component/conveyor_switch + display_name = "Conveyor Switch" + desc = "Allows to control connected conveyor belts." + circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL + + var/datum/port/output/direction + var/obj/machinery/conveyor_switch/attached_switch + +/obj/item/circuit_component/conveyor_switch/Initialize() + . = ..() + direction = add_output_port("Conveyor Direction", PORT_TYPE_NUMBER) + +/obj/item/circuit_component/conveyor_switch/get_ui_notices() + . = ..() + . += create_ui_notice("Conveyor direction 0 means that it is stopped, 1 means that it is active and -1 means that it is working in reverse mode", "orange", "info") + +/obj/item/circuit_component/conveyor_switch/register_usb_parent(atom/movable/parent) + . = ..() + if(istype(parent, /obj/machinery/conveyor_switch)) + attached_switch = parent + +/obj/item/circuit_component/conveyor_switch/unregister_usb_parent(atom/movable/parent) + attached_switch = null + return ..() + +/obj/item/circuit_component/conveyor_switch/input_received(datum/port/input/port) + . = ..() + if(. || !attached_switch) + return + + attached_switch.update_position() + attached_switch.update_appearance() + attached_switch.update_linked_conveyors() + attached_switch.update_linked_switches() + direction.set_output(attached_switch.position)