Skip to content

Commit

Permalink
[MIRROR] Fixes crafting menu not detecting ingredients properly [MDB …
Browse files Browse the repository at this point in the history
…IGNORE] (#24513) (#223)

* Fixes crafting menu not detecting ingredients properly (#79141)

## About The Pull Request
1. Fixes #79089
This fix applies for the above issue and all crafting recipes that
require some sort of reagent container containing reagents. It now adds
the container & the reagents inside of it to the list of available
ingredients & not just the reagents which was previously the case.

2. Fixes #79159
Other crafting ingredients in general were not being detected if it was
not a stack type. That's fixed now too

## Changelog
:cl:
fix: items that require reagent containers & the reagents inside it for
crafting(e.g. molotov) now crafts properly.
fix: most crafting recipes should work now
/:cl:

* Fixes crafting menu not detecting ingredients properly

---------

Co-authored-by: SkyratBot <[email protected]>
Co-authored-by: SyncIt21 <[email protected]>
  • Loading branch information
3 people authored Oct 23, 2023
1 parent 2129c76 commit 58df37c
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions code/datums/components/crafting/crafting.dm
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,15 @@
if(isstack(item))
var/obj/item/stack/stack = item
.["other"][item.type] += stack.amount
else if(is_reagent_container(item) && item.is_drainable() && length(item.reagents.reagent_list)) //some container that has some reagents inside it that can be drained
var/obj/item/reagent_containers/container = item
for(var/datum/reagent/reagent as anything in container.reagents.reagent_list)
.["other"][reagent.type] += reagent.volume
else //a reagent container that is empty can also be used as a tool. e.g. glass bottle can be used as a rolling pin
if(item.tool_behaviour)
.["tool_behaviour"] += item.tool_behaviour
else
.["other"][item.type] += 1
if(is_reagent_container(item) && item.is_drainable() && length(item.reagents.reagent_list)) //some container that has some reagents inside it that can be drained
var/obj/item/reagent_containers/container = item
for(var/datum/reagent/reagent as anything in container.reagents.reagent_list)
.["other"][reagent.type] += reagent.volume
else //a reagent container that is empty can also be used as a tool. e.g. glass bottle can be used as a rolling pin
if(item.tool_behaviour)
.["tool_behaviour"] += item.tool_behaviour
else if (ismachinery(object))
LAZYADDASSOCLIST(.["machinery"], object.type, object)
else if (isstructure(object))
Expand Down

0 comments on commit 58df37c

Please sign in to comment.