From da65f852b6595afe6ece0400cb2d6e8c4d4da326 Mon Sep 17 00:00:00 2001 From: caelaislinn Date: Sun, 20 May 2012 22:18:26 +1000 Subject: [PATCH] - power monitor: a remote monitoring device to send network data to a console - lowered the number of radsuits per crate down to 1 (they're never used on exodus anyway) - tweaked turbines Signed-off-by: caelaislinn --- baystation12.dme | 5 +- .../Cael_Aislinn/Rust/core_field.dm | 52 ++-- .../Cael_Aislinn/Rust/fuel_injector.dm | 30 +-- .../Cael_Aislinn/power_monitor.dm | 226 ++++++++++++++++++ code/game/communications.dm | 1 + code/modules/power/turbine.dm | 189 +++++++++------ 6 files changed, 378 insertions(+), 125 deletions(-) create mode 100644 code/WorkInProgress/Cael_Aislinn/power_monitor.dm diff --git a/baystation12.dme b/baystation12.dme index 627b48fb13b..545823586c1 100644 --- a/baystation12.dme +++ b/baystation12.dme @@ -165,6 +165,7 @@ #define FILE_DIR "code/WorkInProgress/Apples" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn/BirdMan" +#define FILE_DIR "code/WorkInProgress/Cael_Aislinn/Jumper" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn/Rust" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn/Supermatter" #define FILE_DIR "code/WorkInProgress/Cael_Aislinn/Tajara" @@ -203,6 +204,7 @@ #define FILE_DIR "icons/vending_icons" #define FILE_DIR "interface" #define FILE_DIR "maps" +#define FILE_DIR "maps/backup" #define FILE_DIR "maps/RandomZLevels" #define FILE_DIR "sound" #define FILE_DIR "sound/AI" @@ -1146,6 +1148,7 @@ #include "code\WorkInProgress\buildmode.dm" #include "code\WorkInProgress\explosion_particles.dm" #include "code\WorkInProgress\animusstation\atm.dm" +#include "code\WorkInProgress\Cael_Aislinn\power_monitor.dm" #include "code\WorkInProgress\Cael_Aislinn\BirdMan\bird_transformation.dm" #include "code\WorkInProgress\Cael_Aislinn\BirdMan\birdman.dm" #include "code\WorkInProgress\Cael_Aislinn\Rust\core_field.dm" @@ -1204,5 +1207,5 @@ #include "code\WorkInProgress\Wrongnumber\weldbackpack.dm" #include "interface\interface.dm" #include "interface\skin.dmf" -#include "maps\tgstation.2.0.8.dmm" +#include "maps\Antiqua.dmm" // END_INCLUDE diff --git a/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm b/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm index 321b835209f..ad6a754ba78 100644 --- a/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm +++ b/code/WorkInProgress/Cael_Aislinn/Rust/core_field.dm @@ -131,7 +131,7 @@ Deuterium-tritium fusion: 4.5 x 10^7 K radiation = 0 //update values - var/transfer_ratio = 50 / field_strength + var/transfer_ratio = field_strength / 50 major_radius = field_strength * 0.21875// max = 8.75 minor_radius = field_strength * 0.2125// max = 8.625 volume_covered = PI * major_radius * minor_radius * 2.5 * 2.5 * 2.5 * 7 * 7 * transfer_ratio @@ -159,10 +159,12 @@ Deuterium-tritium fusion: 4.5 x 10^7 K var/datum/gas_mixture/plasma_captured = new /datum/gas_mixture() // plasma_captured.toxins = round(gas_covered.toxins * transfer_ratio) + //world << "\blue[plasma_captured.toxins] moles of plasma captured" plasma_captured.temperature = gas_covered.temperature + //plasma_captured.update_values() gas_covered.toxins -= plasma_captured.toxins - plasma_captured.update_values() - gas_covered.update_values() + //gas_covered.update_values() + // held_plasma.merge(plasma_captured) // environment.merge(gas_covered) @@ -187,7 +189,25 @@ Deuterium-tritium fusion: 4.5 x 10^7 K //if there is too much plasma in the field, lose some /*if( held_plasma.toxins > (MOLES_CELLSTANDARD * 7) * (50 / field_strength) ) LosePlasma()*/ - LosePlasma() + if(held_plasma.toxins > 1) + //lose a random amount of plasma back into the air, increased by the field strength (want to switch this over to frequency eventually) + var/loss_ratio = rand() * (0.05 + (0.05 * 50 / field_strength)) + //world << "lost [loss_ratio*100]% of held plasma" + // + var/datum/gas_mixture/plasma_lost = new + plasma_lost.temperature = held_plasma.temperature + // + plasma_lost.toxins = held_plasma.toxins * loss_ratio + //plasma_lost.update_values() + held_plasma.toxins -= held_plasma.toxins * loss_ratio + //held_plasma.update_values() + // + environment.merge(plasma_lost) + radiation += loss_ratio * mega_energy * 0.1 + mega_energy -= loss_ratio * mega_energy * 0.1 + else + held_plasma.toxins = 0 + //held_plasma.update_values() //handle some reactants formatting //helium-4 has no use at the moment, but a buttload of it is produced @@ -293,30 +313,6 @@ Deuterium-tritium fusion: 4.5 x 10^7 K catcher.UpdateSize() return changed - proc/LosePlasma() - if(held_plasma.toxins > 1) - //lose a random amount of plasma back into the air, increased by the field strength (want to switch this over to frequency eventually) - var/datum/gas_mixture/environment = loc.return_air() - var/loss_ratio = rand() * (0.05 + (0.05 * 50 / field_strength)) - //world << "lost [loss_ratio*100]% of held plasma" - // - var/datum/gas_mixture/plasma_lost = new - plasma_lost.temperature = held_plasma.temperature - // - plasma_lost.toxins = held_plasma.toxins * loss_ratio - plasma_lost.update_values() - held_plasma.toxins -= held_plasma.toxins * loss_ratio - held_plasma.update_values() - // - environment.merge(plasma_lost) - radiation += loss_ratio * mega_energy * 0.1 - mega_energy -= loss_ratio * mega_energy * 0.1 - return 1 - else - held_plasma.toxins = 0 - held_plasma.update_values() - return 0 - //the !!fun!! part //reactions have to be individually hardcoded, see AttemptReaction() below this proc/React() diff --git a/code/WorkInProgress/Cael_Aislinn/Rust/fuel_injector.dm b/code/WorkInProgress/Cael_Aislinn/Rust/fuel_injector.dm index 91c35089c2c..da06f39cca2 100644 --- a/code/WorkInProgress/Cael_Aislinn/Rust/fuel_injector.dm +++ b/code/WorkInProgress/Cael_Aislinn/Rust/fuel_injector.dm @@ -104,11 +104,11 @@ user.machine = null user << browse(null, "window=fuel_injector") return - var/t = "Reactor Core Fuel Injector
" + var/t = "Reactor Core Fuel Injector
" t += "Stage: [stage]
" t += "Status: [injecting ? "Active \[Disable\]" : "Standby \[Enable\]"]
" - t += "Interval (sec): [rate/10] \[Modify\]" - t += "Fuel usage: [fuel_usage*100]% \[Modify\]" + t += "Interval (sec): [rate/10] \[Modify\]
" + t += "Fuel usage: [fuel_usage*100]% \[Modify\]
" /* var/t = "Reactor Core Fuel Control
" t += "Current fuel injection stage: [active_stage]
" @@ -146,6 +146,7 @@ t += "" t += "" */ + t += "
" t += "Close
" user << browse(t, "window=fuel_injector;size=500x800") user.machine = src @@ -178,26 +179,21 @@ for(var/reagent in owned_assembly_port.cur_assembly.rod_quantities) //world << "checking [reagent]" if(owned_assembly_port.cur_assembly.rod_quantities[reagent] > 0) - //world << " rods left: [owned_assembly_port.cur_assembly.rod_quantities[reagent]]] + //world << " rods left: [owned_assembly_port.cur_assembly.rod_quantities[reagent]]" var/amount = owned_assembly_port.cur_assembly.rod_quantities[reagent] * fuel_usage var/numparticles = round(amount * 1000) if(numparticles < 1) numparticles = 1 //world << " amount: [amount]" //world << " numparticles: [numparticles]" - for(var/i=0, i
" + dat += "Transponder Codes:
    " + for(var/key in codes) + dat += "
  • [key] ... [codes[key]]" + if(!locked) + dat += " (edit)" + dat += " (delete)
    " + if(!locked) + dat += "(add new)
    " + dat += "
      " + + user << browse(dat, "window=powermonitor") + onclose(user, "powermonitor") + return + + Topic(href, href_list) + ..() + if (usr.stat) + return + if ((in_range(src, usr) && istype(src.loc, /turf)) || (istype(usr, /mob/living/silicon))) + if(open && !locked) + usr.machine = src + + if (href_list["freq"]) + freq = sanitize_frequency(freq + text2num(href_list["freq"])) + updateDialog() + + else if(href_list["modifytag"]) + var/newtag = input("Enter new power network tag", "Power Monitor", powernet_tag) as text|null + if(newtag) + powernet_tag = newtag + updateDialog() + + else if(href_list["edit"]) + var/codekey = href_list["code"] + + var/newkey = input("Enter Transponder Code Key", "Power Monitor", codekey) as text|null + if(!newkey) + return + + var/codeval = codes[codekey] + var/newval = input("Enter Transponder Code Value", "Power Monitor", codeval) as text|null + if(!newval) + newval = codekey + return + + codes.Remove(codekey) + codes[newkey] = newval + + updateDialog() + + else if(href_list["delete"]) + var/codekey = href_list["code"] + codes.Remove(codekey) + updateDialog() + + else if(href_list["add"]) + + var/newkey = input("Enter New Transponder Code Key", "Power Monitor") as text|null + if(!newkey) + return + + var/newval = input("Enter New Transponder Code Value", "Power Monitor") as text|null + if(!newval) + newval = "1" + return + + if(!codes) + codes = new() + + codes[newkey] = newval + + updateDialog() diff --git a/code/game/communications.dm b/code/game/communications.dm index be87e6bb1b2..b5449e60d6e 100644 --- a/code/game/communications.dm +++ b/code/game/communications.dm @@ -132,6 +132,7 @@ var/const/RADIO_AIRLOCK = "6" var/const/RADIO_SECBOT = "7" var/const/RADIO_MULEBOT = "8" var/const/RADIO_MAGNETS = "9" +var/const/RADIO_POWER = "10" var/global/datum/controller/radio/radio_controller diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index b7025d41e63..10e2f2ad9a4 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -30,11 +30,15 @@ if(..()) return - if( href_list["view"] ) - usr.client.eye = src + if( href_list["close"] ) + usr << browse(null, "window=turbinegen") + usr.machine = null - src.add_fingerprint(usr) - src.updateUsrDialog() + else if( href_list["str"] ) + starter = !starter + src.updateDialog() + + src.updateDialog() #define COMPFRICTION 5e5 #define COMPSTARTERLOAD 2800 @@ -72,6 +76,31 @@ overlays += image('pipes.dmi', "comp-o1", FLY_LAYER) //TODO: DEFERRED + attack_ai(var/mob/user as mob) + return src.attack_hand(user) + + attack_paw(var/mob/user as mob) + return src.attack_hand(user) + + attack_hand(var/mob/user as mob) + if(..()) + return + user.machine = src + + var/dat = "Gas turbine generator
      " + if(turbine) + dat += "Turbine status: [starter ? "Off On" : "Off On"]
      " + dat += "Turbine speed: [rpm]rpm
      " + dat += "Power currently being generated: [turbine.lastgen]W
      " + dat += "Internal gas temperature: [gas_contained.temperature]K
      " + else + dat += "\red No turbine found.
      " + dat += "
      " + dat += "Refresh Close
      " + + user << browse(dat, "window=turbinegen;size=400x500") + onclose(user, "turbinegen") + /obj/machinery/power/turbine name = "gas turbine generator" desc = "A gas turbine used for backup power generation." @@ -92,7 +121,6 @@ if(!compressor) stat |= BROKEN - #define TURBPRES 9000000 #define TURBGENQ 20000 #define TURBGENG 0.8 @@ -123,65 +151,40 @@ if(lastgen > 100) overlays += image('pipes.dmi', "turb-o", FLY_LAYER) - for(var/mob/M in viewers(1, src)) - if ((M.client && M.machine == src)) - src.interact(M) - AutoUpdateAI(src) + attack_ai(var/mob/user as mob) + return src.attack_hand(user) - attack_ai(mob/user) - if(stat & (BROKEN|NOPOWER)) - return - interact(user) + attack_paw(var/mob/user as mob) + return src.attack_hand(user) - attack_hand(mob/user) - add_fingerprint(user) - if(stat & (BROKEN|NOPOWER)) - return - interact(user) - - proc/interact(mob/user) - if ( (get_dist(src, user) > 1 ) || (stat & (NOPOWER|BROKEN)) && (!istype(user, /mob/living/silicon/ai)) ) - user.machine = null - user << browse(null, "window=turbine") + attack_hand(var/mob/user as mob) + if(..()) return user.machine = src - var/t = "Gas Turbine Generator
      " - t += "Generated power : [round(lastgen)] W
      " - t += "Turbine: [round(compressor.rpm)] RPM
      " - t += "Starter: [ compressor.starter ? "Off On" : "Off On"]" - t += "
      " - t += "Refresh Close" + var/dat = "Gas turbine generator
      " + if(compressor) + dat += "Turbine status: [compressor.starter ? "Off On" : "Off On"]
      " + dat += "Turbine speed: [compressor.rpm]rpm
      " + dat += "Power currently being generated: [lastgen]W
      " + dat += "Internal gas temperature: [compressor.gas_contained.temperature]K
      " + else + dat += "\red No compressor found.
      " + dat += "
      " + dat += "Refresh Close
      " - user << browse(t, "window=turbine") - onclose(user, "turbine") - return + user << browse(dat, "window=turbinegen;size=400x500") + onclose(user, "turbinegen") Topic(href, href_list) - ..() - if(stat & BROKEN) + if(..()) return - if (usr.stat || usr.restrained() ) - return - if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey") - if(!istype(usr, /mob/living/silicon/ai)) - usr << "\red You don't have the dexterity to do this!" - return - if (( usr.machine==src && ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai))) - if( href_list["close"] ) - usr << browse(null, "window=turbine") - usr.machine = null - return - else if( href_list["str"] ) - compressor.starter = !compressor.starter - spawn(0) - for(var/mob/M in viewers(1, src)) - if ((M.client && M.machine == src)) - src.interact(M) - else - usr << browse(null, "window=turbine") + + if( href_list["close"] ) + usr << browse(null, "window=turbinegen") usr.machine = null - return + + src.updateDialog() ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -200,6 +203,7 @@ New() ..() compressors = new/list() + doors = new/list() spawn(5) for(var/obj/machinery/compressor/C in world) if(src.vent_network == C.comp_id) @@ -208,6 +212,22 @@ if(src.vent_network == D.networkTag) doors.Add(D) + process() + ..() + src.updateDialog() + + power_change() + if(stat & BROKEN) + icon_state = "broken" + else + if( powered() ) + icon_state = initial(icon_state) + stat &= ~NOPOWER + else + spawn(rand(0, 15)) + src.icon_state = "c_unpowered" + stat |= NOPOWER + /* /obj/machinery/computer/turbine_computer/attackby(I as obj, user as mob) if(istype(I, /obj/item/weapon/screwdriver)) @@ -243,42 +263,48 @@ return */ + attack_ai(var/mob/user as mob) + return src.attack_hand(user) + + attack_paw(var/mob/user as mob) + return src.attack_hand(user) + attack_hand(var/mob/user as mob) - interact() - return - - proc/interact() - if ( (get_dist(src, usr) > 1 ) || (stat & (NOPOWER|BROKEN)) && (!istype(usr, /mob/living/silicon/ai)) ) - usr.machine = null - usr << browse(null, "window=turbinecomp") + if(..()) return - usr.machine = src + user.machine = src - var/dat = "Gas turbine remote control system
      " + var/dat = "Gas turbine remote control system" + dat += "Refresh Close
      " + dat += "
      " if(src.doors.len) var/closed = 0 for(var/obj/machinery/door/poddoor/D in src.doors) if(D.density) closed = 1 - dat += "Connected vent status: [closed ? "Closed \[Open\]" : "Open \[Close\]"]" + dat += "Connected vent door status: [closed ? "Closed \[Open\]" : "\[Close\] Open"]" else dat += "No vents connected." + dat += "
      " if(src.compressors.len) for(var/obj/machinery/compressor/C in compressors) - dat += "Turbine status: [C.starter ? "Off On" : "Off On"]
      " - dat += "Turbine speed: [C.rpm]rpm
      " - dat += "Power currently being generated: [C.turbine.lastgen]W
      " - dat += "Internal gas temperature: [C.gas_contained.temperature]K
      " - dat += "View
      " + if(C.turbine) + dat += "Turbine status: [C.starter ? "Off On" : "Off On"]
      " + dat += "Turbine speed: [C.rpm]rpm
      " + dat += "Power currently being generated: [C.turbine.lastgen]W
      " + dat += "Internal gas temperature: [C.gas_contained.temperature]K
      " + dat += "View
      " + else + dat += "\red Invalid turbine/compressor configuration.
      " dat += "
      " else dat += "\redNo compatible attached compressors found." dat += "Refresh Close
      " - usr << browse(dat, "window=turbinecomp;size=400x500") - onclose(usr, "turbinecomp") + user << browse(dat, "window=turbinecomp;size=400x500") + onclose(user, "turbinecomp") Topic(href, href_list) if(..()) @@ -288,19 +314,24 @@ for(var/obj/machinery/door/poddoor/D in src.doors) spawn(0) D.open() - if (href_list["closedoors"]) + src.updateDialog() + else if (href_list["closedoors"]) for(var/obj/machinery/door/poddoor/D in src.doors) spawn(0) D.close() + src.updateDialog() + + else if( href_list["view"] ) + var/obj/machinery/compressor/C = locate(href_list["comp"]) + if(C) + usr.client.eye = C + else if( href_list["str"] ) + var/obj/machinery/compressor/C = locate(href_list["comp"]) + if(C) + C.starter = !C.starter + else if( href_list["close"] ) usr << browse(null, "window=turbinecomp") usr.machine = null - return - src.add_fingerprint(usr) - src.updateUsrDialog() - return - - process() src.updateDialog() - return \ No newline at end of file