Files
Bubberstation/code/modules/power/monitor.dm
SkyratBot 2728bbe9a9 [MIRROR] Polishes some side sources of light and color [MDB IGNORE] (#19860)
* Polishes some side sources of light and color (#73936)

## About The Pull Request

[Circuit Floor
Polish](6b0ee98132)

Circuit floors glow! but it looks like crap cause it's dim and the
colors are washed out.
I'd like to make them look nicer. Let's make them more intense and
longer range, and change the colors over to more vivid replacements.

While I'm here, these should really use power and turn on and off based
off that.
Simple enough to do, just need to hook into a signal (and add a setter
for turf area, which cleans up other code too).

[Desklamp
Upgrade](8506b13b9c)

Desklamps look bad. They're fullwhite, have a way too large
range.Crummy.
Let's lower their lightrange from 5 to 3.5, and make the ornate ones
warmer, and the more utilitarian ones cooler. The clown one can be
yellow because it's funny

I'm renaming a color define here so I'm touching more files then you'd
expect

[Brightens
Niknacks](835bae28e9)

Increases the light range of request consoles, status displays,
newscasters, and air alarms (keycard machines too, when they're awaiting
input at least)
Increases the brightness of air alarms, I think they should be on par
with apcs, should be able to tell when they're good/bad.
Increases the brightness of vending machines (I want them to light up
the tiles around them very lightly, I think it's a vibe)

Fixes a bug with ai status displays where they'd display an emissive
even if they didn't have anything on their screen, looking stupid.
This was decently easy but required a define. Looked really bad tho

## Why It's Good For The Game

Pretty

<details>
<summary>
Circuit Floors
</summary>

Old

![image](https://user-images.githubusercontent.com/58055496/224534470-c6eac5f5-5de6-40e9-897d-3212b8796d81.png)

![image](https://user-images.githubusercontent.com/58055496/224534477-ad412ad9-f7c4-44ae-ad75-a1a2c9bd17be.png)

New

![image](https://user-images.githubusercontent.com/58055496/224534486-b7b408a3-546c-4f90-aa9f-0e58bf8128ad.png)

![image](https://user-images.githubusercontent.com/58055496/224534496-626458f7-ab63-429c-a5db-eae9c784d06a.png)
</details>

<details>
<summary>
Desk Lights
</summary>

Old

![image](https://user-images.githubusercontent.com/58055496/224534513-9868b0b8-bc73-4b45-b986-8445078a8653.png)

![image](https://user-images.githubusercontent.com/58055496/224534518-bbbc8c6d-b59e-4f28-a31c-6c6a7e2c2885.png)

New

![image](https://user-images.githubusercontent.com/58055496/224534529-7988f440-03be-42ef-894c-b9e77f577ae5.png)

![image](https://user-images.githubusercontent.com/58055496/224534532-c3f2c6bf-c925-4a59-a8f9-10bb955a9942.png)
</details>

The niknack changes are more minor so I'm not gonna grab photos for
them. I can if you'd like but I don't think it's necessary. Mostly a
vibes in dark spaces sorta thing

## Changelog

🆑
add: I made circuit floors brighter and more vivid.
add: Made air alarms, vending machines, newscasters, request consoles,
status displays and keycard machines slightly "brighter" (larger light
range, tho I did make air alarms a bit brighter too)
add: Tweaked desklamps. Lower range, and each type gets its own coloring
instead of just fullwhite.
fix: AI displays are no longer always emissive, they'll stop doing it if
they aren't displaying anything. Hopefully this'll look nicer
/🆑

* Polishes some side sources of light and color

* yellow

* Update dance_machine.dm

* Merge branch 'upstream-merge-73936' of https://github.com/Skyrat-SS13/Skyrat-tg into upstream-merge-73936

---------

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
Co-authored-by: Zonespace <41448081+Zonespace27@users.noreply.github.com>
Co-authored-by: lessthnthree <three@lessthanthree.dk>
2023-03-26 01:39:17 -07:00

113 lines
3.6 KiB
Plaintext

//modular computer program version is located in code\modules\modular_computers\file_system\programs\powermonitor.dm, /datum/computer_file/program/power_monitor
/obj/machinery/computer/monitor
name = "power monitoring console"
desc = "It monitors power levels across the station."
icon_screen = "power"
icon_keyboard = "power_key"
light_color = LIGHT_COLOR_DIM_YELLOW
use_power = ACTIVE_POWER_USE
circuit = /obj/item/circuitboard/computer/powermonitor
tgui_id = "PowerMonitor"
var/datum/weakref/attached_wire_ref
var/datum/weakref/local_apc_ref
var/list/history = list()
var/record_size = 60
var/record_interval = 50
var/next_record = 0
/obj/machinery/computer/monitor/Initialize(mapload)
. = ..()
search()
history["supply"] = list()
history["demand"] = list()
/obj/machinery/computer/monitor/process()
if(!get_powernet())
update_use_power(IDLE_POWER_USE)
search()
else
update_use_power(ACTIVE_POWER_USE)
record()
/obj/machinery/computer/monitor/proc/search() //keep in sync with /obj/machinery/computer/monitor's version
var/turf/T = get_turf(src)
attached_wire_ref = WEAKREF(locate(/obj/structure/cable) in T)
if(attached_wire_ref)
return
var/area/A = get_area(src) //if the computer isn't directly connected to a wire, attempt to find the APC powering it to pull it's powernet instead
if(!A)
return
var/obj/machinery/power/apc/local_apc = A.apc
if(!local_apc)
return
if(!local_apc.terminal) //this really shouldn't happen without badminnery.
local_apc = null
local_apc_ref = WEAKREF(local_apc)
/obj/machinery/computer/monitor/proc/get_powernet() //keep in sync with /datum/computer_file/program/power_monitor's version //np
var/obj/structure/cable/attached_wire = attached_wire_ref?.resolve()
var/obj/machinery/power/apc/local_apc = local_apc_ref?.resolve()
if(attached_wire || (local_apc?.terminal))
return attached_wire ? attached_wire.powernet : local_apc.terminal.powernet
return FALSE
/obj/machinery/computer/monitor/proc/record() //keep in sync with /datum/computer_file/program/power_monitor's version
if(world.time >= next_record)
next_record = world.time + record_interval
var/datum/powernet/connected_powernet = get_powernet()
var/list/supply = history["supply"]
if(connected_powernet)
supply += connected_powernet.viewavail
if(supply.len > record_size)
supply.Cut(1, 2)
var/list/demand = history["demand"]
if(connected_powernet)
demand += connected_powernet.viewload
if(demand.len > record_size)
demand.Cut(1, 2)
/obj/machinery/computer/monitor/ui_interact(mob/user, datum/tgui/ui)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "PowerMonitor", name)
ui.open()
/obj/machinery/computer/monitor/ui_data()
var/datum/powernet/connected_powernet = get_powernet()
var/list/data = list()
data["stored"] = record_size
data["interval"] = record_interval / 10
data["attached"] = connected_powernet ? TRUE : FALSE
data["history"] = history
data["areas"] = list()
if(connected_powernet)
data["supply"] = display_power(connected_powernet.viewavail)
data["demand"] = display_power(connected_powernet.viewload)
for(var/obj/machinery/power/terminal/term in connected_powernet.nodes)
var/obj/machinery/power/apc/A = term.master
if(istype(A))
var/cell_charge
if(!A.cell)
cell_charge = 0
else
cell_charge = A.cell.percent()
data["areas"] += list(list(
"name" = A.area.name,
"charge" = cell_charge,
"load" = display_power(A.lastused_total),
"charging" = A.charging,
"eqp" = A.equipment,
"lgt" = A.lighting,
"env" = A.environ
))
return data