diff --git a/code/__DEFINES/integrated_electronics.dm b/code/__DEFINES/integrated_electronics.dm index 3647a61d773..727314abc6f 100644 --- a/code/__DEFINES/integrated_electronics.dm +++ b/code/__DEFINES/integrated_electronics.dm @@ -40,6 +40,7 @@ #define IC_PINTYPE_REF /datum/integrated_io/ref #define IC_PINTYPE_LIST /datum/integrated_io/lists #define IC_PINTYPE_INDEX /datum/integrated_io/index +#define IC_PINTYPE_SELFREF /datum/integrated_io/selfref #define IC_PINTYPE_PULSE_IN /datum/integrated_io/activate #define IC_PINTYPE_PULSE_OUT /datum/integrated_io/activate/out diff --git a/code/modules/integrated_electronics/core/debugger.dm b/code/modules/integrated_electronics/core/debugger.dm index ceaee08fa15..5d414de5eea 100644 --- a/code/modules/integrated_electronics/core/debugger.dm +++ b/code/modules/integrated_electronics/core/debugger.dm @@ -9,9 +9,10 @@ w_class = WEIGHT_CLASS_SMALL var/data_to_write = null var/accepting_refs = FALSE + var/copy_values = FALSE /obj/item/integrated_electronics/debugger/attack_self(mob/user) - var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number","ref", "null") + var/type_to_use = input("Please choose a type to use.","[src] type setting") as null|anything in list("string","number","ref","copy","null") if(!user.IsAdvancedToolUser()) return @@ -19,22 +20,31 @@ switch(type_to_use) if("string") accepting_refs = FALSE + copy_values = FALSE new_data = stripped_input(user, "Now type in a string.","[src] string writing", no_trim = TRUE) if(istext(new_data) && user.IsAdvancedToolUser()) data_to_write = new_data to_chat(user, "You set \the [src]'s memory to \"[new_data]\".") if("number") accepting_refs = FALSE + copy_values = FALSE new_data = input(user, "Now type in a number.","[src] number writing") as null|num if(isnum(new_data) && user.IsAdvancedToolUser()) data_to_write = new_data to_chat(user, "You set \the [src]'s memory to [new_data].") if("ref") accepting_refs = TRUE + copy_values = FALSE to_chat(user, "You turn \the [src]'s ref scanner on. Slide it across \ an object for a ref of that object to save it in memory.") + if("copy") + accepting_refs = FALSE + copy_values = TRUE + to_chat(user, "You turn \the [src]'s value copier on. Use it on a pin \ + to save its current value in memory.") if("null") data_to_write = null + copy_values = FALSE to_chat(user, "You set \the [src]'s memory to absolutely nothing.") /obj/item/integrated_electronics/debugger/afterattack(atom/target, mob/living/user, proximity) @@ -47,14 +57,26 @@ accepting_refs = FALSE /obj/item/integrated_electronics/debugger/proc/write_data(var/datum/integrated_io/io, mob/user) + //If the pin can take data: if(io.io_type == DATA_CHANNEL) + //If the debugger is set to copy, copy the data in the pin onto it + if(copy_values) + data_to_write = io.data + to_chat(user, "You let the debugger copy the data.") + copy_values = FALSE + return + + //Else, write the data to the pin io.write_data_to_pin(data_to_write) var/data_to_show = data_to_write + //This is only to convert a weakref into a name for better output if(isweakref(data_to_write)) var/datum/weakref/w = data_to_write var/atom/A = w.resolve() data_to_show = A.name to_chat(user, "You write '[data_to_write ? data_to_show : "NULL"]' to the '[io]' pin of \the [io.holder].") + + //If the pin can only be pulsed else if(io.io_type == PULSE_CHANNEL) io.holder.check_then_do_work(io.ord,ignore_power = TRUE) to_chat(user, "You pulse \the [io.holder]'s [io].") diff --git a/code/modules/integrated_electronics/core/printer.dm b/code/modules/integrated_electronics/core/printer.dm index 3470cef801b..de3ade389f2 100644 --- a/code/modules/integrated_electronics/core/printer.dm +++ b/code/modules/integrated_electronics/core/printer.dm @@ -137,13 +137,13 @@ if(!cloning) HTML += " {Load Program} " else - HTML += " {Load Program}" + HTML += " Load Program" if(!program) - HTML += " {[fast_clone ? "Print" : "Begin Printing"] Assembly}" + HTML += " [fast_clone ? "Print" : "Begin Printing"] Assembly" else if(cloning) - HTML += " {Cancel Print}" + HTML += " Cancel Print" else - HTML += " {[fast_clone ? "Print" : "Begin Printing"] Assembly}" + HTML += " [fast_clone ? "Print" : "Begin Printing"] Assembly" HTML += "

