mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-24 13:30:42 +01:00
Mitigates (autolathe) recycling exploits by minimizing what can be recycled, adding unit tests and fixing the recipes (#10375)
* Mitigates research recycling exploits by minimizing what can be recycled * Moves the research design check into a new unit test * Adds unit test for stack material recipes costs and fixes these costs * Instead of changing recipes the resulting materials are worth less * Crap fix
This commit is contained in:
@@ -155,23 +155,7 @@
|
||||
return
|
||||
|
||||
if (use(required))
|
||||
var/atom/O
|
||||
if(recipe.use_material)
|
||||
O = new recipe.result_type(user.loc, recipe.use_material)
|
||||
else
|
||||
O = new recipe.result_type(user.loc)
|
||||
O.set_dir(user.dir)
|
||||
O.add_fingerprint(user)
|
||||
|
||||
if (istype(O, /obj/item/stack))
|
||||
var/obj/item/stack/S = O
|
||||
S.amount = produced
|
||||
S.update_icon()
|
||||
S.add_to_stacks(user)
|
||||
|
||||
if (istype(O, /obj/item/storage)) //BubbleWrap - so newly formed boxes are empty
|
||||
for (var/obj/item/I in O)
|
||||
qdel(I)
|
||||
recipe.Produce(produced, user.loc, user.dir, user)
|
||||
|
||||
/obj/item/stack/Topic(href, href_list)
|
||||
..()
|
||||
@@ -388,6 +372,30 @@
|
||||
src.on_floor = on_floor
|
||||
src.use_material = supplied_material
|
||||
|
||||
/datum/stack_recipe/proc/Produce(var/amount = 1, var/loc = null, var/dir = NORTH, var/user = null)
|
||||
if(amount < 1)
|
||||
return null
|
||||
|
||||
var/atom/O
|
||||
if(use_material)
|
||||
O = new result_type(loc, use_material)
|
||||
else
|
||||
O = new result_type(loc)
|
||||
O.set_dir(dir)
|
||||
O.add_fingerprint(user)
|
||||
|
||||
if (istype(O, /obj/item/stack))
|
||||
var/obj/item/stack/S = O
|
||||
S.amount = amount
|
||||
S.update_icon()
|
||||
if(user)
|
||||
S.add_to_stacks(user)
|
||||
|
||||
if (istype(O, /obj/item/storage)) //BubbleWrap - so newly formed boxes are empty
|
||||
for (var/obj/item/I in O)
|
||||
qdel(I)
|
||||
return O
|
||||
|
||||
/*
|
||||
* Recipe list datum
|
||||
*/
|
||||
@@ -397,4 +405,4 @@
|
||||
|
||||
/datum/stack_recipe_list/New(new_title, new_recipes)
|
||||
src.title = new_title
|
||||
src.recipes = new_recipes
|
||||
src.recipes = new_recipes
|
||||
|
||||
Reference in New Issue
Block a user