import { Fragment } from 'inferno'; import { useBackend } from '../backend'; import { Box, Button, Flex, LabeledList, Slider, Section } from '../components'; import { Window } from '../layouts'; export const GeneralAtmoControl = (props, context) => { const { act, data } = useBackend(context); // While many of these variables are unused, it's helpful to have a consistent // list of all possible parameters in the core component of this UI. // So, keep them here and update them as necessary, pretty please. const { // All sensors, // Tanks /obj/machinery/computer/general_air_control tanks, // Tanks+Core /obj/machinery/computer/general_air_control/large_tank_control input_info, output_info, input_flow_setting, pressure_setting, max_pressure, max_flowrate, // Core /obj/machinery/computer/general_air_control/supermatter_core core, // Fuel /obj/machinery/computer/general_air_control/fuel_injection fuel, automation, device_info, } = data; return ( {(core || tanks) && } {fuel && } ); }; const AtmoControlSensors = (props, context) => { const { act } = useBackend(context); const { sensors } = props; if (!sensors) { return (
No Sensors Connected.
); } else { return (
{sensors.map((sensor) => (
))}
); } }; const AtmoSensor = (props, context) => { const { sensor } = props; if (!sensor.sensor_data) { return UNABLE TO FIND SENSOR; } const { pressure, temperature, oxygen, nitrogen, carbon_dioxide, phoron } = sensor.sensor_data; let labeledListContents = []; if (pressure) { labeledListContents.push({pressure} kPa); } if (temperature) { labeledListContents.push({temperature} K); } if (oxygen || nitrogen || carbon_dioxide || phoron) { labeledListContents.push( {oxygen ? ({oxygen}% O²) : null} {nitrogen ? ({nitrogen}% N²) : null} {carbon_dioxide ? ({carbon_dioxide}% CO²) : null} {phoron ? ({phoron}% TX) : null} ); } return {labeledListContents.map((item) => item)}; }; const AtmoControlTankCore = (props, context) => { const { act, data } = useBackend(context); const { // Tanks /obj/machinery/computer/general_air_control tanks, // Tanks+Core /obj/machinery/computer/general_air_control/large_tank_control input_info, output_info, input_flow_setting, pressure_setting, max_pressure, max_flowrate, // Core /obj/machinery/computer/general_air_control/supermatter_core core, } = data; let sectionName = 'Unknown Control System'; if (tanks) { sectionName = 'Tank Control System'; } else if (core) { sectionName = 'Core Cooling Control System'; } const inputActions = { 'power': () => act('in_toggle_injector'), 'apply': () => act('in_set_flowrate'), 'refresh': () => act('in_refresh_status'), 'slider': (e, val) => act('adj_input_flow_rate', { 'adj_input_flow_rate': val, }), }; const outputActions = { 'power': () => act('out_toggle_power'), 'apply': () => act('out_set_pressure'), 'refresh': () => act('out_refresh_status'), 'slider': (e, val) => act('adj_pressure', { 'adj_pressure': val }), }; return (
); }; const AtmoControlTankCoreControl = (props, context) => { const { info, maxSliderValue, sliderControl, sliderFill, unit, name, limitName, actions } = props; return (
); }; const AtmoControlFuel = (props, context) => { const { act, data } = useBackend(context); const { fuel, automation, device_info } = data; return (
); };