Merge pull request #9960 from Ghommie/Ghommie-cit398

Ports custom reagent icecreams.
This commit is contained in:
kevinz000
2019-11-28 23:11:57 -07:00
committed by GitHub
2 changed files with 116 additions and 35 deletions

View File

@@ -4,8 +4,9 @@
#define ICECREAM_PEACH 4 #define ICECREAM_PEACH 4
#define ICECREAM_GRAPE 5 #define ICECREAM_GRAPE 5
#define ICECREAM_BLUE 6 #define ICECREAM_BLUE 6
#define CONE_WAFFLE 7 #define ICECREAM_CUSTOM 7
#define CONE_CHOC 8 #define CONE_WAFFLE 8
#define CONE_CHOC 9
@@ -22,17 +23,18 @@
var/list/product_types = list() var/list/product_types = list()
var/dispense_flavour = ICECREAM_VANILLA var/dispense_flavour = ICECREAM_VANILLA
var/flavour_name = "vanilla" var/flavour_name = "vanilla"
var/obj/item/reagent_containers/beaker = null
var/static/list/icecream_vat_reagents = list( var/static/list/icecream_vat_reagents = list(
"milk" = 5, "milk" = 6,
"flour" = 5, "flour" = 6,
"sugar" = 5, "sugar" = 6,
"ice" = 5, "ice" = 6,
"cocoa" = 5, "cocoa" = 6,
"vanilla" = 5, "vanilla" = 6,
"berryjuice" = 5, "berryjuice" = 6,
"singulo" = 5, "singulo" = 6,
"peachjuice" = 5, "peachjuice" = 6,
"grapejuice" = 5) "grapejuice" = 6)
/obj/machinery/icecream_vat/proc/get_ingredient_list(type) /obj/machinery/icecream_vat/proc/get_ingredient_list(type)
switch(type) switch(type)
@@ -40,6 +42,8 @@
return list("milk", "ice", "cocoa") return list("milk", "ice", "cocoa")
if(ICECREAM_STRAWBERRY) if(ICECREAM_STRAWBERRY)
return list("milk", "ice", "berryjuice") return list("milk", "ice", "berryjuice")
if(ICECREAM_CUSTOM)
return list("milk", "ice")
if(ICECREAM_PEACH) if(ICECREAM_PEACH)
return list("milk", "ice", "peachjuice") return list("milk", "ice", "peachjuice")
if(ICECREAM_GRAPE) if(ICECREAM_GRAPE)
@@ -66,6 +70,8 @@
return "grape" return "grape"
if(ICECREAM_BLUE) if(ICECREAM_BLUE)
return "blue" return "blue"
if(ICECREAM_CUSTOM)
return "custom"
if(CONE_WAFFLE) if(CONE_WAFFLE)
return "waffle" return "waffle"
if(CONE_CHOC) if(CONE_CHOC)
@@ -76,7 +82,7 @@
/obj/machinery/icecream_vat/Initialize() /obj/machinery/icecream_vat/Initialize()
. = ..() . = ..()
while(product_types.len < 8) while(product_types.len < 9)
product_types.Add(5) product_types.Add(5)
create_reagents(100, OPENCONTAINER | NO_REACT) create_reagents(100, OPENCONTAINER | NO_REACT)
for(var/reagent in icecream_vat_reagents) for(var/reagent in icecream_vat_reagents)
@@ -87,16 +93,23 @@
var/dat var/dat
dat += "<b>ICE CREAM</b><br><div class='statusDisplay'>" dat += "<b>ICE CREAM</b><br><div class='statusDisplay'>"
dat += "<b>Dispensing: [flavour_name] icecream </b> <br><br>" dat += "<b>Dispensing: [flavour_name] icecream </b> <br><br>"
dat += "<b>Vanilla ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_VANILLA]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_VANILLA];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_VANILLA];amount=5'><b>x5</b></a> [product_types[ICECREAM_VANILLA]] scoops left. (Ingredients: milk, ice)<br>" dat += "<b>Vanilla ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_VANILLA]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_VANILLA];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_VANILLA];amount=5'><b>x5</b></a> [product_types[ICECREAM_VANILLA]] scoops left. (Ingredients: milk, ice, vanilla)<br>"
dat += "<b>Strawberry ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_STRAWBERRY]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_STRAWBERRY];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_STRAWBERRY];amount=5'><b>x5</b></a> [product_types[ICECREAM_STRAWBERRY]] dollops left. (Ingredients: milk, ice, berry juice)<br>" dat += "<b>Strawberry ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_STRAWBERRY]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_STRAWBERRY];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_STRAWBERRY];amount=5'><b>x5</b></a> [product_types[ICECREAM_STRAWBERRY]] dollops left. (Ingredients: milk, ice, berry juice)<br>"
dat += "<b>Chocolate ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_CHOCOLATE]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_CHOCOLATE];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_CHOCOLATE];amount=5'><b>x5</b></a> [product_types[ICECREAM_CHOCOLATE]] dollops left. (Ingredients: milk, ice, coco powder)<br>" dat += "<b>Chocolate ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_CHOCOLATE]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_CHOCOLATE];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_CHOCOLATE];amount=5'><b>x5</b></a> [product_types[ICECREAM_CHOCOLATE]] dollops left. (Ingredients: milk, ice, coco powder)<br>"
dat += "<b>Peach ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_PEACH]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_PEACH];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_PEACH];amount=5'><b>x5</b></a> [product_types[ICECREAM_PEACH]] dollops left. (Ingredients: milk, ice, peach juice)<br>" dat += "<b>Peach ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_PEACH]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_PEACH];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_PEACH];amount=5'><b>x5</b></a> [product_types[ICECREAM_PEACH]] dollops left. (Ingredients: milk, ice, peach juice)<br>"
dat += "<b>Grape ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_GRAPE]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_GRAPE];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_GRAPE];amount=5'><b>x5</b></a> [product_types[ICECREAM_GRAPE]] dollops left. (Ingredients: milk, ice, grape juice)<br>" dat += "<b>Grape ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_GRAPE]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_GRAPE];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_GRAPE];amount=5'><b>x5</b></a> [product_types[ICECREAM_GRAPE]] dollops left. (Ingredients: milk, ice, grape juice)<br>"
dat += "<b>Blue ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_BLUE]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_BLUE];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_BLUE];amount=5'><b>x5</b></a> [product_types[ICECREAM_BLUE]] dollops left. (Ingredients: milk, ice, singulo)<br></div>" dat += "<b>Blue ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_BLUE]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_BLUE];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_BLUE];amount=5'><b>x5</b></a> [product_types[ICECREAM_BLUE]] dollops left. (Ingredients: milk, ice, singulo)<br>"
dat += "<b>Custom ice cream:</b> <a href='?src=[REF(src)];select=[ICECREAM_CUSTOM]'><b>Select</b></a> <a href='?src=[REF(src)];make=[ICECREAM_CUSTOM];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[ICECREAM_CUSTOM];amount=5'><b>x5</b></a> [product_types[ICECREAM_CUSTOM]] dollops left. (Ingredients: milk, ice, optional flavoring)<br></div>"
dat += "<br><b>CONES</b><br><div class='statusDisplay'>" dat += "<br><b>CONES</b><br><div class='statusDisplay'>"
dat += "<b>Waffle cones:</b> <a href='?src=[REF(src)];cone=[CONE_WAFFLE]'><b>Dispense</b></a> <a href='?src=[REF(src)];make=[CONE_WAFFLE];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[CONE_WAFFLE];amount=5'><b>x5</b></a> [product_types[CONE_WAFFLE]] cones left. (Ingredients: flour, sugar)<br>" dat += "<b>Waffle cones:</b> <a href='?src=[REF(src)];cone=[CONE_WAFFLE]'><b>Dispense</b></a> <a href='?src=[REF(src)];make=[CONE_WAFFLE];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[CONE_WAFFLE];amount=5'><b>x5</b></a> [product_types[CONE_WAFFLE]] cones left. (Ingredients: flour, sugar)<br>"
dat += "<b>Chocolate cones:</b> <a href='?src=[REF(src)];cone=[CONE_CHOC]'><b>Dispense</b></a> <a href='?src=[REF(src)];make=[CONE_CHOC];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[CONE_CHOC];amount=5'><b>x5</b></a> [product_types[CONE_CHOC]] cones left. (Ingredients: flour, sugar, coco powder)<br></div>" dat += "<b>Chocolate cones:</b> <a href='?src=[REF(src)];cone=[CONE_CHOC]'><b>Dispense</b></a> <a href='?src=[REF(src)];make=[CONE_CHOC];amount=1'><b>Make</b></a> <a href='?src=[REF(src)];make=[CONE_CHOC];amount=5'><b>x5</b></a> [product_types[CONE_CHOC]] cones left. (Ingredients: flour, sugar, coco powder)<br></div>"
dat += "<br>" dat += "<br>"
if(beaker)
dat += "<b>BEAKER CONTENT</b><br><div class='statusDisplay'>"
for(var/datum/reagent/R in beaker.reagents.reagent_list)
dat += "[R.name]: [R.volume]u<br>"
dat += "<a href='?src=[REF(src)];refill=1'><b>Refill from beaker</b></a></div>"
dat += "<br>"
dat += "<b>VAT CONTENT</b><br>" dat += "<b>VAT CONTENT</b><br>"
for(var/datum/reagent/R in reagents.reagent_list) for(var/datum/reagent/R in reagents.reagent_list)
dat += "[R.name]: [R.volume]" dat += "[R.name]: [R.volume]"
@@ -114,36 +127,60 @@
if(product_types[dispense_flavour] > 0) if(product_types[dispense_flavour] > 0)
visible_message("[icon2html(src, viewers(src))] <span class='info'>[user] scoops delicious [flavour_name] ice cream into [I].</span>") visible_message("[icon2html(src, viewers(src))] <span class='info'>[user] scoops delicious [flavour_name] ice cream into [I].</span>")
product_types[dispense_flavour] -= 1 product_types[dispense_flavour] -= 1
if(beaker && beaker.reagents.total_volume)
I.add_ice_cream(flavour_name, beaker.reagents)
else
I.add_ice_cream(flavour_name)
I.add_ice_cream(flavour_name) I.add_ice_cream(flavour_name)
// if(beaker)
// beaker.reagents.trans_to(I, 10)
if(I.reagents.total_volume < 10) if(I.reagents.total_volume < 10)
I.reagents.add_reagent("sugar", 10 - I.reagents.total_volume) I.reagents.add_reagent("sugar", 10 - I.reagents.total_volume)
updateDialog()
else else
to_chat(user, "<span class='warning'>There is not enough ice cream left!</span>") to_chat(user, "<span class='warning'>There is not enough ice cream left!</span>")
else else
to_chat(user, "<span class='notice'>[O] already has ice cream in it.</span>") to_chat(user, "<span class='notice'>[O] already has ice cream in it.</span>")
return 1 return 1
if(istype(O, /obj/item/reagent_containers) && !(O.item_flags & ABSTRACT) && O.is_open_container())
. = TRUE //no afterattack
var/obj/item/reagent_containers/B = O
if(!user.transferItemToLoc(B, src))
return
replace_beaker(user, B)
to_chat(user, "<span class='notice'>You add [B] to [src].</span>")
updateUsrDialog()
update_icon()
return
else if(O.is_drainable()) else if(O.is_drainable())
return return
else else
return ..() return ..()
/obj/machinery/icecream_vat/proc/RefillFromBeaker()
if(!beaker || !beaker.reagents)
return
for(var/datum/reagent/R in beaker.reagents.reagent_list)
if(R.type in icecream_vat_reagents)
beaker.reagents.trans_id_to(src, R.type, R.volume)
say("Internalizing reagent.")
playsound(src, 'sound/items/drink.ogg', 25, 1)
return
/obj/machinery/icecream_vat/proc/make(mob/user, make_type, amount) /obj/machinery/icecream_vat/proc/make(mob/user, make_type, amount)
var/recipe_amount = amount * 3 //prevents reagent duping by requring roughly the amount of reagenst you gain back by grinding.
for(var/R in get_ingredient_list(make_type)) for(var/R in get_ingredient_list(make_type))
if(reagents.has_reagent(R, amount)) if(reagents.has_reagent(R, recipe_amount))
continue continue
amount = 0 amount = 0
break break
if(amount) if(amount)
for(var/R in get_ingredient_list(make_type)) for(var/R in get_ingredient_list(make_type))
reagents.remove_reagent(R, amount) reagents.remove_reagent(R, recipe_amount)
product_types[make_type] += amount product_types[make_type] += amount
var/flavour = get_flavour_name(make_type) var/flavour = get_flavour_name(make_type)
if(make_type > 4) if(make_type > 7)
src.visible_message("<span class='info'>[user] cooks up some [flavour] cones.</span>") visible_message("<span class='info'>[user] cooks up some [flavour] cones.</span>")
else else
src.visible_message("<span class='info'>[user] whips up some [flavour] icecream.</span>") visible_message("<span class='info'>[user] whips up some [flavour] icecream.</span>")
else else
to_chat(user, "<span class='warning'>You don't have the ingredients to make this!</span>") to_chat(user, "<span class='warning'>You don't have the ingredients to make this!</span>")
@@ -172,7 +209,10 @@
make(usr, C, amount) make(usr, C, amount)
if(href_list["disposeI"]) if(href_list["disposeI"])
reagents.del_reagent(href_list["disposeI"]) reagents.del_reagent(text2path(href_list["disposeI"]))
if(href_list["refill"])
RefillFromBeaker()
updateDialog() updateDialog()
@@ -189,15 +229,16 @@
desc = "Delicious waffle cone, but no ice cream." desc = "Delicious waffle cone, but no ice cream."
icon = 'icons/obj/kitchen.dmi' icon = 'icons/obj/kitchen.dmi'
icon_state = "icecream_cone_waffle" //default for admin-spawned cones, href_list["cone"] should overwrite this all the time icon_state = "icecream_cone_waffle" //default for admin-spawned cones, href_list["cone"] should overwrite this all the time
list_reagents = list(/datum/reagent/consumable/nutriment = 4)
tastes = list("cream" = 2, "waffle" = 1)
var/ice_creamed = 0 var/ice_creamed = 0
var/cone_type var/cone_type
bitesize = 3 bitesize = 4
foodtype = DAIRY foodtype = DAIRY | SUGAR
/obj/item/reagent_containers/food/snacks/icecream/Initialize() /obj/item/reagent_containers/food/snacks/icecream/Initialize()
. = ..() . = ..()
create_reagents(20) reagents.maximum_volume = 20
reagents.add_reagent("nutriment", 4)
/obj/item/reagent_containers/food/snacks/icecream/proc/set_cone_type(var/cone_name) /obj/item/reagent_containers/food/snacks/icecream/proc/set_cone_type(var/cone_name)
cone_type = cone_name cone_type = cone_name
@@ -211,30 +252,53 @@
desc = "Delicious [cone_name] cone, but no ice cream." desc = "Delicious [cone_name] cone, but no ice cream."
/obj/item/reagent_containers/food/snacks/icecream/proc/add_ice_cream(var/flavour_name) /obj/item/reagent_containers/food/snacks/icecream/proc/add_ice_cream(flavour_name, datum/reagents/R = null)
name = "[flavour_name] icecream" name = "[flavour_name] icecream"
src.add_overlay("icecream_[flavour_name]")
switch (flavour_name) // adding the actual reagents advertised in the ingredient list switch (flavour_name) // adding the actual reagents advertised in the ingredient list
if ("vanilla") if ("vanilla")
desc = "A delicious [cone_type] cone filled with vanilla ice cream. All the other ice creams take content from it." desc = "A delicious [cone_type] cone filled with vanilla ice cream. All the other ice creams take content from it."
reagents.add_reagent("vanilla", 3)
filling_color = "#ECE1C1"
if ("chocolate") if ("chocolate")
desc = "A delicious [cone_type] cone filled with chocolate ice cream. Surprisingly, made with real cocoa." desc = "A delicious [cone_type] cone filled with chocolate ice cream. Surprisingly, made with real cocoa."
reagents.add_reagent("cocoa", 2) reagents.add_reagent("cocoa", 3)
filling_color = "#93673B"
if ("strawberry") if ("strawberry")
desc = "A delicious [cone_type] cone filled with strawberry ice cream. Definitely not made with real strawberries." desc = "A delicious [cone_type] cone filled with strawberry ice cream. Definitely not made with real strawberries."
reagents.add_reagent("berryjuice", 2) reagents.add_reagent("berryjuice", 3)
filling_color = "#EFB4B4"
if ("peach") if ("peach")
desc = "A delicious [cone_type] cone filled with peach ice cream. Definitely made with real peaches!" desc = "A delicious [cone_type] cone filled with peach ice cream. Definitely made with real peaches!"
reagents.add_reagent("peachjuice", 2) reagents.add_reagent("peachjuice", 3)
filling_color = "#E78108"
if ("grape") if ("grape")
desc = "A delicious [cone_type] cone filled with grape ice cream. Surprisingly, made with real pink grape, likely not real sugarcanes used." desc = "A delicious [cone_type] cone filled with grape ice cream. Surprisingly, made with real pink grape, likely not real sugarcanes used."
reagents.add_reagent("grapejuice", 2) reagents.add_reagent("grapejuice", 3)
filling_color = "#FF1493"
if ("blue") if ("blue")
desc = "A delicious [cone_type] cone filled with blue ice cream. Made with real... blue?" desc = "A delicious [cone_type] cone filled with blue ice cream. Made with real... blue?"
reagents.add_reagent("singulo", 2) reagents.add_reagent("singulo", 3)
filling_color = "#ACBCED"
if ("mob") if ("mob")
desc = "A suspicious [cone_type] cone filled with bright red ice cream. That's probably not strawberry..." desc = "A suspicious [cone_type] cone filled with bright red ice cream. That's probably not strawberry..."
reagents.add_reagent("liquidgibs", 2) reagents.add_reagent("liquidgibs", 3)
filling_color = "#EFB4B4"
if ("custom")
if(R && R.total_volume >= 4) //consumable reagents have stronger taste so higher volume will allow non-food flavourings to break through better.
var/mutable_appearance/flavoring = mutable_appearance(icon,"icecream_custom")
var/datum/reagent/master = R.get_master_reagent()
flavoring.color = master.color
filling_color = master.color
name = "[master.name] icecream"
desc = "A delicious [cone_type] cone filled with artisanal icecream. Made with real [master.name]. Ain't that something."
R.trans_to(src, 4)
add_overlay(flavoring)
else
name = "bland icecream"
desc = "A delicious [cone_type] cone filled with anemic, flavorless icecream.You wonder why this was ever scooped.."
add_overlay("icecream_custom")
if(flavour_name != "custom")
src.add_overlay("icecream_[flavour_name]")
ice_creamed = 1 ice_creamed = 1
/obj/item/reagent_containers/food/snacks/icecream/proc/add_mob_flavor(var/mob/M) /obj/item/reagent_containers/food/snacks/icecream/proc/add_mob_flavor(var/mob/M)
@@ -246,6 +310,22 @@
new /obj/item/stack/sheet/metal(loc, 4) new /obj/item/stack/sheet/metal(loc, 4)
qdel(src) qdel(src)
/obj/machinery/icecream_vat/AltClick(mob/living/user)
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE, FALSE, NO_TK))
return
replace_beaker(user)
/obj/machinery/icecream_vat/proc/replace_beaker(mob/living/user, obj/item/reagent_containers/new_beaker)
if(beaker)
beaker.forceMove(drop_location())
if(user && Adjacent(user) && !issiliconoradminghost(user))
user.put_in_hands(beaker)
if(new_beaker)
beaker = new_beaker
else
beaker = null
updateDialog()
return TRUE
#undef ICECREAM_VANILLA #undef ICECREAM_VANILLA
#undef ICECREAM_CHOCOLATE #undef ICECREAM_CHOCOLATE
@@ -253,5 +333,6 @@
#undef ICECREAM_PEACH #undef ICECREAM_PEACH
#undef ICECREAM_GRAPE #undef ICECREAM_GRAPE
#undef ICECREAM_BLUE #undef ICECREAM_BLUE
#undef ICECREAM_CUSTOM
#undef CONE_WAFFLE #undef CONE_WAFFLE
#undef CONE_CHOC #undef CONE_CHOC

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB