From 7f21c15ea03ab2d9e423f089ffb30d097b4d7ee6 Mon Sep 17 00:00:00 2001 From: Sealed101 <75863639+Sealed101@users.noreply.github.com> Date: Wed, 8 Sep 2021 11:44:57 +0300 Subject: [PATCH] Fixes RnD experiment discounts applying indefinitely (#61258) Discount experiments have been decreasing required points for nodes indefinitely, resulting in research costs being like Industrial Engineering here: Curiously, this didn't mean free research points for reasons unknown to me. I believe this has been going on for the entire lifespan of Experisci and nobody reported it. Yet here I am, an RnD main fixing something that's my lifeblood. Discounts aren't supposed to grow into 1450%+ discounts over time. RnD discount experiments now reduce the proper amount of points needed instead of gradually growing into a 100% free tech node. --- code/modules/research/techweb/_techweb_node.dm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/code/modules/research/techweb/_techweb_node.dm b/code/modules/research/techweb/_techweb_node.dm index 0dcac24bb57..d24f6fbaa0d 100644 --- a/code/modules/research/techweb/_techweb_node.dm +++ b/code/modules/research/techweb/_techweb_node.dm @@ -36,6 +36,8 @@ 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 we apply a discount to a node we add the experiment for it here to prevent excess discount applications + var/list/discount_used = list() /datum/techweb_node/error_node id = "ERROR" @@ -69,6 +71,7 @@ VARSET_TO_LIST(., research_costs) VARSET_TO_LIST(., category) VARSET_TO_LIST(., required_experiments) + VARSET_TO_LIST(., discount_used) /datum/techweb_node/deserialize_list(list/input, list/options) if(!input["id"]) @@ -85,6 +88,7 @@ VARSET_FROM_LIST(input, research_costs) VARSET_FROM_LIST(input, category) VARSET_FROM_LIST(input, required_experiments) + VARSET_FROM_LIST(input, discount_used) Initialize() return src @@ -111,8 +115,9 @@ 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? + if(host.completed_experiments[experiment_type] && !discount_used[experiment_type]) //do we have this discount_experiment unlocked AND it wasn't applied already? actual_costs[cost_type] -= discount_experiments[experiment_type] + discount_used[experiment_type] = experiment_type return actual_costs else return research_costs