From 2dbbd59888d4a3f7f4d9c4042cdc5c05c491de53 Mon Sep 17 00:00:00 2001 From: Dunkhan Date: Sun, 29 Oct 2017 14:46:14 +0100 Subject: [PATCH 1/4] Added a set of atmospheric analysis sensors to the integrated electronics module --- .../integrated_electronics/subtypes/input.dm | 232 ++++++++++++++++++ 1 file changed, 232 insertions(+) diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index d752f0d5cd9..17dbf51cbda 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -619,3 +619,235 @@ activate_pin(2) +/obj/item/integrated_circuit/input/atmo_scanner + name = "integrated atmospheric analyser" + desc = "The same atmospheric analysis module that is integrate into every pda. \ + This allows the machine to know the composition, temperature and pressure of the surrounding atmosphere." + icon_state = "medscan_adv" + complexity = 9 + inputs = list() + outputs = list( + "pressure" = IC_PINTYPE_NUMBER, + "temperature" = IC_PINTYPE_NUMBER, + "oxygen" = IC_PINTYPE_NUMBER, + "nitrogen" = IC_PINTYPE_NUMBER, + "carbon dioxide" = IC_PINTYPE_NUMBER, + "phoron" = IC_PINTYPE_NUMBER, + "other" = IC_PINTYPE_NUMBER, + ) + activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) + spawn_flags = IC_SPAWN_RESEARCH + origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3) + power_draw_per_use = 60 + +/obj/item/integrated_circuit/input/atmo_scanner/do_work() + var/turf/T = get_turf(src) + if(!istype(T)) //Invalid input + return + var/datum/gas_mixture/environment = T.return_air() + + var/pressure = environment.return_pressure() + var/total_moles = environment.total_moles + + if (total_moles) + var/o2_level = environment.gas["oxygen"]/total_moles + var/n2_level = environment.gas["nitrogen"]/total_moles + var/co2_level = environment.gas["carbon_dioxide"]/total_moles + var/phoron_level = environment.gas["phoron"]/total_moles + var/unknown_level = 1-(o2_level+n2_level+co2_level+phoron_level) + set_pin_data(IC_OUTPUT, 1, pressure) + set_pin_data(IC_OUTPUT, 2, round(environment.temperature-T0C,0.1)) + set_pin_data(IC_OUTPUT, 3, round(o2_level*100,0.1)) + set_pin_data(IC_OUTPUT, 4, round(n2_level*100,0.1)) + set_pin_data(IC_OUTPUT, 5, round(co2_level*100,0.1)) + set_pin_data(IC_OUTPUT, 6, round(phoron_level*100,0.01)) + set_pin_data(IC_OUTPUT, 7, round(unknown_level, 0.01)) + else + set_pin_data(IC_OUTPUT, 1, 0) + set_pin_data(IC_OUTPUT, 2, -273.15) + set_pin_data(IC_OUTPUT, 3, 0) + set_pin_data(IC_OUTPUT, 4, 0) + set_pin_data(IC_OUTPUT, 5, 0) + set_pin_data(IC_OUTPUT, 6, 0) + set_pin_data(IC_OUTPUT, 7, 0) + push_data() + activate_pin(2) + +/obj/item/integrated_circuit/input/pressure_sensor + name = "integrated pressure sensor" + desc = "A tiny pressure sensor module similar to that found in a PDA atmosphere analyser" + icon_state = "medscan_adv" + complexity = 3 + inputs = list() + outputs = list( + "pressure" = IC_PINTYPE_NUMBER, + ) + activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) + spawn_flags = IC_SPAWN_RESEARCH + origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3) + power_draw_per_use = 20 + +/obj/item/integrated_circuit/input/pressure_sensor/do_work() + var/turf/T = get_turf(src) + if(!istype(T)) //Invalid input + return + var/datum/gas_mixture/environment = T.return_air() + + var/pressure = environment.return_pressure() + var/total_moles = environment.total_moles + + if (total_moles) + set_pin_data(IC_OUTPUT, 1, pressure) + else + set_pin_data(IC_OUTPUT, 1, 0) + push_data() + activate_pin(2) + +/obj/item/integrated_circuit/input/temperature_sensor + name = "integrated temperature sensor" + desc = "A tiny temperature sensor module similar to that found in a PDA atmosphere analyser" + icon_state = "medscan_adv" + complexity = 3 + inputs = list() + outputs = list( + "temperature" = IC_PINTYPE_NUMBER, + ) + activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) + spawn_flags = IC_SPAWN_RESEARCH + origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3) + power_draw_per_use = 20 + +/obj/item/integrated_circuit/input/temperature_sensor/do_work() + var/turf/T = get_turf(src) + if(!istype(T)) //Invalid input + return + var/datum/gas_mixture/environment = T.return_air() + + var/total_moles = environment.total_moles + + if (total_moles) + set_pin_data(IC_OUTPUT, 1, round(environment.temperature-T0C,0.1)) + else + set_pin_data(IC_OUTPUT, 1, -273.15) + push_data() + activate_pin(2) + +/obj/item/integrated_circuit/input/oxygen_sensor + name = "integrated oxygen sensor" + desc = "A tiny oxygen sensor module similar to that found in a PDA atmosphere analyser" + icon_state = "medscan_adv" + complexity = 3 + inputs = list() + outputs = list( + "oxygen" = IC_PINTYPE_NUMBER, + ) + activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) + spawn_flags = IC_SPAWN_RESEARCH + origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3) + power_draw_per_use = 20 + +/obj/item/integrated_circuit/input/oxygen_sensor/do_work() + var/turf/T = get_turf(src) + if(!istype(T)) //Invalid input + return + var/datum/gas_mixture/environment = T.return_air() + + var/total_moles = environment.total_moles + + if (total_moles) + var/o2_level = environment.gas["oxygen"]/total_moles + set_pin_data(IC_OUTPUT, 1, round(o2_level*100,0.1)) + else + set_pin_data(IC_OUTPUT, 1, 0) + push_data() + activate_pin(2) + +/obj/item/integrated_circuit/input/co2_sensor + name = "integrated co2 sensor" + desc = "A tiny carbon dioxide sensor module similar to that found in a PDA atmosphere analyser" + icon_state = "medscan_adv" + complexity = 3 + inputs = list() + outputs = list( + "co2" = IC_PINTYPE_NUMBER, + ) + activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) + spawn_flags = IC_SPAWN_RESEARCH + origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3) + power_draw_per_use = 20 + +/obj/item/integrated_circuit/input/co2_sensor/do_work() + var/turf/T = get_turf(src) + if(!istype(T)) //Invalid input + return + var/datum/gas_mixture/environment = T.return_air() + + var/total_moles = environment.total_moles + + if (total_moles) + var/co2_level = environment.gas["carbon_dioxide"]/total_moles + set_pin_data(IC_OUTPUT, 1, round(co2_level*100,0.1)) + else + set_pin_data(IC_OUTPUT, 1, 0) + push_data() + activate_pin(2) + +/obj/item/integrated_circuit/input/nitrogen_sensor + name = "integrated nitrogen sensor" + desc = "A tiny nitrogen sensor module similar to that found in a PDA atmosphere analyser" + icon_state = "medscan_adv" + complexity = 3 + inputs = list() + outputs = list( + "nitrogen" = IC_PINTYPE_NUMBER, + ) + activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) + spawn_flags = IC_SPAWN_RESEARCH + origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3) + power_draw_per_use = 20 + +/obj/item/integrated_circuit/input/nitrogen_sensor/do_work() + var/turf/T = get_turf(src) + if(!istype(T)) //Invalid input + return + var/datum/gas_mixture/environment = T.return_air() + + var/total_moles = environment.total_moles + + if (total_moles) + var/n2_level = environment.gas["nitrogen"]/total_moles + set_pin_data(IC_OUTPUT, 1, round(n2_level*100,0.1)) + else + set_pin_data(IC_OUTPUT, 1, 0) + push_data() + activate_pin(2) + +/obj/item/integrated_circuit/input/phoron_sensor + name = "integrated phoron sensor" + desc = "A tiny phoron gas sensor module similar to that found in a PDA atmosphere analyser" + icon_state = "medscan_adv" + complexity = 3 + inputs = list() + outputs = list( + "phoron" = IC_PINTYPE_NUMBER, + ) + activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) + spawn_flags = IC_SPAWN_RESEARCH + origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3) + power_draw_per_use = 20 + +/obj/item/integrated_circuit/input/phoron_sensor/do_work() + var/turf/T = get_turf(src) + if(!istype(T)) //Invalid input + return + var/datum/gas_mixture/environment = T.return_air() + + var/total_moles = environment.total_moles + + if (total_moles) + var/phoron_level = environment.gas["phoron"]/total_moles + set_pin_data(IC_OUTPUT, 1, round(phoron_level*100,0.1)) + else + set_pin_data(IC_OUTPUT, 1, 0) + push_data() + activate_pin(2) \ No newline at end of file From 151e2b8d029b78ad879564beb930f501ed09c39d Mon Sep 17 00:00:00 2001 From: Dunkhan Date: Sun, 29 Oct 2017 15:07:18 +0100 Subject: [PATCH 2/4] Fixed spelling and capitalisation errors --- code/modules/integrated_electronics/subtypes/input.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index 17dbf51cbda..30d1e667578 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -621,7 +621,7 @@ /obj/item/integrated_circuit/input/atmo_scanner name = "integrated atmospheric analyser" - desc = "The same atmospheric analysis module that is integrate into every pda. \ + desc = "The same atmospheric analysis module that is integrated into every PDA. \ This allows the machine to know the composition, temperature and pressure of the surrounding atmosphere." icon_state = "medscan_adv" complexity = 9 From ef40c806be0654a3322564cc95c888eb3deb1b3b Mon Sep 17 00:00:00 2001 From: Dunkhan Date: Sun, 29 Oct 2017 17:34:21 +0100 Subject: [PATCH 3/4] Removed trailing list commas --- .../integrated_electronics/subtypes/input.dm | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index 30d1e667578..d69345fbd38 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -633,7 +633,7 @@ "nitrogen" = IC_PINTYPE_NUMBER, "carbon dioxide" = IC_PINTYPE_NUMBER, "phoron" = IC_PINTYPE_NUMBER, - "other" = IC_PINTYPE_NUMBER, + "other" = IC_PINTYPE_NUMBER ) activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_RESEARCH @@ -680,7 +680,7 @@ complexity = 3 inputs = list() outputs = list( - "pressure" = IC_PINTYPE_NUMBER, + "pressure" = IC_PINTYPE_NUMBER ) activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_RESEARCH @@ -710,7 +710,7 @@ complexity = 3 inputs = list() outputs = list( - "temperature" = IC_PINTYPE_NUMBER, + "temperature" = IC_PINTYPE_NUMBER ) activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_RESEARCH @@ -739,7 +739,7 @@ complexity = 3 inputs = list() outputs = list( - "oxygen" = IC_PINTYPE_NUMBER, + "oxygen" = IC_PINTYPE_NUMBER ) activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_RESEARCH @@ -769,7 +769,7 @@ complexity = 3 inputs = list() outputs = list( - "co2" = IC_PINTYPE_NUMBER, + "co2" = IC_PINTYPE_NUMBER ) activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_RESEARCH @@ -799,7 +799,7 @@ complexity = 3 inputs = list() outputs = list( - "nitrogen" = IC_PINTYPE_NUMBER, + "nitrogen" = IC_PINTYPE_NUMBER ) activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_RESEARCH @@ -829,7 +829,7 @@ complexity = 3 inputs = list() outputs = list( - "phoron" = IC_PINTYPE_NUMBER, + "phoron" = IC_PINTYPE_NUMBER ) activators = list("scan" = IC_PINTYPE_PULSE_IN, "on scanned" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_RESEARCH From c6c015ebbb0f11f8f79bb9bd15c4225ca2f9efba Mon Sep 17 00:00:00 2001 From: Dunkhan Date: Sun, 29 Oct 2017 20:08:44 +0100 Subject: [PATCH 4/4] Added full stops to description text --- .../modules/integrated_electronics/subtypes/input.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index d69345fbd38..00e5bf2ea41 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -675,7 +675,7 @@ /obj/item/integrated_circuit/input/pressure_sensor name = "integrated pressure sensor" - desc = "A tiny pressure sensor module similar to that found in a PDA atmosphere analyser" + desc = "A tiny pressure sensor module similar to that found in a PDA atmosphere analyser." icon_state = "medscan_adv" complexity = 3 inputs = list() @@ -705,7 +705,7 @@ /obj/item/integrated_circuit/input/temperature_sensor name = "integrated temperature sensor" - desc = "A tiny temperature sensor module similar to that found in a PDA atmosphere analyser" + desc = "A tiny temperature sensor module similar to that found in a PDA atmosphere analyser." icon_state = "medscan_adv" complexity = 3 inputs = list() @@ -734,7 +734,7 @@ /obj/item/integrated_circuit/input/oxygen_sensor name = "integrated oxygen sensor" - desc = "A tiny oxygen sensor module similar to that found in a PDA atmosphere analyser" + desc = "A tiny oxygen sensor module similar to that found in a PDA atmosphere analyser." icon_state = "medscan_adv" complexity = 3 inputs = list() @@ -764,7 +764,7 @@ /obj/item/integrated_circuit/input/co2_sensor name = "integrated co2 sensor" - desc = "A tiny carbon dioxide sensor module similar to that found in a PDA atmosphere analyser" + desc = "A tiny carbon dioxide sensor module similar to that found in a PDA atmosphere analyser." icon_state = "medscan_adv" complexity = 3 inputs = list() @@ -794,7 +794,7 @@ /obj/item/integrated_circuit/input/nitrogen_sensor name = "integrated nitrogen sensor" - desc = "A tiny nitrogen sensor module similar to that found in a PDA atmosphere analyser" + desc = "A tiny nitrogen sensor module similar to that found in a PDA atmosphere analyser." icon_state = "medscan_adv" complexity = 3 inputs = list() @@ -824,7 +824,7 @@ /obj/item/integrated_circuit/input/phoron_sensor name = "integrated phoron sensor" - desc = "A tiny phoron gas sensor module similar to that found in a PDA atmosphere analyser" + desc = "A tiny phoron gas sensor module similar to that found in a PDA atmosphere analyser." icon_state = "medscan_adv" complexity = 3 inputs = list()