mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-24 00:12:07 +00:00
Largely a port of https://github.com/Baystation12/Baystation12/pull/8038 (Credit to Zuhayr for his hard work on botany) Breakdown of the port: - Plant traits have been expanded drastically - You want a bio-luminescent tomato that explodes into a cloud of acid when thrown or stepped on? Or maybe a corn vine that entangles people and injects them with mannitol and it's harvests that can be used as a battery? Totally possible. - Adds new random seeds! Replaces the egg-plant seed in the exotic seeds crate from cargo with 2 of these. - Literally random, they have randomly generated stats, chemicals, and traits. Great for researching, and/or wasting cargo's supply points. - Plant analyzers can now print off the last scan they recorded, meaning you can distribute copies of the report to validate your claims of having the dankest weed on station. - Potatoes, carrots, watermelons, soybeans, and pumpkins can all be sliced/diced/carved with ANY sharp object, such as knives, hatchets, glass shards, and e-swords. - This should give the chef a bit more room to make it look like he actually is doing the work by slicing up fries by hand. The processor still also works. - New reagent: Wood Pulp - Currently has no use in recipes, but any plant with this reagent in it can be chopped into planks with a hatchet. Did someone order some Ambrosia Deus planks? - Also, vines with woodpulp are dense. You have been warned. Now onto the stuff I did in addition to the stuff from Bay. - Fixed typos where plasma was mistakenly called "phoron" in the port. (Sorry bay) - Replaced bay's botany mutation chances with our tiered mutation system. - Re-re-added tobacco, space tobacco, tea aspera, tea astra, coffee arabica, and coffee robusta. - Re-enabled the rolling of joints - Made it possible to hand-roll cigarettes from tobacco / space tobacco. (A requested / promised addition) - Just like with joints, it will inherit any chems in the tobacco, has the same reagent capacity as a joint, but looks and smokes like a cig (lasts as long as the cigarettes) with a different name/description to differentiate it from pre-made cigs. - Corn can now be juiced in the grinder, in addition to grinding it. Grinding corn will result in it's contained reagents (like corn starch), while juicing corn will result in corn oil. - Re-added the additional plant analyzer information when scanning trays (displays age, weed level, etc) Also cleaned up the recipes_microwave.dm file, removing the commented out recipes that were distributed to the other machines during the Kitchen Overhaul. Shortens the file a bit and makes it more readable. I probably forgot stuff, so I will add things as I remember them / they get pointed out.
145 lines
5.2 KiB
Plaintext
145 lines
5.2 KiB
Plaintext
/* * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
* /datum/recipe by rastaf0 13 apr 2011 *
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * *
|
|
* This is powerful and flexible recipe system.
|
|
* It exists not only for food.
|
|
* supports both reagents and objects as prerequisites.
|
|
* In order to use this system you have to define a deriative from /datum/recipe
|
|
* * reagents are reagents. Acid, milc, booze, etc.
|
|
* * items are objects. Fruits, tools, circuit boards.
|
|
* * result is type to create as new object
|
|
* * time is optional parameter, you shall use in in your machine,
|
|
default /datum/recipe/ procs does not rely on this parameter.
|
|
*
|
|
* Functions you need:
|
|
* /datum/recipe/proc/make(var/obj/container as obj)
|
|
* Creates result inside container,
|
|
* deletes prerequisite reagents,
|
|
* transfers reagents from prerequisite objects,
|
|
* deletes all prerequisite objects (even not needed for recipe at the moment).
|
|
*
|
|
* /proc/select_recipe(list/datum/recipe/avaiable_recipes, obj/obj as obj, exact = 1)
|
|
* Wonderful function that select suitable recipe for you.
|
|
* obj is a machine (or magik hat) with prerequisites,
|
|
* exact = 0 forces algorithm to ignore superfluous stuff.
|
|
*
|
|
*
|
|
* 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
|
|
*
|
|
* */
|
|
|
|
/datum/recipe
|
|
var/list/reagents // example: = list("berryjuice" = 5) // do not list same reagent twice
|
|
var/list/items // example: = list(/obj/item/weapon/crowbar, /obj/item/weapon/welder) // place /foo/bar before /foo
|
|
var/list/fruit // example: = list("fruit" = 3)
|
|
var/result // example: = /obj/item/weapon/reagent_containers/food/snacks/donut/normal
|
|
var/time = 100 // 1/10 part of second
|
|
var/byproduct // example: = /obj/item/weapon/kitchen/mould // byproduct to return, such as a mould or trash
|
|
|
|
|
|
/datum/recipe/proc/check_reagents(var/datum/reagents/avail_reagents) //1=precisely, 0=insufficiently, -1=superfluous
|
|
. = 1
|
|
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
|
|
else
|
|
return 0
|
|
if ((reagents?(reagents.len):(0)) < avail_reagents.reagent_list.len)
|
|
return -1
|
|
return .
|
|
|
|
/datum/recipe/proc/check_fruit(var/obj/container)
|
|
. = 1
|
|
if(fruit && fruit.len)
|
|
var/list/checklist = list()
|
|
// You should trust Copy().
|
|
checklist = fruit.Copy()
|
|
for(var/obj/item/weapon/reagent_containers/food/snacks/grown/G in container)
|
|
if(!G.seed || !G.seed.kitchen_tag || isnull(checklist[G.seed.kitchen_tag]))
|
|
continue
|
|
checklist[G.seed.kitchen_tag]--
|
|
for(var/ktag in checklist)
|
|
if(!isnull(checklist[ktag]))
|
|
if(checklist[ktag] < 0)
|
|
. = 0
|
|
else if(checklist[ktag] > 0)
|
|
. = -1
|
|
break
|
|
return .
|
|
|
|
/datum/recipe/proc/check_items(var/obj/container as obj)
|
|
. = 1
|
|
if (items && items.len)
|
|
var/list/checklist = list()
|
|
checklist = items.Copy() // You should really trust Copy
|
|
for(var/obj/O in container)
|
|
if(istype(O,/obj/item/weapon/reagent_containers/food/snacks/grown))
|
|
continue // Fruit is handled in check_fruit().
|
|
var/found = 0
|
|
for(var/i = 1; i < checklist.len+1; i++)
|
|
var/item_type = checklist[i]
|
|
if (istype(O,item_type))
|
|
checklist.Cut(i, i+1)
|
|
found = 1
|
|
break
|
|
if (!found)
|
|
. = 0
|
|
if (checklist.len)
|
|
. = -1
|
|
return .
|
|
|
|
//general version
|
|
/datum/recipe/proc/make(var/obj/container as obj)
|
|
var/obj/result_obj = new result(container)
|
|
for (var/obj/O in (container.contents-result_obj))
|
|
O.reagents.trans_to(result_obj, O.reagents.total_volume)
|
|
qdel(O)
|
|
container.reagents.clear_reagents()
|
|
return result_obj
|
|
|
|
// food-related
|
|
/datum/recipe/proc/make_food(var/obj/container as obj)
|
|
var/obj/result_obj = new result(container)
|
|
for (var/obj/O in (container.contents-result_obj))
|
|
if (O.reagents)
|
|
O.reagents.del_reagent("nutriment")
|
|
O.reagents.update_total()
|
|
O.reagents.trans_to(result_obj, O.reagents.total_volume)
|
|
qdel(O)
|
|
container.reagents.clear_reagents()
|
|
return result_obj
|
|
|
|
/proc/select_recipe(var/list/datum/recipe/avaiable_recipes, var/obj/obj as obj, var/exact = 1 as num)
|
|
if (!exact)
|
|
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
|
|
if (possible_recipes.len==0)
|
|
return null
|
|
else if (possible_recipes.len==1)
|
|
return possible_recipes[1]
|
|
else //okay, let's select the most complicated recipe
|
|
var/highest_count = 0
|
|
. = possible_recipes[1]
|
|
for (var/datum/recipe/recipe in possible_recipes)
|
|
var/count = ((recipe.items)?(recipe.items.len):0) + ((recipe.reagents)?(recipe.reagents.len):0) + ((recipe.fruit)?(recipe.fruit.len):0)
|
|
if (count >= highest_count)
|
|
highest_count = count
|
|
. = recipe
|
|
return .
|
|
|
|
/datum/recipe/proc/get_byproduct()
|
|
if(byproduct)
|
|
return byproduct
|
|
else
|
|
return null
|