Standardized power displays

This commit is contained in:
shizcalev
2017-08-28 14:22:05 -04:00
parent 964d481210
commit 2427f217f7
20 changed files with 70 additions and 63 deletions
+11
View File
@@ -357,6 +357,17 @@ Turf and target are separate in case you want to teleport some distance from a t
var/M = E/(SPEED_OF_LIGHT_SQ)
return M
//Takes the value of energy used/produced/ect.
//Returns a text value of that number in W, kW, MW, or GW.
/proc/DisplayPower(var/powerused)
if(powerused < 1000) //Less than a kW
return "[powerused] W"
else if(powerused < 1000000) //Less than a MW
return "[round((powerused * 0.001),0.01)] kW"
else if(powerused < 1000000000) //Less than a GW
return "[round((powerused * 0.000001),0.001)] MW"
return "[round((powerused * 0.000000001),0.0001)] GW"
/proc/key_name(whom, include_link = null, include_name = 1)
var/mob/M
var/client/C
+1 -1
View File
@@ -66,7 +66,7 @@
if(filters["Responsive"] && !APC.aidisabled)
continue
dat += "<a href='?src=\ref[src];access_apc=\ref[APC]'>[A]</a><br>\
<b>Charge:</b> [APC.cell.charge] / [APC.cell.maxcharge] W ([round((APC.cell.charge / APC.cell.maxcharge) * 100)]%)<br>\
<b>Charge:</b> [DisplayPower(APC.cell.charge)] / [DisplayPower(APC.cell.maxcharge)] ([round((APC.cell.charge / APC.cell.maxcharge) * 100)]%)<br>\
<b>Area:</b> [APC.area]<br>\
[APC.aidisabled || APC.panel_open ? "<font color='#FF0000'>APC does not respond to interface query.</font>" : "<font color='#00FF00'>APC responds to interface query.</font>"]<br><br>"
dat += "<a href='?src=\ref[src];check_logs=1'>Check Logs</a><br>"
+2 -2
View File
@@ -302,7 +302,7 @@ Code:
var/obj/machinery/power/apc/A = term.master
L += A
menu += "<PRE>Total power: [powmonitor.attached.powernet.viewavail] W<BR>Total load: [num2text(powmonitor.attached.powernet.viewload,10)] W<BR>"
menu += "<PRE>Total power: [DisplayPower(powmonitor.attached.powernet.viewavail)]<BR>Total load: [DisplayPower(powmonitor.attached.powernet.viewload)]<BR>"
menu += "<FONT SIZE=-1>"
@@ -314,7 +314,7 @@ Code:
for(var/obj/machinery/power/apc/A in L)
menu += copytext(add_tspace(A.area.name, 30), 1, 30)
menu += " [S[A.equipment+1]] [S[A.lighting+1]] [S[A.environ+1]] [add_lspace(A.lastused_total, 6)] [A.cell ? "[add_lspace(round(A.cell.percent()), 3)]% [chg[A.charging+1]]" : " N/C"]<BR>"
menu += " [S[A.equipment+1]] [S[A.lighting+1]] [S[A.environ+1]] [add_lspace(DisplayPower(A.lastused_total), 6)] [A.cell ? "[add_lspace(round(A.cell.percent()), 3)]% [chg[A.charging+1]]" : " N/C"]<BR>"
menu += "</FONT></PRE>"
+1 -1
View File
@@ -157,7 +157,7 @@
/obj/item/inducer/examine(mob/living/M)
..()
if(cell)
to_chat(M, "<span class='notice'>It's display shows: [cell.charge]W</span>")
to_chat(M, "<span class='notice'>It's display shows: [DisplayPower(cell.charge)]</span>")
else
to_chat(M,"<span class='notice'>It's display is dark.</span>")
if(opened)
@@ -58,8 +58,8 @@
data["interval"] = record_interval / 10
data["attached"] = attached ? TRUE : FALSE
if(attached)
data["supply"] = attached.powernet.viewavail
data["demand"] = attached.powernet.viewload
data["supply"] = DisplayPower(attached.powernet.viewavail)
data["demand"] = DisplayPower(attached.powernet.viewload)
data["history"] = history
data["areas"] = list()
@@ -70,7 +70,7 @@
data["areas"] += list(list(
"name" = A.area.name,
"charge" = A.cell ? A.cell.percent() : 0,
"load" = A.lastused_total,
"load" = DisplayPower(A.lastused_total),
"charging" = A.charging,
"eqp" = A.equipment,
"lgt" = A.lighting,
+1 -1
View File
@@ -170,7 +170,7 @@ Contents:
..()
if(s_initialized)
if(user == affecting)
to_chat(user, "All systems operational. Current energy capacity: <B>[cell.charge]</B>.")
to_chat(user, "All systems operational. Current energy capacity: <B>[DisplayPower(cell.charge)]</B>.")
to_chat(user, "The CLOAK-tech device is <B>[s_active?"active":"inactive"]</B>.")
to_chat(user, "There are <B>[s_bombs]</B> smoke bomb\s remaining.")
to_chat(user, "There are <B>[a_boost]</B> adrenaline booster\s remaining.")
@@ -44,7 +44,7 @@
addtimer(CALLBACK(src, .proc/ninitialize_six, delay, U), delay)
/obj/item/clothing/suit/space/space_ninja/proc/ninitialize_six(delay, mob/living/carbon/human/U)
to_chat(U, "<span class='notice'>Primary system status: <B>ONLINE</B>.\nBackup system status: <B>ONLINE</B>.\nCurrent energy capacity: <B>[cell.charge]</B>.</span>")
to_chat(U, "<span class='notice'>Primary system status: <B>ONLINE</B>.\nBackup system status: <B>ONLINE</B>.\nCurrent energy capacity: <B>[DisplayPower(cell.charge)]</B>.</span>")
addtimer(CALLBACK(src, .proc/ninitialize_seven, delay, U), delay)
/obj/item/clothing/suit/space/space_ninja/proc/ninitialize_seven(delay, mob/living/carbon/human/U)
+1 -1
View File
@@ -306,7 +306,7 @@
dat += "Cores: [linked_cores.len]<BR><BR>"
dat += "-Current Efficiency: [reported_core_efficiency]<BR>"
dat += "-Average Stability: [stored_core_stability] <A href='?src=\ref[src];refreshstability=1'>(update)</A><BR>"
dat += "Last Produced: [stored_power]<BR>"
dat += "Last Produced: [DisplayPower(stored_power)]<BR>"
dat += "Fuel: "
if(!fueljar)
+4 -4
View File
@@ -658,7 +658,7 @@
"powerCellStatus" = cell ? cell.percent() : null,
"chargeMode" = chargemode,
"chargingStatus" = charging,
"totalLoad" = lastused_total,
"totalLoad" = DisplayPower(lastused_total),
"coverLocked" = coverlocked,
"siliconUser" = user.has_unlimited_silicon_privilege || user.using_power_flow_console(),
"malfStatus" = get_malf_status(user),
@@ -666,7 +666,7 @@
"powerChannels" = list(
list(
"title" = "Equipment",
"powerLoad" = lastused_equip,
"powerLoad" = DisplayPower(lastused_equip),
"status" = equipment,
"topicParams" = list(
"auto" = list("eqp" = 3),
@@ -676,7 +676,7 @@
),
list(
"title" = "Lighting",
"powerLoad" = lastused_light,
"powerLoad" = DisplayPower(lastused_light),
"status" = lighting,
"topicParams" = list(
"auto" = list("lgt" = 3),
@@ -686,7 +686,7 @@
),
list(
"title" = "Environment",
"powerLoad" = lastused_environ,
"powerLoad" = DisplayPower(lastused_environ),
"status" = environ,
"topicParams" = list(
"auto" = list("env" = 3),
+1 -1
View File
@@ -143,7 +143,7 @@ By design, d1 is the smallest direction and d2 is the highest
else if(istype(W, /obj/item/device/multitool))
if(powernet && (powernet.avail > 0)) // is it powered?
to_chat(user, "<span class='danger'>[powernet.avail]W in power network.</span>")
to_chat(user, "<span class='danger'>[DisplayPower(powernet.avail)] in power network.</span>")
else
to_chat(user, "<span class='danger'>The cable is not powered.</span>")
shock(user, 5, 0.2)
+6 -12
View File
@@ -55,7 +55,7 @@
stat |= BROKEN
update_icon()
/obj/machinery/power/generator/Destroy()
SSair.atmos_machinery -= src
return ..()
@@ -126,7 +126,7 @@
if(cold_air)
var/datum/gas_mixture/cold_circ_air1 = cold_circ.AIR1
cold_circ_air1.merge(cold_air)
update_icon()
var/circ = "[cold_circ && cold_circ.last_pressure_delta > 0 ? "1" : "0"][hot_circ && hot_circ.last_pressure_delta > 0 ? "1" : "0"]"
@@ -135,7 +135,7 @@
update_icon()
src.updateDialog()
/obj/machinery/power/generator/process()
//Setting this number higher just makes the change in power output slower, it doesnt actualy reduce power output cause **math**
var/power_output = round(lastgen / 10)
@@ -161,15 +161,9 @@
var/datum/gas_mixture/hot_circ_air2 = hot_circ.AIR2
t += "<div class='statusDisplay'>"
var/displaygen = lastgenlev
if(displaygen < 1000000) //less than a MW
displaygen /= 1000
t += "Output: [round(displaygen,0.01)] kW"
else
displaygen /= 1000000
t += "Output: [round(displaygen,0.01)] MW"
t += "Output: [DisplayPower(lastgenlev)]"
t += "<BR>"
t += "<B><font color='blue'>Cold loop</font></B><BR>"
+3 -3
View File
@@ -66,8 +66,8 @@
data["areas"] = list()
if(attached)
data["supply"] = attached.powernet.viewavail
data["demand"] = attached.powernet.viewload
data["supply"] = DisplayPower(attached.powernet.viewavail)
data["demand"] = DisplayPower(attached.powernet.viewload)
for(var/obj/machinery/power/terminal/term in attached.powernet.nodes)
var/obj/machinery/power/apc/A = term.master
if(istype(A))
@@ -79,7 +79,7 @@
data["areas"] += list(list(
"name" = A.area.name,
"charge" = cell_charge,
"load" = A.lastused_total,
"load" = DisplayPower(A.lastused_total),
"charging" = A.charging,
"eqp" = A.equipment,
"lgt" = A.lighting,
+1 -1
View File
@@ -230,7 +230,7 @@
var/stack_percent = round(sheet_left * 100, 1)
dat += text("Current stack: [stack_percent]% <br>")
dat += text("Power output: <A href='?src=\ref[src];action=lower_power'>-</A> [power_gen * power_output] <A href='?src=\ref[src];action=higher_power'>+</A><br>")
dat += text("Power current: [(powernet == null ? "Unconnected" : "[avail()]")]<br>")
dat += text("Power current: [(powernet == null ? "Unconnected" : "[DisplayPower(avail())]")]<br>")
dat += text("Heat: [current_heat]<br>")
dat += "<br><A href='?src=\ref[src];action=close'>Close</A>"
user << browse(dat, "window=port_gen")
+4 -2
View File
@@ -335,14 +335,16 @@
"inputAttempt" = input_attempt,
"inputting" = inputting,
"inputLevel" = input_level,
"inputLevel_text" = DisplayPower(input_level),
"inputLevelMax" = input_level_max,
"inputAvailable" = input_available,
"inputAvailable" = DisplayPower(input_available),
"outputAttempt" = output_attempt,
"outputting" = outputting,
"outputLevel" = output_level,
"outputLevel_text" = DisplayPower(output_level),
"outputLevelMax" = output_level_max,
"outputUsed" = output_used
"outputUsed" = DisplayPower(output_used)
)
return data
+2 -2
View File
@@ -272,7 +272,7 @@
var/t = "<TT><B>Gas Turbine Generator</B><HR><PRE>"
t += "Generated power : [round(lastgen)] W<BR><BR>"
t += "Generated power : [DisplayPower(lastgen)]<BR><BR>"
t += "Turbine: [round(compressor.rpm)] RPM<BR>"
@@ -337,7 +337,7 @@
dat += {"Turbine status: [ src.compressor.starter ? "<A href='?src=\ref[src];str=1'>Off</A> <B>On</B>" : "<B>Off</B> <A href='?src=\ref[src];str=1'>On</A>"]
\n<BR>
\nTurbine speed: [src.compressor.rpm]rpm<BR>
\nPower currently being generated: [src.compressor.turbine.lastgen]W<BR>
\nPower currently being generated: [DisplayPower(src.compressor.turbine.lastgen)]<BR>
\nInternal gas temperature: [src.compressor.gas_contained.temperature]K<BR>
\n</PRE><HR><A href='?src=\ref[src];close=1'>Close</A>
\n<BR>
+16 -16
View File
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -94,7 +94,7 @@
<ui-display title='Power Channels'>
{{#each data.powerChannels}}
<ui-section label='{{title}}' nowrap>
<div class='content'>{{Math.round(adata.powerChannels[@index].powerLoad)}} W</div>
<div class='content'>{{adata.powerChannels[@index].powerLoad}}</div>
<div class='content'><span class='{{status >= 2 ? "good" : "bad"}}'>{{status >= 2 ? "On" : "Off"}}</span></div>
<div class='content'>[<span>{{status == 1 || status == 3 ? "Auto" : "Manual"}}</span>]</div>
<div class='content' style='float:right'>
@@ -110,7 +110,7 @@
</ui-section>
{{/each}}
<ui-section label='Total Load'>
<span class='bold'>{{Math.round(adata.totalLoad)}} W</span>
<span class='bold'>{{adata.totalLoad}}</span>
</ui-section>
</ui-display>
{{#if data.siliconUser}}
+3 -3
View File
@@ -50,10 +50,10 @@
xinc='{{data.stored / 10}}' yinc='9'/>
{{else}}
<ui-section label='Available'>
<span>{{data.supply}} W</span>
<span>{{data.supply}}</span>
</ui-section>
<ui-section label='Load'>
<span>{{data.demand}} W</span>
<span>{{data.demand}}</span>
</ui-section>
{{/if}}
</ui-display>
@@ -70,7 +70,7 @@
{{#each data.areas}}
<ui-section label='{{name}}' nowrap>
<div class='content'>{{Math.round(adata.areas[@index].charge)}} %</div>
<div class='content'>{{Math.round(adata.areas[@index].load)}} W</div>
<div class='content'>{{adata.areas[@index].load}}</div>
<div class='content'><span class='{{chargingState(charging)}}'>{{chargingMode(charging)}}</span></div>
<div class='content'><span class='{{channelState(eqp)}}'>{{channelPower(eqp)}} [<span>{{channelMode(eqp)}}</span>]</span></div>
<div class='content'><span class='{{channelState(lgt)}}'>{{channelPower(lgt)}} [<span>{{channelMode(lgt)}}</span>]</span></div>
+3 -3
View File
@@ -47,10 +47,10 @@
xinc='{{data.stored / 10}}' yinc='9'/>
{{else}}
<ui-section label='Available'>
<span>{{data.supply}} W</span>
<span>{{data.supply}}</span>
</ui-section>
<ui-section label='Load'>
<span>{{data.demand}} W</span>
<span>{{data.demand}}</span>
</ui-section>
{{/if}}
</ui-display>
@@ -67,7 +67,7 @@
{{#each data.areas}}
<ui-section label='{{name}}' nowrap>
<div class='content'>{{Math.round(adata.areas[@index].charge)}} %</div>
<div class='content'>{{Math.round(adata.areas[@index].load)}} W</div>
<div class='content'>{{adata.areas[@index].load}}</div>
<div class='content'><span class='{{chargingState(charging)}}'>{{chargingMode(charging)}}</span></div>
<div class='content'><span class='{{channelState(eqp)}}'>{{channelPower(eqp)}} [<span>{{channelMode(eqp)}}</span>]</span></div>
<div class='content'><span class='{{channelState(lgt)}}'>{{channelPower(lgt)}} [<span>{{channelMode(lgt)}}</span>]</span></div>
+4 -4
View File
@@ -34,7 +34,7 @@
[<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-bar min='0' max='{{data.inputLevelMax}}' value='{{data.inputLevel}}'>{{adata.inputLevel_text}}</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"}'/>
@@ -44,7 +44,7 @@
<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>
<span>{{adata.inputAvailable}}</span>
</ui-section>
</ui-display>
<ui-display title='Output'>
@@ -55,7 +55,7 @@
[<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-bar min='0' max='{{data.outputLevelMax}}' value='{{data.outputLevel}}'>{{adata.outputLevel_text}}</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"}'/>
@@ -65,6 +65,6 @@
<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>
<span>{{adata.outputUsed}}</span>
</ui-section>
</ui-display>