Merge pull request #15526 from timothyteakettle/bartender-pda
adds bartender cartridge for drink recipe searching, updates chemist cartridge to have equivalent functionality for all recipes
This commit is contained in:
@@ -16,6 +16,8 @@ GLOBAL_LIST_EMPTY(singularities) //list of all singularities on the stati
|
||||
GLOBAL_LIST_EMPTY(grounding_rods) //list of all grounding rods on the station
|
||||
|
||||
GLOBAL_LIST(chemical_reactions_list) //list of all /datum/chemical_reaction datums. Used during chemical reactions
|
||||
GLOBAL_LIST(drink_reactions_list) //list of all /datum/chemical_reaction datums where the output is of type /datum/reagent/consumable for bartender PDA
|
||||
GLOBAL_LIST(normalized_chemical_reactions_list) //list of all /datum/chemical_reaction datums with actual sane indexing for chemistry PDA
|
||||
GLOBAL_LIST(chemical_reagents_list) //list of all /datum/reagent datums indexed by reagent id. Used by chemistry stuff
|
||||
GLOBAL_LIST_EMPTY(tech_list) //list of all /datum/tech datums indexed by id.
|
||||
GLOBAL_LIST_EMPTY(surgeries_list) //list of all surgeries by name, associated with their path.
|
||||
|
||||
@@ -369,6 +369,10 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
dat += "<li><a href='byond://?src=[REF(src)];choice=Toggle Door'>[PDAIMG(rdoor)]Toggle Remote Door</a></li>"
|
||||
if (cartridge.access & CART_DRONEPHONE)
|
||||
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)
|
||||
@@ -705,6 +709,16 @@ GLOBAL_LIST_EMPTY(PDAs)
|
||||
if(T)
|
||||
pai.forceMove(T)
|
||||
|
||||
//DRINK RECIPE BROWSER=============================
|
||||
if("Drink Recipe Browser")
|
||||
if(cartridge && cartridge.access & CART_BARTENDER)
|
||||
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===================================
|
||||
|
||||
else//Cartridge menu linking
|
||||
|
||||
@@ -222,6 +222,7 @@
|
||||
/obj/item/pda/bar
|
||||
name = "bartender PDA"
|
||||
icon_state = "pda-bartender"
|
||||
default_cartridge = /obj/item/cartridge/bartender
|
||||
inserted_item = /obj/item/pen/fountain
|
||||
|
||||
/obj/item/pda/atmos
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
#define CART_QUARTERMASTER (1<<12)
|
||||
#define CART_HYDROPONICS (1<<13)
|
||||
#define CART_DRONEPHONE (1<<14)
|
||||
#define CART_BARTENDER (1<<15)
|
||||
#define CART_CHEMISTRY (1<<16)
|
||||
|
||||
|
||||
/obj/item/cartridge
|
||||
@@ -77,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
|
||||
@@ -190,6 +192,12 @@
|
||||
bot_access_flags = SEC_BOT | MULE_BOT | FLOOR_BOT | CLEAN_BOT | MED_BOT | FIRE_BOT
|
||||
spam_enabled = 1
|
||||
|
||||
/obj/item/cartridge/bartender
|
||||
name = "\improper B.O.O.Z.E cartridge"
|
||||
desc = "Now with 12% alcohol!"
|
||||
icon_state = "cart-bar"
|
||||
access = CART_BARTENDER
|
||||
|
||||
/obj/item/cartridge/captain/New()
|
||||
..()
|
||||
radio = new(src)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
GLOB.chemical_reagents_list[path] = D
|
||||
|
||||
/proc/build_chemical_reactions_list()
|
||||
message_admins("STARTY START START!")
|
||||
//Chemical Reactions - Initialises all /datum/chemical_reaction into a list
|
||||
// It is filtered into multiple lists within a list.
|
||||
// For example:
|
||||
@@ -26,11 +27,20 @@
|
||||
//Randomized need to go last since they need to check against conflicts with normal recipes
|
||||
var/paths = subtypesof(/datum/chemical_reaction) - typesof(/datum/chemical_reaction/randomized) + subtypesof(/datum/chemical_reaction/randomized)
|
||||
GLOB.chemical_reactions_list = list()
|
||||
GLOB.normalized_chemical_reactions_list = list() // chemistry pda
|
||||
GLOB.drink_reactions_list = list() // bartender pda
|
||||
|
||||
for(var/path in paths)
|
||||
|
||||
var/datum/chemical_reaction/D = new path()
|
||||
var/list/reaction_ids = list()
|
||||
// store recipes separately for bartender/chemistry cartridges
|
||||
if(D.id && !D.is_secret) // don't show things like secretcatchem or secret sauce
|
||||
var/datum/reagent/r = D.id
|
||||
if(ispath(D.id, /datum/reagent/consumable))
|
||||
GLOB.drink_reactions_list[initial(r.name)] = D
|
||||
if(ispath(D.id, /datum/reagent))
|
||||
GLOB.normalized_chemical_reactions_list[initial(r.name)] = D
|
||||
|
||||
if(D.required_reagents && D.required_reagents.len)
|
||||
for(var/reaction in D.required_reagents)
|
||||
@@ -43,6 +53,31 @@
|
||||
GLOB.chemical_reactions_list[id] += D
|
||||
break // Don't bother adding ourselves to other reagent ids, it is redundant
|
||||
|
||||
/proc/recipe_search(mob/M, list/reaction_list)
|
||||
var/option = input(M, "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 reaction_list)
|
||||
if(findtext(lowertext(reagent_name), option))
|
||||
var/datum/chemical_reaction/reaction = reaction_list[reagent_name]
|
||||
found_reagent_name = reagent_name
|
||||
reagents_required = reaction.required_reagents
|
||||
required_temp = reaction.required_temp
|
||||
break
|
||||
if(length(reagents_required))
|
||||
to_chat(M, "<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(M, reagents_required_string)
|
||||
return
|
||||
else
|
||||
to_chat(M, "<span class='warning'>Reagent with term: [option] could not be located!</span>")
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/datum/reagents
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
var/clear_conversion //bitflags for clear conversions; REACTION_CLEAR_IMPURE or REACTION_CLEAR_INVERSE
|
||||
var/PurityMin = 0.15 //If purity is below 0.15, it explodes too. Set to 0 to disable this.
|
||||
|
||||
var/is_secret = FALSE // If it should show in recipe searchers such as the bartender/chemistry PDA functions
|
||||
|
||||
|
||||
/datum/chemical_reaction/proc/on_reaction(datum/reagents/holder, multiplier, specialreact)
|
||||
set waitfor = FALSE
|
||||
|
||||
@@ -54,6 +54,8 @@ GLOBAL_LIST_INIT(food_reagents, build_reagents_to_food()) //reagentid = related
|
||||
var/max_result_reagents = 1
|
||||
var/list/possible_results = list()
|
||||
|
||||
is_secret = TRUE
|
||||
|
||||
/datum/chemical_reaction/randomized/proc/GenerateRecipe()
|
||||
created = world.time
|
||||
if(randomize_container)
|
||||
|
||||
Reference in New Issue
Block a user