From 41590d464db7b51e9e897fb3ec5fbe68ca593431 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Fri, 22 Jan 2021 05:05:42 +0100 Subject: [PATCH] [MIRROR] Patches gene shears click stack exploit (#2828) * Patches gene shears click stack exploit (#56301) Fixes #55390 by checking the plant's heath again after the input is done and before the gene is removed. I'm not sure if it's the cleanest way to get around stacking inputs to exploit the health, but it works? * Patches gene shears click stack exploit Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> --- code/__DEFINES/botany.dm | 1 + code/modules/hydroponics/hydroponics.dm | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/code/__DEFINES/botany.dm b/code/__DEFINES/botany.dm index d2e4d4e739c..f5c20b91c05 100644 --- a/code/__DEFINES/botany.dm +++ b/code/__DEFINES/botany.dm @@ -3,6 +3,7 @@ #define YIELD_WEED_MINIMUM 3 #define YIELD_WEED_MAXIMUM 10 #define STATIC_NUTRIENT_CAPACITY 10 +#define GENE_SHEAR_MIN_HEALTH 15 //Both available scanning modes for the plant analyzer. #define PLANT_SCANMODE_STATS 0 diff --git a/code/modules/hydroponics/hydroponics.dm b/code/modules/hydroponics/hydroponics.dm index 90c86cbbd7b..569b62d4268 100644 --- a/code/modules/hydroponics/hydroponics.dm +++ b/code/modules/hydroponics/hydroponics.dm @@ -657,7 +657,7 @@ if(!myseed) to_chat(user, "The tray is empty.") return - if(plant_health <= 15) + if(plant_health <= GENE_SHEAR_MIN_HEALTH) to_chat(user, "This plant looks too unhealty to be sheared right now.") return @@ -673,6 +673,10 @@ return if(!user.canUseTopic(src, BE_CLOSE)) return + if(!myseed) + return + if(plant_health <= GENE_SHEAR_MIN_HEALTH) //Check health again to make sure they're not keeping inputs open to get free shears. + return for(var/datum/plant_gene/gene in myseed.genes) if(gene.name == removed_trait) if(myseed.genes.Remove(gene))