mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Well now the microwave works except for anything involving fruit. I hate this code.
This commit is contained in:
@@ -26,10 +26,7 @@
|
||||
*
|
||||
* Functions you do not need to call directly but could:
|
||||
* /datum/recipe/proc/check_reagents(var/datum/reagents/avail_reagents)
|
||||
* //1=precisely, 0=insufficiently, -1=superfluous
|
||||
*
|
||||
* /datum/recipe/proc/check_items(var/obj/container as obj)
|
||||
* //1=precisely, 0=insufficiently, -1=superfluous
|
||||
*
|
||||
* */
|
||||
|
||||
@@ -46,11 +43,11 @@
|
||||
var/aval_r_amnt = avail_reagents.get_reagent_amount(r_r)
|
||||
if (!(abs(aval_r_amnt - reagents[r_r])<0.5)) //if NOT equals
|
||||
if (aval_r_amnt>reagents[r_r])
|
||||
. = -1
|
||||
. = 0
|
||||
else
|
||||
return 0
|
||||
return -1
|
||||
if ((reagents?(reagents.len):(0)) < avail_reagents.reagent_list.len)
|
||||
return -1
|
||||
return 0
|
||||
return .
|
||||
|
||||
/datum/recipe/proc/check_fruit(var/obj/container)
|
||||
@@ -66,9 +63,9 @@
|
||||
for(var/ktag in checklist)
|
||||
if(!isnull(checklist[ktag]))
|
||||
if(checklist[ktag] < 0)
|
||||
. = -1
|
||||
else if(checklist[ktag] > 0)
|
||||
. = 0
|
||||
else if(checklist[ktag] > 0)
|
||||
. = -1
|
||||
break
|
||||
return .
|
||||
|
||||
@@ -84,9 +81,9 @@
|
||||
found = 1
|
||||
break
|
||||
if (!found)
|
||||
. = -1
|
||||
. = 0
|
||||
if (checklist.len)
|
||||
. = 0
|
||||
. = -1
|
||||
return .
|
||||
|
||||
//general version
|
||||
@@ -100,6 +97,10 @@
|
||||
|
||||
// food-related
|
||||
/datum/recipe/proc/make_food(var/obj/container as obj)
|
||||
world << "trying to make [result]."
|
||||
if(!result)
|
||||
world << "<span class='danger'>Recipe is defined without a result, please bug this.</span>"
|
||||
return
|
||||
var/obj/result_obj = new result(container)
|
||||
for (var/obj/O in (container.contents-result_obj))
|
||||
if (O.reagents)
|
||||
@@ -111,14 +112,11 @@
|
||||
return result_obj
|
||||
|
||||
/proc/select_recipe(var/list/datum/recipe/avaiable_recipes, var/obj/obj as obj, var/exact)
|
||||
if (!exact)
|
||||
exact = -1
|
||||
else
|
||||
exact = 1
|
||||
var/list/datum/recipe/possible_recipes = new
|
||||
for (var/datum/recipe/recipe in avaiable_recipes)
|
||||
if (recipe.check_reagents(obj.reagents)==exact && recipe.check_items(obj)==exact && recipe.check_fruit(obj)==exact)
|
||||
possible_recipes+=recipe
|
||||
var/target = exact ? 0 : 1
|
||||
if(recipe.check_reagents(obj.reagents) >= target && recipe.check_items(obj) >= target && recipe.check_fruit(obj) >= target)
|
||||
possible_recipes |= recipe
|
||||
if (possible_recipes.len==0)
|
||||
return null
|
||||
else if (possible_recipes.len==1)
|
||||
|
||||
@@ -274,7 +274,7 @@
|
||||
cooked.loc = src.loc
|
||||
return
|
||||
|
||||
/obj/machinery/microwave/proc/wzhzhzh(var/seconds as num)
|
||||
/obj/machinery/microwave/proc/wzhzhzh(var/seconds as num) // Whoever named this proc is fucking literally Satan. ~ Z
|
||||
for (var/i=1 to seconds)
|
||||
if (stat & (NOPOWER|BROKEN))
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user