Files
Bubberstation/code/modules/wiremod/components/sensors/tempsensor.dm
SkyratBot c9b268a72a [MIRROR] Integrated the component printer into the integrated circuit UI. You can now link integrated circuits to component printers [MDB IGNORE] (#9107)
* Integrated the component printer into the integrated circuit UI. You can now link integrated circuits to component printers (#62287)

Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>

* Integrated the component printer into the integrated circuit UI. You can now link integrated circuits to component printers

Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com>
2021-10-28 15:49:34 -04:00

34 lines
923 B
Plaintext

/**
* # Temperature Sensor
*
* Returns the temperature of the tile
*/
/obj/item/circuit_component/tempsensor
display_name = "Temperature Sensor"
desc = "Outputs the current temperature of the tile"
category = "Sensor"
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
/// The result from the output
var/datum/port/output/result
/obj/item/circuit_component/tempsensor/populate_ports()
result = add_output_port("Result", PORT_TYPE_NUMBER)
/obj/item/circuit_component/tempsensor/input_received(datum/port/input/port)
//Get current turf
var/turf/location = get_turf(src)
if(!location)
result.set_output(null)
return
//Get environment info
var/datum/gas_mixture/environment = location.return_air()
var/total_moles = environment.total_moles()
if(total_moles)
//If there's atmos, return temperature
result.set_output(round(environment.temperature,1))
else
result.set_output(0)