mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-02-06 22:39:04 +00:00
* [NO GBP]Refactors how sheets are ejected from mat container (#77945) ## About The Pull Request As #77936 pointed out an infinite while loop occurs in the recycler. This was caused due to my recent mat changes as follows. When the recycler eats up an item. If it found any material inside, it would attempt to eject any sheets formed from it over hereed71735fb3/code/game/machinery/recycler.dm (L199)Inside this proc i first create the sheets in `null space` why is explained in the commented71735fb3/code/datums/components/material/material_container.dm (L599-L600)After doing logging & stuff i then would move the sheets back into its target turf so it could get merged agained71735fb3/code/datums/components/material/material_container.dm (L607-L608)Unfortunately this would trigger `COMSIG_ATOM_ENTERED` signal which the recycler is hooked onto. The recycler would then eat the newly ejected sheets again, which would cause more sheets to be ejected, which would again trigger the signal `COMSIG_ATOM_ENTERED` and you have your infinite loop. I did this because i had no clue how to stop the stack from merging when it got spawned and this was a poor solution, so upon examining the code i found there is a var to specifically stops stacks from merginged71735fb3/code/game/objects/items/stacks/stack.dm (L81)Yup there is specific param called `merge=TRUE` which allows you to explicitly stop stacks from merging. I now use this var and manually merge stacks afterwards without calling `forceMove()` so it doesn't trigger the recycler anymore which caused the infinite loops. ## Why It's good for the game Writing checks to see if an object came from null space is weird. It makes the code difficult to reason with as such situations never happen. Now it makes sense for an atom to be moved "into" null space for e.g. when it gets deleted but for an atom to "return back from it" never happens and you shouldn't be bothered with figuring out how that happened. ## Changelog 🆑 refactor: sheets are merged in a better way when ejected from machines & material related stuff /🆑 * [NO GBP]Refactors how sheets are ejected from mat container --------- Co-authored-by: SyncIt21 <110812394+SyncIt21@users.noreply.github.com>