mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 03:02:54 +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:
|
* Functions you do not need to call directly but could:
|
||||||
* /datum/recipe/proc/check_reagents(var/datum/reagents/avail_reagents)
|
* /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)
|
* /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)
|
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 (!(abs(aval_r_amnt - reagents[r_r])<0.5)) //if NOT equals
|
||||||
if (aval_r_amnt>reagents[r_r])
|
if (aval_r_amnt>reagents[r_r])
|
||||||
. = -1
|
. = 0
|
||||||
else
|
else
|
||||||
return 0
|
|
||||||
if ((reagents?(reagents.len):(0)) < avail_reagents.reagent_list.len)
|
|
||||||
return -1
|
return -1
|
||||||
|
if ((reagents?(reagents.len):(0)) < avail_reagents.reagent_list.len)
|
||||||
|
return 0
|
||||||
return .
|
return .
|
||||||
|
|
||||||
/datum/recipe/proc/check_fruit(var/obj/container)
|
/datum/recipe/proc/check_fruit(var/obj/container)
|
||||||
@@ -66,9 +63,9 @@
|
|||||||
for(var/ktag in checklist)
|
for(var/ktag in checklist)
|
||||||
if(!isnull(checklist[ktag]))
|
if(!isnull(checklist[ktag]))
|
||||||
if(checklist[ktag] < 0)
|
if(checklist[ktag] < 0)
|
||||||
. = -1
|
|
||||||
else if(checklist[ktag] > 0)
|
|
||||||
. = 0
|
. = 0
|
||||||
|
else if(checklist[ktag] > 0)
|
||||||
|
. = -1
|
||||||
break
|
break
|
||||||
return .
|
return .
|
||||||
|
|
||||||
@@ -84,9 +81,9 @@
|
|||||||
found = 1
|
found = 1
|
||||||
break
|
break
|
||||||
if (!found)
|
if (!found)
|
||||||
. = -1
|
|
||||||
if (checklist.len)
|
|
||||||
. = 0
|
. = 0
|
||||||
|
if (checklist.len)
|
||||||
|
. = -1
|
||||||
return .
|
return .
|
||||||
|
|
||||||
//general version
|
//general version
|
||||||
@@ -100,6 +97,10 @@
|
|||||||
|
|
||||||
// food-related
|
// food-related
|
||||||
/datum/recipe/proc/make_food(var/obj/container as obj)
|
/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)
|
var/obj/result_obj = new result(container)
|
||||||
for (var/obj/O in (container.contents-result_obj))
|
for (var/obj/O in (container.contents-result_obj))
|
||||||
if (O.reagents)
|
if (O.reagents)
|
||||||
@@ -111,14 +112,11 @@
|
|||||||
return result_obj
|
return result_obj
|
||||||
|
|
||||||
/proc/select_recipe(var/list/datum/recipe/avaiable_recipes, var/obj/obj as obj, var/exact)
|
/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
|
var/list/datum/recipe/possible_recipes = new
|
||||||
for (var/datum/recipe/recipe in avaiable_recipes)
|
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)
|
var/target = exact ? 0 : 1
|
||||||
possible_recipes+=recipe
|
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)
|
if (possible_recipes.len==0)
|
||||||
return null
|
return null
|
||||||
else if (possible_recipes.len==1)
|
else if (possible_recipes.len==1)
|
||||||
|
|||||||
@@ -274,7 +274,7 @@
|
|||||||
cooked.loc = src.loc
|
cooked.loc = src.loc
|
||||||
return
|
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)
|
for (var/i=1 to seconds)
|
||||||
if (stat & (NOPOWER|BROKEN))
|
if (stat & (NOPOWER|BROKEN))
|
||||||
return 0
|
return 0
|
||||||
|
|||||||
Reference in New Issue
Block a user