////////////////////////////////// // Converter Gate // ////////////////////////////////// /* This gate is special enough to warrant its own file, as it overrides a lot of the logic_gate procs as well as adds a new one. - CONVERT Gates convert signaler and logic signals, to allow logic gates to actually be used in tandem with assemblies and station equipment like doors. - While technically a mono-input device, the input and output are actually completely different types of signals, and thus incompatible without this gate. - A signaler must be attached manually before the gate is fully functional, and will retain any frequency and code settings it had when attached. - You can adjust these settings through a link in the multitool menu, but the receiving mode is automatically controlled by the converter. - While attached, the ability to manually send the signal on the signaler through its menu is also disabled, to avoid messing up the logic system. */ //CONVERT Gate /obj/machinery/logic_gate/convert name = "CONVERT Gate" desc = "Converts signals between radio and logic types, allowing for signaller input/output from logic systems." icon_state = "logic_convert" mono_input = 1 var/logic_output = 0 //When set to 1, the logic signal is the output. When set to 0, the logic signal is the input. var/obj/item/device/assembly/signaler/attached_signaler = null /obj/machinery/logic_gate/convert/handle_logic() output_state = input1_state return /obj/machinery/logic_gate/convert/attackby(obj/item/O, mob/user, params) if(tamperproof) //Extra precaution to avoid people attaching/removing signalers from tamperproofed converters return if(istype(O, /obj/item/device/assembly/signaler)) var/obj/item/device/assembly/signaler/S = O if(S.secured) to_chat(user, "The [S] is already secured.") return if(attached_signaler) to_chat(user, "There is already a device attached, remove it first.") return user.unEquip(S) S.forceMove(src) S.holder = src S.toggle_secure() if(logic_output) //Make sure we are set to receive if the converter is set to output logic, and send if the converter is set to accept logic input S.receiving = 1 else S.receiving = 0 attached_signaler = S to_chat(user, "You attach \the [S] to the I/O connection port and secure it.") return if(attached_signaler && istype(O, /obj/item/weapon/screwdriver)) //Makes sure we remove the attached signaler before we can open up and deconstruct the machine var/obj/item/device/assembly/signaler/S = attached_signaler attached_signaler = null S.forceMove(get_turf(src)) S.holder = null S.toggle_secure() to_chat(user, "You unsecure and detach \the [S] from the I/O connection port.") return ..() /obj/machinery/logic_gate/convert/multitool_menu(var/mob/user, var/obj/item/device/multitool/P) var/logic_state_string var/menu_contents = {"