diff --git a/code/game/gamemodes/events/power_failure.dm b/code/game/gamemodes/events/power_failure.dm index 87dd5f335c..3e212577d1 100644 --- a/code/game/gamemodes/events/power_failure.dm +++ b/code/game/gamemodes/events/power_failure.dm @@ -49,7 +49,7 @@ if(S.z != 1) continue S.charge = S.capacity - S.output = 200000 + S.output = S.output_level_max // Most new SMESs on map are of buildable type, and may actually have higher output limit than 200kW. Use max output of that SMES instead. S.online = 1 S.updateicon() S.power_change() diff --git a/code/modules/mob/living/silicon/robot/drone/drone_items.dm b/code/modules/mob/living/silicon/robot/drone/drone_items.dm index 30b3824fb4..aa033cde55 100644 --- a/code/modules/mob/living/silicon/robot/drone/drone_items.dm +++ b/code/modules/mob/living/silicon/robot/drone/drone_items.dm @@ -22,7 +22,8 @@ /obj/item/weapon/rack_parts, /obj/item/weapon/camera_assembly, /obj/item/weapon/tank, - /obj/item/weapon/circuitboard + /obj/item/weapon/circuitboard, + /obj/item/weapon/smes_coil ) //Item currently being held. diff --git a/code/modules/power/breaker_box.dm b/code/modules/power/breaker_box.dm index adfd8203d0..f01b736c33 100644 --- a/code/modules/power/breaker_box.dm +++ b/code/modules/power/breaker_box.dm @@ -8,6 +8,7 @@ name = "Breaker Box" icon = 'icons/obj/power.dmi' icon_state = "bbox_off" + directwired = 0 var/icon_state_on = "bbox_on" var/icon_state_off = "bbox_off" flags = FPRINT diff --git a/code/modules/power/cable.dm b/code/modules/power/cable.dm index 73a3eca3c4..b607a32c55 100644 --- a/code/modules/power/cable.dm +++ b/code/modules/power/cable.dm @@ -207,7 +207,8 @@ icon_state = "coil" amount = MAXCOIL max_amount = MAXCOIL - item_color = COLOR_RED + color = COLOR_RED + //item_color = COLOR_RED Use regular "color" var instead. No need to have it duplicate in two vars. Causes confusion. desc = "A coil of power cable." throwforce = 10 w_class = 2.0 @@ -227,10 +228,8 @@ /obj/item/stack/cable_coil/New(loc, length = MAXCOIL, var/param_color = null) ..() src.amount = length - if (param_color) + if (param_color) // It should be red by default, so only recolor it if parameter was specified. color = param_color - else - color = item_color pixel_x = rand(-2,2) pixel_y = rand(-2,2) updateicon() @@ -239,7 +238,6 @@ /obj/item/stack/cable_coil/proc/updateicon() if (!color) color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_ORANGE, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN) - item_color = color if(amount == 1) icon_state = "coil1" name = "cable piece" @@ -277,7 +275,7 @@ usr << "You need at least 15 lengths to make restraints!" return var/obj/item/weapon/handcuffs/cable/B = new /obj/item/weapon/handcuffs/cable(usr.loc) - B.color = item_color + B.color = color usr << "You wind some cable together to make some restraints." src.use(15) else @@ -287,7 +285,7 @@ /obj/item/stack/cable_coil/attackby(obj/item/weapon/W, mob/user) if( istype(W, /obj/item/weapon/wirecutters) && src.amount > 1) src.amount-- - new/obj/item/stack/cable_coil(user.loc, 1,item_color) + new/obj/item/stack/cable_coil(user.loc, 1,color) user << "You cut a piece off the cable coil." src.updateicon() src.update_wclass() @@ -375,7 +373,7 @@ var/obj/structure/cable/C = new(F) var/obj/structure/cable/D = new(temp.floorbelow) - C.cableColor(item_color) + C.cableColor(color) C.d1 = 11 C.d2 = dirn @@ -389,7 +387,7 @@ C.mergeConnectedNetworks(C.d2) C.mergeConnectedNetworksOnTurf() - D.cableColor(item_color) + D.cableColor(color) D.d1 = 12 D.d2 = 0 @@ -412,7 +410,7 @@ var/obj/structure/cable/C = new(F) - C.cableColor(item_color) + C.cableColor(color) C.d1 = 0 C.d2 = dirn @@ -475,7 +473,7 @@ return var/obj/structure/cable/NC = new(U) - NC.cableColor(item_color) + NC.cableColor(color) NC.d1 = 0 NC.d2 = fdirn @@ -513,7 +511,7 @@ return - C.cableColor(item_color) + C.cableColor(color) C.d1 = nd1 C.d2 = nd2 @@ -619,28 +617,28 @@ obj/structure/cable/proc/cableColor(var/colorC) update_wclass() /obj/item/stack/cable_coil/yellow - item_color = COLOR_YELLOW + color = COLOR_YELLOW /obj/item/stack/cable_coil/blue - item_color = COLOR_BLUE + color = COLOR_BLUE /obj/item/stack/cable_coil/green - item_color = COLOR_GREEN + color = COLOR_GREEN /obj/item/stack/cable_coil/pink - item_color = COLOR_PINK + color = COLOR_PINK /obj/item/stack/cable_coil/orange - item_color = COLOR_ORANGE + color = COLOR_ORANGE /obj/item/stack/cable_coil/cyan - item_color = COLOR_CYAN + color = COLOR_CYAN /obj/item/stack/cable_coil/white - item_color = COLOR_WHITE + color = COLOR_WHITE /obj/item/stack/cable_coil/random/New() - item_color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN) + color = pick(COLOR_RED, COLOR_BLUE, COLOR_GREEN, COLOR_WHITE, COLOR_PINK, COLOR_YELLOW, COLOR_CYAN) ..() /obj/item/stack/cable_coil/attack(mob/M as mob, mob/user as mob) diff --git a/code/modules/power/power.dm b/code/modules/power/power.dm index 82936a1dc8..b87073ce5f 100644 --- a/code/modules/power/power.dm +++ b/code/modules/power/power.dm @@ -112,8 +112,7 @@ C.powernet.cables += C for(var/obj/machinery/power/M in machines) - if(!M.powernet) continue // APCs have powernet=0 so they don't count as network nodes directly - M.powernet.nodes[M] = M + M.connect_to_network() return 1 @@ -232,12 +231,17 @@ return . /obj/machinery/power/proc/connect_to_network() + // First disconnect us from the old powernet + if(powernet) + powernet.nodes -= src + powernet = null + // Then find any cables on our location var/turf/T = src.loc var/obj/structure/cable/C = T.get_cable_node() if(!C || !C.powernet) return 0 -// makepowernets() //TODO: find fast way //EWWWW what are you doing!? + // And connect us to their powernet powernet = C.powernet - powernet.nodes[src] = src + powernet.nodes += src return 1 /obj/machinery/power/proc/disconnect_from_network() diff --git a/code/modules/power/smes.dm b/code/modules/power/smes.dm index 80ad06248e..a4ade0b8db 100644 --- a/code/modules/power/smes.dm +++ b/code/modules/power/smes.dm @@ -11,6 +11,7 @@ density = 1 anchored = 1 use_power = 0 + directwired = 0 var/output = 50000 //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() @@ -60,7 +61,9 @@ overlays += image('icons/obj/power.dmi', "smes-op[online]") - if(charging) + if(charging == 2) + overlays += image('icons/obj/power.dmi', "smes-oc2") + else if (charging == 1) overlays += image('icons/obj/power.dmi', "smes-oc1") else if(chargemode) @@ -95,9 +98,11 @@ var/actual_load = add_load(target_load) // add the load to the terminal side network charge += actual_load * SMESRATE // increase the charge - if (actual_load >= target_load) // did the powernet have enough power available for us? + if (actual_load >= target_load) // Did we charge at full rate? + charging = 2 + else if (actual_load) // If not, did we charge at least partially? charging = 1 - else + else // Or not at all? charging = 0 if(online) // if outputting @@ -222,6 +227,7 @@ "You added cables to the [src].") terminal.connect_to_network() stat = 0 + return 0 else if(istype(W, /obj/item/weapon/wirecutters) && terminal && !building_terminal) building_terminal = 1 @@ -245,6 +251,7 @@ "You cut the cables and dismantle the power terminal.") del(terminal) building_terminal = 0 + return 0 return 1 /obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1) diff --git a/code/modules/power/smes_construction.dm b/code/modules/power/smes_construction.dm index 891f231f8f..6b6fb17908 100644 --- a/code/modules/power/smes_construction.dm +++ b/code/modules/power/smes_construction.dm @@ -113,7 +113,8 @@ h_user << "Medium electrical sparks as you touch the [src], severely burning your hand!" h_user.adjustFireLoss(rand(10,25)) h_user.Paralyse(5) - empulse(src.loc, 2, 4) + spawn(0) + empulse(src.loc, 2, 4) charge = 0 if (36 to 60) @@ -129,7 +130,8 @@ h_user << "Strong electrical arc sparks between you and [src], knocking you out for a while!" h_user.adjustFireLoss(rand(35,75)) h_user.Paralyse(12) - empulse(src.loc, 8, 16) + spawn(0) + empulse(src.loc, 8, 16) charge = 0 apcs_overload(1, 10) src.visible_message("\icon[src] [src] beeps: \"Caution. Output regulators malfunction. Uncontrolled discharge detected.\"") @@ -143,7 +145,8 @@ // Remember, we have few gigajoules of electricity here.. Turn them into crispy toast. h_user.adjustFireLoss(rand(150,195)) h_user.Paralyse(25) - empulse(src.loc, 32, 64) + spawn(0) + empulse(src.loc, 32, 64) charge = 0 apcs_overload(5, 25) src.visible_message("\icon[src] [src] beeps: \"Caution. Output regulators malfunction. Significant uncontrolled discharge detected.\"") @@ -228,7 +231,7 @@ for(var/obj/I in component_parts) if(I.reliability != 100 && crit_fail) I.crit_fail = 1 - I.loc = src.loc + I.loc = src.loc del(src) return diff --git a/code/modules/power/terminal.dm b/code/modules/power/terminal.dm index f739ba93fd..3f19ef8da0 100644 --- a/code/modules/power/terminal.dm +++ b/code/modules/power/terminal.dm @@ -30,3 +30,7 @@ invisibility = 0 icon_state = "term" +// Needed so terminals are not removed from machines list. +// Powernet rebuilds need this to work properly. +/obj/machinery/power/terminal/process() + return 1 \ No newline at end of file diff --git a/icons/obj/power.dmi b/icons/obj/power.dmi index 4d2282bbcf..e10f708f41 100644 Binary files a/icons/obj/power.dmi and b/icons/obj/power.dmi differ diff --git a/nano/templates/smes.tmpl b/nano/templates/smes.tmpl index 04b93b4148..8b72cefedd 100644 --- a/nano/templates/smes.tmpl +++ b/nano/templates/smes.tmpl @@ -18,10 +18,12 @@
{{:helper.link('Auto', 'refresh', {'cmode' : 1}, data.chargeMode ? 'selected' : null)}}{{:helper.link('Off', 'close', {'cmode' : 1}, data.chargeMode ? null : 'selected')}}   - {{if data.charging}} + {{if data.charging == 2}} [Charging] + {{else data.charging == 1}} + [Partially Charging] {{else}} - [Not Charging] + [Not Charging] {{/if}}
@@ -36,7 +38,7 @@ {{:helper.link('MIN', null, {'input' : 'min'}, (data.chargeLevel > 0) ? null : 'disabled')}} {{:helper.link('SET', null, {'input' : 'set'}, null)}} {{:helper.link('MAX', null, {'input' : 'max'}, (data.chargeLevel < data.chargeMax) ? null : 'disabled')}} -
 {{:data.chargeLevel}} W 
+
 {{:data.chargeLevel}} W 
@@ -61,7 +63,7 @@ {{:helper.link('MIN', null, {'output' : 'min'}, (data.outputLevel > 0) ? null : 'disabled')}} {{:helper.link('SET', null, {'output' : 'set'}, null)}} {{:helper.link('MAX', null, {'output' : 'max'}, (data.outputLevel < data.outputMax) ? null : 'disabled')}} -
 {{:data.outputLevel}} W 
+
 {{:data.outputLevel}} W