This commit is contained in:
@@ -41,6 +41,11 @@
|
||||
var/comp_id = 0
|
||||
var/efficiency
|
||||
|
||||
/obj/machinery/power/compressor/Destroy()
|
||||
if(turbine && turbine.compressor == src)
|
||||
turbine.compressor = null
|
||||
turbine = null
|
||||
return ..()
|
||||
|
||||
/obj/machinery/power/turbine
|
||||
name = "gas turbine generator"
|
||||
@@ -51,12 +56,20 @@
|
||||
resistance_flags = FIRE_PROOF
|
||||
CanAtmosPass = ATMOS_PASS_DENSITY
|
||||
circuit = /obj/item/circuitboard/machine/power_turbine
|
||||
ui_x = 310
|
||||
ui_y = 150
|
||||
var/opened = 0
|
||||
var/obj/machinery/power/compressor/compressor
|
||||
var/turf/outturf
|
||||
var/lastgen
|
||||
var/productivity = 1
|
||||
|
||||
/obj/machinery/power/turbine/Destroy()
|
||||
if(compressor && compressor.turbine == src)
|
||||
compressor.turbine = null
|
||||
compressor = null
|
||||
return ..()
|
||||
|
||||
// the inlet stage of the gas turbine electricity generator
|
||||
|
||||
/obj/machinery/power/compressor/Initialize()
|
||||
@@ -66,12 +79,10 @@
|
||||
inturf = get_step(src, dir)
|
||||
locate_machinery()
|
||||
if(!turbine)
|
||||
stat |= BROKEN
|
||||
|
||||
obj_break()
|
||||
|
||||
#define COMPFRICTION 5e5
|
||||
|
||||
|
||||
/obj/machinery/power/compressor/locate_machinery()
|
||||
if(turbine)
|
||||
return
|
||||
@@ -103,7 +114,7 @@
|
||||
stat &= ~BROKEN
|
||||
else
|
||||
to_chat(user, "<span class='alert'>Turbine not connected.</span>")
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
@@ -129,9 +140,9 @@
|
||||
|
||||
// RPM function to include compression friction - be advised that too low/high of a compfriction value can make things screwy
|
||||
|
||||
rpm = min(rpm, (COMPFRICTION*efficiency)/2)
|
||||
rpm = max(0, rpm - (rpm*rpm)/(COMPFRICTION*efficiency))
|
||||
|
||||
|
||||
if(starter && !(stat & NOPOWER))
|
||||
use_power(2800)
|
||||
if(rpm<1000)
|
||||
@@ -140,8 +151,6 @@
|
||||
if(rpm<1000)
|
||||
rpmtarget = 0
|
||||
|
||||
|
||||
|
||||
if(rpm>50000)
|
||||
add_overlay(mutable_appearance(icon, "comp-o4", FLY_LAYER))
|
||||
else if(rpm>10000)
|
||||
@@ -164,7 +173,7 @@
|
||||
outturf = get_step(src, dir)
|
||||
locate_machinery()
|
||||
if(!compressor)
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
connect_to_network()
|
||||
|
||||
/obj/machinery/power/turbine/RefreshParts()
|
||||
@@ -222,8 +231,6 @@
|
||||
if(lastgen > 100)
|
||||
add_overlay(mutable_appearance(icon, "turb-o", FLY_LAYER))
|
||||
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/power/turbine/attackby(obj/item/I, mob/user, params)
|
||||
if(default_deconstruction_screwdriver(user, initial(icon_state), initial(icon_state), I))
|
||||
return
|
||||
@@ -237,53 +244,42 @@
|
||||
stat &= ~BROKEN
|
||||
else
|
||||
to_chat(user, "<span class='alert'>Compressor not connected.</span>")
|
||||
stat |= BROKEN
|
||||
obj_break()
|
||||
return
|
||||
|
||||
default_deconstruction_crowbar(I)
|
||||
|
||||
/obj/machinery/power/turbine/ui_interact(mob/user)
|
||||
/obj/machinery/power/turbine/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)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "TurbineComputer", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
if(!Adjacent(user) || (stat & (NOPOWER|BROKEN)) && !issilicon(user))
|
||||
user.unset_machine(src)
|
||||
user << browse(null, "window=turbine")
|
||||
return
|
||||
/obj/machinery/power/turbine/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
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["online"] = compressor?.starter
|
||||
data["power"] = DisplayPower(compressor?.turbine?.lastgen)
|
||||
data["rpm"] = compressor?.rpm
|
||||
data["temp"] = compressor?.gas_contained.temperature
|
||||
return data
|
||||
|
||||
var/t = "<TT><B>Gas Turbine Generator</B><HR><PRE>"
|
||||
|
||||
t += "Generated power : [DisplayPower(lastgen)]<BR><BR>"
|
||||
|
||||
t += "Turbine: [round(compressor.rpm)] RPM<BR>"
|
||||
|
||||
t += "Starter: [ compressor.starter ? "<A href='?src=[REF(src)];str=1'>Off</A> <B>On</B>" : "<B>Off</B> <A href='?src=[REF(src)];str=1'>On</A>"]"
|
||||
|
||||
t += "</PRE><HR><A href='?src=[REF(src)];close=1'>Close</A>"
|
||||
|
||||
t += "</TT>"
|
||||
var/datum/browser/popup = new(user, "turbine", name)
|
||||
popup.set_content(t)
|
||||
popup.open()
|
||||
|
||||
return
|
||||
|
||||
/obj/machinery/power/turbine/Topic(href, href_list)
|
||||
/obj/machinery/power/turbine/ui_act(action, params)
|
||||
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()
|
||||
|
||||
|
||||
|
||||
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
if(compressor && compressor.turbine)
|
||||
compressor.starter = !compressor.starter
|
||||
. = TRUE
|
||||
if("reconnect")
|
||||
locate_machinery()
|
||||
. = TRUE
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -296,6 +292,8 @@
|
||||
icon_screen = "turbinecomp"
|
||||
icon_keyboard = "tech_key"
|
||||
circuit = /obj/item/circuitboard/computer/turbine_computer
|
||||
ui_x = 310
|
||||
ui_y = 150
|
||||
var/obj/machinery/power/compressor/compressor
|
||||
var/id = 0
|
||||
|
||||
@@ -319,27 +317,25 @@
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "turbine_computer", name, 300, 200, master_ui, state)
|
||||
ui = new(user, src, ui_key, "TurbineComputer", name, ui_x, ui_y, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/computer/turbine_computer/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
|
||||
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["online"] = compressor?.starter
|
||||
|
||||
data["power"] = DisplayPower(compressor?.turbine?.lastgen)
|
||||
data["rpm"] = compressor?.rpm
|
||||
data["temp"] = compressor?.gas_contained.temperature
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/computer/turbine_computer/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("toggle_power")
|
||||
if(compressor && compressor.turbine)
|
||||
|
||||
Reference in New Issue
Block a user