From 10c70d734535e848642fa144adc554aefe0c6a21 Mon Sep 17 00:00:00 2001 From: Bop Date: Fri, 1 Jul 2022 09:30:00 +0700 Subject: [PATCH 1/9] added sm rad monitor --- .../file_system/programs/sm_monitor.dm | 2 ++ code/modules/power/supermatter/supermatter.dm | 4 +++- .../tgui/interfaces/NtosSupermatterMonitor.js | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index 83bdae25f9a5..ebfd7f3369ae 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -135,12 +135,14 @@ if(data_corrupted) //yes it goes negative, that's even more funny data["SM_integrity"] = active.get_fake_integrity() data["SM_power"] = active.power + round((rand()-0.5)*12000,1) + data["SM_radiation"] = active.last_rads + round((rand()-0.5)*13000,1) data["SM_ambienttemp"] = air.return_temperature() + round((rand()-0.5)*20000,1) data["SM_ambientpressure"] = air.return_pressure() + round((rand()-0.5)*15000,1) data["SM_moles"] = air.total_moles() + round((rand()-0.5)*1800,1) else data["SM_integrity"] = active.get_integrity() data["SM_power"] = active.power + data["SM_radiation"] = active.last_rads data["SM_ambienttemp"] = air.return_temperature() data["SM_ambientpressure"] = air.return_pressure() data["SM_moles"] = air.total_moles() diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index d8e2228bf882..c5c391f11149 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -136,6 +136,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) /// Additonal power to add over time comes from sliver extraction(800) or consuming(200) var/matter_power = 0 + var/last_rads = 0 ///How much the bullets damage should be multiplied by when it is added to the internal variables var/config_bullet_energy = 2 @@ -499,7 +500,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) if(prob(50)) //1 + (tritRad + pluoxDampen * bzDampen * o2Rad * plasmaRad / (10 - bzrads)) - radiation_pulse(src, max((power * (1 + (power_transmission_bonus/(10-(bzcomp * BZ_RADIOACTIVITY_MODIFIER))))) * radmodifier)) //Yogs addition, radmodifier + last_rads = max((power * (1 + (power_transmission_bonus/(10-(bzcomp * BZ_RADIOACTIVITY_MODIFIER))))) * radmodifier) //Yogs addition, radmodifier + radiation_pulse(src, last_rads) if(bzcomp >= 0.4 && prob(50 * bzcomp)) src.fire_nuclear_particle() // Start to emit radballs at a maximum of 50% chance per tick diff --git a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js index de2a021d8564..75165fc0ecd5 100644 --- a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js +++ b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js @@ -30,6 +30,7 @@ export const NtosSupermatterMonitorContent = (props, context) => { SM_ambienttemp, SM_ambientpressure, SM_moles, + SM_radiation, } = data; if (!active) { return ( @@ -68,6 +69,23 @@ export const NtosSupermatterMonitorContent = (props, context) => { {toFixed(SM_power) + ' MeV/cm3'} + + + {toFixed(SM_radiation) + ' Sv/h'} + + Date: Fri, 1 Jul 2022 10:39:52 +0700 Subject: [PATCH 2/9] EMP TIME --- code/modules/power/supermatter/supermatter.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index c5c391f11149..88cc89cdf28f 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -350,6 +350,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) M.rad_act(rads) var/turf/T = get_turf(src) + INVOKE_ASYNC(GLOBAL_PROC, /proc/empulse, T, 200 * max(0.2, gasmix_power_ratio), 300 * max(0.2, gasmix_power_ratio), TRUE, FALSE, FALSE, TRUE) for(var/_M in GLOB.player_list) var/mob/M = _M var/turf/T2 = get_turf(M) From bdcc3bba5d3f53ec14e18dfca1938b0eaadaeeef Mon Sep 17 00:00:00 2001 From: Bop Date: Fri, 1 Jul 2022 11:06:31 +0700 Subject: [PATCH 3/9] Fixes --- tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js index 75165fc0ecd5..2657bd0232a9 100644 --- a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js +++ b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js @@ -78,7 +78,7 @@ export const NtosSupermatterMonitorContent = (props, context) => { // The threshold where enough radiation gets to the // collectors to start generating power. Experimentally // determined, because radiation waves are inscrutable. - grey: [-Infinity, 320], + teal: [-Infinity, 320], good: [320, 5000], average: [5000, 7000], bad: [7000, Infinity], From 223fbc54d13b87c8ac0b0b37479cb641e92df2ee Mon Sep 17 00:00:00 2001 From: Bop Date: Fri, 1 Jul 2022 11:21:59 +0700 Subject: [PATCH 4/9] Changes --- .../modular_computers/file_system/programs/sm_monitor.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index ebfd7f3369ae..821828a09846 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -135,7 +135,7 @@ if(data_corrupted) //yes it goes negative, that's even more funny data["SM_integrity"] = active.get_fake_integrity() data["SM_power"] = active.power + round((rand()-0.5)*12000,1) - data["SM_radiation"] = active.last_rads + round((rand()-0.5)*13000,1) + data["SM_radiation"] = active.last_rads + round((rand()-0.5)*12000,1) data["SM_ambienttemp"] = air.return_temperature() + round((rand()-0.5)*20000,1) data["SM_ambientpressure"] = air.return_pressure() + round((rand()-0.5)*15000,1) data["SM_moles"] = air.total_moles() + round((rand()-0.5)*1800,1) From 41bda62c8b4c33cf5d04eac464d351610498c025 Mon Sep 17 00:00:00 2001 From: Bop Date: Fri, 1 Jul 2022 11:47:31 +0700 Subject: [PATCH 5/9] Please help --- tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js index 2657bd0232a9..f1ce90a6dbd8 100644 --- a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js +++ b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js @@ -78,7 +78,6 @@ export const NtosSupermatterMonitorContent = (props, context) => { // The threshold where enough radiation gets to the // collectors to start generating power. Experimentally // determined, because radiation waves are inscrutable. - teal: [-Infinity, 320], good: [320, 5000], average: [5000, 7000], bad: [7000, Infinity], From a1e8380b3637930c5f115658720ac004bd719a7d Mon Sep 17 00:00:00 2001 From: Bop Date: Fri, 1 Jul 2022 11:50:11 +0700 Subject: [PATCH 6/9] STOP --- .../tgui/interfaces/NtosSupermatterMonitor.js | 419 +++++++++--------- 1 file changed, 213 insertions(+), 206 deletions(-) diff --git a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js index f1ce90a6dbd8..821828a09846 100644 --- a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js +++ b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js @@ -1,206 +1,213 @@ -import { sortBy } from 'common/collections'; -import { flow } from 'common/fp'; -import { toFixed } from 'common/math'; -import { useBackend } from '../backend'; -import { Button, Flex, LabeledList, ProgressBar, Section, Table } from '../components'; -import { getGasColor, getGasLabel } from '../constants'; -import { NtosWindow } from '../layouts'; - -const logScale = value => Math.log2(16 + Math.max(0, value)) - 4; - -export const NtosSupermatterMonitor = (props, context) => { - return ( - - - - - - ); -}; - -export const NtosSupermatterMonitorContent = (props, context) => { - const { act, data } = useBackend(context); - const { - active, - SM_integrity, - SM_power, - SM_ambienttemp, - SM_ambientpressure, - SM_moles, - SM_radiation, - } = data; - if (!active) { - return ( - - ); - } - const gases = flow([ - gases => gases.filter(gas => gas.amount >= 0.01), - sortBy(gas => -gas.amount), - ])(data.gases || []); - const gasMaxAmount = Math.max(1, ...gases.map(gas => gas.amount)); - return ( - - -
- - - - - - - {toFixed(SM_power) + ' MeV/cm3'} - - - - - {toFixed(SM_radiation) + ' Sv/h'} - - - - - {toFixed(SM_ambienttemp) + ' K'} - - - - - {toFixed(SM_ambientpressure) + ' kPa'} - - - - - {toFixed(SM_moles) + ' moles'} - - - -
-
- -
act('PRG_clear')} /> - )}> - - {gases.map(gas => ( - - - {toFixed(gas.amount, 2) + '%'} - - - ))} - -
-
-
- ); -}; - -const SupermatterList = (props, context) => { - const { act, data } = useBackend(context); - const { supermatters = [] } = data; - return ( -
act('PRG_refresh')} /> - )}> - - {supermatters.map(sm => ( - - - {sm.uid + '. ' + sm.area_name} - - - Integrity: - - - - - -
-
- ); -}; +/datum/computer_file/program/supermatter_monitor + filename = "smmonitor" + filedesc = "Supermatter Monitoring" + category = PROGRAM_CATEGORY_ENGI + ui_header = "smmon_0.gif" + program_icon_state = "smmon_0" + extended_desc = "This program connects to specially calibrated supermatter sensors to provide information on the status of supermatter-based engines." + requires_ntnet = TRUE + transfer_access = ACCESS_ENGINE + network_destination = "supermatter monitoring system" + size = 5 + tgui_id = "NtosSupermatterMonitor" + program_icon = "radiation" + alert_able = TRUE + + var/last_status = SUPERMATTER_INACTIVE + var/list/supermatters + var/obj/machinery/power/supermatter_crystal/active // Currently selected supermatter crystal. + var/data_corrupted = FALSE //used for when supermatter corruptor is attached + +/datum/computer_file/program/supermatter_monitor/Destroy() + clear_signals() + active = null + return ..() + +/datum/computer_file/program/supermatter_monitor/process_tick() + ..() + var/new_status = get_status() + if(last_status != new_status) + last_status = new_status + ui_header = "smmon_[last_status].gif" + program_icon_state = "smmon_[last_status]" + if(istype(computer)) + computer.update_icon() + +/datum/computer_file/program/supermatter_monitor/run_program(mob/living/user) + . = ..(user) + if(!(active in GLOB.machines)) + active = null + refresh() + +/datum/computer_file/program/supermatter_monitor/kill_program(forced = FALSE) + supermatters = null + ..() + +// Refreshes list of active supermatter crystals +/datum/computer_file/program/supermatter_monitor/proc/refresh() + supermatters = list() + var/turf/T = get_turf(ui_host()) + if(!T) + return + for(var/obj/machinery/power/supermatter_crystal/S in GLOB.machines) + // Delaminating, not within coverage, not on a tile. + if (!isturf(S.loc) || !(is_station_level(S.z) || is_mining_level(S.z) || S.z == T.z)) + continue + supermatters.Add(S) + + if(!(active in supermatters)) + active = null + +/datum/computer_file/program/supermatter_monitor/proc/get_status() + . = SUPERMATTER_INACTIVE + for(var/obj/machinery/power/supermatter_crystal/S in supermatters) + . = max(., S.get_status()) + +/** + * Sets up the signal listener for Supermatter delaminations. + * + * Unregisters any old listners for SM delams, and then registers one for the SM refered + * to in the `active` variable. This proc is also used with no active SM to simply clear + * the signal and exit. + */ +/datum/computer_file/program/supermatter_monitor/proc/set_signals() + if(active) + RegisterSignal(active, COMSIG_SUPERMATTER_DELAM_ALARM, .proc/send_alert, override = TRUE) + RegisterSignal(active, COMSIG_SUPERMATTER_DELAM_START_ALARM, .proc/send_start_alert, override = TRUE) + +/** + * Removes the signal listener for Supermatter delaminations from the selected supermatter. + * + * Pretty much does what it says. + */ +/datum/computer_file/program/supermatter_monitor/proc/clear_signals() + if(active) + UnregisterSignal(active, COMSIG_SUPERMATTER_DELAM_ALARM) + UnregisterSignal(active, COMSIG_SUPERMATTER_DELAM_START_ALARM) + +/** + * Sends an SM delam alert to the computer. + * + * Triggered by a signal from the selected supermatter, this proc sends a notification + * to the computer if the program is either closed or minimized. We do not send these + * notifications to the comptuer if we're the active program, because engineers fixing + * the supermatter probably don't need constant beeping to distract them. + */ +/datum/computer_file/program/supermatter_monitor/proc/send_alert() + if(!computer.get_ntnet_status()) + return + if(computer.active_program != src) + computer.alert_call(src, "Crystal delamination in progress!") + alert_pending = TRUE + +/** + * Sends an SM delam start alert to the computer. + * + * Triggered by a signal from the selected supermatter at the start of a delamination, + * this proc sends a notification to the computer if this program is the active one. + * We do this so that people carrying a tablet with NT CIMS open but with the NTOS window + * closed will still get one audio alert. This is not sent to computers with the program + * minimized or closed to avoid double-notifications. + */ +/datum/computer_file/program/supermatter_monitor/proc/send_start_alert() + if(!computer.get_ntnet_status()) + return + if(computer.active_program == src) + computer.alert_call(src, "Crystal delamination in progress!") + +/datum/computer_file/program/supermatter_monitor/ui_data() + var/list/data = get_header_data() + + if(istype(active)) + var/turf/T = get_turf(active) + if(!T) + active = null + refresh() + return + var/datum/gas_mixture/air = T.return_air() + if(!air) + active = null + return + if(active.corruptor_attached) + data_corrupted = TRUE + + data["active"] = TRUE + if(data_corrupted) //yes it goes negative, that's even more funny + data["SM_integrity"] = active.get_fake_integrity() + data["SM_power"] = active.power + round((rand()-0.5)*12000,1) + data["SM_radiation"] = active.last_rads + round((rand()-0.5)*12000,1) + data["SM_ambienttemp"] = air.return_temperature() + round((rand()-0.5)*20000,1) + data["SM_ambientpressure"] = air.return_pressure() + round((rand()-0.5)*15000,1) + data["SM_moles"] = air.total_moles() + round((rand()-0.5)*1800,1) + else + data["SM_integrity"] = active.get_integrity() + data["SM_power"] = active.power + data["SM_radiation"] = active.last_rads + data["SM_ambienttemp"] = air.return_temperature() + data["SM_ambientpressure"] = air.return_pressure() + data["SM_moles"] = air.total_moles() + //data["SM_EPR"] = round((air.total_moles / air.group_multiplier) / 23.1, 0.01) + var/list/gasdata = list() + + + if(air.total_moles()) + for(var/gasid in air.get_gases()) + if(data_corrupted) + gasdata.Add(list(list( + "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], + "amount" = round(rand()*100,0.01)))) + else + gasdata.Add(list(list( + "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], + "amount" = round(100*air.get_moles(gasid)/air.total_moles(),0.01)))) + + else + for(var/gasid in air.get_gases()) + gasdata.Add(list(list( + "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], + "amount" = 0))) + + data["gases"] = gasdata + else + var/list/SMS = list() + for(var/obj/machinery/power/supermatter_crystal/S in supermatters) + var/area/A = get_area(S) + if(A) + if(S.corruptor_attached) + SMS.Add(list(list( + "area_name" = A.name, + "integrity" = S.get_fake_integrity(), + "uid" = S.uid + ))) + else + SMS.Add(list(list( + "area_name" = A.name, + "integrity" = S.get_integrity(), + "uid" = S.uid + ))) + + data["active"] = FALSE + data["supermatters"] = SMS + + return data + +/datum/computer_file/program/supermatter_monitor/ui_act(action, params) + if(..()) + return TRUE + computer.play_interact_sound() + + switch(action) + if("PRG_clear") + clear_signals() + active = null + return TRUE + if("PRG_refresh") + refresh() + return TRUE + if("PRG_set") + var/newuid = text2num(params["target"]) + for(var/obj/machinery/power/supermatter_crystal/S in supermatters) + if(S.uid == newuid) + active = S + set_signals() + return TRUE From 237a20c22c938dc388f6b3932d3ad96425731d12 Mon Sep 17 00:00:00 2001 From: Bop Date: Fri, 1 Jul 2022 11:56:43 +0700 Subject: [PATCH 7/9] OMG PLEASE --- .../file_system/programs/sm_monitor.dm | 1 - .../tgui/interfaces/NtosSupermatterMonitor.js | 420 +++++++++--------- 2 files changed, 207 insertions(+), 214 deletions(-) diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index 821828a09846..db5c1131e74e 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -135,7 +135,6 @@ if(data_corrupted) //yes it goes negative, that's even more funny data["SM_integrity"] = active.get_fake_integrity() data["SM_power"] = active.power + round((rand()-0.5)*12000,1) - data["SM_radiation"] = active.last_rads + round((rand()-0.5)*12000,1) data["SM_ambienttemp"] = air.return_temperature() + round((rand()-0.5)*20000,1) data["SM_ambientpressure"] = air.return_pressure() + round((rand()-0.5)*15000,1) data["SM_moles"] = air.total_moles() + round((rand()-0.5)*1800,1) diff --git a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js index 821828a09846..88978cb8d7da 100644 --- a/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js +++ b/tgui/packages/tgui/interfaces/NtosSupermatterMonitor.js @@ -1,213 +1,207 @@ -/datum/computer_file/program/supermatter_monitor - filename = "smmonitor" - filedesc = "Supermatter Monitoring" - category = PROGRAM_CATEGORY_ENGI - ui_header = "smmon_0.gif" - program_icon_state = "smmon_0" - extended_desc = "This program connects to specially calibrated supermatter sensors to provide information on the status of supermatter-based engines." - requires_ntnet = TRUE - transfer_access = ACCESS_ENGINE - network_destination = "supermatter monitoring system" - size = 5 - tgui_id = "NtosSupermatterMonitor" - program_icon = "radiation" - alert_able = TRUE - - var/last_status = SUPERMATTER_INACTIVE - var/list/supermatters - var/obj/machinery/power/supermatter_crystal/active // Currently selected supermatter crystal. - var/data_corrupted = FALSE //used for when supermatter corruptor is attached - -/datum/computer_file/program/supermatter_monitor/Destroy() - clear_signals() - active = null - return ..() - -/datum/computer_file/program/supermatter_monitor/process_tick() - ..() - var/new_status = get_status() - if(last_status != new_status) - last_status = new_status - ui_header = "smmon_[last_status].gif" - program_icon_state = "smmon_[last_status]" - if(istype(computer)) - computer.update_icon() - -/datum/computer_file/program/supermatter_monitor/run_program(mob/living/user) - . = ..(user) - if(!(active in GLOB.machines)) - active = null - refresh() - -/datum/computer_file/program/supermatter_monitor/kill_program(forced = FALSE) - supermatters = null - ..() - -// Refreshes list of active supermatter crystals -/datum/computer_file/program/supermatter_monitor/proc/refresh() - supermatters = list() - var/turf/T = get_turf(ui_host()) - if(!T) - return - for(var/obj/machinery/power/supermatter_crystal/S in GLOB.machines) - // Delaminating, not within coverage, not on a tile. - if (!isturf(S.loc) || !(is_station_level(S.z) || is_mining_level(S.z) || S.z == T.z)) - continue - supermatters.Add(S) - - if(!(active in supermatters)) - active = null - -/datum/computer_file/program/supermatter_monitor/proc/get_status() - . = SUPERMATTER_INACTIVE - for(var/obj/machinery/power/supermatter_crystal/S in supermatters) - . = max(., S.get_status()) - -/** - * Sets up the signal listener for Supermatter delaminations. - * - * Unregisters any old listners for SM delams, and then registers one for the SM refered - * to in the `active` variable. This proc is also used with no active SM to simply clear - * the signal and exit. - */ -/datum/computer_file/program/supermatter_monitor/proc/set_signals() - if(active) - RegisterSignal(active, COMSIG_SUPERMATTER_DELAM_ALARM, .proc/send_alert, override = TRUE) - RegisterSignal(active, COMSIG_SUPERMATTER_DELAM_START_ALARM, .proc/send_start_alert, override = TRUE) - -/** - * Removes the signal listener for Supermatter delaminations from the selected supermatter. - * - * Pretty much does what it says. - */ -/datum/computer_file/program/supermatter_monitor/proc/clear_signals() - if(active) - UnregisterSignal(active, COMSIG_SUPERMATTER_DELAM_ALARM) - UnregisterSignal(active, COMSIG_SUPERMATTER_DELAM_START_ALARM) - -/** - * Sends an SM delam alert to the computer. - * - * Triggered by a signal from the selected supermatter, this proc sends a notification - * to the computer if the program is either closed or minimized. We do not send these - * notifications to the comptuer if we're the active program, because engineers fixing - * the supermatter probably don't need constant beeping to distract them. - */ -/datum/computer_file/program/supermatter_monitor/proc/send_alert() - if(!computer.get_ntnet_status()) - return - if(computer.active_program != src) - computer.alert_call(src, "Crystal delamination in progress!") - alert_pending = TRUE - -/** - * Sends an SM delam start alert to the computer. - * - * Triggered by a signal from the selected supermatter at the start of a delamination, - * this proc sends a notification to the computer if this program is the active one. - * We do this so that people carrying a tablet with NT CIMS open but with the NTOS window - * closed will still get one audio alert. This is not sent to computers with the program - * minimized or closed to avoid double-notifications. - */ -/datum/computer_file/program/supermatter_monitor/proc/send_start_alert() - if(!computer.get_ntnet_status()) - return - if(computer.active_program == src) - computer.alert_call(src, "Crystal delamination in progress!") - -/datum/computer_file/program/supermatter_monitor/ui_data() - var/list/data = get_header_data() - - if(istype(active)) - var/turf/T = get_turf(active) - if(!T) - active = null - refresh() - return - var/datum/gas_mixture/air = T.return_air() - if(!air) - active = null - return - if(active.corruptor_attached) - data_corrupted = TRUE - - data["active"] = TRUE - if(data_corrupted) //yes it goes negative, that's even more funny - data["SM_integrity"] = active.get_fake_integrity() - data["SM_power"] = active.power + round((rand()-0.5)*12000,1) - data["SM_radiation"] = active.last_rads + round((rand()-0.5)*12000,1) - data["SM_ambienttemp"] = air.return_temperature() + round((rand()-0.5)*20000,1) - data["SM_ambientpressure"] = air.return_pressure() + round((rand()-0.5)*15000,1) - data["SM_moles"] = air.total_moles() + round((rand()-0.5)*1800,1) - else - data["SM_integrity"] = active.get_integrity() - data["SM_power"] = active.power - data["SM_radiation"] = active.last_rads - data["SM_ambienttemp"] = air.return_temperature() - data["SM_ambientpressure"] = air.return_pressure() - data["SM_moles"] = air.total_moles() - //data["SM_EPR"] = round((air.total_moles / air.group_multiplier) / 23.1, 0.01) - var/list/gasdata = list() - - - if(air.total_moles()) - for(var/gasid in air.get_gases()) - if(data_corrupted) - gasdata.Add(list(list( - "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], - "amount" = round(rand()*100,0.01)))) - else - gasdata.Add(list(list( - "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], - "amount" = round(100*air.get_moles(gasid)/air.total_moles(),0.01)))) - - else - for(var/gasid in air.get_gases()) - gasdata.Add(list(list( - "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], - "amount" = 0))) - - data["gases"] = gasdata - else - var/list/SMS = list() - for(var/obj/machinery/power/supermatter_crystal/S in supermatters) - var/area/A = get_area(S) - if(A) - if(S.corruptor_attached) - SMS.Add(list(list( - "area_name" = A.name, - "integrity" = S.get_fake_integrity(), - "uid" = S.uid - ))) - else - SMS.Add(list(list( - "area_name" = A.name, - "integrity" = S.get_integrity(), - "uid" = S.uid - ))) - - data["active"] = FALSE - data["supermatters"] = SMS - - return data - -/datum/computer_file/program/supermatter_monitor/ui_act(action, params) - if(..()) - return TRUE - computer.play_interact_sound() - - switch(action) - if("PRG_clear") - clear_signals() - active = null - return TRUE - if("PRG_refresh") - refresh() - return TRUE - if("PRG_set") - var/newuid = text2num(params["target"]) - for(var/obj/machinery/power/supermatter_crystal/S in supermatters) - if(S.uid == newuid) - active = S - set_signals() - return TRUE +import { sortBy } from 'common/collections'; +import { flow } from 'common/fp'; +import { toFixed } from 'common/math'; +import { useBackend } from '../backend'; +import { Button, Flex, LabeledList, ProgressBar, Section, Table } from '../components'; +import { getGasColor, getGasLabel } from '../constants'; +import { NtosWindow } from '../layouts'; + +const logScale = value => Math.log2(16 + Math.max(0, value)) - 4; + +export const NtosSupermatterMonitor = (props, context) => { + return ( + + + + + + ); +}; + +export const NtosSupermatterMonitorContent = (props, context) => { + const { act, data } = useBackend(context); + const { + active, + SM_integrity, + SM_power, + SM_radiation, + SM_ambienttemp, + SM_ambientpressure, + SM_moles, + } = data; + if (!active) { + return ( + + ); + } + const gases = flow([ + gases => gases.filter(gas => gas.amount >= 0.01), + sortBy(gas => -gas.amount), + ])(data.gases || []); + const gasMaxAmount = Math.max(1, ...gases.map(gas => gas.amount)); + return ( + + +
+ + + + + + + {toFixed(SM_power) + ' MeV/cm3'} + + + + + {toFixed(SM_radiation) + ' Sv/h'} + + + + + {toFixed(SM_ambienttemp) + ' K'} + + + + + {toFixed(SM_ambientpressure) + ' kPa'} + + + + + {toFixed(SM_moles) + ' moles'} + + + +
+
+ +
act('PRG_clear')} /> + )}> + + {gases.map(gas => ( + + + {toFixed(gas.amount, 2) + '%'} + + + ))} + +
+
+
+ ); +}; + +const SupermatterList = (props, context) => { + const { act, data } = useBackend(context); + const { supermatters = [] } = data; + return ( +
act('PRG_refresh')} /> + )}> + + {supermatters.map(sm => ( + + + {sm.uid + '. ' + sm.area_name} + + + Integrity: + + + + + +
+
+ ); +}; From 4db6f82fe356fac8cf105995128bf36d6be48ab4 Mon Sep 17 00:00:00 2001 From: Bop Date: Fri, 1 Jul 2022 16:16:38 +0700 Subject: [PATCH 8/9] fixes --- .../modular_computers/file_system/programs/sm_monitor.dm | 3 ++- code/modules/power/supermatter/supermatter.dm | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/code/modules/modular_computers/file_system/programs/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/sm_monitor.dm index db5c1131e74e..ae40497444b7 100644 --- a/code/modules/modular_computers/file_system/programs/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/sm_monitor.dm @@ -134,7 +134,8 @@ data["active"] = TRUE if(data_corrupted) //yes it goes negative, that's even more funny data["SM_integrity"] = active.get_fake_integrity() - data["SM_power"] = active.power + round((rand()-0.5)*12000,1) + data["SM_power"] = active.power + round((rand()-0.5)*12000,1) + data["SM_radiation"] = active.last_rads + round((rand()-0.5)*12000,1) data["SM_ambienttemp"] = air.return_temperature() + round((rand()-0.5)*20000,1) data["SM_ambientpressure"] = air.return_pressure() + round((rand()-0.5)*15000,1) data["SM_moles"] = air.total_moles() + round((rand()-0.5)*1800,1) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 88cc89cdf28f..d09f66d796ba 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -501,8 +501,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) if(prob(50)) //1 + (tritRad + pluoxDampen * bzDampen * o2Rad * plasmaRad / (10 - bzrads)) - last_rads = max((power * (1 + (power_transmission_bonus/(10-(bzcomp * BZ_RADIOACTIVITY_MODIFIER))))) * radmodifier) //Yogs addition, radmodifier - radiation_pulse(src, last_rads) + last_rads = power * (1 + (power_transmission_bonus/(10-(bzcomp * BZ_RADIOACTIVITY_MODIFIER)))) * radmodifier //Yogs addition, radmodifier + radiation_pulse(src, max(last_rads)) if(bzcomp >= 0.4 && prob(50 * bzcomp)) src.fire_nuclear_particle() // Start to emit radballs at a maximum of 50% chance per tick From 4e4b9389977da1abc044bffe94beabe78d2b64c7 Mon Sep 17 00:00:00 2001 From: Bop Date: Sat, 2 Jul 2022 13:04:16 +0700 Subject: [PATCH 9/9] Attempted --- code/modules/power/supermatter/supermatter.dm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index d09f66d796ba..f0b8c48d6584 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -32,6 +32,8 @@ /// How much extra radioactivity to emit #define BZ_RADIOACTIVITY_MODIFIER 5 // Up to 500% rads +#define TRITIUM_RADIOACTIVITY_MODIFIER 3 +#define PLUOXIUM_RADIOACTIVITY_MODIFIER -2 /// Higher == Gas makes the crystal more resistant against heat damage. #define N2O_HEAT_RESISTANCE 6 @@ -461,6 +463,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) var/pluoxiumcomp = max(removed.get_moles(/datum/gas/pluoxium)/combined_gas, 0) var/tritiumcomp = max(removed.get_moles(/datum/gas/tritium)/combined_gas, 0) var/bzcomp = max(removed.get_moles(/datum/gas/bz)/combined_gas, 0) + var/pluoxiumbonus = max(removed.get_moles(/datum/gas/pluoxium)/combined_gas, 0) + // Mole releated calculations var/bzmol = max(removed.get_moles(/datum/gas/bz), 0) @@ -501,7 +505,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) if(prob(50)) //1 + (tritRad + pluoxDampen * bzDampen * o2Rad * plasmaRad / (10 - bzrads)) - last_rads = power * (1 + (power_transmission_bonus/(10-(bzcomp * BZ_RADIOACTIVITY_MODIFIER)))) * radmodifier //Yogs addition, radmodifier + last_rads = power * (1 + (tritiumcomp * TRITIUM_RADIOACTIVITY_MODIFIER) + ((pluoxiumcomp * PLUOXIUM_RADIOACTIVITY_MODIFIER) * pluoxiumbonus) * (power_transmission_bonus/(10-(bzcomp * BZ_RADIOACTIVITY_MODIFIER)))) * radmodifier radiation_pulse(src, max(last_rads)) if(bzcomp >= 0.4 && prob(50 * bzcomp))