mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-27 09:31:54 +00:00
## About The Pull Request So, with the somewhat-recent power changes, cells now have a shitton of charge compared to the old one. Now, recently, the `model.respawn_consumable` call in `/mob/living/silicon/robot/proc/charge` was changed to use this variable, so every time you had a borg inside a charger, it would constantly drain 0.5% of its cell charge, and use it for the light replacer charge calculation. ### The light replacer So, we now have about 200000 as the charge coefficient on bluespace cells. On code that was made back for 1000 charge in like 2012 according to the gitblame. Slight issue: **There's a fucking for loop looping 200000 times every time we charge**, calling `/obj/item/lightreplacer/proc/Charge` every time it loops. It has no break condition, so it does this every machinery tick. This, with a single janiborg with a blue cell kills the machinery subsystem and causes a hell of a lot of overtime, and a hilarious profiler log:  ### The fix Simply not make the light replacer calculation loop like this and just use division and a modulo, like a normal sensible coder, plus adjust it to the new cell values. See the profiler log now:  ## Why It's Good For The Game It fixes a potentially game killing bug. A FUCK moment to be sure ## Warning for upstreams _Looks at Nova and Skyrat_ check your Charge() proc usages, I know you have at least one extra hit for it. ## Changelog 🆑 fix: Fixes janitor borgs killing the machinery subsystem by charging light replacers 200k times a tick. /🆑