mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-18 20:53:55 +01:00
f9fabdf1b6
* Refactors & patches for grinding & juicing (#78268) ## About The Pull Request This deals with grinding & juicing in 4 stages **1. General grinding & juicing** Nothing player facing, just added some extra null checks to ensure we use `reagents` and `target_holder` only when they are not null. The current way it was setup did not check for this **2. Grinding Stacks** - Fixes #48387 - Fixes #78180 - Fixes #77878 This changes the way stacks are grinded. Rather than grinding the whole stack and have reagents wasted from grinding because there isn't enough space in the beaker we do the reverse. We calculate how many pieces of cable(or sheets of material) can be grinded "based" on the available volume inside the `target_holder`(i.e. beaker for all in 1 grinder, or internal buffer for chemical plumbing grinder, mortar & pedestal) **For example** Say you have a beaker of 100 ml capacity and you have a stack of 50 iron sheets where each sheet of iron when grinded yields 20 units of iron reagent. Doing some simple math we should only be able to grind 5 sheets of iron(20 units of iron per sheet x 5 = 100 ml capacity). This means the remaining 45 sheets of iron should be left untouched and we should be able to eject and regrind them in a different beaker if we don't have the space for it. This PR does exactly that. It computes how many pieces/sheets can be grinded based on the available volume for grinding (e.g. based on the available volume in your beaker for the all in 1 grinder) and grinds exactly that many pieces, leaving the rest of stack untouched so you can reuse them This way you avoid wasting stacks when your beaker doesn't have the required space to hold its reagents **3. Plumbing Chemical Grinder** - Not sure how nobody noticed but the plumbing chemical grinder completely stopped working because wrong arguments were passed to the items grind & juice procs https://github.com/tgstation/tgstation/blob/2ddbdca1b7fb5cb85cbdcd566a489cbc4794edcf/code/modules/plumbing/plumbers/grinder_chemical.dm#L47 When it fact it should have been `I.grind(reagents, usr)` So yeah the plumbing chemical grinder works again - Fixes #75429 The plumbing chemical grinder now blocks anything that isn't an `obj/item` from entering inside it. The `grind` proc is set up to accept only items anyway so allowing mobs to enter is just a waste of processing power. That way nobody gets stuck inside, - Fixes #62822 The chemical grinder now accepts items coming at it from any direction. if you don't want to throw stuff at it you can manually put stuff in it with hand. If you try to use a storage item like a bag(plant bag or any bag) it dumps all its contents in the grinder. **4. All in 1 Grinder** - Fixes #76983 You can now remove the beaker when the blender is unpowered with right click. The left click does not work when power is off because `ui_interact()` proc is disabled which was responsible for ejecting the beaker & its contents. The right click was meant to compensate for this but it also checked if power was available and it also failed. Now that check has been removed meaning you can eject the beaker & its contents via right click - Fixes #54813 The delay and shake animation is already handled by the `operate()` proc but the mix settings would add an additional timer on top of that with a fixed delay of 50 deciseconds. That timer is adjusted so its reduced from upgraded parts ## Changelog 🆑 code: added some null checks for general juicing & grinding items fix: grinding stacks now grinds as many pieces/sheets from the stack as possible that can fit in a beaker/container without wasting the whole stack fix: plumbing chemical grinder now actually works again fix: the plumbing chemical grinder allows stuff to enter from any direction but not mobs and also accepts items put inside it via hand including bags fix: You can remove the beaker from the all in 1 grinder when power is off via right click fix: All in 1 grinder now mixes faster with upgraded parts refactor: you can no longer walk into a plumbing chemical grinder /🆑 --------- Co-authored-by: Jeremiah <42397676+jlsnow301@ users.noreply.github.com> * Refactors & patches for grinding & juicing --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com> Co-authored-by: Jeremiah <42397676+jlsnow301@ users.noreply.github.com>