mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-12 08:36:00 +01:00
[MIRROR] Adds support for non-science techwebs (+Config) [MDB IGNORE] (#17596)
* Adds support for non-science techwebs (+Config) (#71070) ## About The Pull Request This is an expanding of https://github.com/tgstation/tgstation/pull/69708 Adds a config to not connect machines to a techweb at the start of a round Adds the ability to multitool a server to get its techweb in its buffer, which can then be used on machines to sync them. Adds support for some machines to not cry when they don't have a techweb linked to it, in case they actually don't. If the config to not have machines connected to the science server is enabled, research servers will make their own techwebs instead. This is barebones though and would need more work if this option is used. For misc stuff: - I replaced checking ``GLOB.machines`` for research servers, to instead check ``SSresearch.servers``, where we can use ``as anything``. - Removed unused vars on the RD server control - I renamed the operating computer's .dm file to remove the capitalized letter from it. It's now operating_computer instead of Operations. ## Why It's Good For The Game This is adding support for 2 different cases that can be used in the future: 1. Off-station roles, we can make roles like Oldstation have their own techweb so they don't ruin science's efforts, or use their advanced research to get things we don't want, or even possibly have some blacklist webs for ghost roles (like teleporters) so that way we don't need to have this dance where we have to give them a very specific amount of materials for them to do things while not being able to get a teleporter and leaving. I heard discussions that people wanted this a while back, and one of the main things preventing this from happening is the lack of support. Hopefully this is encouragement to make it a reality, because I think it would be a really cool expansion of ghost roles and a good way to prevent them from messing with the round in progress. 2. Downstreams who want to do different things with Science. Personally I made this PR with voidcrew(shiptest) in mind and think this would make their lives easier. I didn't expand too much on this because I'm leaving up mostly to the downstreams to figure out what they want to do with these systems. ## Changelog This generally isn't really player facing, since most of the changes would only come into effect if the config is enabled?? 🆑 fix: Research servers now only show servers connected to their techweb. /🆑 * Adds support for non-science techwebs (+Config) Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/ai_restorer/try_insert(obj/item/attacking_item, mob/living/user)
|
||||
/datum/computer_file/program/ai_restorer/application_attackby(obj/item/attacking_item, mob/living/user)
|
||||
if(!computer)
|
||||
return FALSE
|
||||
if(!istype(attacking_item, /obj/item/aicard))
|
||||
|
||||
@@ -24,7 +24,16 @@
|
||||
|
||||
/datum/computer_file/program/scipaper_program/on_start(mob/living/user)
|
||||
. = ..()
|
||||
linked_techweb = SSresearch.science_tech
|
||||
if(!CONFIG_GET(flag/no_default_techweb_link))
|
||||
linked_techweb = SSresearch.science_tech
|
||||
|
||||
/datum/computer_file/program/scipaper_program/application_attackby(obj/item/attacking_item, mob/living/user)
|
||||
if(!istype(attacking_item, /obj/item/multitool))
|
||||
return FALSE
|
||||
var/obj/item/multitool/attacking_tool = attacking_item
|
||||
if(!QDELETED(attacking_tool.buffer) && istype(attacking_tool.buffer, /datum/techweb))
|
||||
linked_techweb = attacking_tool.buffer
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/scipaper_program/proc/recheck_file_presence()
|
||||
if(selected_file in computer.stored_files)
|
||||
@@ -75,78 +84,84 @@
|
||||
/datum/computer_file/program/scipaper_program/ui_data()
|
||||
// Program Headers:
|
||||
var/list/data = get_header_data()
|
||||
data["currentTab"] = current_tab
|
||||
data["currentTab"] = current_tab
|
||||
data["has_techweb"] = !!linked_techweb
|
||||
|
||||
// First page. Form submission.
|
||||
if(current_tab == 1)
|
||||
data["fileList"] = list()
|
||||
data["expList"] = list()
|
||||
data["allowedTiers"] = list()
|
||||
data["allowedPartners"] = list()
|
||||
// Both the file and experiment list are assoc lists. ID as value, display name as keys.
|
||||
for(var/datum/computer_file/data/ordnance/ordnance_file in computer.stored_files)
|
||||
data["fileList"] += list(ordnance_file.filename = ordnance_file.uid)
|
||||
if(selected_file)
|
||||
for (var/possible_experiment in selected_file.possible_experiments)
|
||||
var/datum/experiment/ordnance/experiment = possible_experiment
|
||||
data["expList"] += list(initial(experiment.name) = experiment)
|
||||
data["allowedTiers"] = paper_to_be.calculate_tier()
|
||||
for (var/partner in SSresearch.scientific_partners)
|
||||
var/datum/scientific_partner/scientific_partner = partner
|
||||
if(paper_to_be.experiment_path in scientific_partner.accepted_experiments)
|
||||
data["allowedPartners"] += list(scientific_partner.name = scientific_partner.type)
|
||||
switch(current_tab)
|
||||
// First page. Form submission.
|
||||
if(1)
|
||||
data["fileList"] = list()
|
||||
data["expList"] = list()
|
||||
data["allowedTiers"] = list()
|
||||
data["allowedPartners"] = list()
|
||||
// Both the file and experiment list are assoc lists. ID as value, display name as keys.
|
||||
for(var/datum/computer_file/data/ordnance/ordnance_file in computer.stored_files)
|
||||
data["fileList"] += list(ordnance_file.filename = ordnance_file.uid)
|
||||
if(selected_file)
|
||||
for (var/possible_experiment in selected_file.possible_experiments)
|
||||
var/datum/experiment/ordnance/experiment = possible_experiment
|
||||
data["expList"] += list(initial(experiment.name) = experiment)
|
||||
data["allowedTiers"] = paper_to_be.calculate_tier()
|
||||
for (var/partner in SSresearch.scientific_partners)
|
||||
var/datum/scientific_partner/scientific_partner = partner
|
||||
if(paper_to_be.experiment_path in scientific_partner.accepted_experiments)
|
||||
data["allowedPartners"] += list(scientific_partner.name = scientific_partner.type)
|
||||
|
||||
data += paper_to_be.return_gist()
|
||||
data["selectedFile"] = selected_file?.filename
|
||||
// Renamed both of these to be more topical.
|
||||
data["selectedExperiment"] = data["experimentName"]
|
||||
data -= "experimentName"
|
||||
data["selectedPartner"] = data["partner"]
|
||||
data -= "partner"
|
||||
data += paper_to_be.return_gist()
|
||||
data["selectedFile"] = selected_file?.filename
|
||||
// Renamed both of these to be more topical.
|
||||
data["selectedExperiment"] = data["experimentName"]
|
||||
data -= "experimentName"
|
||||
data["selectedPartner"] = data["partner"]
|
||||
data -= "partner"
|
||||
|
||||
// Second page. View previous
|
||||
if(current_tab == 2)
|
||||
data["publishedPapers"] = list()
|
||||
for (var/experiment_types in linked_techweb.published_papers)
|
||||
for (var/datum/scientific_paper/paper in linked_techweb.published_papers[experiment_types])
|
||||
data["publishedPapers"] += list(paper.return_gist())
|
||||
// Second page. View previous
|
||||
if(2)
|
||||
data["publishedPapers"] = list()
|
||||
if(!linked_techweb)
|
||||
return data
|
||||
for (var/experiment_types in linked_techweb.published_papers)
|
||||
for (var/datum/scientific_paper/paper in linked_techweb.published_papers[experiment_types])
|
||||
data["publishedPapers"] += list(paper.return_gist())
|
||||
|
||||
if(current_tab == 4)
|
||||
data["purchaseableBoosts"] = list()
|
||||
data["relations"] = list()
|
||||
var/list/visible_nodes = list()
|
||||
visible_nodes += linked_techweb.get_available_nodes()
|
||||
visible_nodes += linked_techweb.get_researched_nodes()
|
||||
data["visibleNodes"] = list()
|
||||
for (var/id in visible_nodes)
|
||||
if(visible_nodes[id])
|
||||
data["visibleNodes"] += id
|
||||
if(4)
|
||||
data["purchaseableBoosts"] = list()
|
||||
data["relations"] = list()
|
||||
data["visibleNodes"] = list()
|
||||
if(!linked_techweb)
|
||||
return data
|
||||
var/list/visible_nodes = list()
|
||||
visible_nodes += linked_techweb.get_available_nodes()
|
||||
visible_nodes += linked_techweb.get_researched_nodes()
|
||||
for (var/id in visible_nodes)
|
||||
if(visible_nodes[id])
|
||||
data["visibleNodes"] += id
|
||||
|
||||
for (var/datum/scientific_partner/partner as anything in SSresearch.scientific_partners)
|
||||
var/relations = linked_techweb.scientific_cooperation[partner.type]
|
||||
switch (round(relations / SCIENTIFIC_COOPERATION_PURCHASE_MULTIPLIER)) // We use points to determine these
|
||||
if(-INFINITY to 0)
|
||||
data["relations"][partner.type] = "Nonexistant"
|
||||
if(1 to 2499)
|
||||
data["relations"][partner.type] = "Negligible"
|
||||
if(2500 to 4999)
|
||||
data["relations"][partner.type] = "Limited"
|
||||
if(5000 to 9999)
|
||||
data["relations"][partner.type] = "Cordial"
|
||||
if(10000 to 19999)
|
||||
data["relations"][partner.type] = "Partners"
|
||||
if(20000 to INFINITY)
|
||||
data["relations"][partner.type] = "Devoted"
|
||||
else
|
||||
data["relations"][partner.type] = "Undefined"
|
||||
data["purchaseableBoosts"][partner.type] = list()
|
||||
for(var/node_id in linked_techweb.get_available_nodes())
|
||||
// Not from our partner
|
||||
if(!(node_id in partner.boosted_nodes))
|
||||
continue
|
||||
if(!partner.allowed_to_boost(linked_techweb, node_id))
|
||||
continue
|
||||
data["purchaseableBoosts"][partner.type] += node_id
|
||||
for (var/datum/scientific_partner/partner as anything in SSresearch.scientific_partners)
|
||||
var/relations = linked_techweb.scientific_cooperation[partner.type]
|
||||
switch (round(relations / SCIENTIFIC_COOPERATION_PURCHASE_MULTIPLIER)) // We use points to determine these
|
||||
if(-INFINITY to 0)
|
||||
data["relations"][partner.type] = "Nonexistant"
|
||||
if(1 to 2499)
|
||||
data["relations"][partner.type] = "Negligible"
|
||||
if(2500 to 4999)
|
||||
data["relations"][partner.type] = "Limited"
|
||||
if(5000 to 9999)
|
||||
data["relations"][partner.type] = "Cordial"
|
||||
if(10000 to 19999)
|
||||
data["relations"][partner.type] = "Partners"
|
||||
if(20000 to INFINITY)
|
||||
data["relations"][partner.type] = "Devoted"
|
||||
else
|
||||
data["relations"][partner.type] = "Undefined"
|
||||
data["purchaseableBoosts"][partner.type] = list()
|
||||
for(var/node_id in linked_techweb.get_available_nodes())
|
||||
// Not from our partner
|
||||
if(!(node_id in partner.boosted_nodes))
|
||||
continue
|
||||
if(!partner.allowed_to_boost(linked_techweb, node_id))
|
||||
continue
|
||||
data["purchaseableBoosts"][partner.type] += node_id
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/scipaper_program/ui_act(action, params)
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
/// Whether this app can send messages to all.
|
||||
var/spam_mode = FALSE
|
||||
|
||||
/datum/computer_file/program/messenger/try_insert(obj/item/attacking_item, mob/living/user)
|
||||
/datum/computer_file/program/messenger/application_attackby(obj/item/attacking_item, mob/living/user)
|
||||
if(!istype(attacking_item, /obj/item/photo))
|
||||
return FALSE
|
||||
var/obj/item/photo/pic = attacking_item
|
||||
|
||||
@@ -23,8 +23,16 @@
|
||||
|
||||
/datum/computer_file/program/science/on_start(mob/living/user)
|
||||
. = ..()
|
||||
stored_research = SSresearch.science_tech
|
||||
if(!CONFIG_GET(flag/no_default_techweb_link))
|
||||
stored_research = SSresearch.science_tech
|
||||
|
||||
/datum/computer_file/program/science/application_attackby(obj/item/attacking_item, mob/living/user)
|
||||
if(!istype(attacking_item, /obj/item/multitool))
|
||||
return FALSE
|
||||
var/obj/item/multitool/attacking_tool = attacking_item
|
||||
if(!QDELETED(attacking_tool.buffer) && istype(attacking_tool.buffer, /datum/techweb))
|
||||
stored_research = attacking_tool.buffer
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/science/ui_assets(mob/user)
|
||||
return list(
|
||||
@@ -34,6 +42,9 @@
|
||||
// heavy data from this proc should be moved to static data when possible
|
||||
/datum/computer_file/program/science/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
data["stored_research"] = !!stored_research
|
||||
if(!stored_research) //lack of a research node is all we care about.
|
||||
return data
|
||||
data += list(
|
||||
"nodes" = list(),
|
||||
"experiments" = list(),
|
||||
@@ -44,7 +55,7 @@
|
||||
"sec_protocols" = !(computer.obj_flags & EMAGGED),
|
||||
"t_disk" = null, //Not doing disk operations on the app, use the console for that.
|
||||
"d_disk" = null, //See above.
|
||||
"locked" = locked
|
||||
"locked" = locked,
|
||||
)
|
||||
|
||||
// Serialize all nodes to display
|
||||
@@ -179,8 +190,8 @@
|
||||
return id_cache[id]
|
||||
|
||||
/datum/computer_file/program/science/proc/research_node(id, mob/user)
|
||||
if(!stored_research.available_nodes[id] || stored_research.researched_nodes[id])
|
||||
computer.say("Node unlock failed: Either already researched or not available!")
|
||||
if(!stored_research || !stored_research.available_nodes[id] || stored_research.researched_nodes[id])
|
||||
computer.say("Node unlock failed: Either no techweb is found, node is already researched or is not available!")
|
||||
return FALSE
|
||||
var/datum/techweb_node/tech_node = SSresearch.techweb_node_by_id(id)
|
||||
if(!istype(tech_node))
|
||||
|
||||
Reference in New Issue
Block a user