From 4d880078086aae3ff03bb5a9ba97cba2b2af8e5a Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 6 Aug 2023 03:53:17 +0200 Subject: [PATCH] [MIRROR] Fixed uplink discount stocks affecting normal uplink item stocks [MDB IGNORE] (#22894) * Fixed uplink discount stocks affecting normal uplink item stocks (#77289) ## About The Pull Request If an uplink item was discounted and purchased, it would prevent purchase of the normal-priced uplink item, which is supposed to be infinitely buyable. This fixes that Closes #73560 ## Why It's Good For The Game Fixes an oversight in the uplink stock system. ## Changelog :cl: fix: Fixed being unable to purchase regular-priced uplink items if you bought the discounted variant of it. /:cl: --------- Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> * Fixed uplink discount stocks affecting normal uplink item stocks --------- Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> --- code/datums/components/uplink.dm | 5 ++--- code/modules/uplink/uplink_items.dm | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/datums/components/uplink.dm b/code/datums/components/uplink.dm index e4ae35dad26..1f47e15b79a 100644 --- a/code/datums/components/uplink.dm +++ b/code/datums/components/uplink.dm @@ -234,9 +234,8 @@ var/list/extra_purchasable_stock = list() var/list/extra_purchasable = list() for(var/datum/uplink_item/item as anything in uplink_handler.extra_purchasable) - if(item in stock_list) - extra_purchasable_stock[REF(item)] = stock_list[item] - stock_list -= item + if(item.stock_key in stock_list) + extra_purchasable_stock[REF(item)] = stock_list[item.stock_key] extra_purchasable += list(list( "id" = item.type, "name" = item.name, diff --git a/code/modules/uplink/uplink_items.dm b/code/modules/uplink/uplink_items.dm index 2b929988441..2c060b6ff98 100644 --- a/code/modules/uplink/uplink_items.dm +++ b/code/modules/uplink/uplink_items.dm @@ -12,6 +12,7 @@ uplink_item.limited_stock = limited_stock if(uplink_item.cost >= 20) //Tough love for nuke ops discount *= 0.5 + uplink_item.stock_key = WEAKREF(uplink_item) uplink_item.category = category uplink_item.cost = max(round(uplink_item.cost * (1 - discount)),1) uplink_item.name += " ([round(((initial(uplink_item.cost)-uplink_item.cost)/initial(uplink_item.cost))*100)]% off!)"