Merge branch 'atlantiscze-engineering-substations' into dev

This commit is contained in:
Ccomp5950
2014-08-30 21:59:41 -05:00
14 changed files with 2698 additions and 2513 deletions
+2 -1
View File
@@ -1126,11 +1126,13 @@
#include "code\modules\paperwork\stamps.dm"
#include "code\modules\power\apc.dm"
#include "code\modules\power\batteryrack.dm"
#include "code\modules\power\breaker_box.dm"
#include "code\modules\power\cable.dm"
#include "code\modules\power\cable_heavyduty.dm"
#include "code\modules\power\cable_logic.dm"
#include "code\modules\power\cell.dm"
#include "code\modules\power\engine.dm"
#include "code\modules\power\fractal_reactor.dm"
#include "code\modules\power\generator.dm"
#include "code\modules\power\generator_type2.dm"
#include "code\modules\power\gravitygenerator.dm"
@@ -1141,7 +1143,6 @@
#include "code\modules\power\profiling.dm"
#include "code\modules\power\smes.dm"
#include "code\modules\power\solar.dm"
#include "code\modules\power\switch.dm"
#include "code\modules\power\terminal.dm"
#include "code\modules\power\tracker.dm"
#include "code\modules\power\turbine.dm"
+8
View File
@@ -436,6 +436,14 @@ var/list/all_supply_groups = list("Operations","Security","Hospitality","Enginee
containername = "Wooden planks crate"
group = "Engineering"
/datum/supply_packs/smescoil
name = "Superconducting Magnetic Coil"
contains = list(/obj/item/weapon/smes_coil)
cost = 75
containertype = /obj/structure/closet/crate
containername = "Superconducting Magnetic Coil crate"
group = "Engineering"
/datum/supply_packs/electrical
name = "Electrical maintenance crate"
contains = list(/obj/item/weapon/storage/toolbox/electrical,
+27
View File
@@ -700,6 +700,33 @@ var/list/ghostteleportlocs = list()
name = "\improper EVA Hallway"
icon_state = "eva"
// SUBSTATIONS (Subtype of maint, that should let them serve as shielded area during radstorm)
/area/maintenance/substation
name = "Substation"
icon_state = "substation"
/area/maintenance/substation/engineering // Probably will be connected to engineering SMES room, as wires cannot be crossed properly without them sharing powernets.
name = "Engineering Substation"
/area/maintenance/substation/medical_science // Medbay and Science. Each has it's own separated machinery, but it originates from the same room.
name = "Medical Research Substation"
/area/maintenance/substation/civilian_east // Bar, kitchen, dorms, ...
name = "Civilian East Substation"
/area/maintenance/substation/civilian_west // Cargo, PTS, locker room, probably arrivals, ...)
name = "Civilian West Substation"
/area/maintenance/substation/command // AI and central cluster. This one will be between HoP office and meeting room (probably).
name = "Command Substation"
/area/maintenance/substation/security // Security, Brig, Permabrig, etc.
name = "Security Substation"
//Hallway
/area/hallway/primary/fore
+23 -1
View File
@@ -32,6 +32,28 @@
var/cells_amount = 0
var/capacitors_amount = 0
// Smaller capacity, but higher I/O
// Starts fully charged, as it's used in substations. This replaces Engineering SMESs round start charge.
/obj/machinery/power/smes/batteryrack/substation
name = "Substation PSU"
desc = "A rack of power cells working as a PSU. This one seems to be equipped for higher power loads."
output = 150000
chargelevel = 150000
online = 1
// One high capacity cell, two regular cells. Lots of room for engineer upgrades
// Also five basic capacitors. Again, upgradeable.
/obj/machinery/power/smes/batteryrack/substation/add_parts()
component_parts = list()
component_parts += new /obj/item/weapon/circuitboard/batteryrack
component_parts += new /obj/item/weapon/cell/high
component_parts += new /obj/item/weapon/cell
component_parts += new /obj/item/weapon/cell
component_parts += new /obj/item/weapon/stock_parts/capacitor
component_parts += new /obj/item/weapon/stock_parts/capacitor
component_parts += new /obj/item/weapon/stock_parts/capacitor
component_parts += new /obj/item/weapon/stock_parts/capacitor
component_parts += new /obj/item/weapon/stock_parts/capacitor
/obj/machinery/power/smes/batteryrack/New()
..()
@@ -224,7 +246,7 @@
var/load = min((capacity * 1.5 - charge)/SMESRATE, chargelevel) // charge at set rate, limited to spare capacity
load = add_load(load) // add the load to the terminal side network
charge += load * SMESRATE // increase the charge
else // if not enough capacity
charging = 0 // stop charging
+97
View File
@@ -0,0 +1,97 @@
// Updated version of old powerswitch by Atlantis
// Has better texture, and is now considered electronic device
// AI has ability to toggle it in 5 seconds
// Humans need 30 seconds (AI is faster when it comes to complex electronics)
// Used for advanced grid control (read: Substations)
/obj/machinery/power/breakerbox
name = "Breaker Box"
icon = 'icons/obj/power.dmi'
icon_state = "bbox_off"
var/icon_state_on = "bbox_on"
var/icon_state_off = "bbox_off"
flags = FPRINT
density = 1
anchored = 1
var/on = 0
var/busy = 0
var/directions = list(1,2,4,8,5,6,9,10)
/obj/machinery/power/breakerbox/activated
icon_state = "bbox_on"
// Enabled on server startup. Used in substations to keep them in bypass mode.
/obj/machinery/power/breakerbox/activated/New()
set_state(1)
/obj/machinery/power/breakerbox/examine()
usr << "Large machine with heavy duty switching circuits used for advanced grid control"
if(on)
usr << "\green It seems to be online."
else
usr << "\red It seems to be offline"
/obj/machinery/power/breakerbox/attack_ai(mob/user)
if(busy)
user << "\red System is busy. Please wait until current operation is finished before changing power settings."
return
..()
busy = 1
user << "\green Updating power settings.."
if(do_after(user, 50)) //5s for AI as AIs can manipulate electronics much faster.
set_state(!on)
user << "\green Update Completed. New setting:[on ? "on": "off"]"
busy = 0
/obj/machinery/power/breakerbox/attack_hand(mob/user)
if(busy)
user << "\red System is busy. Please wait until current operation is finished before changing power settings."
return
..()
busy = 1
for(var/mob/O in viewers(user))
O.show_message(text("\red [user] started reprogramming [src]!"), 1)
if(do_after(user, 300)) // 30s for non-AIs as humans have to manually reprogram it and rapid switching may cause some lag / powernet updates flood. If AIs spam it they can be easily traced.
set_state(!on)
user.visible_message(\
"<span class='notice'>[user.name] [on ? "enabled" : "disabled"] the breaker box!</span>",\
"<span class='notice'>You [on ? "enabled" : "disabled"] the breaker box!</span>")
busy = 0
/obj/machinery/power/breakerbox/proc/set_state(var/state)
on = state
if(on)
icon_state = icon_state_on
var/list/connection_dirs = list()
for(var/direction in directions)
for(var/obj/structure/cable/C in get_step(src,direction))
if(C.d1 == turn(direction, 180) || C.d2 == turn(direction, 180))
connection_dirs += direction
break
for(var/direction in connection_dirs)
var/obj/structure/cable/C = new/obj/structure/cable(src.loc)
C.d1 = 0
C.d2 = direction
C.icon_state = "[C.d1]-[C.d2]"
C.breaker_box = src
var/datum/powernet/PN = new()
PN.number = powernets.len + 1
powernets += PN
PN.cables += C
C.mergeConnectedNetworks(C.d2)
C.mergeConnectedNetworksOnTurf()
else
icon_state = icon_state_off
for(var/obj/structure/cable/C in src.loc)
del(C)
+4 -4
View File
@@ -36,7 +36,7 @@
var/d2 = 1
layer = 2.44 //Just below unary stuff, which is at 2.45 and above pipes, which are at 2.4
color = COLOR_RED
var/obj/structure/powerswitch/power_switch
var/obj/machinery/power/breakerbox/breaker_box
/obj/structure/cable/yellow
color = COLOR_YELLOW
@@ -117,9 +117,9 @@
return
///// Z-Level Stuff
// if(power_switch)
// user << "\red This piece of cable is tied to a power switch. Flip the switch to remove it."
// return
if(breaker_box)
user << "\red This cable is connected to nearby breaker box. Use breaker box to interact with it."
return
if (shock(user, 50))
return
+28
View File
@@ -0,0 +1,28 @@
// ###############################################################################
// # ITEM: FRACTAL ENERGY REACTOR #
// # FUNCTION: Generate infinite electricity. Used for map testing. #
// ###############################################################################
/obj/machinery/power/fractal_reactor
name = "Fractal Energy Reactor"
desc = "This thing drains power from fractal-subspace. (DEBUG ITEM: INFINITE POWERSOURCE FOR MAP TESTING. CONTACT DEVELOPERS IF FOUND.)"
icon = 'icons/obj/power.dmi'
icon_state = "tracker" //ICON stolen from solar tracker. There is no need to make new texture for debug item
anchored = 1
density = 1
directwired = 1
var/power_generation_rate = 2000000 //Defaults to 2MW of power. Should be enough to run SMES charging on full 2 times.
var/powernet_connection_failed = 0
// This should be only used on Dev for testing purposes.
/obj/machinery/power/fractal_reactor/New()
..()
world << "<b>\red WARNING: \black Map testing power source activated at: X:[src.loc.x] Y:[src.loc.y] Z:[src.loc.z]</b>"
/obj/machinery/power/fractal_reactor/process()
if(!powernet && !powernet_connection_failed)
if(!connect_to_network())
powernet_connection_failed = 1
spawn(150) // Error! Check again in 15 seconds.
powernet_connection_failed = 0
add_avail(power_generation_rate)
+82 -10
View File
@@ -1,8 +1,23 @@
// the SMES
// stores power
#define SMESMAXCHARGELEVEL 200000
#define SMESMAXOUTPUT 200000
//Board
/obj/item/weapon/circuitboard/smes
name = "Circuit board (SMES Cell)"
build_path = "/obj/machinery/power/smes"
board_type = "machine"
origin_tech = "powerstorage=6;engineering=4" // Board itself is high tech. Coils have to be ordered from cargo or salvaged from existing SMESs.
frame_desc = "Requires 1 superconducting magnetic coil and 30 wires."
req_components = list("/obj/item/weapon/smes_coil" = 1, "/obj/item/stack/cable_coil" = 30)
//Construction Item
/obj/item/weapon/smes_coil
name = "Superconducting Magnetic Coil"
desc = "Heavy duty superconducting magnetic coil, mainly used in construction of SMES units."
icon = 'icons/obj/stock_parts.dmi'
icon_state = "smes_coil" // Just few icons patched together. If someone wants to make better icon, feel free to do so!
w_class = 4.0 // It's LARGE (backpack size)
/obj/machinery/power/smes
name = "power storage unit"
@@ -11,15 +26,15 @@
density = 1
anchored = 1
use_power = 0
var/output = 50000 //Amount of power it tries to output
var/output = 0 //Amount of power it tries to output
var/lastout = 0 //Amount of power it actually outputs to the powernet
var/loaddemand = 0 //For use in restore()
var/capacity = 5e6 //Maximum amount of power it can hold
var/charge = 1e6 //Current amount of power it holds
var/charge = 0 //Current amount of power it holds
var/charging = 0 //1 if it's actually charging, 0 if not
var/chargemode = 0 //1 if it's trying to charge, 0 if not.
//var/chargecount = 0
var/chargelevel = 50000 //Amount of power it tries to charge from powernet
var/chargelevel = 0 //Amount of power it tries to charge from powernet
var/online = 1 //1 if it's outputting power, 0 if not.
var/name_tag = null
var/obj/machinery/power/terminal/terminal = null
@@ -29,15 +44,29 @@
var/last_online = 0
var/open_hatch = 0
var/building_terminal = 0 //Suggestions about how to avoid clickspam building several terminals accepted!
var/input_level_max = SMESMAXCHARGELEVEL
var/output_level_max = SMESMAXOUTPUT
var/input_level_max = 250000 // It is now coil amount based, so no need for DEFINE
var/output_level_max = 250000
var/storage_per_coil = 5000000
var/IO_per_coil = 250000
var/max_coils = 6 //30M capacity, 1.5MW input/output when fully upgraded
var/cur_coils = 1 // Current amount of installed coils
/obj/machinery/power/smes/New()
component_parts = list()
component_parts += new /obj/item/stack/cable_coil(src,30)
component_parts += new /obj/item/weapon/circuitboard/smes(src)
// Allows for mapped-in SMESs with larger capacity/IO
for(var/i = 1, i <= cur_coils, i++)
component_parts += new /obj/item/weapon/smes_coil(src)
..()
recalc_coils()
spawn(5)
if(!powernet)
connect_to_network()
dir_loop:
for(var/d in cardinal)
var/turf/T = get_step(src, d)
@@ -54,6 +83,15 @@
updateicon()
return
/obj/machinery/power/smes/proc/recalc_coils()
if ((cur_coils <= max_coils) && (cur_coils >= 1))
capacity = cur_coils * storage_per_coil
charge = between(0, charge, capacity)
output_level_max = cur_coils * IO_per_coil
output = between(0, output, output_level_max)
input_level_max = cur_coils * IO_per_coil
chargelevel = between(0, chargelevel, input_level_max)
/obj/machinery/power/smes/proc/updateicon()
overlays.Cut()
@@ -255,6 +293,40 @@
del(terminal)
building_terminal = 0
// PSUs have their own code in batteryrack.dm
else if(istype(W, /obj/item/weapon/crowbar) && !(istype(src, /obj/machinery/power/smes/batteryrack)))
if (charge < (capacity / 100))
if (!online && !chargemode)
if (!terminal)
playsound(get_turf(src), 'sound/items/Crowbar.ogg', 50, 1)
usr << "\red You begin to disassemble the SMES cell!"
if (do_after(usr, 100 * cur_coils)) // More coils = takes longer to disassemble. It's complex so largest one with 5 coils will take 50s
usr << "\red You have disassembled the SMES cell!"
var/obj/machinery/constructable_frame/machine_frame/M = new /obj/machinery/constructable_frame/machine_frame(src.loc)
M.state = 2
M.icon_state = "box_1"
for(var/obj/I in component_parts)
if(I.reliability != 100 && crit_fail)
I.crit_fail = 1
I.loc = src.loc
del(src)
return 1
else
user << "<span class='warning'>You have to disassemble the terminal first!</span>"
else
user << "<span class='warning'>Turn off the [src] before dismantling it.</span>"
else
user << "<span class='warning'>Better let [src] discharge before dismantling it.</span>"
else if(istype(W, /obj/item/weapon/smes_coil) && !(istype(src, /obj/machinery/power/smes/batteryrack)))
if (cur_coils < max_coils)
usr << "You install the coil into the SMES unit!"
user.drop_item()
cur_coils ++
component_parts += W
W.loc = src
recalc_coils()
else
usr << "\red You can't insert more coils to this SMES unit!"
/obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
@@ -388,10 +460,10 @@
name = "magical power storage unit"
desc = "A high-capacity superconducting magnetic energy storage (SMES) unit. Magically produces power."
capacity = 9000000
output = SMESMAXOUTPUT
output = 250000
/obj/machinery/power/smes/magical/process()
charge = 9000000
charge = 5000000
..()
/proc/rate_control(var/S, var/V, var/C, var/Min=1, var/Max=5, var/Limit=null)
-85
View File
@@ -1,85 +0,0 @@
//This is a power switch. When turned on it looks at the cables around the tile that it's on and notes which cables are trying to connect to it.
//After it knows this it creates the number of cables from the center to each of the cables attempting to conenct. These cables cannot be removed
//with wirecutters. When the switch is turned off it removes all the cables on the tile it's on.
//The switch uses a 5s delay to prevent powernet change spamming.
/*
/obj/structure/powerswitch
name = "power switch"
desc = "A switch that controls power."
icon = 'icons/obj/power.dmi'
icon_state = "switch-dbl-up"
var/icon_state_on = "switch-dbl-down"
var/icon_state_off = "switch-dbl-up"
flags = FPRINT
density = 0
anchored = 1
var/on = 0 //up is off, down is on
var/busy = 0 //set to 1 when you start pulling
/obj/structure/powerswitch/simple
icon_state = "switch-up"
icon_state_on = "switch-down"
icon_state_off = "switch-up"
/obj/structure/powerswitch/examine()
..()
if(on)
usr << "The switch is in the on position"
else
usr << "The switch is in the off position"
/obj/structure/powerswitch/attack_ai(mob/user)
user << "\red You're an AI. This is a manual switch. It's not going to work."
return
/obj/structure/powerswitch/attack_hand(mob/user)
if(busy)
user << "\red This switch is already being toggled."
return
..()
busy = 1
for(var/mob/O in viewers(user))
O.show_message(text("\red [user] started pulling the [src]."), 1)
if(do_after(user, 50))
set_state(!on)
for(var/mob/O in viewers(user))
O.show_message(text("\red [user] flipped the [src] into the [on ? "on": "off"] position."), 1)
busy = 0
/obj/structure/powerswitch/proc/set_state(var/state)
on = state
if(on)
icon_state = icon_state_on
var/list/connection_dirs = list()
for(var/direction in list(1,2,4,8,5,6,9,10))
for(var/obj/structure/cable/C in get_step(src,direction))
if(C.d1 == turn(direction, 180) || C.d2 == turn(direction, 180))
connection_dirs += direction
break
for(var/direction in connection_dirs)
var/obj/structure/cable/C = new/obj/structure/cable(src.loc)
C.d1 = 0
C.d2 = direction
C.icon_state = "[C.d1]-[C.d2]"
C.power_switch = src
var/datum/powernet/PN = new()
PN.number = powernets.len + 1
powernets += PN
C.netnum = PN.number
PN.cables += C
C.mergeConnectedNetworks(C.d2)
C.mergeConnectedNetworksOnTurf()
else
icon_state = icon_state_off
for(var/obj/structure/cable/C in src.loc)
del(C)
*/
+10
View File
@@ -375,6 +375,16 @@ datum/design/aifixer
materials = list("$glass" = 2000, "sacid" = 20)
build_path = "/obj/item/weapon/circuitboard/aifixer"
// VERY VERY EXPENSIVE (needs diamonds and stuff)
datum/design/aifixer
name = "Circuit Design (SMES Cell)"
desc = "Allows for the construction of circuit boards used to build an SMES Cell."
id = "smes_cell"
req_tech = list("powerstorage" = 7, "engineering" = 5) // Higher than obtained by deconstructing existing boards. Needs more RnD effor to make
build_type = IMPRINTER
materials = list("$glass" = 4000, "sacid" = 40, "$gold" = 1000, "$silver" = 1000, "$diamond" = 500)
build_path = "/obj/item/weapon/circuitboard/smes"
///////////////////////////////////
//////////AI Module Disks//////////
///////////////////////////////////
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

+2417 -2412
View File
File diff suppressed because it is too large Load Diff