From de73153ccb2c70ce6f4cda87e036b2241abd5218 Mon Sep 17 00:00:00 2001 From: CitadelStationBot Date: Tue, 5 Jun 2018 13:19:33 -0500 Subject: [PATCH] [MIRROR] Fixes uplink refunds (#7014) * Fixes uplink refunds (#38272) * Fixes uplink refunds * Whoops * Sure * Fixes uplink refunds --- code/modules/uplink/uplink.dm | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/code/modules/uplink/uplink.dm b/code/modules/uplink/uplink.dm index e269e0bf49..deacb6d401 100644 --- a/code/modules/uplink/uplink.dm +++ b/code/modules/uplink/uplink.dm @@ -74,25 +74,17 @@ GLOBAL_LIST_EMPTY(uplinks) return //no hitting everyone/everything just to try to slot tcs in! if(istype(I, /obj/item/stack/telecrystal)) LoadTC(user, I) - for(var/item in subtypesof(/datum/uplink_item)) - var/datum/uplink_item/UI = item - var/path = null - if(initial(UI.refund_path)) - path = initial(UI.refund_path) - else - path = initial(UI.item) - var/cost = 0 - if(initial(UI.refund_amount)) - cost = initial(UI.refund_amount) - else - cost = initial(UI.cost) - var/refundable = initial(UI.refundable) - if(I.type == path && refundable && I.check_uplink_validity()) - telecrystals += cost - purchase_log.total_spent -= cost - to_chat(user, "[I] refunded.") - qdel(I) - return + for(var/category in uplink_items) + for(var/item in uplink_items[category]) + var/datum/uplink_item/UI = uplink_items[category][item] + var/path = UI.refund_path || UI.item + var/cost = UI.refund_amount || UI.cost + if(I.type == path && UI.refundable && I.check_uplink_validity()) + telecrystals += cost + purchase_log.total_spent -= cost + to_chat(user, "[I] refunded.") + qdel(I) + return /datum/component/uplink/proc/interact(mob/user) if(locked)