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:
deathride58
2018-05-31 23:03:18 +00:00
committed by kevinz000
parent b6e608cb4c
commit 2f9e3e403d
395 changed files with 134016 additions and 26287 deletions

View File

@@ -144,6 +144,9 @@
// EMPs are similar to explosions, but don't cause physical damage to the casing. Instead they screw up the components
/obj/machinery/modular_computer/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_CONTENTS)
return
if(cpu)
cpu.emp_act(severity)

View File

@@ -1,3 +1,5 @@
//normal computer version is located in code\modules\power\monitor.dm, /obj/machinery/computer/monitor
/datum/computer_file/program/power_monitor
filename = "powermonitor"
filedesc = "Power Monitor"
@@ -14,7 +16,8 @@
ui_y = 1000
var/has_alert = 0
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
@@ -29,42 +32,62 @@
/datum/computer_file/program/power_monitor/process_tick()
if(!attached)
if(!get_powernet())
search()
else
record()
/datum/computer_file/program/power_monitor/proc/search()
/datum/computer_file/program/power_monitor/proc/search() //keep in sync with /obj/machinery/computer/monitor's version
var/turf/T = get_turf(computer)
attached = locate() in T
attached_wire = locate(/obj/structure/cable) in T
if(attached_wire)
return
var/area/A = get_area(computer) //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
/datum/computer_file/program/power_monitor/proc/record()
/datum/computer_file/program/power_monitor/proc/get_powernet() //keep in sync with /obj/machinery/computer/monitor's version
if(attached_wire || (local_apc && local_apc.terminal))
return attached_wire ? attached_wire.powernet : local_apc.terminal.powernet
return FALSE
/datum/computer_file/program/power_monitor/proc/record() //keep in sync with /obj/machinery/computer/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"]
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"]
demand += attached.powernet.viewload
if(connected_powernet)
demand += connected_powernet.viewload
if(demand.len > record_size)
demand.Cut(1, 2)
/datum/computer_file/program/power_monitor/ui_data()
var/datum/powernet/connected_powernet = get_powernet()
var/list/data = get_header_data()
data["stored"] = record_size
data["interval"] = record_interval / 10
data["attached"] = attached ? TRUE : FALSE
if(attached)
data["supply"] = DisplayPower(attached.powernet.viewavail)
data["demand"] = DisplayPower(attached.powernet.viewload)
data["attached"] = connected_powernet ? TRUE : FALSE
if(connected_powernet)
data["supply"] = DisplayPower(connected_powernet.viewavail)
data["demand"] = DisplayPower(connected_powernet.viewload)
data["history"] = history
data["areas"] = list()
if(attached)
for(var/obj/machinery/power/terminal/term in attached.powernet.nodes)
if(connected_powernet)
for(var/obj/machinery/power/terminal/term in connected_powernet.nodes)
var/obj/machinery/power/apc/A = term.master
if(istype(A))
data["areas"] += list(list(