Skip to content

Commit

Permalink
[MIRROR] Fix runtime when food processor handles items without reagen…
Browse files Browse the repository at this point in the history
…ts (#2125)

* Fix runtime when food processor handles items without reagents (#81646)

## About The Pull Request

### Alternate title: "Stop the popsicle stick maximizer."

<details>
<summary>The popsicle stick maximizer in question</summary>


![image](https://github.com/tgstation/tgstation/assets/42909981/29f636f3-6509-4cf9-9093-9fcd0ea5de4f)

</details>

So when using the food processor to produce popsicle sticks from logs,
it seemed to never actually delete the log, letting you create more and
more and more and more and more and etc popsicle sticks.
This seemed to be caused by the popsicles not actually having reagents
to clear nor copy to, and thus it caused a runtime before it got the
opportunity to delete the log.

<details>
<summary>Runtime</summary>


![image](https://github.com/tgstation/tgstation/assets/42909981/bd853870-64e9-4b47-aead-38e6955b7dab)

</details>

Adding a check to make sure neither of these are null before proceeding
to use them resolves this issue.
## Why It's Good For The Game

Less runtimes, less popsicle stick maximizing.
Fixes #81644.
## Changelog
:cl:
fix: Disabled the popsicle stick maximizer. (Producing popsicle sticks
actually deletes the input logs.)
/:cl:

* Fix runtime when food processor handles items without reagents

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: _0Steven <[email protected]>
  • Loading branch information
3 people authored Feb 26, 2024
1 parent 544c25e commit 136bdec
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions code/modules/food_and_drinks/machinery/processor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@
var/cached_multiplier = (recipe.food_multiplier * rating_amount)
for(var/i in 1 to cached_multiplier)
var/atom/processed_food = new recipe.output(drop_location())
processed_food.reagents.clear_reagents()
what.reagents.copy_to(processed_food, what.reagents.total_volume, multiplier = 1 / cached_multiplier)
if(processed_food.reagents && what.reagents)
processed_food.reagents.clear_reagents()
what.reagents.copy_to(processed_food, what.reagents.total_volume, multiplier = 1 / cached_multiplier)
if(cached_mats)
processed_food.set_custom_materials(cached_mats, 1 / cached_multiplier)

Expand Down

0 comments on commit 136bdec

Please sign in to comment.