Removes SMES power failure.

changes exception system to use critical_machine variable on machines.
Tcomms machines and the AI have their areas exempted.
If the PA is assembled, engineering is exempted.
This commit is contained in:
Shadowlight213
2016-08-22 19:24:59 -07:00
parent e0d2a9f434
commit 7e09f1bc77
10 changed files with 62 additions and 97 deletions
-1
View File
@@ -1,5 +1,4 @@
var/global/list/cable_list = list() //Index for all cables, so that powernets don't have to look through the entire world all the time
var/global/list/smes_list = list() //list of all SMES
var/global/list/portals = list() //list of all /obj/effect/portal
var/global/list/airlocks = list() //list of all airlocks
var/global/list/mechas_list = list() //list of all mechs. Used by hostile mobs target tracking.
-2
View File
@@ -57,7 +57,6 @@
S.charge = S.capacity
S.output_level = S.output_level_max
S.output_attempt = 1
S.failure_timer = 0
S.update_icon()
S.power_change()
for(var/area/A in world)
@@ -76,7 +75,6 @@
S.charge = S.capacity
S.output_level = S.output_level_max
S.output_attempt = 1
S.failure_timer = 0
S.update_icon()
S.power_change()
+1
View File
@@ -114,6 +114,7 @@ Class Procs:
var/global/gl_uid = 1
var/panel_open = 0
var/state_open = 0
var/critical_machine = FALSE //If this machine is critical to station operation and should have the area be excempted from power failures.
var/mob/living/occupant = null
var/unsecuring_tool = /obj/item/weapon/wrench
var/interact_open = 0 // Can the machine be interacted with when in maint/when the panel is open.
@@ -31,6 +31,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
var/long_range_link = 0 // Can you link it across Z levels or on the otherside of the map? (Relay & Hub)
var/hide = 0 // Is it a hidden machine?
var/listening_level = 0 // 0 = auto set in New() - this is the z level that the machine is listening to.
critical_machine = TRUE
/obj/machinery/telecomms/proc/relay_information(datum/signal/signal, filter, copysig, amount = 20)
-19
View File
@@ -13,26 +13,7 @@
/datum/round_event/grid_check/start()
var/static/list/smes_skip = typecacheof(list(/area/engine/engine_smes, /area/turret_protected))
for(var/V in smes_list)
var/obj/machinery/power/smes/S = V
var/area/A = get_area(S)
if(is_type_in_typecache(A,smes_skip) || S.z != ZLEVEL_STATION)
continue
S.energy_fail(rand(15,30))
var/static/list/skipped_areas = typecacheof(list(/area/engine/engineering, /area/turret_protected/ai))
for(var/P in apcs_list)
var/obj/machinery/power/apc/C = P
if(C.cell && C.z == ZLEVEL_STATION)
var/area/A = get_area(C)
if(is_type_in_typecache(A,skipped_areas))
continue
C.energy_fail(rand(30,120))
+8
View File
@@ -1150,6 +1150,14 @@
/obj/machinery/power/apc/proc/energy_fail(duration)
for(var/obj/machinery/M in area.contents)
if(M.critical_machine)
return
for(var/A in ai_list)
var/mob/living/silicon/ai/I = A
if(get_area(I) == area)
return
failure_timer = max(failure_timer, round(duration))
@@ -159,6 +159,7 @@
var/turf/T = loc
assembled = 0
critical_machine = FALSE
var/obj/structure/particle_accelerator/fuel_chamber/F = locate() in orange(1,src)
if(!F)
@@ -189,6 +190,7 @@
return 0
assembled = 1
critical_machine = TRUE //Only counts if the PA is actually assembled.
return 1
/obj/machinery/particle_accelerator/control_box/proc/check_part(turf/T, type)
-17
View File
@@ -29,7 +29,6 @@
var/input_level = 50000 // amount of power the SMES attempts to charge by
var/input_level_max = 200000 // cap on input_level
var/input_available = 0 // amount of charge available from input last tick
var/failure_timer = 0
var/output_attempt = 1 // 1 = attempting to output, 0 = not attempting to output
var/outputting = 1 // 1 = actually outputting, 0 = not outputting
@@ -44,7 +43,6 @@
/obj/machinery/power/smes/New()
..()
smes_list |= src
var/obj/item/weapon/circuitboard/machine/B = new /obj/item/weapon/circuitboard/machine/smes(null)
B.apply_default_parts(src)
@@ -184,7 +182,6 @@
cell.charge = (charge / capacity) * cell.maxcharge
/obj/machinery/power/smes/Destroy()
smes_list -= src
if(ticker && ticker.current_state == GAME_STATE_PLAYING)
var/area/area = get_area(src)
message_admins("SMES deleted at (<A HREF='?_src_=holder;adminplayerobservecoodjump=1;X=[x];Y=[y];Z=[z]'>[area.name]</a>)")
@@ -254,9 +251,6 @@
if(stat & BROKEN)
return
if(failure_timer) // Disabled by gridcheck.
failure_timer--
return
//store machine state to see if we need to update the icon overlays
var/last_disp = chargedisplay()
@@ -347,18 +341,14 @@
/obj/machinery/power/smes/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
datum/tgui/master_ui = null, datum/ui_state/state = default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "smes", name, 340, 440, master_ui, state)
ui.open()
if(ui)
ui.set_autoupdate(state = (failure_timer ? 1 : 0))
/obj/machinery/power/smes/ui_data()
var/list/data = list(
"capacityPercent" = round(100*charge/capacity, 0.1),
"capacity" = capacity,
"failTime" = failure_timer,
"charge" = charge,
"inputAttempt" = input_attempt,
@@ -379,9 +369,6 @@
if(..())
return
switch(action)
if("reboot")
failure_timer = 0
update_icon()
if("tryinput")
input_attempt = !input_attempt
log_smes(usr.ckey)
@@ -436,7 +423,6 @@
if(.)
output_level = Clamp(target, 0, output_level_max)
log_smes(usr.ckey)
return 1
/obj/machinery/power/smes/proc/log_smes(user = "")
investigate_log("input/output; [input_level>output_level?"<font color='green'>":"<font color='red'>"][input_level]/[output_level]</font> | Charge: [charge] | Output-mode: [output_attempt?"<font color='green'>on</font>":"<font color='red'>off</font>"] | Input-mode: [input_attempt?"<font color='green'>auto</font>":"<font color='red'>off</font>"] by [user]", "singulo")
@@ -456,9 +442,6 @@
log_smes("an emp")
..()
/obj/machinery/power/smes/proc/energy_fail(duration)
failure_timer = duration
/obj/machinery/power/smes/engineering
charge = 1.5e6 // Engineering starts with some charge for singulo
+2 -2
View File
File diff suppressed because one or more lines are too long
+48 -56
View File
@@ -20,59 +20,51 @@
}
}
</script>
{{#if data.failTime}}
<ui-notice>
<b><h3>SYSTEM FAILURE</h3></b>
<i>I/O regulators malfunction detected! Waiting for system reboot...</i><br>
Automatic reboot in {{data.failTime}} seconds...
<ui-button icon='refresh' action='reboot'>Reboot Now</ui-button><br><br><br>
</ui-notice>
{{else}}
<ui-display title='Storage'>
<ui-section label='Stored Energy'>
<ui-bar min='0' max='100' value='{{data.capacityPercent}}' state='{{capacityPercentState}}'>{{Math.fixed(adata.capacityPercent)}}%</ui-bar>
</ui-section>
</ui-display>
<ui-display title='Input'>
<ui-section label='Charge Mode'>
<ui-button icon='{{data.inputAttempt ? "refresh" : "close"}}' style='{{data.inputAttempt ? "selected" : null}}'
action='tryinput'>{{data.inputAttempt ? "Auto" : "Off"}}</ui-button>
&nbsp;
[<span class='{{inputState}}'>{{data.capacityPercent >= 100 ? "Fully Charged" : data.inputting ? "Charging" : "Not Charging"}}</span>]
</ui-section>
<ui-section label='Target Input'>
<ui-bar min='0' max='{{data.inputLevelMax}}' value='{{data.inputLevel}}'>{{Math.round(adata.inputLevel)}}W</ui-bar>
</ui-section>
<ui-section label='Adjust Input'>
<ui-button icon='fast-backward' state='{{data.inputLevel == 0 ? "disabled" : null}}' action='input' params='{"target": "min"}'/>
<ui-button icon='backward' state='{{data.inputLevel == 0 ? "disabled" : null}}' action='input' params='{"adjust": -10000}'/>
<ui-button icon='pencil' action='input' params='{"target": "input"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.inputLevel == data.inputLevelMax ? "disabled" : null}}' action='input' params='{"adjust": 10000}'/>
<ui-button icon='fast-forward' state='{{data.inputLevel == data.inputLevelMax ? "disabled" : null}}' action='input' params='{"target": "max"}'/>
</ui-section>
<ui-section label='Available'>
<span>{{Math.round(adata.inputAvailable)}}W</span>
</ui-section>
</ui-display>
<ui-display title='Output'>
<ui-section label='Output Mode'>
<ui-button icon='{{data.outputAttempt ? "power-off" : "close"}}' style='{{data.outputAttempt ? "selected" : null}}'
action='tryoutput'>{{data.outputAttempt ? "On" : "Off"}}</ui-button>
&nbsp;
[<span class='{{outputState}}'>{{data.outputting ? "Sending" : data.charge > 0 ? "Not Sending" : "No Charge"}}</span>]
</ui-section>
<ui-section label='Target Output'>
<ui-bar min='0' max='{{data.outputLevelMax}}' value='{{data.outputLevel}}'>{{Math.round(adata.outputLevel)}}W</ui-bar>
</ui-section>
<ui-section label='Adjust Output'>
<ui-button icon='fast-backward' state='{{data.outputLevel == 0 ? "disabled" : null}}' action='output' params='{"target": "min"}'/>
<ui-button icon='backward' state='{{data.outputLevel == 0 ? "disabled" : null}}' action='output' params='{"adjust": -10000}'/>
<ui-button icon='pencil' action='output' params='{"target": "input"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.outputLevel == data.outputLevelMax ? "disabled" : null}}' action='output' params='{"adjust": 10000}'/>
<ui-button icon='fast-forward' state='{{data.outputLevel == data.outputLevelMax ? "disabled" : null}}' action='output' params='{"target": "max"}'/>
</ui-section>
<ui-section label='Outputting'>
<span>{{Math.round(adata.outputUsed)}}W</span>
</ui-section>
</ui-display>
{{/if}}
<ui-display title='Storage'>
<ui-section label='Stored Energy'>
<ui-bar min='0' max='100' value='{{data.capacityPercent}}' state='{{capacityPercentState}}'>{{Math.fixed(adata.capacityPercent)}}%</ui-bar>
</ui-section>
</ui-display>
<ui-display title='Input'>
<ui-section label='Charge Mode'>
<ui-button icon='{{data.inputAttempt ? "refresh" : "close"}}' style='{{data.inputAttempt ? "selected" : null}}'
action='tryinput'>{{data.inputAttempt ? "Auto" : "Off"}}</ui-button>
&nbsp;
[<span class='{{inputState}}'>{{data.capacityPercent >= 100 ? "Fully Charged" : data.inputting ? "Charging" : "Not Charging"}}</span>]
</ui-section>
<ui-section label='Target Input'>
<ui-bar min='0' max='{{data.inputLevelMax}}' value='{{data.inputLevel}}'>{{Math.round(adata.inputLevel)}}W</ui-bar>
</ui-section>
<ui-section label='Adjust Input'>
<ui-button icon='fast-backward' state='{{data.inputLevel == 0 ? "disabled" : null}}' action='input' params='{"target": "min"}'/>
<ui-button icon='backward' state='{{data.inputLevel == 0 ? "disabled" : null}}' action='input' params='{"adjust": -10000}'/>
<ui-button icon='pencil' action='input' params='{"target": "input"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.inputLevel == data.inputLevelMax ? "disabled" : null}}' action='input' params='{"adjust": 10000}'/>
<ui-button icon='fast-forward' state='{{data.inputLevel == data.inputLevelMax ? "disabled" : null}}' action='input' params='{"target": "max"}'/>
</ui-section>
<ui-section label='Available'>
<span>{{Math.round(adata.inputAvailable)}}W</span>
</ui-section>
</ui-display>
<ui-display title='Output'>
<ui-section label='Output Mode'>
<ui-button icon='{{data.outputAttempt ? "power-off" : "close"}}' style='{{data.outputAttempt ? "selected" : null}}'
action='tryoutput'>{{data.outputAttempt ? "On" : "Off"}}</ui-button>
&nbsp;
[<span class='{{outputState}}'>{{data.outputting ? "Sending" : data.charge > 0 ? "Not Sending" : "No Charge"}}</span>]
</ui-section>
<ui-section label='Target Output'>
<ui-bar min='0' max='{{data.outputLevelMax}}' value='{{data.outputLevel}}'>{{Math.round(adata.outputLevel)}}W</ui-bar>
</ui-section>
<ui-section label='Adjust Output'>
<ui-button icon='fast-backward' state='{{data.outputLevel == 0 ? "disabled" : null}}' action='output' params='{"target": "min"}'/>
<ui-button icon='backward' state='{{data.outputLevel == 0 ? "disabled" : null}}' action='output' params='{"adjust": -10000}'/>
<ui-button icon='pencil' action='output' params='{"target": "input"}'>Set</ui-button>
<ui-button icon='forward' state='{{data.outputLevel == data.outputLevelMax ? "disabled" : null}}' action='output' params='{"adjust": 10000}'/>
<ui-button icon='fast-forward' state='{{data.outputLevel == data.outputLevelMax ? "disabled" : null}}' action='output' params='{"target": "max"}'/>
</ui-section>
<ui-section label='Outputting'>
<span>{{Math.round(adata.outputUsed)}}W</span>
</ui-section>
</ui-display>