Merge pull request #14067 from VOREStation/upstream-merge-8817

[MIRROR] Naming Food & Blood Cakes
This commit is contained in:
Heroman3003
2022-12-04 07:17:44 +10:00
committed by CHOMPStation2
parent a076afbee3
commit 151e5fdb91
2 changed files with 30 additions and 1 deletions

View File

@@ -7,10 +7,28 @@
/obj/item/weapon/reagent_containers/food /obj/item/weapon/reagent_containers/food
possible_transfer_amounts = null possible_transfer_amounts = null
volume = 50 //Sets the default container amount for all food items. volume = 50 //Sets the default container amount for all food items.
var/filling_color = "#FFFFFF" //Used by sandwiches. description_info = "Food can use the Rename Food verb in the Object Tab to rename it."
var/filling_color = "#FFFFFF" //Used by sandwiches and custom food.
drop_sound = 'sound/items/drop/food.ogg' drop_sound = 'sound/items/drop/food.ogg'
pickup_sound = 'sound/items/pickup/food.ogg' pickup_sound = 'sound/items/pickup/food.ogg'
/obj/item/weapon/reagent_containers/food/verb/change_name()
set name = "Rename Food"
set category = "Object"
set src in view(0)
handle_name_change(usr)
/obj/item/weapon/reagent_containers/food/proc/handle_name_change(var/mob/living/user)
if(user.stat == DEAD || !(ishuman(user) || isrobot(user)))
to_chat(user, SPAN_WARNING("You can't cook!"))
return
var/n_name = sanitizeSafe(input(user, "What would you like to name \the [src]? Leave blank to reset.", "Food Naming", null) as text, MAX_NAME_LEN)
if(!n_name)
n_name = initial(name)
name = n_name
/obj/item/weapon/reagent_containers/food/Initialize() /obj/item/weapon/reagent_containers/food/Initialize()
. = ..() . = ..()
if (center_of_mass.len && !pixel_x && !pixel_y) if (center_of_mass.len && !pixel_x && !pixel_y)

View File

@@ -489,6 +489,10 @@
var/list/cooktypes = list() var/list/cooktypes = list()
var/datum/reagents/buffer = new /datum/reagents(1000) var/datum/reagents/buffer = new /datum/reagents(1000)
var/totalcolour var/totalcolour
var/reagents_determine_color
if(!LAZYLEN(CI.container.contents)) // It's possible to make something, such as a cake in the oven, with only reagents. This stops them from being grey and sad.
reagents_determine_color = TRUE
for (var/obj/item/I in CI.container) for (var/obj/item/I in CI.container)
var/obj/item/weapon/reagent_containers/food/snacks/S var/obj/item/weapon/reagent_containers/food/snacks/S
@@ -527,6 +531,13 @@
buffer.trans_to_holder(result.reagents, buffer.total_volume) //trans_to doesn't handle food items well, so buffer.trans_to_holder(result.reagents, buffer.total_volume) //trans_to doesn't handle food items well, so
//just call trans_to_holder instead //just call trans_to_holder instead
// Reagent-only foods.
if(reagents_determine_color)
totalcolour = result.reagents.get_color()
for(var/datum/reagent/reag in result.reagents.reagent_list)
words |= text2list(reag.name, " ")
//Filling overlay //Filling overlay
var/image/I = image(result.icon, "[result.icon_state]_filling") var/image/I = image(result.icon, "[result.icon_state]_filling")
I.color = totalcolour I.color = totalcolour