Skip to content

Commit

Permalink
Fixes datum icecreams, improves admin reagent interface (tgstation#44242
Browse files Browse the repository at this point in the history
)

* fix + improve

* Update datumvars.dm

* fix sleepers

* Update datumvars.dm
  • Loading branch information
vuonojenmustaturska authored and AnturK committed Jun 1, 2019
1 parent bb19793 commit a21e686
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
24 changes: 14 additions & 10 deletions code/datums/datumvars.dm
Original file line number Diff line number Diff line change
Expand Up @@ -935,21 +935,25 @@

if(A.reagents)
var/chosen_id
var/list/reagent_options = sortList(GLOB.chemical_reagents_list)
switch(alert(usr, "Choose a method.", "Add Reagents", "Enter ID", "Choose ID"))
if("Enter ID")
switch(alert(usr, "Choose a method.", "Add Reagents", "Search", "Choose from a list", "I'm feeling lucky"))
if("Search")
var/valid_id
while(!valid_id)
chosen_id = stripped_input(usr, "Enter the ID of the reagent you want to add.")
if(!chosen_id) //Get me out of here!
chosen_id = input(usr, "Enter the ID of the reagent you want to add.", "Search reagents") as null|text
if(isnull(chosen_id)) //Get me out of here!
break
for(var/ID in reagent_options)
if(ID == chosen_id)
valid_id = 1
if (!ispath(text2path(chosen_id)))
chosen_id = pick_closest_path(chosen_id, make_types_fancy(subtypesof(/datum/reagent)))
if (ispath(chosen_id))
valid_id = TRUE
else
valid_id = TRUE
if(!valid_id)
to_chat(usr, "<span class='warning'>A reagent with that ID doesn't exist!</span>")
if("Choose ID")
chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") as null|anything in reagent_options
if("Choose from a list")
chosen_id = input(usr, "Choose a reagent to add.", "Choose a reagent.") as null|anything in subtypesof(/datum/reagent)
if("I'm feeling lucky")
chosen_id = pick(subtypesof(/datum/reagent))
if(chosen_id)
var/amount = input(usr, "Choose the amount to add.", "Choose the amount.", A.reagents.maximum_volume) as num
if(amount)
Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/Sleeper.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
data["chems"] = list()
for(var/chem in available_chems)
var/datum/reagent/R = GLOB.chemical_reagents_list[chem]
data["chems"] += list(list("name" = R.name, "id" = ckey(R.name), "allowed" = chem_allowed(chem)))
data["chems"] += list(list("name" = R.name, "id" = R.type, "allowed" = chem_allowed(chem)))

data["occupant"] = list()
var/mob/living/mob_occupant = occupant
Expand Down Expand Up @@ -215,8 +215,8 @@
open_machine()
. = TRUE
if("inject")
var/chem = params["chem"]
if(!is_operational() || !mob_occupant)
var/chem = text2path(params["chem"])
if(!is_operational() || !mob_occupant || isnull(chem))
return
if(mob_occupant.health < min_health && chem != /datum/reagent/medicine/epinephrine)
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
max_integrity = 300
var/list/product_types = list()
var/dispense_flavour = ICECREAM_VANILLA
var/flavour_name = /datum/reagent/consumable/vanilla
var/flavour_name = "vanilla"
var/static/list/icecream_vat_reagents = list(
/datum/reagent/consumable/milk = 5,
/datum/reagent/consumable/flour = 5,
Expand Down Expand Up @@ -57,7 +57,7 @@
if(CONE_CHOC)
return "chocolate"
else //ICECREAM_VANILLA
return /datum/reagent/consumable/vanilla
return "vanilla"


/obj/machinery/icecream_vat/Initialize()
Expand Down Expand Up @@ -197,7 +197,7 @@
name = "[flavour_name] icecream"
src.add_overlay("icecream_[flavour_name]")
switch (flavour_name) // adding the actual reagents advertised in the ingredient list
if (/datum/reagent/consumable/vanilla)
if ("vanilla")
desc = "A delicious [cone_type] cone filled with vanilla ice cream. All the other ice creams take content from it."
if ("chocolate")
desc = "A delicious [cone_type] cone filled with chocolate ice cream. Surprisingly, made with real cocoa."
Expand Down

0 comments on commit a21e686

Please sign in to comment.