Little Weakref Refactor

This commit is contained in:
Heroman3003
2023-06-03 09:22:18 +00:00
committed by CHOMPStation2
parent 515d0e49ba
commit 3d53d2bb62
41 changed files with 295 additions and 172 deletions
@@ -21,7 +21,7 @@ D [1]/ ||
/datum/integrated_io
var/name = "input/output"
var/obj/item/integrated_circuit/holder = null
var/weakref/data = null // This is a weakref, to reduce typecasts. Note that oftentimes numbers and text may also occupy this.
var/datum/weakref/data = null // This is a weakref, to reduce typecasts. Note that oftentimes numbers and text may also occupy this.
var/list/linked = list()
var/io_type = DATA_CHANNEL
@@ -47,7 +47,7 @@ D [1]/ ||
/datum/integrated_io/proc/data_as_type(var/as_type)
if(!isweakref(data))
return
var/weakref/w = data
var/datum/weakref/w = data
var/output = w.resolve()
return istype(output, as_type) ? output : null
@@ -82,7 +82,7 @@ list[](
return result
if(isweakref(input))
var/weakref/w = input
var/datum/weakref/w = input
var/atom/A = w.resolve()
//return A ? "([A.name] \[Ref\])" : "(null)" // For refs, we want just the name displayed.
return A ? "(\ref[A] \[Ref\])" : "(null)"