Gas Turbine Generator
"
t += "Generated power : [DisplayPower(lastgen)]
"
t += "Turbine: [round(compressor.rpm)] RPM
"
t += "Starter: [ compressor.starter ? "Off On" : "Off On"]"
t += "
Close"
t += ""
var/datum/browser/popup = new(user, "turbine", name, 700, 500, src)
popup.set_content(t)
popup.open()
return
/obj/machinery/power/turbine/Topic(href, href_list)
if(..())
return
if(href_list["close"])
usr << browse(null, "window=turbine")
usr.unset_machine(src)
return
else if(href_list["str"])
if(compressor)
compressor.starter = !compressor.starter
updateDialog()
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Turbine Computer
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/obj/machinery/computer/turbine_computer/initialize()
. = ..()
return INITIALIZE_HINT_LATELOAD
/obj/machinery/computer/turbine_computer/LateInitialize()
locate_machinery()
/obj/machinery/computer/turbine_computer/proc/locate_machinery()
if(!id)
return
for(var/obj/machinery/compressor/C in machines)
if(C.comp_id == id)
compressor = C
LAZYINITLIST(doors)
for(var/obj/machinery/door/blast/P in machines)
if(P.id == id)
doors += P
/obj/machinery/computer/turbine_computer/attackby(obj/item/W, mob/user)
if(ismultitool(W))
var/new_ident = input("Enter a new ident tag.", name, id) as null|text
if(new_ident && user.Adjacent(src))
id = new_ident
return
/obj/machinery/computer/turbine_computer/attack_hand(var/mob/user as mob)
if((. = ..()))
return
src.interact(user)
/obj/machinery/computer/turbine_computer/interact(mob/user)
return ui_interact(user)
/obj/machinery/computer/turbine_computer/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/list/data = list()
data["connected"] = (compressor && compressor.turbine) ? 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["door_status"] = door_status ? TRUE : FALSE
if(compressor && compressor.turbine)
data["online"] = compressor.starter
data["power"] = DisplayPower(compressor.turbine.lastgen)
data["rpm"] = compressor.rpm
data["temp"] = compressor.gas_contained.temperature
// update the ui if it exists, returns null if no ui is passed/found
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "turbine_computer.tmpl", name, 520, 440)
// when the ui is first opened this is the data it will use
ui.set_initial_data(data)
// open the new ui window
ui.open()
// auto update every Master Controller tick
ui.set_auto_update(TRUE)
/obj/machinery/computer/turbine_computer/Topic(href, href_list)
if(..())
return
if(href_list["power-on"])
if(compressor && compressor.turbine)
compressor.starter = TRUE
. = TRUE
else if(href_list["power-off"])
if(compressor && compressor.turbine)
compressor.starter = FALSE
. = TRUE
else if(href_list["reconnect"])
locate_machinery()
. = TRUE
else if(href_list["doors"])
door_status = !door_status
for(var/obj/machinery/door/blast/D in src.doors)
if (door_status)
spawn(0) D.close()
else
spawn(0)D.open()
. = TRUE
#undef COMPFRICTION
#undef COMPSTARTERLOAD
#undef TURBPRES
#undef TURBGENQ
#undef TURBGENG