From 3ec8063b1eeea2984454d7a02de6c08dc46455bc Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Tue, 31 Jan 2023 03:07:05 +0100 Subject: [PATCH] [MIRROR] Checks if a machine has no research before connecting techweb [MDB IGNORE] (#19032) Checks if a machine has no research before connecting techweb (#72944) ## About The Pull Request Currently all machines, if the config to not have a techweb link is on, will set their node to science even if they were meant to be connected to another (like through subtypes). This fixes that by checking to ensure they don't have a techweb connected already before giving them a new one. Also as a minor fix, RD consoles will now properly add themselves to the list of accessing RD consoles if they aren't linking to the default. This list currently does nothing but I can see good uses of it in the future. ## Why It's Good For The Game Fixes an error that was found on a downstream, it's a worthwhile fix that thankfully was caught this early. ## Changelog Nothing player-facing. Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> --- code/game/machinery/computer/dna_console.dm | 2 +- code/game/machinery/computer/operating_computer.dm | 4 ++-- code/modules/mob/living/simple_animal/bot/medbot.dm | 2 +- .../modular_computers/file_system/programs/frontier.dm | 2 +- .../modules/modular_computers/file_system/programs/techweb.dm | 2 +- code/modules/research/rdconsole.dm | 3 ++- code/modules/research/rdmachines.dm | 2 +- code/modules/research/server.dm | 4 ++-- code/modules/vehicles/mecha/mech_fabricator.dm | 2 +- code/modules/wiremod/core/component_printer.dm | 2 +- 10 files changed, 13 insertions(+), 12 deletions(-) diff --git a/code/game/machinery/computer/dna_console.dm b/code/game/machinery/computer/dna_console.dm index 3bdac412f76..5896a06fc80 100644 --- a/code/game/machinery/computer/dna_console.dm +++ b/code/game/machinery/computer/dna_console.dm @@ -237,7 +237,7 @@ // Link machine with research techweb. Used for discovering and accessing // already discovered mutations - if(!CONFIG_GET(flag/no_default_techweb_link)) + if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research) stored_research = SSresearch.science_tech /obj/machinery/computer/scan_consolenew/ui_interact(mob/user, datum/tgui/ui) diff --git a/code/game/machinery/computer/operating_computer.dm b/code/game/machinery/computer/operating_computer.dm index a1ca710c137..954ec03caee 100644 --- a/code/game/machinery/computer/operating_computer.dm +++ b/code/game/machinery/computer/operating_computer.dm @@ -16,8 +16,8 @@ var/datum/component/experiment_handler/experiment_handler /obj/machinery/computer/operating/Initialize(mapload) - ..() - if(!CONFIG_GET(flag/no_default_techweb_link)) + . = ..() + if(!CONFIG_GET(flag/no_default_techweb_link) && !linked_techweb) linked_techweb = SSresearch.science_tech find_table() return INITIALIZE_HINT_LATELOAD diff --git a/code/modules/mob/living/simple_animal/bot/medbot.dm b/code/modules/mob/living/simple_animal/bot/medbot.dm index 86bc44ed71c..25d4d236058 100644 --- a/code/modules/mob/living/simple_animal/bot/medbot.dm +++ b/code/modules/mob/living/simple_animal/bot/medbot.dm @@ -137,7 +137,7 @@ skin = new_skin update_appearance() - if(!CONFIG_GET(flag/no_default_techweb_link)) + if(!CONFIG_GET(flag/no_default_techweb_link) && !linked_techweb) linked_techweb = SSresearch.science_tech AddComponent(/datum/component/tippable, \ diff --git a/code/modules/modular_computers/file_system/programs/frontier.dm b/code/modules/modular_computers/file_system/programs/frontier.dm index b5ff07af803..9df43887ebe 100644 --- a/code/modules/modular_computers/file_system/programs/frontier.dm +++ b/code/modules/modular_computers/file_system/programs/frontier.dm @@ -24,7 +24,7 @@ /datum/computer_file/program/scipaper_program/on_start(mob/living/user) . = ..() - if(!CONFIG_GET(flag/no_default_techweb_link)) + if(!CONFIG_GET(flag/no_default_techweb_link) && !linked_techweb) linked_techweb = SSresearch.science_tech /datum/computer_file/program/scipaper_program/application_attackby(obj/item/attacking_item, mob/living/user) diff --git a/code/modules/modular_computers/file_system/programs/techweb.dm b/code/modules/modular_computers/file_system/programs/techweb.dm index 95158423186..2e609a24374 100644 --- a/code/modules/modular_computers/file_system/programs/techweb.dm +++ b/code/modules/modular_computers/file_system/programs/techweb.dm @@ -23,7 +23,7 @@ /datum/computer_file/program/science/on_start(mob/living/user) . = ..() - if(!CONFIG_GET(flag/no_default_techweb_link)) + if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research) stored_research = SSresearch.science_tech /datum/computer_file/program/science/application_attackby(obj/item/attacking_item, mob/living/user) diff --git a/code/modules/research/rdconsole.dm b/code/modules/research/rdconsole.dm index 05d18731671..790f7c8ab72 100644 --- a/code/modules/research/rdconsole.dm +++ b/code/modules/research/rdconsole.dm @@ -47,8 +47,9 @@ Nothing else in the console has ID requirements. /obj/machinery/computer/rdconsole/Initialize(mapload) . = ..() - if(!CONFIG_GET(flag/no_default_techweb_link)) + if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research) stored_research = SSresearch.science_tech + if(stored_research) stored_research.consoles_accessing += src /obj/machinery/computer/rdconsole/Destroy() diff --git a/code/modules/research/rdmachines.dm b/code/modules/research/rdmachines.dm index ee1db5b7bd1..6c5b0392a5a 100644 --- a/code/modules/research/rdmachines.dm +++ b/code/modules/research/rdmachines.dm @@ -20,7 +20,7 @@ /obj/machinery/rnd/Initialize(mapload) . = ..() - if(!CONFIG_GET(flag/no_default_techweb_link)) + if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research) connect_techweb(SSresearch.science_tech) wires = new /datum/wires/rnd(src) diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index bdf1a201acc..f4a7dfa0cb1 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -27,7 +27,7 @@ /obj/machinery/rnd/server/Initialize(mapload) . = ..() - if(CONFIG_GET(flag/no_default_techweb_link)) + if(CONFIG_GET(flag/no_default_techweb_link) && !stored_research) stored_research = new /datum/techweb stored_research.techweb_servers |= src name += " [num2hex(rand(1,65535), -1)]" //gives us a random four-digit hex number as part of the name. Y'know, for fluff. @@ -119,7 +119,7 @@ /obj/machinery/computer/rdservercontrol/Initialize(mapload, obj/item/circuitboard/C) . = ..() - if(!CONFIG_GET(flag/no_default_techweb_link)) + if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research) stored_research = SSresearch.science_tech /obj/machinery/computer/rdservercontrol/Topic(href, href_list) diff --git a/code/modules/vehicles/mecha/mech_fabricator.dm b/code/modules/vehicles/mecha/mech_fabricator.dm index 10bec406234..5355a62ab6e 100644 --- a/code/modules/vehicles/mecha/mech_fabricator.dm +++ b/code/modules/vehicles/mecha/mech_fabricator.dm @@ -53,7 +53,7 @@ var/list/datum/design/cached_designs /obj/machinery/mecha_part_fabricator/Initialize(mapload) - if(!CONFIG_GET(flag/no_default_techweb_link)) + if(!CONFIG_GET(flag/no_default_techweb_link) && !stored_research) connect_techweb(SSresearch.science_tech) rmat = AddComponent(/datum/component/remote_materials, "mechfab", mapload && link_on_init, mat_container_flags=BREAKDOWN_FLAGS_LATHE) cached_designs = list() diff --git a/code/modules/wiremod/core/component_printer.dm b/code/modules/wiremod/core/component_printer.dm index 1fe030da568..11d888527ff 100644 --- a/code/modules/wiremod/core/component_printer.dm +++ b/code/modules/wiremod/core/component_printer.dm @@ -19,7 +19,7 @@ /obj/machinery/component_printer/Initialize(mapload) . = ..() - if(!CONFIG_GET(flag/no_default_techweb_link)) + if(!CONFIG_GET(flag/no_default_techweb_link) && !techweb) connect_techweb(SSresearch.science_tech) materials = AddComponent( \