[MIRROR] Experi-Sci: Techweb nodes may now require you to perform "scientific" experiments (#3614)

* Experi-Sci: Techweb nodes may now require you to perform "scientific" experiments

* Update all_nodes.dm

Co-authored-by: Qustinnus <Floydje123@hotmail.com>
Co-authored-by: Gandalf2k15 <jzo123@hotmail.com>
This commit is contained in:
SkyratBot
2021-02-23 22:51:28 +01:00
committed by GitHub
parent e9896f3cf5
commit e5ff997ef8
82 changed files with 3350 additions and 809 deletions
+42 -16
View File
@@ -1,21 +1,41 @@
//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.
/**
* # 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?"
var/hidden = FALSE //Whether it starts off hidden.
var/experimental = FALSE //If the tech can be randomly granted by the BEPIS as a reward. Meant to be fully given in tech disks, not researched.
var/starting_node = FALSE //Whether it's available without any research.
/// Whether it starts off hidden
var/hidden = FALSE
/// If the tech can be randomly generated by the BEPIS 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()
var/list/unlock_ids = list() //CALCULATED FROM OTHER NODE'S PREREQUISITES. Assoc list id = TRUE.
var/list/boost_item_paths = list() //Associative list, path = list(point type = point_value).
var/autounlock_by_boost = TRUE //boosting this will autounlock this node.
var/list/research_costs = list() //Point cost to research. type = amount
var/category = "Misc" //Category
/// 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()
/datum/techweb_node/error_node
id = "ERROR"
@@ -48,6 +68,7 @@
VARSET_TO_LIST(., autounlock_by_boost)
VARSET_TO_LIST(., research_costs)
VARSET_TO_LIST(., category)
VARSET_TO_LIST(., required_experiments)
/datum/techweb_node/deserialize_list(list/input, list/options)
if(!input["id"])
@@ -63,6 +84,7 @@
VARSET_FROM_LIST(input, autounlock_by_boost)
VARSET_FROM_LIST(input, research_costs)
VARSET_FROM_LIST(input, category)
VARSET_FROM_LIST(input, required_experiments)
Initialize()
return src
@@ -83,10 +105,14 @@
if(host)
var/list/actual_costs = research_costs
if(host.boosted_nodes[id])
var/list/L = host.boosted_nodes[id]
for(var/i in L)
if(actual_costs[i])
actual_costs[i] -= L[i]
var/list/boostlist = host.boosted_nodes[id]
for(var/booster in boostlist)
if(actual_costs[booster])
actual_costs[booster] -= boostlist[booster]
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]
return actual_costs
else
return research_costs