Cooking Tooltips (#10036)

This commit is contained in:
Geeves
2020-09-27 01:01:13 +02:00
committed by GitHub
parent 62b55b76ff
commit f8db2849b8
3 changed files with 58 additions and 6 deletions

View File

@@ -30,6 +30,31 @@
else
to_chat(user, SPAN_WARNING("It is switched off."))
/obj/machinery/appliance/cooker/MouseEntered(location, control, params)
. = ..()
if(get_dist(usr, src) <= 2)
var/description = ""
if(isemptylist(cooking_objs))
description = "It is empty."
else
description = "Contains...<ul>"
for(var/datum/cooking_item/CI in cooking_objs)
description += "<li>\a [CI.container.label(null, CI.combine_target)], [report_progress(CI)]</li>"
description += "</ul>"
if(!stat)
if(temperature < min_temp)
description += "[src] is still heating up and is too cold to cook anything yet."
else
description += "It is running at [round(get_efficiency(), 0.1)]% efficiency!"
description += "Temperature: [round(temperature - T0C, 0.1)]C / [round(optimal_temp - T0C, 0.1)]C"
else
description += "It is switched off."
openToolTip(usr, src, params, name, description)
/obj/machinery/appliance/cooker/MouseExited(location, control, params)
. = ..()
closeToolTip(usr)
/obj/machinery/appliance/cooker/list_contents(var/mob/user)
if (length(cooking_objs))
var/string = "Contains...</br>"

View File

@@ -19,13 +19,34 @@
/obj/item/reagent_containers/cooking_container/examine(var/mob/user)
. = ..()
if (length(contents))
var/string = "It contains:</br><ul><li>"
string += jointext(contents, "</li></br><li>") + "</li></ul>"
to_chat(user, SPAN_NOTICE(string))
if (reagents.total_volume)
to_chat(user, SPAN_NOTICE("It contains [reagents.total_volume] units of reagents."))
if(length(contents))
to_chat(user, SPAN_NOTICE(get_content_info()))
if(reagents.total_volume)
to_chat(user, SPAN_NOTICE(get_reagent_info()))
/obj/item/reagent_containers/cooking_container/proc/get_content_info()
var/string = "It contains:</br><ul><li>"
string += jointext(contents, "</li></br><li>") + "</li></ul>"
return string
/obj/item/reagent_containers/cooking_container/proc/get_reagent_info()
return "It contains [reagents.total_volume] units of reagents."
/obj/item/reagent_containers/cooking_container/MouseEntered(location, control, params)
. = ..()
if(get_dist(usr, src) <= 2)
var/description
if(length(contents))
description = get_content_info()
if(reagents.total_volume)
if(!description)
description = ""
description += get_reagent_info()
openToolTip(usr, src, params, name, description)
/obj/item/reagent_containers/cooking_container/MouseExited(location, control, params)
. = ..()
closeToolTip(usr)
/obj/item/reagent_containers/cooking_container/attackby(var/obj/item/I, var/mob/user)
if(is_type_in_list(I, insertable))