Hard upstream sync (#6951)
* maps - none of our changes included yet i'll get them in after i finish up the rest of the sync * sync part 1 - underscore folders in code * controllers folder * datums folder * game folder * cmon, work * modules - admin to awaymissions * cargo to events * fields to lighting * mapping > ruins * rest of the code folder * rest of the folders in the root directory * DME * fixes compiling errors. it compiles so it works * readds map changes * fixes dogborg module select * fixes typo in moduleselect_alternate_icon filepath
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
//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."
|
||||
@@ -9,12 +11,24 @@
|
||||
active_power_usage = 100
|
||||
circuit = /obj/item/circuitboard/computer/powermonitor
|
||||
|
||||
var/obj/structure/cable/attached
|
||||
var/obj/structure/cable/attached_wire
|
||||
var/obj/machinery/power/apc/local_apc
|
||||
|
||||
var/list/history = list()
|
||||
var/record_size = 60
|
||||
var/record_interval = 50
|
||||
var/next_record = 0
|
||||
var/is_secret_monitor = FALSE
|
||||
|
||||
/obj/machinery/computer/monitor/secret //Hides the power monitor (such as ones on ruins & CentCom) from PDA's to prevent metagaming.
|
||||
name = "outdated power monitoring console"
|
||||
desc = "It monitors power levels across the local powernet."
|
||||
circuit = /obj/item/circuitboard/computer/powermonitor/secret
|
||||
is_secret_monitor = TRUE
|
||||
|
||||
/obj/machinery/computer/monitor/secret/examine(mob/user)
|
||||
..()
|
||||
to_chat(user, "<span class='notice'>It's operating system seems quite outdated... It doesn't seem like it'd be compatible with the latest remote NTOS monitoring systems.</span>")
|
||||
|
||||
/obj/machinery/computer/monitor/Initialize()
|
||||
. = ..()
|
||||
@@ -23,30 +37,47 @@
|
||||
history["demand"] = list()
|
||||
|
||||
/obj/machinery/computer/monitor/process()
|
||||
if(!attached)
|
||||
if(!get_powernet())
|
||||
use_power = IDLE_POWER_USE
|
||||
search()
|
||||
else
|
||||
use_power = ACTIVE_POWER_USE
|
||||
record()
|
||||
|
||||
/obj/machinery/computer/monitor/proc/search()
|
||||
/obj/machinery/computer/monitor/proc/search() //keep in sync with /datum/computer_file/program/power_monitor's version
|
||||
var/turf/T = get_turf(src)
|
||||
attached = locate() in T
|
||||
attached_wire = locate(/obj/structure/cable) in T
|
||||
if(attached_wire)
|
||||
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
|
||||
local_apc = A.get_apc()
|
||||
if(!local_apc)
|
||||
return
|
||||
if(!local_apc.terminal) //this really shouldn't happen without badminnery.
|
||||
local_apc = null
|
||||
|
||||
/obj/machinery/computer/monitor/proc/record()
|
||||
/obj/machinery/computer/monitor/proc/get_powernet() //keep in sync with /datum/computer_file/program/power_monitor's version
|
||||
if(attached_wire || (local_apc && 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(attached.powernet)
|
||||
supply += attached.powernet.viewavail
|
||||
if(connected_powernet)
|
||||
supply += connected_powernet.viewavail
|
||||
if(supply.len > record_size)
|
||||
supply.Cut(1, 2)
|
||||
|
||||
var/list/demand = history["demand"]
|
||||
if(attached.powernet)
|
||||
demand += attached.powernet.viewload
|
||||
if(connected_powernet)
|
||||
demand += connected_powernet.viewload
|
||||
if(demand.len > record_size)
|
||||
demand.Cut(1, 2)
|
||||
|
||||
@@ -58,17 +89,18 @@
|
||||
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"] = attached ? TRUE : FALSE
|
||||
data["attached"] = connected_powernet ? TRUE : FALSE
|
||||
data["history"] = history
|
||||
data["areas"] = list()
|
||||
|
||||
if(attached)
|
||||
data["supply"] = DisplayPower(attached.powernet.viewavail)
|
||||
data["demand"] = DisplayPower(attached.powernet.viewload)
|
||||
for(var/obj/machinery/power/terminal/term in attached.powernet.nodes)
|
||||
if(connected_powernet)
|
||||
data["supply"] = DisplayPower(connected_powernet.viewavail)
|
||||
data["demand"] = DisplayPower(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
|
||||
|
||||
Reference in New Issue
Block a user