Fix turbine computer showing broken

This commit is contained in:
Matt Smith
2017-11-30 02:55:45 +00:00
committed by CitadelStationBot
parent 4b25b45701
commit a0cdca9e7c
2 changed files with 18 additions and 14 deletions

View File

@@ -344,10 +344,10 @@
/obj/machinery/computer/turbine_computer/ui_data(mob/user)
var/list/data = list()
data["working"] = (compressor.starter && compressor && compressor.turbine && !compressor.stat && !compressor.turbine.stat)
data["connected"] = (compressor && compressor.turbine) ? TRUE : FALSE
data["compressor_broke"] = (!compressor || compressor.stat) ? TRUE : FALSE
data["turbine_broke"] = (!compressor || compressor.turbine.stat) ? TRUE : FALSE
data["compressor_broke"] = (!compressor || (compressor.stat & BROKEN)) ? 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["power"] = DisplayPower(compressor.turbine.lastgen)
@@ -360,9 +360,13 @@
if(..())
return
switch(action)
if("power")
if("power-on")
if(compressor && compressor.turbine)
compressor.starter = !compressor.starter
compressor.starter = TRUE
. = TRUE
if("power-off")
if(compressor && compressor.turbine)
compressor.starter = FALSE
. = TRUE
if("reconnect")
locate_machinery()

View File

@@ -13,20 +13,20 @@ component.exports = {
<ui-notice>
<ui-section label='Reconnect'>
<div style='float:right'>
<ui-button icon='refresh' action='reconnect' state='{{data.connected}}'>Reconnect</ui-button>
<ui-button icon='refresh' action='reconnect'>Reconnect</ui-button>
</div>
</ui-section>
</ui-notice>
<ui-display title='Turbine Controller'>
<ui-section label='Status'>
{{#if data.working}}
<span class='{{powerState(data.online)}}'>{{data.online && !(data.compressor_broke || data.turbine_broke) ? "Online" : "Offline"}}</span>
{{else}}
{{#if data.broken}}
<span class='bad'>Broken</span>
{{else}}
<span class='{{powerState(data.online)}}'>{{data.online && !(data.compressor_broke || data.turbine_broke) ? "Online" : "Offline"}}</span>
{{/if}}
<div style='float:right'>
<ui-button icon='power-off' action='power' state='{{data.working}}' style='{{data.online ? "selected" : ""}}'>On</ui-button>
<ui-button icon='close' action='power' state='{{data.working}}' style='{{data.online ? "" : "selected"}}'>Off</ui-button>
<ui-button icon='power-off' action='power-on' state='{{data.broken}}' style='{{data.online ? "selected" : ""}}'>On</ui-button>
<ui-button icon='close' action='power-off' state='{{data.broken}}' style='{{data.online ? "" : "selected"}}'>Off</ui-button>
</div>
{{#if data.compressor_broke}}
<br>
@@ -40,12 +40,12 @@ component.exports = {
</ui-display>
<ui-display title='Status'>
<ui-section label='Turbine Speed'>
<span>{{data.working ? data.rpm : "--"}} RPM</span>
<span>{{data.broken ? "--" : data.rpm}} RPM</span>
</ui-section>
<ui-section label='Internal Temp'>
<span>{{data.working ? data.temp : "--"}} K</span>
<span>{{data.broken ? "--" : data.temp}} K</span>
</ui-section>
<ui-section label='Generated Power'>
<span>{{data.working ? data.power : "--"}}</span>
<span>{{data.broken ? "--" : data.power}}</span>
</ui-section>
</ui-display>