diff --git a/code/__DEFINES/research.dm b/code/__DEFINES/research.dm index c78b4938621..96a2c74ef8b 100644 --- a/code/__DEFINES/research.dm +++ b/code/__DEFINES/research.dm @@ -79,6 +79,7 @@ #define SCIENTIFIC_COOPERATION_PURCHASE_MULTIPLIER 0.01 /// How much money is one point of gain worth. #define SCIPAPER_GAIN_TO_MONEY 125 +#define SCIPAPER_ALREADY_BOUGHT 2 ///Connects the 'server_var' to a valid research server on your Z level. ///Used for machines in LateInitialize, to ensure that RND servers are loaded first. diff --git a/code/modules/modular_computers/file_system/programs/frontier.dm b/code/modules/modular_computers/file_system/programs/frontier.dm index 9df0e2d9160..34bcbca8027 100644 --- a/code/modules/modular_computers/file_system/programs/frontier.dm +++ b/code/modules/modular_computers/file_system/programs/frontier.dm @@ -155,7 +155,8 @@ else data["relations"][partner.type] = "Undefined" data["purchaseableBoosts"][partner.type] = list() - for(var/node_id in linked_techweb.get_available_nodes()) + var/displayable_nodes = linked_techweb.get_available_nodes() + linked_techweb.get_researched_nodes() + for(var/node_id in displayable_nodes) // Not from our partner if(!(node_id in partner.boostable_nodes)) continue @@ -218,8 +219,9 @@ var/datum/scientific_partner/partner = locate(text2path(params["boost_seller"])) in SSresearch.scientific_partners var/datum/techweb_node/node = SSresearch.techweb_node_by_id(params["purchased_boost"]) if(partner && node) - if(partner.purchase_boost(linked_techweb, node)) - computer.say("Purchase successful.") + var/possible_boost = partner.purchase_boost(linked_techweb, node) + if(possible_boost) + computer.say("Purchase successful[possible_boost == SCIPAPER_ALREADY_BOUGHT ? ", refunding [partner.boostable_nodes[params["purchased_boost"]]] points" : ""].") playsound(computer, 'sound/machines/ping.ogg', 25) return TRUE playsound(computer, 'sound/machines/terminal/terminal_error.ogg', 25) diff --git a/code/modules/research/ordnance/_scipaper.dm b/code/modules/research/ordnance/_scipaper.dm index 7d3ea79b332..0b5efc03e10 100644 --- a/code/modules/research/ordnance/_scipaper.dm +++ b/code/modules/research/ordnance/_scipaper.dm @@ -290,17 +290,23 @@ var/list/boostable_nodes = list() /datum/scientific_partner/proc/purchase_boost(datum/techweb/purchasing_techweb, datum/techweb_node/node) - if(!allowed_to_boost(purchasing_techweb, node.id)) + var/possible_boost = allowed_to_boost(purchasing_techweb, node.id) + if(!possible_boost) return FALSE purchasing_techweb.boost_techweb_node(node, list(TECHWEB_POINT_TYPE_GENERIC = boostable_nodes[node.id])) purchasing_techweb.scientific_cooperation[type] -= boostable_nodes[node.id] * SCIENTIFIC_COOPERATION_PURCHASE_MULTIPLIER + if(possible_boost == SCIPAPER_ALREADY_BOUGHT) /// Refund the original price + purchasing_techweb.add_point_list(list(TECHWEB_POINT_TYPE_GENERIC = boostable_nodes[node.id])) + return SCIPAPER_ALREADY_BOUGHT return TRUE /datum/scientific_partner/proc/allowed_to_boost(datum/techweb/purchasing_techweb, node_id) if(purchasing_techweb.scientific_cooperation[type] < (boostable_nodes[node_id] * SCIENTIFIC_COOPERATION_PURCHASE_MULTIPLIER)) // Too expensive return FALSE - if(!(node_id in purchasing_techweb.get_available_nodes())) // Not currently available - return FALSE if((TECHWEB_POINT_TYPE_GENERIC in purchasing_techweb.boosted_nodes[node_id]) && (purchasing_techweb.boosted_nodes[node_id][TECHWEB_POINT_TYPE_GENERIC] >= boostable_nodes[node_id])) // Already bought or we have a bigger discount return FALSE + if(node_id in purchasing_techweb.researched_nodes) + return SCIPAPER_ALREADY_BOUGHT + if(!(node_id in purchasing_techweb.get_available_nodes())) // Not currently available + return FALSE return TRUE diff --git a/code/modules/research/ordnance/scipaper_partner.dm b/code/modules/research/ordnance/scipaper_partner.dm index 5bbe3e7d627..39d1cc68ed4 100644 --- a/code/modules/research/ordnance/scipaper_partner.dm +++ b/code/modules/research/ordnance/scipaper_partner.dm @@ -54,7 +54,7 @@ TECHWEB_NODE_CYBER_ORGANS = TECHWEB_TIER_2_POINTS, TECHWEB_NODE_CYBER_ORGANS_UPGRADED = TECHWEB_TIER_3_POINTS, TECHWEB_NODE_MEDBAY_EQUIP_ADV = TECHWEB_TIER_3_POINTS, - TECHWEB_NODE_CYTOLOGY = TECHWEB_TIER_3_POINTS, + TECHWEB_NODE_CYTOLOGY = TECHWEB_TIER_2_POINTS, TECHWEB_NODE_BORG_MEDICAL = TECHWEB_TIER_3_POINTS, TECHWEB_NODE_COMBAT_IMPLANTS = TECHWEB_TIER_4_POINTS, ) diff --git a/code/modules/research/techweb/_techweb_node.dm b/code/modules/research/techweb/_techweb_node.dm index 2a6eb8b7b7d..104e475b7e5 100644 --- a/code/modules/research/techweb/_techweb_node.dm +++ b/code/modules/research/techweb/_techweb_node.dm @@ -92,7 +92,7 @@ if(host.completed_experiments[experiment_type]) //do we have this discount_experiment unlocked? actual_costs[cost_type] -= discount_experiments[experiment_type] - if(host.boosted_nodes[id]) // Boosts should be subservient to experiments. Discount from boosts are capped when costs fall below 250. + if(host.boosted_nodes[id]) // Boosts should be subservient to experiments. var/list/boostlist = host.boosted_nodes[id] for(var/booster in boostlist) if(actual_costs[booster])