mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-09 15:15:34 +01:00
901a1d4450
## About The Pull Request This PR adds USB functionality to temperature pumps, emitters and temperature control unit machines. <img width="1082" height="340" alt="working" src="https://github.com/user-attachments/assets/25e40c17-33ab-4159-b431-b3ccbe83626d" /> ### New USB Components <img width="139" height="101" alt="emitter" src="https://github.com/user-attachments/assets/66580351-6cca-4dfe-9de4-3813cf62678c" /> * Emitter New exposed controls allow you to manually fire a single beam, and get signals whenever it is toggled on/off/fired. It doesn't allow a player to toggle it on/off (must be done physically). ID locking the emitter will also lock out the ability to fire the emitter via USB. <img width="303" height="226" alt="temp pump" src="https://github.com/user-attachments/assets/4d0e6758-d653-4ac1-a080-d8e31d64408d" /> * Temperature Pump This works exactly the same as the other USB controlled pumps, with the addition of setting the heat rate. <img width="267" height="151" alt="temperature control" src="https://github.com/user-attachments/assets/6fff5148-bd70-4a1c-9899-10c997279669" /> * Temperature Control Unit The USB interface now allows this to be remotely turned off and on like the other USB pump interfaces. ## Why It's Good For The Game These three parts are crucial to engineering/atmos projects, and gives experienced players more depth to toy with circuits. ## Changelog 🆑 add: Added USB interface to emitters, temperature pumps and temperature control unit machines /🆑
59 lines
2.1 KiB
Plaintext
59 lines
2.1 KiB
Plaintext
/**
|
|
* USB wiremod interface for emitter machines
|
|
*/
|
|
/obj/item/circuit_component/emitter
|
|
display_name = "Emitter"
|
|
desc = "Allows you to manually fire and get the ready status of an emitter. Must be unlocked to use fired signal."
|
|
|
|
///Manually trigger the emitter
|
|
var/datum/port/input/fire
|
|
|
|
///Send a signal when the emitter is turned on
|
|
var/datum/port/output/turned_on
|
|
///Send a signal when the emitter is turned off
|
|
var/datum/port/output/turned_off
|
|
///Send a signal when the emitter has fired
|
|
var/datum/port/output/has_fired
|
|
|
|
///The component parent object
|
|
var/obj/machinery/power/emitter/attached_emitter
|
|
|
|
/obj/item/circuit_component/emitter/populate_ports()
|
|
fire = add_input_port("Fire", PORT_TYPE_SIGNAL, trigger = PROC_REF(fire_emitter))
|
|
|
|
turned_on = add_output_port("Turned On", PORT_TYPE_SIGNAL)
|
|
turned_off = add_output_port("Turned Off", PORT_TYPE_SIGNAL)
|
|
has_fired = add_output_port("Has Fired", PORT_TYPE_SIGNAL)
|
|
|
|
/obj/item/circuit_component/emitter/register_usb_parent(atom/movable/parent)
|
|
. = ..()
|
|
if(istype(parent, /obj/machinery/power/emitter))
|
|
attached_emitter = parent
|
|
RegisterSignal(attached_emitter, COMSIG_EMITTER_MACHINE_SET_ON, PROC_REF(handle_emitter_activation))
|
|
RegisterSignal(attached_emitter, COMSIG_EMITTER_MACHINE_ON_FIRE, PROC_REF(handle_emitter_on_fire))
|
|
|
|
/obj/item/circuit_component/emitter/unregister_usb_parent(atom/movable/parent)
|
|
UnregisterSignal(attached_emitter, COMSIG_EMITTER_MACHINE_SET_ON)
|
|
UnregisterSignal(attached_emitter, COMSIG_EMITTER_MACHINE_ON_FIRE)
|
|
attached_emitter = null
|
|
return ..()
|
|
|
|
/obj/item/circuit_component/emitter/proc/handle_emitter_activation(datum/source, active)
|
|
SIGNAL_HANDLER
|
|
if(active)
|
|
turned_on.set_output(COMPONENT_SIGNAL)
|
|
else
|
|
turned_off.set_output(COMPONENT_SIGNAL)
|
|
|
|
/obj/item/circuit_component/emitter/proc/handle_emitter_on_fire(datum/source, active)
|
|
SIGNAL_HANDLER
|
|
has_fired.set_output(COMPONENT_SIGNAL)
|
|
|
|
/obj/item/circuit_component/emitter/proc/fire_emitter()
|
|
CIRCUIT_TRIGGER
|
|
if(!attached_emitter)
|
|
return
|
|
if(attached_emitter.locked) // do not fire if emitter is locked
|
|
return
|
|
attached_emitter.fire_beam_pulse()
|