Fixes some problems from port, mainly ref stuff.

This commit is contained in:
Neerti
2016-09-24 20:01:55 -04:00
parent 801a162ba7
commit b8df2a03ff
2 changed files with 15 additions and 8 deletions
@@ -242,11 +242,12 @@
var/list/linked = list()
var/io_type = DATA_CHANNEL
/datum/integrated_io/New(var/newloc)
/datum/integrated_io/New(var/newloc, var/name)
..()
src.name = name
holder = newloc
if(!holder)
message_admins("ERROR: An integrated_io ([src.name]) spawned without a holder! This is a bug.")
if(!istype(holder))
message_admins("ERROR: An integrated_io ([src.name]) spawned without a valid holder! This is a bug.")
/datum/integrated_io/Destroy()
disconnect()
@@ -270,9 +271,10 @@
return "(null)" // Empty data means nothing to show.
if(istext(data))
return "(\"[data]\")" // Wraps the 'string' in escaped quotes, so that people know it's a 'string'.
if(istype(data, /atom))
var/atom/A = data
return "([A.name] \[Ref\])" // For refs, we want just the name displayed.
if(isweakref(data))
var/weakref/w = data
var/atom/A = w.resolve()
return A ? "([A.name] \[Ref\])" : "(null)" // For refs, we want just the name displayed.
return "([data])" // Nothing special needed for numbers or other stuff.
/datum/integrated_io/activate/display_data()
+7 -2
View File
@@ -137,7 +137,7 @@
/obj/item/device/integrated_electronics/debugger/afterattack(atom/target, mob/living/user, proximity)
if(accepting_refs && proximity)
data_to_write = target
data_to_write = weakref(target)
visible_message("<span class='notice'>[user] slides \a [src]'s over \the [target].</span>")
to_chat(user, "<span class='notice'>You set \the [src]'s memory to a reference to [target.name] \[Ref\]. The ref scanner is \
now off.</span>")
@@ -146,7 +146,12 @@
/obj/item/device/integrated_electronics/debugger/proc/write_data(var/datum/integrated_io/io, mob/user)
if(io.io_type == DATA_CHANNEL)
io.write_data_to_pin(data_to_write)
to_chat(user, "<span class='notice'>You write '[data_to_write ? data_to_write : "NULL"]' to the '[io]' pin of \the [io.holder].</span>")
var/data_to_show = data_to_write
if(isweakref(data_to_write))
var/weakref/w = data_to_write
var/atom/A = w.resolve()
data_to_show = A.name
to_chat(user, "<span class='notice'>You write '[data_to_write ? data_to_show : "NULL"]' to the '[io]' pin of \the [io.holder].</span>")
else if(io.io_type == PULSE_CHANNEL)
io.holder.check_then_do_work()
to_chat(user, "<span class='notice'>You pulse \the [io.holder]'s [io].</span>")