mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-13 19:22:20 +00:00
## About The Pull Request I made this to help me move more towards my goals [laid out here](https://hackmd.io/XLt5MoRvRxuhFbwtk4VAUA) which currently doesn't have much interest. This makes the Destructive Analyzer use a little neat TGUI menu instead of its old HTML one. I also touch a lot of science stuff and a little experimentor stuff, so let me explain a bit: Old iterations of Science had different items that you can use to boost nodes through deconstruction. This has been removed, and its only feature is the auto-unlocking of nodes (that is; making them visible to the R&D console). I thought that instead of keeping this deprecated code around, I would rework it a little to make it clear what we actually use it for (unhiding nodes). All vars and procs that mentioned this have been renamed or reworked to make more sense now. Experimentor stuff shares a lot with the destructive analyzer, so I had to mess with that a bit to keep its decayed corpse of deprecated code, functional. I also added context tips to the destructive analyzer, and added the ability to AltClick to remove the inserted item. Removing items now also plays a little sound because it was kinda lame. Also, balloon alerts. ## Why It's Good For The Game Moves a shitty machine to TGUI so it is slightly less shitty, now it's more direct and compact with more player-feedback. Helps me with a personal project and yea ### Video demonstration I show off connecting the machine to R&D Servers, but I haven't changed the behavior of that and the roundstart analyzers are connected to servers by default. https://github.com/tgstation/tgstation/assets/53777086/65295600-4fae-42d1-9bae-eccefe337a2b ## Changelog 🆑 refactor: Destructive Analyzers now have a TGUI menu. /🆑
102 lines
3.6 KiB
Plaintext
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()
|
|
/// List of items you need to deconstruct to unlock this node.
|
|
var/list/required_items_to_unlock = 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)
|