Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIRROR] TGUI Destructive Analyzer #625

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions code/__DEFINES/research.dm
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#define RDSCREEN_NOBREAK "<NO_HTML_BREAK>"

/// For instances where we don't want a design showing up due to it being for debug/sanity purposes
#define DESIGN_ID_IGNORE "IGNORE_THIS_DESIGN"

#define RESEARCH_MATERIAL_DESTROY_ID "__destroy"

//! Techweb names for new point types. Can be used to define specific point values for specific types of research (science, security, engineering, etc.)
#define TECHWEB_POINT_TYPE_GENERIC "General Research"

Expand Down
42 changes: 15 additions & 27 deletions code/controllers/subsystem/research.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ SUBSYSTEM_DEF(research)
var/list/techweb_nodes_starting = list()
///category name = list(node.id = TRUE)
var/list/techweb_categories = list()
///associative double-layer path = list(id = list(point_type = point_discount))
var/list/techweb_boost_items = list()
///List of all items that can unlock a node. (node.id = list(items))
var/list/techweb_unlock_items = list()
///Node ids that should be hidden by default.
var/list/techweb_nodes_hidden = list()
///Node ids that are exclusive to the BEPIS.
var/list/techweb_nodes_experimental = list()
///path = list(point type = value)
var/list/techweb_point_items = list(
/obj/item/assembly/signaler/anomaly = list(TECHWEB_POINT_TYPE_GENERIC = 10000)
/obj/item/assembly/signaler/anomaly = list(TECHWEB_POINT_TYPE_GENERIC = 10000)
)
var/list/errored_datums = list()
var/list/point_types = list() //typecache style type = TRUE list
Expand Down Expand Up @@ -64,7 +64,7 @@ SUBSYSTEM_DEF(research)
/// Lookup list for ordnance briefers.
var/list/ordnance_experiments = list()
/// Lookup list for scipaper partners.
var/list/scientific_partners = list()
var/list/datum/scientific_partner/scientific_partners = list()

/datum/controller/subsystem/research/Initialize()
point_types = TECHWEB_POINT_TYPE_LIST_ASSOCIATIVE_NAMES
Expand Down Expand Up @@ -153,7 +153,7 @@ SUBSYSTEM_DEF(research)
if (!verify_techweb_nodes()) //Verify all nodes have ids and such.
stack_trace("Invalid techweb nodes detected")
calculate_techweb_nodes()
calculate_techweb_boost_list()
calculate_techweb_item_unlocking_requirements()
if (!verify_techweb_nodes()) //Verify nodes and designs have been crosslinked properly.
CRASH("Invalid techweb nodes detected")

Expand Down Expand Up @@ -209,25 +209,15 @@ SUBSYSTEM_DEF(research)
N.unlock_ids -= u
research_node_id_error(u)
. = FALSE
for(var/p in N.boost_item_paths)
for(var/p in N.required_items_to_unlock)
if(!ispath(p))
N.boost_item_paths -= p
N.required_items_to_unlock -= p
WARNING("[p] is not a valid path.")
node_boost_error(N.id, "[p] is not a valid path.")
. = FALSE
var/list/points = N.boost_item_paths[p]
if(islist(points))
for(var/i in points)
if(!isnum(points[i]))
WARNING("[points[i]] is not a valid number.")
node_boost_error(N.id, "[points[i]] is not a valid number.")
. = FALSE
else if(!point_types[i])
WARNING("[i] is not a valid point type.")
node_boost_error(N.id, "[i] is not a valid point type.")
. = FALSE
else if(!isnull(points))
N.boost_item_paths -= p
var/list/points = N.required_items_to_unlock[p]
if(!isnull(points))
N.required_items_to_unlock -= p
node_boost_error(N.id, "No valid list.")
WARNING("No valid list.")
. = FALSE
Expand Down Expand Up @@ -281,18 +271,16 @@ SUBSYSTEM_DEF(research)
var/datum/techweb_node/prereq_node = techweb_node_by_id(prereq_id)
prereq_node.unlock_ids[node.id] = node

/datum/controller/subsystem/research/proc/calculate_techweb_boost_list(clearall = FALSE)
if(clearall)
techweb_boost_items = list()
/datum/controller/subsystem/research/proc/calculate_techweb_item_unlocking_requirements()
for(var/node_id in techweb_nodes)
var/datum/techweb_node/node = techweb_nodes[node_id]
for(var/path in node.boost_item_paths)
for(var/path in node.required_items_to_unlock)
if(!ispath(path))
continue
if(length(techweb_boost_items[path]))
techweb_boost_items[path][node.id] = node.boost_item_paths[path]
if(length(techweb_unlock_items[path]))
techweb_unlock_items[path][node.id] = node.required_items_to_unlock[path]
else
techweb_boost_items[path] = list(node.id = node.boost_item_paths[path])
techweb_unlock_items[path] = list(node.id = node.required_items_to_unlock[path])
CHECK_TICK

/datum/controller/subsystem/research/proc/populate_ordnance_experiments()
Expand Down
5 changes: 1 addition & 4 deletions code/game/objects/items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@
///Separator between the items on the list
var/sep = ""
///Nodes that can be boosted
var/list/boostable_nodes = techweb_item_boost_check(src)
var/list/boostable_nodes = techweb_item_unlock_check(src)
if (boostable_nodes)
for(var/id in boostable_nodes)
var/datum/techweb_node/node = SSresearch.techweb_node_by_id(id)
Expand Down Expand Up @@ -618,9 +618,6 @@
R.activate_module(src)
R.hud_used.update_robot_modules_display()

/obj/item/proc/GetDeconstructableContents()
return get_all_contents() - src

// afterattack() and attack() prototypes moved to _onclick/item_attack.dm for consistency

/obj/item/proc/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK, damage_type = BRUTE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,8 @@
req_components = list(
/datum/stock_part/scanning_module = 1,
/datum/stock_part/servo = 1,
/datum/stock_part/micro_laser = 1)
/datum/stock_part/micro_laser = 1,
)

/obj/item/circuitboard/machine/experimentor
name = "E.X.P.E.R.I-MENTOR"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
singular_partner["path"] = partner.type
singular_partner["boostedNodes"] = list()
singular_partner["acceptedExperiments"] = list()
for (var/node_id in partner.boosted_nodes)
for (var/node_id in partner.boostable_nodes)
var/datum/techweb_node/node = SSresearch.techweb_node_by_id(node_id)
singular_partner["boostedNodes"] += list(list("name" = node.display_name, "discount" = partner.boosted_nodes[node_id], "id"=node_id))
singular_partner["boostedNodes"] += list(list("name" = node.display_name, "discount" = partner.boostable_nodes[node_id], "id" = node_id))
for (var/datum/experiment/ordnance/ordnance_experiment as anything in partner.accepted_experiments)
singular_partner["acceptedExperiments"] += initial(ordnance_experiment.name)
parsed_partners += list(singular_partner)
Expand Down Expand Up @@ -154,7 +154,7 @@
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))
if(!(node_id in partner.boostable_nodes))
continue
if(!partner.allowed_to_boost(linked_techweb, node_id))
continue
Expand Down
Loading