mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-30 23:48:28 +01:00
Adds mixing bowls
This commit is contained in:
+18
-5
@@ -53,15 +53,28 @@
|
||||
return -1
|
||||
return .
|
||||
|
||||
/datum/recipe/proc/check_items(obj/container) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
/datum/recipe/proc/check_items(obj/container, list/ignored_items = null) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
if(!items)
|
||||
if(locate(/obj/) in container)
|
||||
return -1
|
||||
else
|
||||
if(ignored_items) //are we supposed to be ignoring anything?
|
||||
var/unignored = FALSE
|
||||
for(var/obj/O in container)
|
||||
if(!is_type_in_list(O, ignored_items))
|
||||
unignored = TRUE //found something we aren't ignoring, quit looking
|
||||
break
|
||||
if(unignored)
|
||||
return -1
|
||||
else //anything we found is something we are ignoring
|
||||
return 1
|
||||
else //not ignoring anything, and we found something
|
||||
return -1
|
||||
else //didn't find anything
|
||||
return 1
|
||||
. = 1
|
||||
var/list/checklist = items.Copy()
|
||||
for(var/obj/O in container)
|
||||
if(ignored_items && is_type_in_list(O, ignored_items)) //skip if this is something we are ignoring
|
||||
continue
|
||||
var/found = 0
|
||||
for(var/type in checklist)
|
||||
if(istype(O,type))
|
||||
@@ -95,12 +108,12 @@
|
||||
container.reagents.clear_reagents()
|
||||
return result_obj
|
||||
|
||||
/proc/select_recipe(list/datum/recipe/available_recipes, obj/obj, exact = 1 as num)
|
||||
/proc/select_recipe(list/datum/recipe/available_recipes, obj/obj, exact = 1 as num, list/ignored_items = null)
|
||||
if(!exact)
|
||||
exact = -1
|
||||
var/list/datum/recipe/possible_recipes = new
|
||||
for(var/datum/recipe/recipe in available_recipes)
|
||||
if(recipe.check_reagents(obj.reagents) == exact && recipe.check_items(obj) == exact)
|
||||
if(recipe.check_reagents(obj.reagents) == exact && recipe.check_items(obj, ignored_items) == exact)
|
||||
possible_recipes += recipe
|
||||
if(possible_recipes.len == 0)
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user