From 59eefab93b6040005c5fd19c2e3cf4f782ea347c Mon Sep 17 00:00:00 2001 From: Blevruz Date: Sun, 23 Jan 2022 01:01:22 +0100 Subject: [PATCH] Adds circuit USB for reflectors (#64037) Reflectors get USB ports. You can put in an angle and, if the reflector is unlocked, it goes to that angle when the component is triggered. Fun new uses for circuits! Fun new uses for the trig module!! We love lasers!!! --- code/game/objects/structures/reflector.dm | 31 +++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/code/game/objects/structures/reflector.dm b/code/game/objects/structures/reflector.dm index c6bdd84c550..6150c7b76da 100644 --- a/code/game/objects/structures/reflector.dm +++ b/code/game/objects/structures/reflector.dm @@ -32,6 +32,10 @@ if(admin) can_rotate = FALSE + + AddComponent(/datum/component/usb_port, list( + /obj/item/circuit_component/reflector, + )) /obj/structure/reflector/examine(mob/user) . = ..() @@ -256,3 +260,30 @@ return else return ..() + +// USB + +/obj/item/circuit_component/reflector + display_name = "Reflector" + desc = "Allows you to adjust the angle of a reflector." + circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL + + ///angle the reflector will be set to at trigger unless locked + var/datum/port/input/angle + + var/obj/structure/reflector/attached_reflector + +/obj/item/circuit_component/reflector/populate_ports() + angle = add_input_port("Angle", PORT_TYPE_NUMBER) + +/obj/item/circuit_component/reflector/register_usb_parent(atom/movable/parent) + . = ..() + if(istype(parent, /obj/structure/reflector)) + attached_reflector = parent + +/obj/item/circuit_component/reflector/unregister_usb_parent(atom/movable/parent) + attached_reflector = null + return ..() + +/obj/item/circuit_component/reflector/input_received(datum/port/input/port) + attached_reflector?.set_angle(angle.value)