mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 12:35:33 +01:00
tgui-next: Turbine computer and station alert console (#47735)
* Turbine computer interface * Station alert console * requested chagne * updated to master
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
icon_screen = "alert:0"
|
||||
icon_keyboard = "atmos_key"
|
||||
circuit = /obj/item/circuitboard/computer/stationalert
|
||||
ui_x = 300
|
||||
ui_x = 325
|
||||
ui_y = 500
|
||||
var/alarms = list("Fire" = list(), "Atmosphere" = list(), "Power" = list())
|
||||
|
||||
@@ -26,13 +26,15 @@
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/station_alert/ui_data(mob/user)
|
||||
. = list()
|
||||
var/list/data = list()
|
||||
|
||||
.["alarms"] = list()
|
||||
data["alarms"] = list()
|
||||
for(var/class in alarms)
|
||||
.["alarms"][class] = list()
|
||||
data["alarms"][class] = list()
|
||||
for(var/area in alarms[class])
|
||||
.["alarms"][class] += area
|
||||
data["alarms"][class] += area
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/station_alert/proc/triggerAlarm(class, area/A, O, obj/source)
|
||||
if(source.z != z)
|
||||
|
||||
@@ -71,15 +71,6 @@
|
||||
compressor = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/computer/turbine_computer
|
||||
name = "gas turbine control computer"
|
||||
desc = "A computer to remotely control a gas turbine."
|
||||
icon_screen = "turbinecomp"
|
||||
icon_keyboard = "tech_key"
|
||||
circuit = /obj/item/circuitboard/computer/turbine_computer
|
||||
var/obj/machinery/power/compressor/compressor
|
||||
var/id = 0
|
||||
|
||||
// the inlet stage of the gas turbine electricity generator
|
||||
|
||||
/obj/machinery/power/compressor/Initialize()
|
||||
@@ -132,12 +123,13 @@
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
/obj/machinery/power/compressor/process()
|
||||
if(!turbine)
|
||||
stat = BROKEN
|
||||
if(stat & BROKEN || panel_open)
|
||||
return
|
||||
if(!starter)
|
||||
return
|
||||
if(!turbine || (turbine.stat & BROKEN))
|
||||
starter = FALSE
|
||||
if(stat & BROKEN || panel_open)
|
||||
starter = FALSE
|
||||
return
|
||||
cut_overlays()
|
||||
|
||||
rpm = 0.9* rpm + 0.1 * rpmtarget
|
||||
@@ -313,7 +305,17 @@
|
||||
|
||||
// COMPUTER NEEDS A SERIOUS REWRITE.
|
||||
|
||||
/obj/machinery/computer/turbine_computer
|
||||
name = "gas turbine control computer"
|
||||
desc = "A computer to remotely control a gas turbine."
|
||||
icon_screen = "turbinecomp"
|
||||
icon_keyboard = "tech_key"
|
||||
circuit = /obj/item/circuitboard/computer/turbine_computer
|
||||
var/obj/machinery/power/compressor/compressor
|
||||
var/id = 0
|
||||
|
||||
ui_x = 300
|
||||
ui_y = 200
|
||||
|
||||
/obj/machinery/computer/turbine_computer/Initialize()
|
||||
. = ..()
|
||||
@@ -329,7 +331,7 @@
|
||||
compressor = C
|
||||
return
|
||||
else
|
||||
compressor = locate(/obj/machinery/power/compressor) in range(5, src)
|
||||
compressor = locate(/obj/machinery/power/compressor) in range(7, src)
|
||||
|
||||
/obj/machinery/computer/turbine_computer/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
@@ -341,15 +343,15 @@
|
||||
/obj/machinery/computer/turbine_computer/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
data["connected"] = (compressor && compressor.turbine) ? TRUE : FALSE
|
||||
data["compressor"] = compressor ? TRUE : FALSE
|
||||
data["compressor_broke"] = (!compressor || (compressor.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["turbine"] = compressor?.turbine ? TRUE : FALSE
|
||||
data["turbine_broke"] = (!compressor || !compressor.turbine || (compressor.turbine.stat & BROKEN)) ? TRUE : FALSE
|
||||
data["broken"] = (data["compressor_broke"] || data["turbine_broke"])
|
||||
data["online"] = compressor.starter
|
||||
data["online"] = compressor?.starter
|
||||
|
||||
data["power"] = DisplayPower(compressor.turbine.lastgen)
|
||||
data["rpm"] = compressor.rpm
|
||||
data["temp"] = compressor.gas_contained.temperature
|
||||
data["power"] = DisplayPower(compressor?.turbine?.lastgen)
|
||||
data["rpm"] = compressor?.rpm
|
||||
data["temp"] = compressor?.gas_contained.temperature
|
||||
|
||||
return data
|
||||
|
||||
@@ -357,13 +359,9 @@
|
||||
if(..())
|
||||
return
|
||||
switch(action)
|
||||
if("power-on")
|
||||
if("toggle_power")
|
||||
if(compressor && compressor.turbine)
|
||||
compressor.starter = TRUE
|
||||
. = TRUE
|
||||
if("power-off")
|
||||
if(compressor && compressor.turbine)
|
||||
compressor.starter = FALSE
|
||||
compressor.starter = !compressor.starter
|
||||
. = TRUE
|
||||
if("reconnect")
|
||||
locate_machinery()
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { Fragment } from 'inferno';
|
||||
import { act } from '../byond';
|
||||
import { Section, Button } from '../components';
|
||||
|
||||
export const StationAlertConsole = props => {
|
||||
const { state } = props;
|
||||
const { config, data } = state;
|
||||
const { ref } = config;
|
||||
const categories = data.alarms || [];
|
||||
const fire = categories['Fire'] || [];
|
||||
const atmos = categories['Atmosphere'] || [];
|
||||
const power = categories['Power'] || [];
|
||||
return (
|
||||
<Fragment>
|
||||
<Section title="Fire Alarms">
|
||||
<ul>
|
||||
{fire.length === 0 && (
|
||||
<li className="color-good">
|
||||
Systems Nominal
|
||||
</li>
|
||||
)}
|
||||
{fire.map(alert => (
|
||||
<li key={alert}>
|
||||
{alert}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Section>
|
||||
<Section title="Atmospherics Alarms">
|
||||
<ul>
|
||||
{atmos.length === 0 && (
|
||||
<li className="color-good">
|
||||
Systems Nominal
|
||||
</li>
|
||||
)}
|
||||
{atmos.map(alert => (
|
||||
<li key={alert}>
|
||||
{alert}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Section>
|
||||
<Section title="Power Alarms">
|
||||
<ul>
|
||||
{power.length === 0 && (
|
||||
<li className="color-good">
|
||||
Systems Nominal
|
||||
</li>
|
||||
)}
|
||||
{power.map(alert => (
|
||||
<li key={alert}>
|
||||
{alert}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Section>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
import { Fragment } from 'inferno';
|
||||
import { act } from '../byond';
|
||||
import { Section, Button, LabeledList } from '../components';
|
||||
import { LabeledListItem } from '../components/LabeledList';
|
||||
|
||||
export const TurbineComputer = props => {
|
||||
const { state } = props;
|
||||
const { config, data } = state;
|
||||
const { ref } = config;
|
||||
return (
|
||||
<Section
|
||||
title="Status"
|
||||
buttons={(
|
||||
<Fragment>
|
||||
<Button
|
||||
icon={data.online ? 'power-off' : 'times'}
|
||||
content={data.online ? 'Online' : 'Offline'}
|
||||
selected={data.online}
|
||||
disabled={!data.compressor || data.compressor_broke || !data.turbine || data.turbine_broke}
|
||||
onClick={() => act(ref, 'toggle_power')} />
|
||||
<Button
|
||||
icon="sync"
|
||||
content="Reconnect"
|
||||
onClick={() => act(ref, 'reconnect')} />
|
||||
</Fragment>
|
||||
)}>
|
||||
{(!data.compressor || data.compressor_broke || !data.turbine || data.turbine_broke) ? (
|
||||
<LabeledList>
|
||||
<LabeledListItem
|
||||
label="Compressor Status"
|
||||
color={!data.compressor || data.compressor_broke ? "bad" : "good"}>
|
||||
{data.compressor_broke ? data.compressor ? "Offline" : "Missing" : "Online"}
|
||||
</LabeledListItem>
|
||||
<LabeledListItem
|
||||
label="Turbine Status"
|
||||
color={!data.turbine || data.turbine_broke ? "bad" : "good"}>
|
||||
{data.turbine_broke ? data.turbine ? "Offline" : "Missing" : "Online"}
|
||||
</LabeledListItem>
|
||||
</LabeledList>
|
||||
):(
|
||||
<LabeledList>
|
||||
<LabeledListItem label="Turbine Speed">
|
||||
{data.rpm} RPM
|
||||
</LabeledListItem>
|
||||
<LabeledListItem label="Internal Temp">
|
||||
{data.temp} K
|
||||
</LabeledListItem>
|
||||
<LabeledListItem label="Generated Power">
|
||||
{data.power}
|
||||
</LabeledListItem>
|
||||
</LabeledList>
|
||||
)}
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
File diff suppressed because one or more lines are too long
@@ -49,9 +49,11 @@ import { ShuttleManipulator } from './interfaces/ShuttleManipulator';
|
||||
import { SmartVend } from './interfaces/SmartVend';
|
||||
import { SMES } from './interfaces/SMES';
|
||||
import { SolarControl } from './interfaces/SolarControl';
|
||||
import { StationAlertConsole } from './interfaces/StationAlertConsole';
|
||||
import { SuitStorageUnit } from './interfaces/SuitStorageUnit';
|
||||
import { TankDispenser } from './interfaces/TankDispenser';
|
||||
import { ThermoMachine } from './interfaces/ThermoMachine';
|
||||
import { TurbineComputer } from './interfaces/TurbineComputer';
|
||||
import { VaultController } from './interfaces/VaultController';
|
||||
import { Wires } from './interfaces/Wires';
|
||||
|
||||
@@ -263,6 +265,10 @@ const ROUTES = {
|
||||
component: () => SolarControl,
|
||||
scrollable: false,
|
||||
},
|
||||
station_alert: {
|
||||
component: () => StationAlertConsole,
|
||||
scrollable: true,
|
||||
},
|
||||
suit_storage_unit: {
|
||||
component: () => SuitStorageUnit,
|
||||
scrollable: false,
|
||||
@@ -275,6 +281,10 @@ const ROUTES = {
|
||||
component: () => ThermoMachine,
|
||||
scrollable: false,
|
||||
},
|
||||
turbine_computer: {
|
||||
component: () => TurbineComputer,
|
||||
scrollable: false,
|
||||
},
|
||||
vault_controller: {
|
||||
component: () => VaultController,
|
||||
scrollable: false,
|
||||
|
||||
Reference in New Issue
Block a user