From fd997e16153f29f28ba890673e796b0c3d82aef4 Mon Sep 17 00:00:00 2001
From: Timothy Teakettle <59849408+timothyteakettle@users.noreply.github.com>
Date: Tue, 22 Feb 2022 21:59:28 +0000
Subject: [PATCH] initial test changes
---
code/_globalvars/lists/objects.dm | 1 +
code/game/objects/items/devices/PDA/PDA.dm | 26 +++++++++++++++++++++
code/game/objects/items/devices/PDA/cart.dm | 7 ++++++
code/modules/reagents/chemistry/holder.dm | 6 +++++
4 files changed, 40 insertions(+)
diff --git a/code/_globalvars/lists/objects.dm b/code/_globalvars/lists/objects.dm
index 14969e6c92..d29bdfae23 100644
--- a/code/_globalvars/lists/objects.dm
+++ b/code/_globalvars/lists/objects.dm
@@ -16,6 +16,7 @@ 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
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.
diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm
index 2339e88a76..9a873fb561 100644
--- a/code/game/objects/items/devices/PDA/PDA.dm
+++ b/code/game/objects/items/devices/PDA/PDA.dm
@@ -369,6 +369,8 @@ GLOBAL_LIST_EMPTY(PDAs)
dat += "
[PDAIMG(rdoor)]Toggle Remote Door"
if (cartridge.access & CART_DRONEPHONE)
dat += "[PDAIMG(dronephone)]Drone Phone"
+ if (cartridge.access & CART_BARTENDER)
+ dat += "[PDAIMG(bucket)]Drink Recipe Browser"
dat += "[PDAIMG(atmos)]Atmospheric Scan"
dat += "[PDAIMG(flashlight)][fon ? "Disable" : "Enable"] Flashlight"
if (pai)
@@ -705,6 +707,30 @@ GLOBAL_LIST_EMPTY(PDAs)
if(T)
pai.forceMove(T)
+//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
+ for(var/reagent_name in GLOB.drink_reactions_list)
+ message_admins(reagent_name)
+ if(findtext(reagent_name, option))
+ found_reagent_name = reagent_name
+ reagents_required = GLOB.drink_reactions_list[reagent_name].required_reagents
+ break
+ if(length(reagents_required))
+ to_chat(U, "Reagent found: [found_reagent_name]
Required Reagents:
")
+ var/reagents_required_string = ""
+ for(var/datum/reagent/r in reagents_required)
+ reagents_required_string += "[initial(r.name)]: [reagents_required[r]]
"
+ to_chat(U, reagents_required_string)
+ return
+ else
+ to_chat(U, "Reagent with term: [option] could not be located!")
+
//LINK FUNCTIONS===================================
else//Cartridge menu linking
diff --git a/code/game/objects/items/devices/PDA/cart.dm b/code/game/objects/items/devices/PDA/cart.dm
index 4ca0b86bc0..9d02207375 100644
--- a/code/game/objects/items/devices/PDA/cart.dm
+++ b/code/game/objects/items/devices/PDA/cart.dm
@@ -13,6 +13,7 @@
#define CART_QUARTERMASTER (1<<12)
#define CART_HYDROPONICS (1<<13)
#define CART_DRONEPHONE (1<<14)
+#define CART_BARTENDER (1<<15)
/obj/item/cartridge
@@ -190,6 +191,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)
diff --git a/code/modules/reagents/chemistry/holder.dm b/code/modules/reagents/chemistry/holder.dm
index 2899f0ca11..6de8efd1db 100644
--- a/code/modules/reagents/chemistry/holder.dm
+++ b/code/modules/reagents/chemistry/holder.dm
@@ -32,6 +32,12 @@
var/datum/chemical_reaction/D = new path()
var/list/reaction_ids = list()
+ // store drinks separately for bartender cartridge
+ if(D.id)
+ if(istype(D.id, /datum/reagent/consumable))
+ var/datum/reagent/consumable/r = D.id
+ GLOB.drink_reactions_list[lowertext(initial(r.name))] = D
+
if(D.required_reagents && D.required_reagents.len)
for(var/reaction in D.required_reagents)
reaction_ids += reaction