From 091c58ec682a975f51c0f5cf3b75054604c466dd Mon Sep 17 00:00:00 2001 From: Marina Gryphon Date: Wed, 8 Nov 2017 08:33:07 -0600 Subject: [PATCH 1/5] Fixed some IE bugs. --- code/controllers/subsystems/electronics.dm | 60 +++++++++++++++++++ .../integrated_electronics/core/helpers.dm | 4 +- .../integrated_electronics/subtypes/input.dm | 4 +- .../integrated_electronics/subtypes/power.dm | 5 ++ 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 code/controllers/subsystems/electronics.dm diff --git a/code/controllers/subsystems/electronics.dm b/code/controllers/subsystems/electronics.dm new file mode 100644 index 0000000000..d3720cd589 --- /dev/null +++ b/code/controllers/subsystems/electronics.dm @@ -0,0 +1,60 @@ +#define IC_SPAWN_DEFAULT 1 // If the circuit comes in the default circuit box and able to be printed in the IC printer. +#define IC_SPAWN_RESEARCH 2 // If the circuit design will be available in the IC printer after upgrading it. + +/var/datum/controller/subsystem/processing/electronics/SSelectronics + +/datum/controller/subsystem/processing/electronics + name = "Electronics" + wait = 2 SECONDS + priority = SS_PRIORITY_ELECTRONICS + flags = SS_KEEP_TIMING + init_order = SS_INIT_MISC_FIRST + + var/list/all_integrated_circuits = list() + var/list/printer_recipe_list = list() + +/datum/controller/subsystem/processing/electronics/New() + NEW_SS_GLOBAL(SSelectronics) + +/datum/controller/subsystem/processing/electronics/Initialize(timeofday) + init_subtypes(/obj/item/integrated_circuit, all_integrated_circuits) + + // First loop is to seperate the actual circuits from base circuits. + var/list/circuits_to_use = list() + for(var/obj/item/integrated_circuit/IC in all_integrated_circuits) + if((IC.spawn_flags & (IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH))) + circuits_to_use += IC + + // Second loop is to find all categories. + var/list/found_categories = list() + for(var/obj/item/integrated_circuit/IC in circuits_to_use) + if(!(IC.category_text in found_categories)) + found_categories += IC.category_text + + // Third loop is to initialize lists by category names, then put circuits matching the category inside. + for(var/category in found_categories) + printer_recipe_list[category] = list() + var/list/current_list = printer_recipe_list[category] + for(var/obj/item/integrated_circuit/IC in circuits_to_use) + if(IC.category_text == category) + current_list += IC + + // Now for non-circuit things. + printer_recipe_list["Assemblies"] = list( + new /obj/item/device/electronic_assembly, + new /obj/item/device/electronic_assembly/medium, + new /obj/item/device/electronic_assembly/large, + new /obj/item/device/electronic_assembly/drone, + new /obj/item/weapon/implant/integrated_circuit, + new /obj/item/device/assembly/electronic_assembly + ) + + printer_recipe_list["Tools"] = list( + new /obj/item/device/integrated_electronics/wirer, + new /obj/item/device/integrated_electronics/debugger + ) + + ..() + +#undef IC_SPAWN_DEFAULT +#undef IC_SPAWN_RESEARCH diff --git a/code/modules/integrated_electronics/core/helpers.dm b/code/modules/integrated_electronics/core/helpers.dm index edfa6b1a86..e31b26fbb1 100644 --- a/code/modules/integrated_electronics/core/helpers.dm +++ b/code/modules/integrated_electronics/core/helpers.dm @@ -18,7 +18,9 @@ else io_list.Add(new io_type(src, io_entry, default_data)) -/obj/item/integrated_circuit/proc/set_pin_data(var/pin_type, var/pin_number, var/new_data) +/obj/item/integrated_circuit/proc/set_pin_data(var/pin_type, var/pin_number, datum/new_data) + if (istype(new_data) && !isweakref(new_data)) + new_data = weakref(new_data) var/datum/integrated_io/pin = get_pin_ref(pin_type, pin_number) return pin.write_data_to_pin(new_data) diff --git a/code/modules/integrated_electronics/subtypes/input.dm b/code/modules/integrated_electronics/subtypes/input.dm index 00e5bf2ea4..92119251c2 100644 --- a/code/modules/integrated_electronics/subtypes/input.dm +++ b/code/modules/integrated_electronics/subtypes/input.dm @@ -336,6 +336,7 @@ // Set the pins so when someone sees them, they won't show as null set_pin_data(IC_INPUT, 1, frequency) set_pin_data(IC_INPUT, 2, code) + push_data() /obj/item/integrated_circuit/input/signaler/Destroy() if(radio_controller) @@ -464,6 +465,7 @@ set_pin_data(IC_OUTPUT, 1, null) set_pin_data(IC_OUTPUT, 2, null) if(!T) + push_data() return set_pin_data(IC_OUTPUT, 1, T.x) @@ -486,7 +488,7 @@ "speaker" = IC_PINTYPE_STRING, "message" = IC_PINTYPE_STRING ) - activators = list("on message received" = IC_PINTYPE_PULSE_IN, "on translation" = IC_PINTYPE_PULSE_OUT) + activators = list("on message received" = IC_PINTYPE_PULSE_OUT, "on translation" = IC_PINTYPE_PULSE_OUT) spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH power_draw_per_use = 15 diff --git a/code/modules/integrated_electronics/subtypes/power.dm b/code/modules/integrated_electronics/subtypes/power.dm index f528434129..920229a973 100644 --- a/code/modules/integrated_electronics/subtypes/power.dm +++ b/code/modules/integrated_electronics/subtypes/power.dm @@ -62,6 +62,10 @@ transfer_amount *= 0.8 // Losses due to distance. if(cell.fully_charged()) + set_pin_data(IC_OUTPUT, 1, cell.charge) + set_pin_data(IC_OUTPUT, 2, cell.maxcharge) + set_pin_data(IC_OUTPUT, 3, cell.percent()) + push_data() return FALSE if(transfer_amount && assembly.draw_power(amount_to_move)) // CELLRATE is already handled in draw_power() @@ -71,6 +75,7 @@ set_pin_data(IC_OUTPUT, 1, cell.charge) set_pin_data(IC_OUTPUT, 2, cell.maxcharge) set_pin_data(IC_OUTPUT, 3, cell.percent()) + push_data() activate_pin(2) return TRUE return FALSE From c755edda5b886700b772ef6119077f7eb0276edb Mon Sep 17 00:00:00 2001 From: Marina Gryphon Date: Wed, 8 Nov 2017 08:37:16 -0600 Subject: [PATCH 2/5] Removed a file I didn't mean to commit. --- code/controllers/subsystems/electronics.dm | 60 ---------------------- 1 file changed, 60 deletions(-) delete mode 100644 code/controllers/subsystems/electronics.dm diff --git a/code/controllers/subsystems/electronics.dm b/code/controllers/subsystems/electronics.dm deleted file mode 100644 index d3720cd589..0000000000 --- a/code/controllers/subsystems/electronics.dm +++ /dev/null @@ -1,60 +0,0 @@ -#define IC_SPAWN_DEFAULT 1 // If the circuit comes in the default circuit box and able to be printed in the IC printer. -#define IC_SPAWN_RESEARCH 2 // If the circuit design will be available in the IC printer after upgrading it. - -/var/datum/controller/subsystem/processing/electronics/SSelectronics - -/datum/controller/subsystem/processing/electronics - name = "Electronics" - wait = 2 SECONDS - priority = SS_PRIORITY_ELECTRONICS - flags = SS_KEEP_TIMING - init_order = SS_INIT_MISC_FIRST - - var/list/all_integrated_circuits = list() - var/list/printer_recipe_list = list() - -/datum/controller/subsystem/processing/electronics/New() - NEW_SS_GLOBAL(SSelectronics) - -/datum/controller/subsystem/processing/electronics/Initialize(timeofday) - init_subtypes(/obj/item/integrated_circuit, all_integrated_circuits) - - // First loop is to seperate the actual circuits from base circuits. - var/list/circuits_to_use = list() - for(var/obj/item/integrated_circuit/IC in all_integrated_circuits) - if((IC.spawn_flags & (IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH))) - circuits_to_use += IC - - // Second loop is to find all categories. - var/list/found_categories = list() - for(var/obj/item/integrated_circuit/IC in circuits_to_use) - if(!(IC.category_text in found_categories)) - found_categories += IC.category_text - - // Third loop is to initialize lists by category names, then put circuits matching the category inside. - for(var/category in found_categories) - printer_recipe_list[category] = list() - var/list/current_list = printer_recipe_list[category] - for(var/obj/item/integrated_circuit/IC in circuits_to_use) - if(IC.category_text == category) - current_list += IC - - // Now for non-circuit things. - printer_recipe_list["Assemblies"] = list( - new /obj/item/device/electronic_assembly, - new /obj/item/device/electronic_assembly/medium, - new /obj/item/device/electronic_assembly/large, - new /obj/item/device/electronic_assembly/drone, - new /obj/item/weapon/implant/integrated_circuit, - new /obj/item/device/assembly/electronic_assembly - ) - - printer_recipe_list["Tools"] = list( - new /obj/item/device/integrated_electronics/wirer, - new /obj/item/device/integrated_electronics/debugger - ) - - ..() - -#undef IC_SPAWN_DEFAULT -#undef IC_SPAWN_RESEARCH From 5af691093ea56e13a3bf4f75129dd9473e6edb64 Mon Sep 17 00:00:00 2001 From: Marina Gryphon Date: Wed, 8 Nov 2017 09:22:03 -0600 Subject: [PATCH 3/5] Re-fixed an issue with power transmitters. --- code/modules/integrated_electronics/subtypes/power.dm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/code/modules/integrated_electronics/subtypes/power.dm b/code/modules/integrated_electronics/subtypes/power.dm index 920229a973..1beb94816b 100644 --- a/code/modules/integrated_electronics/subtypes/power.dm +++ b/code/modules/integrated_electronics/subtypes/power.dm @@ -37,12 +37,12 @@ amount_to_move = 20000 /obj/item/integrated_circuit/power/transmitter/do_work() - set_pin_data(IC_OUTPUT, 1, null) - set_pin_data(IC_OUTPUT, 2, null) - set_pin_data(IC_OUTPUT, 3, null) var/atom/movable/AM = get_pin_data_as_type(IC_INPUT, 1, /atom/movable) if(AM) if(!assembly) + set_pin_data(IC_OUTPUT, 1, null) + set_pin_data(IC_OUTPUT, 2, null) + set_pin_data(IC_OUTPUT, 3, null) return FALSE // Pointless to do everything else if there's no battery to draw from. var/obj/item/weapon/cell/cell = null @@ -78,6 +78,9 @@ push_data() activate_pin(2) return TRUE + set_pin_data(IC_OUTPUT, 1, null) + set_pin_data(IC_OUTPUT, 2, null) + set_pin_data(IC_OUTPUT, 3, null) return FALSE /obj/item/integrated_circuit/power/transmitter/large/do_work() From 8b311ac237e67b3e9d0c919e6217026c3b981ad1 Mon Sep 17 00:00:00 2001 From: Marina Gryphon Date: Wed, 8 Nov 2017 09:28:29 -0600 Subject: [PATCH 4/5] Reverted some changes, apparently it was already fixed. --- .../integrated_electronics/subtypes/power.dm | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/code/modules/integrated_electronics/subtypes/power.dm b/code/modules/integrated_electronics/subtypes/power.dm index 1beb94816b..f528434129 100644 --- a/code/modules/integrated_electronics/subtypes/power.dm +++ b/code/modules/integrated_electronics/subtypes/power.dm @@ -37,12 +37,12 @@ amount_to_move = 20000 /obj/item/integrated_circuit/power/transmitter/do_work() + set_pin_data(IC_OUTPUT, 1, null) + set_pin_data(IC_OUTPUT, 2, null) + set_pin_data(IC_OUTPUT, 3, null) var/atom/movable/AM = get_pin_data_as_type(IC_INPUT, 1, /atom/movable) if(AM) if(!assembly) - set_pin_data(IC_OUTPUT, 1, null) - set_pin_data(IC_OUTPUT, 2, null) - set_pin_data(IC_OUTPUT, 3, null) return FALSE // Pointless to do everything else if there's no battery to draw from. var/obj/item/weapon/cell/cell = null @@ -62,10 +62,6 @@ transfer_amount *= 0.8 // Losses due to distance. if(cell.fully_charged()) - set_pin_data(IC_OUTPUT, 1, cell.charge) - set_pin_data(IC_OUTPUT, 2, cell.maxcharge) - set_pin_data(IC_OUTPUT, 3, cell.percent()) - push_data() return FALSE if(transfer_amount && assembly.draw_power(amount_to_move)) // CELLRATE is already handled in draw_power() @@ -75,12 +71,8 @@ set_pin_data(IC_OUTPUT, 1, cell.charge) set_pin_data(IC_OUTPUT, 2, cell.maxcharge) set_pin_data(IC_OUTPUT, 3, cell.percent()) - push_data() activate_pin(2) return TRUE - set_pin_data(IC_OUTPUT, 1, null) - set_pin_data(IC_OUTPUT, 2, null) - set_pin_data(IC_OUTPUT, 3, null) return FALSE /obj/item/integrated_circuit/power/transmitter/large/do_work() From 1b166e2fa6134c5abeed1db12785ca446ec649de Mon Sep 17 00:00:00 2001 From: Marina Gryphon Date: Wed, 8 Nov 2017 09:44:28 -0600 Subject: [PATCH 5/5] Adds a changelog. --- html/changelogs/MoondancerPony-electronics4246.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 html/changelogs/MoondancerPony-electronics4246.yml diff --git a/html/changelogs/MoondancerPony-electronics4246.yml b/html/changelogs/MoondancerPony-electronics4246.yml new file mode 100644 index 0000000000..d07b11d320 --- /dev/null +++ b/html/changelogs/MoondancerPony-electronics4246.yml @@ -0,0 +1,5 @@ +author: MoondancerPony +delete-after: True +changes: + - bugfix: "Fixed a mislabeled pulse pin on the microphone." + - bugfix: "Fixed an issue with reference pins and multiplexers, and reference pins in general."