From 93ac8c676f63f6fdb2c1c9375296b41a3ea07fd5 Mon Sep 17 00:00:00 2001 From: Razharas Date: Sat, 15 Nov 2014 17:17:27 +0300 Subject: [PATCH 1/4] Made power turbine more sensible Partly fixes #5881 --- code/game/machinery/machinery.dm | 3 ++ code/modules/power/turbine.dm | 68 +++++++++++++++++++------------- 2 files changed, 44 insertions(+), 27 deletions(-) diff --git a/code/game/machinery/machinery.dm b/code/game/machinery/machinery.dm index 2d669717455..ee390467a27 100644 --- a/code/game/machinery/machinery.dm +++ b/code/game/machinery/machinery.dm @@ -122,6 +122,9 @@ Class Procs: open_machine() ..() +/obj/machinery/proc/locate_machinery() + return + /obj/machinery/process()//If you dont use process or power why are you here return PROCESS_KILL diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index ea569bfd9c2..23157f4d830 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -84,7 +84,7 @@ inturf = get_step(src, dir) spawn(5) - turbine = locate() in get_step(src, get_dir(inturf, src)) + locate_machinery() if(!turbine) stat |= BROKEN @@ -98,6 +98,13 @@ // /obj/machinery/power/compressor/CanPass(atom/movable/mover, turf/target, height=0) // return !density +/obj/machinery/power/compressor/locate_machinery() + if(turbine) + return + turbine = locate() in get_step(src, get_dir(inturf, src)) + if(turbine) + turbine.locate_machinery() + /obj/machinery/power/compressor/RefreshParts() var/E = 0 for(var/obj/item/weapon/stock_parts/manipulator/M in component_parts) @@ -111,7 +118,7 @@ if(default_change_direction_wrench(user, I)) turbine = null inturf = get_step(src, dir) - turbine = locate() in get_step(src, get_dir(inturf, src)) + locate_machinery() if(turbine) user << "Turbine connected." stat &= ~BROKEN @@ -129,14 +136,13 @@ return !density /obj/machinery/power/compressor/process() + stat = (!turbine || panel_open) + if(stat & BROKEN) + return if(!starter) return overlays.Cut() - if(stat & BROKEN) - return - if(!turbine) - stat |= BROKEN - return + rpm = 0.9* rpm + 0.1 * rpmtarget var/datum/gas_mixture/environment = inturf.return_air() @@ -199,7 +205,7 @@ // compressor is found in the opposite direction - compressor = locate() in get_step(src, get_dir(outturf, src)) + locate_machinery() if(!compressor) stat |= BROKEN @@ -218,16 +224,20 @@ P += C.rating productivity = P / 6 +/obj/machinery/power/turbine/locate_machinery() + if(compressor) + return + compressor = locate() in get_step(src, get_dir(outturf, src)) + if(compressor) + compressor.locate_machinery() + /obj/machinery/power/turbine/CanAtmosPass(var/turf/T) return !density /obj/machinery/power/turbine/process() - + stat = (!compressor || panel_open) if(stat & BROKEN) return - if(!compressor) - stat |= BROKEN - return if(!compressor.starter) return overlays.Cut() @@ -274,7 +284,7 @@ if(default_change_direction_wrench(user, I)) compressor = null outturf = get_step(src, dir) - compressor = locate() in get_step(src, get_dir(outturf, src)) + locate_machinery() if(compressor) user << "Compressor connected." stat &= ~BROKEN @@ -341,9 +351,9 @@ /obj/machinery/computer/turbine_computer/New() ..() spawn(5) - search_turbine() + locate_machinery() -/obj/machinery/computer/turbine_computer/proc/search_turbine() +/obj/machinery/computer/turbine_computer/locate_machinery() compressor = locate(/obj/machinery/power/compressor) in range(5) /obj/machinery/computer/turbine_computer/attack_hand(var/mob/user as mob) @@ -356,17 +366,21 @@ var/dat if(compressor && compressor.turbine) - dat += {"
Gas turbine remote control system
- \nTurbine status: [ src.compressor.starter ? "Off On" : "Off On"] - \n
- \nTurbine speed: [src.compressor.rpm]rpm
- \nPower currently being generated: [src.compressor.turbine.lastgen]W
- \nInternal gas temperature: [src.compressor.gas_contained.temperature]K
- \n
Close - \n
- \n"} + dat += "
Gas turbine remote control system
" + if(compressor.stat || compressor.turbine.stat) + dat += "[compressor.stat ? "Compressor is inoperable
" : ""]" + dat += "[compressor.turbine.stat ? "Turbine is inoperable" : ""]" + else + dat += {"Turbine status: [ src.compressor.starter ? "Off On" : "Off On"] + \n
+ \nTurbine speed: [src.compressor.rpm]rpm
+ \nPower currently being generated: [src.compressor.turbine.lastgen]W
+ \nInternal gas temperature: [src.compressor.gas_contained.temperature]K
+ \n
Close + \n
+ \n"} else - dat += "There is [!compressor ? "no compressor" : " compressor[!compressor.turbine ? " and no turbine" : ""]"].
" + dat += "There is [!compressor ? "no compressor" : " compressor[!compressor.turbine ? " but no turbine" : ""]"].
" if(!compressor) dat += "Search for compressor" @@ -380,14 +394,14 @@ return else if( href_list["str"] ) - if(compressor) + if(compressor && compressor.turbine) compressor.starter = !compressor.starter else if( href_list["close"] ) usr << browse(null, "window=turbinecomputer") usr.unset_machine(src) return else if(href_list["search"]) - search_turbine() + locate_machinery() src.updateUsrDialog() return From 12e7a3eba054f0a1b5c70b48593cdb31ab5e2f3f Mon Sep 17 00:00:00 2001 From: Razharas Date: Sun, 23 Nov 2014 12:13:27 +0300 Subject: [PATCH 2/4] Fix for heater/freezer and infinite power Yes --- code/game/machinery/Freezer.dm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/code/game/machinery/Freezer.dm b/code/game/machinery/Freezer.dm index f8974fd36c8..b9e6b83b60a 100644 --- a/code/game/machinery/Freezer.dm +++ b/code/game/machinery/Freezer.dm @@ -95,6 +95,7 @@ usr.set_machine(src) if (href_list["start"]) src.on = !src.on + use_power = 1 + src.on update_icon() if(href_list["temp"]) var/amount = text2num(href_list["temp"]) @@ -102,6 +103,7 @@ src.current_temperature = min(T20C, src.current_temperature+amount) else src.current_temperature = max(min_temperature, src.current_temperature+amount) + active_power_usage = (current_heat_capacity * (T20C - current_temperature) / 100) + idle_power_usage src.updateUsrDialog() /obj/machinery/atmospherics/unary/cold_sink/freezer/process() @@ -204,7 +206,7 @@ //user << browse(dat, "window=freezer;size=400x500") //onclose(user, "freezer") - var/datum/browser/popup = new(user, "freezer", "Cryo Gas Cooling System", 400, 240) // Set up the popup browser window + var/datum/browser/popup = new(user, "freezer", "Pyro Gas Heating System", 400, 240) // Set up the popup browser window popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state)) popup.set_content(dat) popup.open() @@ -215,13 +217,15 @@ usr.set_machine(src) if (href_list["start"]) src.on = !src.on + use_power = 1 + src.on update_icon() if(href_list["temp"]) var/amount = text2num(href_list["temp"]) if(amount > 0) - src.current_temperature = min((T20C+max_temperature), src.current_temperature+amount) + src.current_temperature = min((max_temperature), src.current_temperature+amount) else src.current_temperature = max(T20C, src.current_temperature+amount) + active_power_usage = (current_heat_capacity * (current_temperature - T20C) / 100) + idle_power_usage src.updateUsrDialog() src.add_fingerprint(usr) return From f393be45b6d4cbcf1c6c878e1d53ff32acbe08df Mon Sep 17 00:00:00 2001 From: Razharas Date: Fri, 16 Jan 2015 04:08:07 +0300 Subject: [PATCH 3/4] Tiny readibility improvement --- code/modules/power/turbine.dm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index 23157f4d830..540270c3631 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -136,8 +136,9 @@ return !density /obj/machinery/power/compressor/process() - stat = (!turbine || panel_open) - if(stat & BROKEN) + if(!turbine) + stat = BROKEN + if(stat & BROKEN || panel_open) return if(!starter) return @@ -235,8 +236,11 @@ return !density /obj/machinery/power/turbine/process() - stat = (!compressor || panel_open) - if(stat & BROKEN) + + if(!compressor) + stat = BROKEN + + if((stat & BROKEN) || panel_open) return if(!compressor.starter) return From d30872024c84be4326ae21ec515e6da694d64a97 Mon Sep 17 00:00:00 2001 From: Razharas Date: Fri, 16 Jan 2015 04:31:02 +0300 Subject: [PATCH 4/4] And other readibility improvement --- code/modules/power/turbine.dm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index 540270c3631..3e82df3d402 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -372,8 +372,7 @@ if(compressor && compressor.turbine) dat += "
Gas turbine remote control system
" if(compressor.stat || compressor.turbine.stat) - dat += "[compressor.stat ? "Compressor is inoperable
" : ""]" - dat += "[compressor.turbine.stat ? "Turbine is inoperable" : ""]" + dat += "[compressor.stat ? "Compressor is inoperable
" : "Turbine is inoperable"]" else dat += {"Turbine status: [ src.compressor.starter ? "Off On" : "Off On"] \n