mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 04:26:03 +01:00
* Hard Del Fixes, Ref Tracking Changes
This commit is contained in:
@@ -15,8 +15,8 @@
|
||||
program_icon = "plug"
|
||||
|
||||
var/has_alert = 0
|
||||
var/obj/structure/cable/attached_wire
|
||||
var/obj/machinery/power/apc/local_apc
|
||||
var/datum/weakref/attached_wire_ref
|
||||
var/datum/weakref/local_apc_ref
|
||||
var/list/history = list()
|
||||
var/record_size = 60
|
||||
var/record_interval = 50
|
||||
@@ -38,19 +38,22 @@
|
||||
|
||||
/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_wire = locate(/obj/structure/cable) in T
|
||||
if(attached_wire)
|
||||
attached_wire_ref = WEAKREF(locate(/obj/structure/cable) in T)
|
||||
if(attached_wire_ref)
|
||||
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.apc
|
||||
var/obj/machinery/power/apc/local_apc = WEAKREF(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)
|
||||
|
||||
/datum/computer_file/program/power_monitor/proc/get_powernet() //keep in sync with /obj/machinery/computer/monitor's version
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user