mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-24 12:37:26 +01:00
Nanotrasen Chefs have now officially gone to Chef College (#25066)
* chef buff * comments and crap * blam * revert * s34n review * last review * Reduced expert chef cooldown to 5s. * Renamed things for clarity. * Moved Expert Chef Knowledge to IC * Don't use a Oven, use an Oven. * Made kitchen machines less egotistical. * Gave Expert Chef Knowledge a spell. * Apply suggestions from code review Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Less demanding background. * Removed verb decoration and STATUS_USED_EXPERT_CHEF * Apply suggestions from code review Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com> * Changed trait name. * Lint * Apply review comment. * Remove master-removed panel var * Update code/modules/mob/living/carbon/human/human_mob.dm Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> --------- Signed-off-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: Contrabang <91113370+Contrabang@users.noreply.github.com> Co-authored-by: FunnyMan3595 (Charlie Nolan) <funnyman@google.com> Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
This commit is contained in:
co-authored by
DGamerL
GDN
Contrabang
FunnyMan3595
parent
06db6bc004
commit
3b351c8636
+57
-11
@@ -42,26 +42,49 @@
|
||||
var/duplicate = TRUE
|
||||
var/byproduct // example: = /obj/item/kitchen/mould // byproduct to return, such as a mould or trash
|
||||
|
||||
/datum/recipe/proc/check_reagents(datum/reagents/avail_reagents) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
. = 1
|
||||
/datum/recipe/proc/check_reagents(datum/reagents/avail_reagents)
|
||||
. = INGREDIENT_CHECK_EXACT
|
||||
for(var/r_r in reagents)
|
||||
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
|
||||
. = INGREDIENT_CHECK_SURPLUS
|
||||
else
|
||||
return 0
|
||||
if((reagents?(length(reagents)):(0)) < length(avail_reagents.reagent_list))
|
||||
return -1
|
||||
return INGREDIENT_CHECK_FAILURE
|
||||
if((reagents ? length(reagents) : 0) < length(avail_reagents.reagent_list))
|
||||
return INGREDIENT_CHECK_SURPLUS
|
||||
|
||||
/**
|
||||
* Similarly to the function above, this checks for reagents, except instead of being passed a reagent holder, we're passed
|
||||
* [reagent_id] = amount as num.
|
||||
* Returns INGREDIENT_CHECK_EXACT if we have the precise amount thats requested.
|
||||
* Returns INGREDIENT_CHECK_FAILURE if we do not have enough.
|
||||
* Returns INGREDIENT_CHECK_SURPLUS if we have MORE than requested.
|
||||
*/
|
||||
/datum/recipe/proc/check_reagents_assoc_list(list/avail_reagents)
|
||||
. = INGREDIENT_CHECK_EXACT
|
||||
for(var/required_reagent_id in reagents)
|
||||
var/provided_reagent_amount = avail_reagents[required_reagent_id]
|
||||
if(!provided_reagent_amount)
|
||||
return INGREDIENT_CHECK_FAILURE
|
||||
|
||||
if(abs(provided_reagent_amount - reagents[required_reagent_id]) >= 0.5) // If amount is outside of the 0.5 unit tolerance
|
||||
if(provided_reagent_amount > reagents[required_reagent_id]) // we have more than necessary
|
||||
. = INGREDIENT_CHECK_SURPLUS
|
||||
else
|
||||
return INGREDIENT_CHECK_FAILURE // we don't have enough
|
||||
|
||||
if(length(reagents) < length(avail_reagents))
|
||||
return INGREDIENT_CHECK_SURPLUS
|
||||
|
||||
/datum/recipe/proc/check_items(obj/container, list/ignored_items = null) //1=precisely, 0=insufficiently, -1=superfluous
|
||||
. = 1
|
||||
. = INGREDIENT_CHECK_EXACT
|
||||
var/list/checklist = items ? items.Copy() : list()
|
||||
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
|
||||
if(!items)
|
||||
return -1
|
||||
return INGREDIENT_CHECK_SURPLUS
|
||||
var/found = 0
|
||||
for(var/type in checklist)
|
||||
if(istype(O,type))
|
||||
@@ -69,9 +92,32 @@
|
||||
found = 1
|
||||
break
|
||||
if(!found)
|
||||
. = -1
|
||||
. = INGREDIENT_CHECK_SURPLUS
|
||||
if(length(checklist))
|
||||
return 0
|
||||
return INGREDIENT_CHECK_FAILURE
|
||||
|
||||
/**
|
||||
* Similarly to the function above, this checks for items, except instead of being passed a reagent holder, we're passed
|
||||
* [type_path] = amount as num.
|
||||
* Returns INGREDIENT_CHECK_EXACT if we have the precise amount thats requested.
|
||||
* Returns INGREDIENT_CHECK_FAILURE if we do not have enough.
|
||||
* Returns INGREDIENT_CHECK_SURPLUS if we have MORE than requested.
|
||||
*/
|
||||
/datum/recipe/proc/check_items_assoc_list(list/given_objects)
|
||||
. = INGREDIENT_CHECK_EXACT
|
||||
var/list/checklist = items ? items.Copy() : list()
|
||||
for(var/obj/item/I as anything in given_objects) // path
|
||||
var/amount_given = given_objects[I]
|
||||
if(!length(checklist))
|
||||
return INGREDIENT_CHECK_SURPLUS
|
||||
|
||||
for(var/i in 1 to amount_given)
|
||||
if(I in checklist)
|
||||
checklist -= I
|
||||
else if(I in items) // make sure the recipe requires this item before declaring it surplus
|
||||
. = INGREDIENT_CHECK_SURPLUS
|
||||
if(length(checklist)) // we didnt get everything
|
||||
return INGREDIENT_CHECK_FAILURE
|
||||
|
||||
//general version
|
||||
/datum/recipe/proc/make(obj/container)
|
||||
@@ -94,7 +140,7 @@
|
||||
container.reagents.clear_reagents()
|
||||
return result_obj
|
||||
|
||||
/proc/select_recipe(list/datum/recipe/available_recipes, obj/obj, exact = 1 as num, list/ignored_items = null)
|
||||
/proc/select_recipe(list/datum/recipe/available_recipes, obj/obj, exact = INGREDIENT_CHECK_EXACT, list/ignored_items = null)
|
||||
if(!exact)
|
||||
exact = -1
|
||||
var/list/datum/recipe/possible_recipes = new
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/datum/spell/chef/expert_chef
|
||||
name = "Expert Chef Knowledge"
|
||||
desc = "Find things you can cook with the items in reach."
|
||||
school = "chef"
|
||||
clothes_req = FALSE
|
||||
base_cooldown = 5 SECONDS
|
||||
human_req = TRUE
|
||||
action_icon_state = "chef"
|
||||
action_background_icon_state = "bg_default"
|
||||
still_recharging_msg = "All this thinking makes your head hurt, wait a bit longer."
|
||||
|
||||
/datum/spell/chef/expert_chef/cast(list/targets, mob/user = usr)
|
||||
var/mob/living/carbon/human/H = targets[1]
|
||||
H.expert_chef_knowledge()
|
||||
|
||||
/datum/spell/chef/expert_chef/create_new_targeting()
|
||||
return new /datum/spell_targeting/self
|
||||
Reference in New Issue
Block a user