Files
Bubberstation/code/modules/research/techweb/_techweb_node.dm
SkyratBot eeecfcfe09 [MIRROR] Advanced Robotics Techweb Tweak and General Techweb QOL [MDB IGNORE] (#24469)
* Advanced Robotics Techweb Tweak and General Techweb QOL (#78985)

## About The Pull Request

This PR is half a successor to #77399, and half QOL changes. When I made
the old PR, I originally wanted to add a scanning experiment to the
advanced robotics node, but several people (including at least one
maintainer) had reservations with this idea. My plan was to make the
experiment be completed automatically, instead of needing someone to
wave the scanner around, but as it turns out the experiment system is
just fundamentally not designed for experiments like that.

Now I've realized that there doesn't really need to be a new experiment.
So now the advanced robotics node is just not dependent on neural
programming, and that's it. No cost increase, no experiment needed.

As for the QOL changes, it just allows certain experiments to be
completed earlier than they otherwise would be. Normally, for an
experiment to even be available for completion, you need to get at least
one prerequisite node for one of the nodes the experiment benefits (as
in, one of the nodes it is required for or grants a discount too).
However, this sometimes means that you can't complete an experiment even
if you have the means to do it. Nonhuman autopsy is a good example; you
can autopsy a nonhuman corpse right at the start of a round, but the
experiment won't actually be completed unless biological technology has
been researched. The tier two laser experiment is another example. You
get access to tier two lasers necessary for the experiment by
researching industrial technology, but the experiment itself is locked
behind electromagnetic theory.

Now, the nonhuman autopsy experiment, divergent biology experiment, and
all medium and high grade material scanning experiments are unlocked
round-start. The tier two lasers experiment is unlocked by industrial
engineering.
## Why It's Good For The Game

For the advanced robotics change, I'll just quote myself from the last
PR:
> Robotics should not be dependent on an entirely different department
to access their core job content. Such dependencies encourage tiding and
other toxic interactions between departments.

For the QOL changes, it makes the whole system a lot more
newbie-friendly. For the autopsy especially, its common to see new
coroners autopsy the nonhuman bodies first and the human one second.
This means that, when the nonhuman autopsy experiment is actually
unlocked, there aren't any nonhuman bodies left to autopsy. Now it
doesn't matter which order they're autopsied in.
## Changelog
🆑
qol: Nonhuman autopsy, Tier Two Lasers, and several other experiments
can now be completed earlier.
balance: Advanced robotics techweb node no longer requires neural
programming node.
/🆑

* Advanced Robotics Techweb Tweak and General Techweb QOL

---------

Co-authored-by: GPeckman <21979502+GPeckman@users.noreply.github.com>
2023-10-20 14:28:37 -07:00

102 lines
3.6 KiB
Plaintext

/**
* # Techweb Node
*
* A datum representing a researchable node in the techweb.
*
* Techweb nodes are GLOBAL, there should only be one instance of them in the game. Persistant
* changes should never be made to them in-game. USE SSRESEARCH PROCS TO OBTAIN REFERENCES.
* DO NOT REFERENCE OUTSIDE OF SSRESEARCH OR YOU WILL FUCK UP GC.
*/
/datum/techweb_node
/// Internal ID of the node
var/id
/// The name of the node as it is shown on UIs
var/display_name = "Errored Node"
/// A description of the node to show on UIs
var/description = "Why are you seeing this?"
/// Whether it starts off hidden
var/hidden = FALSE
/// If the tech can be randomly generated by BEPIS tech as a reward. Meant to be fully given in tech disks, not researched
var/experimental = FALSE
/// Whether it's available without any research
var/starting_node = FALSE
var/list/prereq_ids = list()
var/list/design_ids = list()
/// CALCULATED FROM OTHER NODE'S PREREQUISITIES. Associated list id = TRUE
var/list/unlock_ids = list()
/// Associative list, path = list(point type = point_value)
var/list/boost_item_paths = list()
/// Boosting this will autounlock this node
var/autounlock_by_boost = TRUE
/// The points cost to research the node, type = amount
var/list/research_costs = list()
/// The category of the node
var/category = "Misc"
/// The list of experiments required to research the node
var/list/required_experiments = list()
/// If completed, these experiments give a specific point amount discount to the node.area
var/list/discount_experiments = list()
/// When this node is completed, allows these experiments to be performed.
var/list/experiments_to_unlock = list()
/// Whether or not this node should show on the wiki
var/show_on_wiki = TRUE
/datum/techweb_node/error_node
id = "ERROR"
display_name = "ERROR"
description = "This usually means something in the database has corrupted. If it doesn't go away automatically, inform Central Command for their techs to fix it ASAP(tm)"
show_on_wiki = FALSE
/datum/techweb_node/proc/Initialize()
//Make lists associative for lookup
for(var/id in prereq_ids)
prereq_ids[id] = TRUE
for(var/id in design_ids)
design_ids[id] = TRUE
for(var/id in unlock_ids)
unlock_ids[id] = TRUE
/datum/techweb_node/Destroy()
SSresearch.techweb_nodes -= id
return ..()
/datum/techweb_node/proc/on_design_deletion(datum/design/D)
prune_design_id(D.id)
/datum/techweb_node/proc/on_node_deletion(datum/techweb_node/TN)
prune_node_id(TN.id)
/datum/techweb_node/proc/prune_design_id(design_id)
design_ids -= design_id
/datum/techweb_node/proc/prune_node_id(node_id)
prereq_ids -= node_id
unlock_ids -= node_id
/datum/techweb_node/proc/get_price(datum/techweb/host)
if(!host)
return research_costs
var/list/actual_costs = research_costs.Copy()
for(var/cost_type in actual_costs)
for(var/experiment_type in discount_experiments)
if(host.completed_experiments[experiment_type]) //do we have this discount_experiment unlocked?
actual_costs[cost_type] -= discount_experiments[experiment_type]
if(host.boosted_nodes[id]) // Boosts should be subservient to experiments. Discount from boosts are capped when costs fall below 250.
var/list/boostlist = host.boosted_nodes[id]
for(var/booster in boostlist)
if(actual_costs[booster])
var/delta = max(0, actual_costs[booster] - 250)
actual_costs[booster] -= min(boostlist[booster], delta)
return actual_costs
/datum/techweb_node/proc/price_display(datum/techweb/TN)
return techweb_point_display_generic(get_price(TN))
///Proc called when the Station (Science techweb specific) researches a node.
/datum/techweb_node/proc/on_station_research()
SHOULD_CALL_PARENT(FALSE)