SMES Power Storage Unit [n_tag? "([n_tag])" : null]
"
+
+ t += "Stored capacity : [round(100.0*charge/capacity, 0.1)]%
"
+
+ t += "Input: [charging ? "Charging" : "Not Charging"] [chargemode ? "Auto Off" : "Auto Off "]
"
- var/t = "SMES Power Storage Unit [n_tag? "([n_tag])" : null]
"
+ t += "Input level: M - - - [add_lspace(chargelevel,5)] + + + M
"
- t += "Stored capacity : [round(100.0*charge/capacity, 0.1)]%
"
+ t += "
"
- t += "Input: [charging ? "Charging" : "Not Charging"] [chargemode ? "Auto Off" : "Auto Off "]
"
+ t += "Output: [online ? "Online Offline" : "Online Offline "]
"
+ t += "Output level: M - - - [add_lspace(output,5)] + + + M
"
- t += "Input level: M - - - [add_lspace(chargelevel,5)] + + + M
"
+ t += "Output load: [round(loaddemand)] W
"
- t += "
"
+ t += "
Close"
- t += "Output: [online ? "Online Offline" : "Online Offline "]
"
-
- t += "Output level: M - - - [add_lspace(output,5)] + + + M
"
-
- t += "Output load: [round(loaddemand)] W
"
-
- t += "
Close"
-
- t += ""
- user << browse(t, "window=smes;size=460x300")
- onclose(user, "smes")
- return
-
-/obj/machinery/power/smes/Topic(href, href_list)
- ..()
-
- if (usr.stat || usr.restrained() )
+ t += ""
+ user << browse(t, "window=smes;size=460x300")
+ onclose(user, "smes")
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!"
+
+
+ Topic(href, href_list)
+ ..()
+
+ 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
//world << "[href] ; [href_list[href]]"
- if (( usr.machine==src && ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
+ if (( usr.machine==src && ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
- if( href_list["close"] )
+ if( href_list["close"] )
+ usr << browse(null, "window=smes")
+ usr.machine = null
+ return
+
+ else if( href_list["cmode"] )
+ chargemode = !chargemode
+ if(!chargemode)
+ charging = 0
+ updateicon()
+
+ else if( href_list["online"] )
+ online = !online
+ updateicon()
+ else if( href_list["input"] )
+
+ var/i = text2num(href_list["input"])
+
+ var/d = 0
+ switch(i)
+ if(-4)
+ chargelevel = 0
+ if(4)
+ chargelevel = SMESMAXCHARGELEVEL //30000
+
+ if(1)
+ d = 100
+ if(-1)
+ d = -100
+ if(2)
+ d = 1000
+ if(-2)
+ d = -1000
+ if(3)
+ d = 10000
+ if(-3)
+ d = -10000
+
+ chargelevel += d
+ chargelevel = max(0, min(SMESMAXCHARGELEVEL, chargelevel)) // clamp to range
+
+ else if( href_list["output"] )
+
+ var/i = text2num(href_list["output"])
+
+ var/d = 0
+ switch(i)
+ if(-4)
+ output = 0
+ if(4)
+ output = SMESMAXOUTPUT //30000
+
+ if(1)
+ d = 100
+ if(-1)
+ d = -100
+ if(2)
+ d = 1000
+ if(-2)
+ d = -1000
+ if(3)
+ d = 10000
+ if(-3)
+ d = -10000
+
+ output += d
+ output = max(0, min(SMESMAXOUTPUT, output)) // clamp to range
+
+
+ src.updateUsrDialog()
+
+ else
usr << browse(null, "window=smes")
usr.machine = null
- return
-
- else if( href_list["cmode"] )
- chargemode = !chargemode
- if(!chargemode)
- charging = 0
- updateicon()
-
- else if( href_list["online"] )
- online = !online
- updateicon()
- else if( href_list["input"] )
-
- var/i = text2num(href_list["input"])
-
- var/d = 0
- switch(i)
- if(-4)
- chargelevel = 0
- if(4)
- chargelevel = SMESMAXCHARGELEVEL //30000
-
- if(1)
- d = 100
- if(-1)
- d = -100
- if(2)
- d = 1000
- if(-2)
- d = -1000
- if(3)
- d = 10000
- if(-3)
- d = -10000
-
- chargelevel += d
- chargelevel = max(0, min(SMESMAXCHARGELEVEL, chargelevel)) // clamp to range
-
- else if( href_list["output"] )
-
- var/i = text2num(href_list["output"])
-
- var/d = 0
- switch(i)
- if(-4)
- output = 0
- if(4)
- output = SMESMAXOUTPUT //30000
-
- if(1)
- d = 100
- if(-1)
- d = -100
- if(2)
- d = 1000
- if(-2)
- d = -1000
- if(3)
- d = 10000
- if(-3)
- d = -10000
-
- output += d
- output = max(0, min(SMESMAXOUTPUT, output)) // clamp to range
+ return
- src.updateUsrDialog()
+ proc/ion_act()
+ if(src.z == 1)
+ if(prob(1)) //explosion
+ world << "\red SMES explosion in [src.loc.loc]"
+ for(var/mob/M in viewers(src))
+ M.show_message("\red The [src.name] is making strange noises!", 3, "\red You hear sizzling electronics.", 2)
+ sleep(10*pick(4,5,6,7,10,14))
+ var/datum/effect/effect/system/harmless_smoke_spread/smoke = new /datum/effect/effect/system/harmless_smoke_spread()
+ smoke.set_up(3, 0, src.loc)
+ smoke.attach(src)
+ smoke.start()
+ explosion(src.loc, -1, 0, 1, 3, 0)
+ del(src)
+ return
+ if(prob(15)) //Power drain
+ world << "\red SMES power drain in [src.loc.loc]"
+ var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
+ s.set_up(3, 1, src)
+ s.start()
+ if(prob(50))
+ emp_act(1)
+ else
+ emp_act(2)
+ if(prob(5)) //smoke only
+ world << "\red SMES smoke in [src.loc.loc]"
+ var/datum/effect/effect/system/harmless_smoke_spread/smoke = new /datum/effect/effect/system/harmless_smoke_spread()
+ smoke.set_up(3, 0, src.loc)
+ smoke.attach(src)
+ smoke.start()
- else
- usr << browse(null, "window=smes")
- usr.machine = null
- return
+ emp_act(severity)
+ online = 0
+ charging = 0
+ output = 0
+ charge -= 1e6/severity
+ if (charge < 0)
+ charge = 0
+ spawn(100)
+ output = initial(output)
+ charging = initial(charging)
+ online = initial(online)
+ ..()
+
+
+
+/obj/machinery/power/smes/magical
+ name = "magical power storage unit"
+ desc = "A high-capacity superconducting magnetic energy storage (SMES) unit. Magically produces power."
+ process()
+ capacity = INFINITY
+ charge = INFINITY
+ ..()
-/obj/machinery/power/smes/proc/ion_act()
- if(src.z == 1)
- if(prob(1)) //explosion
- world << "\red SMES explosion in [src.loc.loc]"
- for(var/mob/M in viewers(src))
- M.show_message("\red The [src.name] is making strange noises!", 3, "\red You hear sizzling electronics.", 2)
- sleep(10*pick(4,5,6,7,10,14))
- var/datum/effect/effect/system/harmless_smoke_spread/smoke = new /datum/effect/effect/system/harmless_smoke_spread()
- smoke.set_up(3, 0, src.loc)
- smoke.attach(src)
- smoke.start()
- explosion(src.loc, -1, 0, 1, 3, 0)
- del(src)
- return
- if(prob(15)) //Power drain
- world << "\red SMES power drain in [src.loc.loc]"
- var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
- s.set_up(3, 1, src)
- s.start()
- if(prob(50))
- emp_act(1)
- else
- emp_act(2)
- if(prob(5)) //smoke only
- world << "\red SMES smoke in [src.loc.loc]"
- var/datum/effect/effect/system/harmless_smoke_spread/smoke = new /datum/effect/effect/system/harmless_smoke_spread()
- smoke.set_up(3, 0, src.loc)
- smoke.attach(src)
- smoke.start()
-/obj/machinery/power/smes/emp_act(severity)
- online = 0
- charging = 0
- output = 0
- charge -= 1e6/severity
- if (charge < 0)
- charge = 0
- spawn(100)
- output = initial(output)
- charging = initial(charging)
- online = initial(online)
- ..()
/proc/rate_control(var/S, var/V, var/C, var/Min=1, var/Max=5, var/Limit=null)
var/href = "