[MIRROR] Fixes reagent multiplication exploit with 1u foam (#6016)

* Fixes reagent multiplication exploit with 1u foam (#59313)

* Fixes reagent multiplication exploit with 1u foam

Co-authored-by: antropod <antropod@gmail.com>
This commit is contained in:
SkyratBot
2021-05-28 23:43:40 +01:00
committed by GitHub
co-authored by antropod
parent c8d060cbb9
commit 9b2f03b4e4
@@ -244,7 +244,17 @@
/datum/effect_system/foam_spread/start()
var/obj/effect/particle_effect/foam/F = new effect_type(location)
var/foamcolor = mix_color_from_reagents(chemholder.reagents.reagent_list)
chemholder.reagents.copy_to(F, chemholder.reagents.total_volume/amount)
// To prevent insane reagent multiplication with 1u foam
// I am capping amount of reagent foam recieves by limiting how low it can go
// Any radius of foam less than 3 makes foam recieve same amount of reagents as foam of radius 3
// Maximum multiplication of reagents is about 166% (3 times as low as before, it was about 500% with 1u foam)
//
// amount is radius of the foam
// 10u foam has radius of 3
// 5u foam has radius of 2
// 1u foam has radius of 1
var/effective_amount = chemholder.reagents.total_volume / max(amount, 3)
chemholder.reagents.copy_to(F, effective_amount)
F.add_atom_colour(foamcolor, FIXED_COLOUR_PRIORITY)
F.amount = amount
F.metal = metal