generalizes recipe searching, adds chemistry functionality

This commit is contained in:
Timothy Teakettle
2022-02-23 11:38:04 +00:00
parent 4adb870324
commit 56547a2556
4 changed files with 42 additions and 26 deletions
+8 -22
View File
@@ -371,6 +371,8 @@ GLOBAL_LIST_EMPTY(PDAs)
dat += "<li><a href='byond://?src=[REF(src)];choice=Drone Phone'>[PDAIMG(dronephone)]Drone Phone</a></li>"
if (cartridge.access & CART_BARTENDER)
dat += "<li><a href='byond://?src=[REF(src)];choice=Drink Recipe Browser'>[PDAIMG(bucket)]Drink Recipe Browser</a></li>"
if (cartridge.access & CART_CHEMISTRY)
dat += "<li><a href='byond://?src=[REF(src)];choice=Chemistry Recipe Browser'>[PDAIMG(bucket)]Chemistry Recipe Browser</a></li>"
dat += "<li><a href='byond://?src=[REF(src)];choice=3'>[PDAIMG(atmos)]Atmospheric Scan</a></li>"
dat += "<li><a href='byond://?src=[REF(src)];choice=Light'>[PDAIMG(flashlight)][fon ? "Disable" : "Enable"] Flashlight</a></li>"
if (pai)
@@ -710,28 +712,12 @@ GLOBAL_LIST_EMPTY(PDAs)
//DRINK RECIPE BROWSER=============================
if("Drink Recipe Browser")
if(cartridge && cartridge.access & CART_BARTENDER)
var/option = input(U, "Enter keyword to return a recipe.")
if(option)
option = lowertext(option)
var/list/reagents_required
var/found_reagent_name
var/required_temp
for(var/reagent_name in GLOB.drink_reactions_list)
if(findtext(lowertext(reagent_name), option))
found_reagent_name = reagent_name
reagents_required = GLOB.drink_reactions_list[reagent_name].required_reagents
required_temp = GLOB.drink_reactions_list[reagent_name].required_temp
break
if(length(reagents_required))
to_chat(U, "<b>Recipe found: [found_reagent_name]</b>[required_temp ? "<br>Required Temperature: [required_temp]K" : ""]<br>Required Reagents:")
var/reagents_required_string = ""
for(var/r in reagents_required)
var/datum/reagent/reagent = r
reagents_required_string += "<br>[initial(reagent.name)]: [reagents_required[r]]"
to_chat(U, reagents_required_string)
return
else
to_chat(U, "<span class='warning'>Reagent with term: [option] could not be located!</span>")
recipe_search(U, GLOB.drink_reactions_list)
//CHEMISTRY RECIPE BROWSER
if("Chemistry Recipe Browser")
if(cartridge && cartridge.access & CART_CHEMISTRY)
recipe_search(U, GLOB.normalized_chemical_reactions_list)
//LINK FUNCTIONS===================================
+2 -1
View File
@@ -14,6 +14,7 @@
#define CART_HYDROPONICS (1<<13)
#define CART_DRONEPHONE (1<<14)
#define CART_BARTENDER (1<<15)
#define CART_CHEMISTRY (1<<16)
/obj/item/cartridge
@@ -78,7 +79,7 @@
/obj/item/cartridge/chemistry
name = "\improper ChemWhiz cartridge"
icon_state = "cart-chem"
access = CART_REAGENT_SCANNER
access = CART_REAGENT_SCANNER | CART_CHEMISTRY
bot_access_flags = MED_BOT
/obj/item/cartridge/security