mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-12 15:45:25 +01:00
Merge pull request #13791 from Fox-McCloud/ice-cream-gc
Makes Ice Cream GC
This commit is contained in:
@@ -17,10 +17,10 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/icecream/update_icon()
|
||||
overlays.Cut()
|
||||
var/image/filling = image('icons/obj/kitchen.dmi', src, "icecream_color")
|
||||
filling.icon += mix_color_from_reagents(reagents.reagent_list)
|
||||
overlays += filling
|
||||
cut_overlays()
|
||||
var/mutable_appearance/filling = mutable_appearance('icons/obj/kitchen.dmi', "icecream_color")
|
||||
filling.color = mix_color_from_reagents(reagents.reagent_list)
|
||||
add_overlay(filling)
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/icecream/icecreamcone
|
||||
name = "ice cream cone"
|
||||
|
||||
@@ -43,10 +43,9 @@
|
||||
return
|
||||
if(istype(I, /obj/item/reagent_containers/food/snacks/icecream))
|
||||
if(!I.reagents.has_reagent("sprinkles"))
|
||||
if(I.reagents.total_volume > 29) I.reagents.remove_any(1)
|
||||
I.reagents.add_reagent("sprinkles",1)
|
||||
var/image/sprinkles = image('icons/obj/kitchen.dmi', src, "sprinkles")
|
||||
I.overlays += sprinkles
|
||||
if(I.reagents.total_volume > 29)
|
||||
I.reagents.remove_any(1)
|
||||
I.reagents.add_reagent("sprinkles", 1)
|
||||
I.name += " with sprinkles"
|
||||
I.desc += ". This also has sprinkles."
|
||||
else
|
||||
|
||||
@@ -1,256 +0,0 @@
|
||||
#define ICECREAM_VANILLA 1
|
||||
#define FLAVOUR_CHOCOLATE 2
|
||||
#define FLAVOUR_STRAWBERRY 3
|
||||
#define FLAVOUR_BLUE 4
|
||||
#define CONE_WAFFLE 5
|
||||
#define CONE_CHOC 6
|
||||
#define INGR_MILK 7
|
||||
#define INGR_FLOUR 8
|
||||
#define INGR_SUGAR 9
|
||||
#define INGR_ICE 10
|
||||
#define MUCK 11
|
||||
|
||||
GLOBAL_LIST_INIT(ingredients_source, list(
|
||||
"berryjuice" = FLAVOUR_STRAWBERRY,\
|
||||
"cocoa" = FLAVOUR_CHOCOLATE,\
|
||||
"singulo" = FLAVOUR_BLUE,\
|
||||
"milk" = INGR_MILK,\
|
||||
"soymilk" = INGR_MILK,\
|
||||
"ice" = INGR_ICE,\
|
||||
"flour" = INGR_FLOUR,\
|
||||
"sugar" = INGR_SUGAR,\
|
||||
))
|
||||
|
||||
/proc/get_icecream_flavour_string(var/flavour_type)
|
||||
switch(flavour_type)
|
||||
if(FLAVOUR_CHOCOLATE)
|
||||
return "chocolate"
|
||||
if(FLAVOUR_STRAWBERRY)
|
||||
return "strawberry"
|
||||
if(FLAVOUR_BLUE)
|
||||
return "blue"
|
||||
if(CONE_WAFFLE)
|
||||
return "waffle"
|
||||
if(CONE_CHOC)
|
||||
return "chocolate"
|
||||
if(INGR_MILK)
|
||||
return "milk"
|
||||
if(INGR_FLOUR)
|
||||
return "flour"
|
||||
if(INGR_SUGAR)
|
||||
return "sugar"
|
||||
if(INGR_ICE)
|
||||
return "ice"
|
||||
if(MUCK)
|
||||
return "muck"
|
||||
else
|
||||
return "vanilla"
|
||||
|
||||
/obj/machinery/icecream_vat
|
||||
name = "icecream vat"
|
||||
desc = "Ding-aling ding dong. Get your Nanotrasen-approved ice cream!"
|
||||
icon = 'icons/obj/kitchen.dmi'
|
||||
icon_state = "icecream_vat"
|
||||
density = 1
|
||||
anchored = 0
|
||||
max_integrity = 300
|
||||
var/list/ingredients = list()
|
||||
var/dispense_flavour = 1
|
||||
var/obj/item/reagent_containers/glass/held_container
|
||||
|
||||
/obj/machinery/icecream_vat/New()
|
||||
..()
|
||||
create_reagents(50)
|
||||
while(ingredients.len < 11)
|
||||
ingredients.Add(5)
|
||||
|
||||
/obj/machinery/icecream_vat/attack_hand(mob/user)
|
||||
user.set_machine(src)
|
||||
interact(user)
|
||||
|
||||
/obj/machinery/icecream_vat/interact(mob/user)
|
||||
var/dat
|
||||
dat += "<a href='?src=[UID()];dispense=[ICECREAM_VANILLA]'><b>Dispense vanilla icecream</b></a> There is [ingredients[ICECREAM_VANILLA]] scoops of vanilla icecream left (made from milk and ice).<br>"
|
||||
dat += "<a href='?src=[UID()];dispense=[FLAVOUR_STRAWBERRY]'><b>Dispense strawberry icecream</b></a> There is [ingredients[FLAVOUR_STRAWBERRY]] dollops of strawberry flavouring left (obtained from berry juice.<br>"
|
||||
dat += "<a href='?src=[UID()];dispense=[FLAVOUR_CHOCOLATE]'><b>Dispense chocolate icecream</b></a> There is [ingredients[FLAVOUR_CHOCOLATE]] dollops of chocolate flavouring left (obtained from cocoa powder).<br>"
|
||||
dat += "<a href='?src=[UID()];dispense=[FLAVOUR_BLUE]'><b>Dispense blue icecream</b></a> There is [ingredients[FLAVOUR_BLUE]] dollops of blue flavouring left (obtained from bluespace tomato singulo).<br>"
|
||||
dat += "<br>"
|
||||
dat += "<a href='?src=[UID()];cone=[CONE_WAFFLE]'><b>Dispense waffle cones</b></a> There are [ingredients[CONE_WAFFLE]] waffle cones left. <br>"
|
||||
dat += "<a href='?src=[UID()];cone=[CONE_CHOC]'><b>Dispense chocolate cones</b></a> There are [ingredients[CONE_CHOC]] chocolate cones left.<br>"
|
||||
dat += "<br>"
|
||||
dat += "<a href='?src=[UID()];make=[CONE_WAFFLE]'><b>Make waffle cones</b></a> There is [ingredients[INGR_FLOUR]]/[ingredients[INGR_SUGAR]] of flour and sugar left.<br>"
|
||||
dat += "<a href='?src=[UID()];make=[CONE_CHOC]'><b>Make chocolate cones</b></a> There is [ingredients[FLAVOUR_CHOCOLATE]]/[ingredients[CONE_WAFFLE]] of chocolate flavouring and waffle cones left.<br>"
|
||||
dat += "<a href='?src=[UID()];make=[ICECREAM_VANILLA]'><b>Make vanilla icecream</b></a> There is [ingredients[INGR_MILK]]/[ingredients[INGR_ICE]] of milk and ice left.<br>"
|
||||
dat += "<br>"
|
||||
if(held_container)
|
||||
dat += "<a href='?src=[UID()];eject=1'>Eject [held_container]</a> "
|
||||
else
|
||||
dat += "No beaker inserted. "
|
||||
dat += "<a href='?src=[UID()];refresh=1'>Refresh</a> <a href='?src=[UID()];close=1'>Close</a>"
|
||||
|
||||
var/datum/browser/popup = new(user, "icecreamvat", name, 600, 400)
|
||||
popup.set_content(dat)
|
||||
popup.open(0)
|
||||
|
||||
/obj/machinery/icecream_vat/attackby(obj/item/O, mob/user, params)
|
||||
if(istype(O, /obj/item/reagent_containers))
|
||||
if(istype(O, /obj/item/reagent_containers/food/snacks/icecream))
|
||||
var/obj/item/reagent_containers/food/snacks/icecream/I = O
|
||||
if(!I.ice_creamed)
|
||||
if(ingredients[ICECREAM_VANILLA] > 0)
|
||||
var/flavour_name = get_icecream_flavour_string(dispense_flavour)
|
||||
if(dispense_flavour < 11 && ingredients[dispense_flavour] > 0)
|
||||
visible_message("[bicon(src)] <span class='info'>[user] scoops delicious [flavour_name] flavoured icecream into [I].</span>")
|
||||
ingredients[dispense_flavour] -= 1
|
||||
ingredients[ICECREAM_VANILLA] -= 1
|
||||
|
||||
I.add_ice_cream(dispense_flavour)
|
||||
if(held_container)
|
||||
held_container.reagents.trans_to(I, 10)
|
||||
if(I.reagents.total_volume < 10)
|
||||
I.reagents.add_reagent("sugar", 10 - I.reagents.total_volume)
|
||||
else
|
||||
to_chat(user, "<span class='warning'>There is not enough [flavour_name] flavouring left! Insert more of the required ingredients.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='warning'>There is not enough icecream left! Insert more milk and ice.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[O] already has icecream in it.</span>")
|
||||
else if(istype(O, /obj/item/reagent_containers/glass))
|
||||
if(held_container)
|
||||
to_chat(user, "<span class='notice'>You must remove [held_container] from [src] first.</span>")
|
||||
else
|
||||
if(!user.drop_item())
|
||||
to_chat(user, "<span class='warning'>\The [O] is stuck to your hand!</span>")
|
||||
return
|
||||
O.forceMove(src)
|
||||
to_chat(user, "<span class='info'>You insert [O] into [src].</span>")
|
||||
held_container = O
|
||||
else
|
||||
var/obj/item/reagent_containers/R = O
|
||||
if(R.reagents)
|
||||
visible_message("<span class='info'>[user] has emptied all of [R] into [src].</span>")
|
||||
for(var/datum/reagent/current_reagent in R.reagents.reagent_list)
|
||||
if(GLOB.ingredients_source[current_reagent.id])
|
||||
add(GLOB.ingredients_source[current_reagent.id], current_reagent.volume / 2)
|
||||
else
|
||||
add(MUCK, current_reagent.volume / 5)
|
||||
R.reagents.clear_reagents()
|
||||
return 1
|
||||
else
|
||||
return ..()
|
||||
|
||||
/obj/machinery/icecream_vat/proc/add(var/add_type, var/amount)
|
||||
if(add_type <= ingredients.len)
|
||||
ingredients[add_type] += amount
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/icecream_vat/proc/make(var/mob/user, var/make_type)
|
||||
switch(make_type)
|
||||
if(CONE_WAFFLE)
|
||||
if(ingredients[INGR_FLOUR] > 0 && ingredients[INGR_SUGAR] > 0)
|
||||
var/amount = max( min(ingredients[INGR_FLOUR], ingredients[INGR_SUGAR]), 5)
|
||||
ingredients[INGR_FLOUR] -= amount
|
||||
ingredients[INGR_SUGAR] -= amount
|
||||
ingredients[CONE_WAFFLE] += amount
|
||||
visible_message("<span class='info'>[user] cooks up some waffle cones.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You require sugar and flour to make waffle cones.</span>")
|
||||
if(CONE_CHOC)
|
||||
if(ingredients[FLAVOUR_CHOCOLATE] > 0 && ingredients[CONE_WAFFLE] > 0)
|
||||
var/amount = min(ingredients[CONE_WAFFLE], ingredients[FLAVOUR_CHOCOLATE])
|
||||
ingredients[CONE_WAFFLE] -= amount
|
||||
ingredients[FLAVOUR_CHOCOLATE] -= amount
|
||||
ingredients[CONE_CHOC] += amount
|
||||
visible_message("<span class='info'>[user] cooks up some chocolate cones.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You require waffle cones and chocolate flavouring to make chocolate cones.</span>")
|
||||
if(ICECREAM_VANILLA)
|
||||
if(ingredients[INGR_ICE] > 0 && ingredients[INGR_MILK] > 0)
|
||||
var/amount = min(ingredients[INGR_ICE], ingredients[INGR_MILK])
|
||||
ingredients[INGR_ICE] -= amount
|
||||
ingredients[INGR_MILK] -= amount
|
||||
ingredients[ICECREAM_VANILLA] += amount
|
||||
visible_message("<span class='info'>[user] whips up some vanilla icecream.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>You require milk and ice to make vanilla icecream.</span>")
|
||||
updateDialog()
|
||||
|
||||
/obj/machinery/icecream_vat/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
if(href_list["dispense"])
|
||||
dispense_flavour = text2num(href_list["dispense"])
|
||||
visible_message("<span class='notice'>[usr] sets [src] to dispense [get_icecream_flavour_string(dispense_flavour)] flavoured icecream.</span>")
|
||||
|
||||
if(href_list["cone"])
|
||||
var/dispense_cone = text2num(href_list["cone"])
|
||||
if(ingredients[dispense_cone] <= ingredients.len)
|
||||
var/cone_name = get_icecream_flavour_string(dispense_cone)
|
||||
if(ingredients[dispense_cone] >= 1)
|
||||
ingredients[dispense_cone] -= 1
|
||||
var/obj/item/reagent_containers/food/snacks/icecream/I = new(loc)
|
||||
I.cone_type = cone_name
|
||||
I.icon_state = "icecream_cone_[cone_name]"
|
||||
I.desc = "Delicious [cone_name] cone, but no ice cream."
|
||||
visible_message("<span class='info'>[usr] dispenses a crunchy [cone_name] cone from [src].</span>")
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>There are no [cone_name] cones left!</span>")
|
||||
updateDialog()
|
||||
|
||||
if(href_list["make"])
|
||||
make( usr, text2num(href_list["make"]) )
|
||||
updateDialog()
|
||||
|
||||
if(href_list["eject"])
|
||||
if(held_container)
|
||||
held_container.forceMove(loc)
|
||||
held_container = null
|
||||
updateDialog()
|
||||
|
||||
if(href_list["refresh"])
|
||||
updateDialog()
|
||||
|
||||
if(href_list["close"])
|
||||
usr.unset_machine()
|
||||
usr << browse(null,"window=icecreamvat")
|
||||
return
|
||||
|
||||
/obj/machinery/icecream_vat/deconstruct(disassembled = TRUE)
|
||||
if(!(flags & NODECONSTRUCT))
|
||||
new /obj/item/stack/sheet/metal(loc, 4)
|
||||
qdel(src)
|
||||
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/icecream
|
||||
name = "ice cream cone"
|
||||
desc = "Delicious waffle cone, but no ice cream."
|
||||
icon = 'icons/obj/kitchen.dmi'
|
||||
icon_state = "icecream_cone"
|
||||
layer = 3.1
|
||||
var/ice_creamed = 0
|
||||
var/cone_type
|
||||
bitesize = 3
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/icecream/New()
|
||||
..()
|
||||
create_reagents(20)
|
||||
reagents.add_reagent("nutriment", 5)
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/icecream/proc/add_ice_cream(var/flavour)
|
||||
var/flavour_name = get_icecream_flavour_string(flavour)
|
||||
name = "[flavour_name] icecream"
|
||||
overlays += "icecream_[flavour_name]"
|
||||
desc = "Delicious [cone_type] cone with a dollop of [flavour_name] ice cream."
|
||||
ice_creamed = 1
|
||||
|
||||
#undef ICECREAM_VANILLA
|
||||
#undef FLAVOUR_CHOCOLATE
|
||||
#undef FLAVOUR_STRAWBERRY
|
||||
#undef FLAVOUR_BLUE
|
||||
#undef CONE_WAFFLE
|
||||
#undef CONE_CHOC
|
||||
#undef INGR_MILK
|
||||
#undef INGR_FLOUR
|
||||
#undef INGR_SUGAR
|
||||
#undef INGR_ICE
|
||||
#undef MUCK
|
||||
Reference in New Issue
Block a user