" HTML += "Categories:" @@ -164,9 +164,9 @@ if((initial(IC.spawn_flags) & IC_SPAWN_RESEARCH) && (!(initial(IC.spawn_flags) & IC_SPAWN_DEFAULT)) && !upgraded) can_build = FALSE if(can_build) - HTML += "\[[initial(O.name)]\]: [initial(O.desc)]
" + HTML += "[initial(O.name)]: [initial(O.desc)]
" else - HTML += "\[[initial(O.name)]\]: [initial(O.desc)]
" + HTML += "[initial(O.name)]: [initial(O.desc)]
" popup.set_content(HTML) popup.open() diff --git a/code/modules/integrated_electronics/core/special_pins/ref_pin.dm b/code/modules/integrated_electronics/core/special_pins/ref_pin.dm index 461965f254b..f64e15f2255 100644 --- a/code/modules/integrated_electronics/core/special_pins/ref_pin.dm +++ b/code/modules/integrated_electronics/core/special_pins/ref_pin.dm @@ -11,4 +11,14 @@ holder.on_data_written() /datum/integrated_io/ref/display_pin_type() - return IC_FORMAT_REF \ No newline at end of file + return IC_FORMAT_REF + +/datum/integrated_io/ref/connect_pin(datum/integrated_io/pin) + ..(pin) + if(istype(pin,/datum/integrated_io/selfref)) + write_data_to_pin(pin.data) + +/datum/integrated_io/ref/disconnect_pin(datum/integrated_io/pin) + ..(pin) + if(istype(pin,/datum/integrated_io/selfref)) + write_data_to_pin(null) diff --git a/code/modules/integrated_electronics/core/special_pins/selfref_pin.dm b/code/modules/integrated_electronics/core/special_pins/selfref_pin.dm new file mode 100644 index 00000000000..79dcf9e6c8c --- /dev/null +++ b/code/modules/integrated_electronics/core/special_pins/selfref_pin.dm @@ -0,0 +1,27 @@ +// This pin only contains its own weakref and can't be changed +/datum/integrated_io/selfref + name = "selfref pin" + +/datum/integrated_io/selfref/New() + ..() + write_data_to_pin(src) + +/datum/integrated_io/selfref/ask_for_pin_data(mob/user) // You can't clear it, it's self reference. + + +/datum/integrated_io/selfref/write_data_to_pin(var/new_data) // You can't write anything else but itself onto it + if(data) + return + data = WEAKREF(holder) + holder.on_data_written() + +/datum/integrated_io/selfref/display_pin_type() + return IC_FORMAT_REF + +/datum/integrated_io/selfref/connect_pin(datum/integrated_io/pin) + pin.write_data_to_pin(data) + ..(pin) + +/datum/integrated_io/selfref/disconnect_pin(datum/integrated_io/pin) + ..(pin) + pin.write_data_to_pin(null) diff --git a/code/modules/integrated_electronics/subtypes/reagents.dm b/code/modules/integrated_electronics/subtypes/reagents.dm index 7943ffbbe7b..b8f326f3890 100644 --- a/code/modules/integrated_electronics/subtypes/reagents.dm +++ b/code/modules/integrated_electronics/subtypes/reagents.dm @@ -65,7 +65,7 @@ ) outputs = list( "volume used" = IC_PINTYPE_NUMBER, - "self reference" = IC_PINTYPE_REF + "self reference" = IC_PINTYPE_SELFREF ) activators = list( "inject" = IC_PINTYPE_PULSE_IN, @@ -267,7 +267,7 @@ inputs = list() outputs = list( "volume used" = IC_PINTYPE_NUMBER, - "self reference" = IC_PINTYPE_REF + "self reference" = IC_PINTYPE_SELFREF ) activators = list("push ref" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH @@ -314,7 +314,7 @@ ) outputs = list( "volume used" = IC_PINTYPE_NUMBER, - "self reference" = IC_PINTYPE_REF + "self reference" = IC_PINTYPE_SELFREF ) activators = list( "grind" = IC_PINTYPE_PULSE_IN, @@ -361,7 +361,7 @@ ) outputs = list( "volume used" = IC_PINTYPE_NUMBER, - "self reference" = IC_PINTYPE_REF + "self reference" = IC_PINTYPE_SELFREF ) activators = list( "juice" = IC_PINTYPE_PULSE_IN, @@ -406,7 +406,7 @@ complexity = 8 outputs = list( "volume used" = IC_PINTYPE_NUMBER, - "self reference" = IC_PINTYPE_REF, + "self reference" = IC_PINTYPE_SELFREF, "list of reagents" = IC_PINTYPE_LIST ) activators = list( @@ -508,7 +508,7 @@ "on" = IC_PINTYPE_BOOLEAN ) inputs_default = list("1" = 300) - outputs = list("volume used" = IC_PINTYPE_NUMBER,"self reference" = IC_PINTYPE_REF,"temperature" = IC_PINTYPE_NUMBER) + outputs = list("volume used" = IC_PINTYPE_NUMBER,"self reference" = IC_PINTYPE_SELFREF,"temperature" = IC_PINTYPE_NUMBER) spawn_flags = IC_SPAWN_RESEARCH var/heater_coefficient = 0.1 diff --git a/tgstation.dme b/tgstation.dme index 2b2018dc3f1..7a8ce4c05d0 100755 --- a/tgstation.dme +++ b/tgstation.dme @@ -1687,6 +1687,7 @@ #include "code\modules\integrated_electronics\core\special_pins\list_pin.dm" #include "code\modules\integrated_electronics\core\special_pins\number_pin.dm" #include "code\modules\integrated_electronics\core\special_pins\ref_pin.dm" +#include "code\modules\integrated_electronics\core\special_pins\selfref_pin.dm" #include "code\modules\integrated_electronics\core\special_pins\string_pin.dm" #include "code\modules\integrated_electronics\passive\passive.dm" #include "code\modules\integrated_electronics\passive\power.dm"