Files
Bubberstation/code/datums/elements/dryable.dm
GhomandGitHub 52e7062fa7 You can now kiss that pizza toilet with the chef kiss skillchip to add "love" to its reagents. (#96547)
## About The Pull Request
De-hardcodes food/crafting complexity (the stuff responsible for food
buffs) from food items and gives the var to the edible component, so
that objects crafted with pizza or meat sheets can have it as well.
Renamed TRAIT_FOOD_CHEF_MADE to TRAIT_HANDMADE now that it's also given
to the item when crafted through either the stack recipe UI or crafting
UI.

## Why It's Good For The Game
See title. In all seriousness though, it's more flexible code.

## Changelog

🆑
refactor: Refactored a couple things around food/recipe complexity (what
food buffs depend on). Technically, you can now kiss that pizza toilet,
which you crafted (right?), with the chef kiss skillchip enabled to add
"love" to its reagents.
/🆑
2026-06-19 12:15:00 -06:00

67 lines
2.7 KiB
Plaintext

// If an item has this element, it can be dried on a drying rack.
/datum/element/dryable
element_flags = ELEMENT_BESPOKE
argument_hash_start_idx = 2
/// The type of atom that is spawned by this element on drying.
var/dry_result
/datum/element/dryable/Attach(datum/target, atom/dry_result)
. = ..()
if(!isatom(target))
return ELEMENT_INCOMPATIBLE
src.dry_result = dry_result
RegisterSignal(target, COMSIG_ITEM_DRIED, PROC_REF(finish_drying))
ADD_TRAIT(target, TRAIT_DRYABLE, ELEMENT_TRAIT(type))
var/atom/atom_target = target
if(!PERFORM_ALL_TESTS(focus_only/check_materials_when_processed) || !atom_target.custom_materials || !dry_result || isstack(atom_target))
return
var/atom/result = new dry_result
if(!atom_target.compare_materials(result))
var/warning = "custom_materials of [result.type] when dried compared to just spawned don't match"
var/what_it_should_be = atom_target.transcribe_materials_list()
stack_trace("[warning]. should be: custom_materials = [what_it_should_be].")
qdel(result)
/datum/element/dryable/Detach(datum/target)
. = ..()
UnregisterSignal(target, COMSIG_FOOD_CONSUMED)
REMOVE_TRAIT(target, TRAIT_DRYABLE, ELEMENT_TRAIT(type))
/datum/element/dryable/proc/finish_drying(atom/source, datum/weakref/drying_user)
SIGNAL_HANDLER
var/static/list/dried_color
if (isnull(dried_color))
dried_color = color_transition_filter(COLOR_DRIED_TAN)
var/atom/dried_atom = source
if(dry_result == dried_atom.type)//if the dried type is the same as our currrent state, don't bother creating a whole new item, just re-color it.
var/atom/movable/resulting_atom = dried_atom
resulting_atom.add_atom_colour(dried_color, FIXED_COLOUR_PRIORITY)
apply_dried_status(resulting_atom, drying_user)
return
else if(isstack(source)) //Check if its a sheet
var/obj/item/stack/itemstack = dried_atom
for(var/i in 1 to itemstack.amount)
var/atom/movable/resulting_atom = new dry_result(source.loc)
apply_dried_status(resulting_atom, drying_user)
qdel(source)
return
var/obj/item/food/resulting_atom = new dry_result(source.loc)
if(istype(source, /obj/item/food) && ispath(dry_result, /obj/item/food))
var/obj/item/food/source_food = source
resulting_atom.reagents.clear_reagents()
source_food.reagents.trans_to(resulting_atom, source_food.reagents.total_volume)
resulting_atom.set_custom_materials(source.custom_materials)
apply_dried_status(resulting_atom, drying_user)
qdel(source)
/datum/element/dryable/proc/apply_dried_status(atom/target, datum/weakref/drying_user)
ADD_TRAIT(target, TRAIT_DRIED, ELEMENT_TRAIT(type))
var/datum/mind/user_mind = drying_user?.resolve()
if(drying_user && istype(target, /obj/item/food))
ADD_TRAIT(target, TRAIT_HANDMADE, REF(user_mind))