[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>
This commit is contained in:
SkyratBot
2021-01-22 04:05:42 +00:00
committed by GitHub
co-authored by MrMelbert
parent 225e20db3d
commit 41590d464d
2 changed files with 6 additions and 1 deletions
+5 -1
View File
@@ -657,7 +657,7 @@
if(!myseed)
to_chat(user, "<span class='notice'>The tray is empty.</span>")
return
if(plant_health <= 15)
if(plant_health <= GENE_SHEAR_MIN_HEALTH)
to_chat(user, "<span class='notice'>This plant looks too unhealty to be sheared right now.</span>")
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))