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.
This commit is contained in:
Sealed101
2021-09-08 11:44:57 +03:00
committed by GitHub
parent 38f17800b7
commit 7f21c15ea0
@@ -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